Amesos Package Browser (Single Doxygen Collection) Development
amesos_cholmod_change_factor.c
Go to the documentation of this file.
00001 /* ========================================================================== */
00002 /* === Core/cholmod_change_factor =========================================== */
00003 /* ========================================================================== */
00004 
00005 /* -----------------------------------------------------------------------------
00006  * CHOLMOD/Core Module.  Copyright (C) 2005-2006,
00007  * Univ. of Florida.  Author: Timothy A. Davis
00008  * The CHOLMOD/Core Module is licensed under Version 2.1 of the GNU
00009  * Lesser General Public License.  See lesser.txt for a text of the license.
00010  * CHOLMOD is also available under other licenses; contact authors for details.
00011  * http://www.cise.ufl.edu/research/sparse
00012  * -------------------------------------------------------------------------- */
00013 
00014 /* Change the numeric/symbolic, LL/LDL, simplicial/super, packed/unpacked,
00015  * monotonic/non-monotonic status of a cholmod_factor object.
00016  *
00017  * There are four basic classes of factor types:
00018  *
00019  * (1) simplicial symbolic:  Consists of two size-n arrays: the fill-reducing
00020  *  permutation (L->Perm) and the nonzero count for each column of L
00021  *  (L->ColCount).  All other factor types also include this information.
00022  *  L->ColCount may be exact (obtained from the analysis routines), or
00023  *  it may be a guess.  During factorization, and certainly after update/
00024  *  downdate, the columns of L can have a different number of nonzeros.
00025  *  L->ColCount is used to allocate space.  L->ColCount is exact for the
00026  *  supernodal factorizations.  The nonzero pattern of L is not kept.
00027  *
00028  * (2) simplicial numeric:  These represent L in a compressed column form.  The
00029  *  variants of this type are:
00030  *
00031  *  LDL': L is unit diagonal.  Row indices in column j are located in
00032  *      L->i [L->p [j] ... L->p [j] + L->nz [j]], and corresponding numeric
00033  *      values are in the same locations in L->x.  The total number of
00034  *      entries is the sum of L->nz [j].  The unit diagonal is not stored;
00035  *      D is stored on the diagonal of L instead.  L->p may or may not be
00036  *      monotonic.  The order of storage of the columns in L->i and L->x is
00037  *      given by a doubly-linked list (L->prev and L->next).  L->p is of
00038  *      size n+1, but only the first n entries are used (it is used if L
00039  *      is converted to a sparse matrix via cholmod_factor_to_sparse).
00040  *
00041  *      For the complex case, L->x is stored interleaved with real/imag
00042  *      parts, and is of size 2*lnz*sizeof(double).  For the zomplex case,
00043  *      L->x is of size lnz*sizeof(double) and holds the real part; L->z
00044  *      is the same size and holds the imaginary part.
00045  *
00046  *  LL':  This is identical to the LDL' form, except that the non-unit
00047  *      diagonal of L is stored as the first entry in each column of L.
00048  *
00049  * (3) supernodal symbolic:  A representation of the nonzero pattern of the
00050  *  supernodes for a supernodal factorization.  There are L->nsuper
00051  *  supernodes.  Columns L->super [k] to L->super [k+1]-1 are in the kth
00052  *  supernode.  The row indices for the kth supernode are in
00053  *  L->s [L->pi [k] ... L->pi [k+1]-1].  The numerical values are not
00054  *  allocated (L->x), but when they are they will be located in
00055  *  L->x [L->px [k] ... L->px [k+1]-1], and the L->px array is defined
00056  *  in this factor type.
00057  *
00058  *  For the complex case, L->x is stored interleaved with real/imag parts,
00059  *  and is of size 2*L->xsize*sizeof(double).  The zomplex supernodal case
00060  *  is not supported, since it is not compatible with LAPACK and the BLAS.
00061  *
00062  * (4) supernodal numeric:  Always an LL' factorization.  L is non-unit
00063  *      diagonal.  L->x contains the numerical values of the supernodes, as
00064  *      described above for the supernodal symbolic factor.
00065  *  For the complex case, L->x is stored interleaved, and is of size
00066  *  2*L->xsize*sizeof(double).  The zomplex supernodal case is not
00067  *  supported, since it is not compatible with LAPACK and the BLAS.
00068  *
00069  *      FUTURE WORK: support a supernodal LDL' factor.
00070  *
00071  *
00072  * In all cases, the row indices in each column (L->i for simplicial L and
00073  * L->s for supernodal L) are kept sorted from low indices to high indices.
00074  * This means the diagonal of L (or D for LDL' factors) is always kept as the
00075  * first entry in each column.
00076  *
00077  * The cholmod_change_factor routine can do almost all possible conversions.
00078  * It cannot do the following conversions:
00079  *
00080  *  (1) Simplicial numeric types cannot be converted to a supernodal
00081  *      symbolic type.  This would simultaneously deallocate the
00082  *      simplicial pattern and numeric values and reallocate uninitialized
00083  *      space for the supernodal pattern.  This isn't useful for the user,
00084  *      and not needed by CHOLMOD's own routines either.
00085  *
00086  *  (2) Only a symbolic factor (simplicial to supernodal) can be converted
00087  *      to a supernodal numeric factor.
00088  *
00089  * Some conversions are meant only to be used internally by other CHOLMOD
00090  * routines, and should not be performed by the end user.  They allocate space
00091  * whose contents are undefined:
00092  *
00093  *  (1) converting from simplicial symbolic to supernodal symbolic.
00094  *  (2) converting any factor to supernodal numeric.
00095  *
00096  * workspace: no conversion routine uses workspace in Common.  No temporary
00097  *  workspace is allocated.
00098  *
00099  * Supports all xtypes, except that there is no supernodal zomplex L.
00100  *
00101  * The to_xtype parameter is used only when converting from symbolic to numeric
00102  * or numeric to symbolic.  It cannot be used to convert a numeric xtype (real,
00103  * complex, or zomplex) to a different numeric xtype.  For that conversion,
00104  * use cholmod_factor_xtype instead.
00105  */
00106 
00107 #include "amesos_cholmod_internal.h"
00108 #include "amesos_cholmod_core.h"
00109 
00110 static void natural_list (cholmod_factor *L) ;
00111 
00112 /* ========================================================================== */
00113 /* === TEMPLATE ============================================================= */
00114 /* ========================================================================== */
00115 
00116 #define REAL
00117 #include "amesos_t_cholmod_change_factor.c"
00118 #define COMPLEX
00119 #include "amesos_t_cholmod_change_factor.c"
00120 #define ZOMPLEX
00121 #include "amesos_t_cholmod_change_factor.c"
00122 
00123 
00124 /* ========================================================================== */
00125 /* === L_is_packed ========================================================== */
00126 /* ========================================================================== */
00127 
00128 /* Return TRUE if the columns of L are packed, FALSE otherwise.  For debugging
00129  * only. */
00130 
00131 #ifndef NDEBUG
00132 static int L_is_packed (cholmod_factor *L, cholmod_common *Common)
00133 {
00134     Int j ;
00135     Int *Lnz = L->nz ;
00136     Int *Lp = L->p ;
00137     Int n = L->n ;
00138 
00139     if (L->xtype == CHOLMOD_PATTERN || L->is_super)
00140     {
00141   return (TRUE) ;
00142     }
00143 
00144     if (Lnz == NULL || Lp == NULL)
00145     {
00146   return (TRUE) ;
00147     }
00148 
00149     for (j = 0 ; j < n ; j++)
00150     {
00151   PRINT3 (("j: "ID" Lnz "ID" Lp[j+1] "ID" Lp[j] "ID"\n", j, Lnz [j],
00152     Lp [j+1], Lp [j])) ;
00153   if (Lnz [j] != (Lp [j+1] - Lp [j]))
00154   {
00155       PRINT2 (("L is not packed\n")) ;
00156       return (FALSE) ;
00157   }
00158     }
00159     return (TRUE) ;
00160 }
00161 #endif
00162 
00163 
00164 /* ========================================================================== */
00165 /* === natural_list ========================================================= */
00166 /* ========================================================================== */
00167 
00168 /* Create a naturally-ordered doubly-linked list of columns. */
00169 
00170 static void natural_list (cholmod_factor *L)
00171 {
00172     Int head, tail, n, j ;
00173     Int *Lnext, *Lprev ;
00174     Lnext = L->next ;
00175     Lprev = L->prev ;
00176     ASSERT (Lprev != NULL && Lnext != NULL) ;
00177     n = L->n ;
00178     head = n+1 ;
00179     tail = n ;
00180     Lnext [head] = 0 ;
00181     Lprev [head] = EMPTY ;
00182     Lnext [tail] = EMPTY ;
00183     Lprev [tail] = n-1 ;
00184     for (j = 0 ; j < n ; j++)
00185     {
00186   Lnext [j] = j+1 ;
00187   Lprev [j] = j-1 ;
00188     }
00189     Lprev [0] = head ;
00190     L->is_monotonic = TRUE ;
00191 }
00192 
00193 
00194 /* ========================================================================== */
00195 /* === allocate_simplicial_numeric ========================================== */
00196 /* ========================================================================== */
00197 
00198 /* Allocate O(n) arrays for simplicial numeric factorization.  Initializes
00199  * the link lists only.  Does not allocate the L->i, L->x, or L->z arrays. */
00200 
00201 static int allocate_simplicial_numeric
00202 (
00203     cholmod_factor *L,
00204     cholmod_common *Common
00205 )
00206 {
00207     Int n ;
00208     Int *Lp, *Lnz, *Lprev, *Lnext ;
00209     size_t n1, n2 ;
00210 
00211     PRINT1 (("Allocate simplicial\n")) ;
00212 
00213     ASSERT (L->xtype == CHOLMOD_PATTERN || L->is_super) ;
00214     ASSERT (L->p == NULL) ;
00215     ASSERT (L->nz == NULL) ;
00216     ASSERT (L->prev == NULL) ;
00217     ASSERT (L->next == NULL) ;
00218 
00219     n = L->n ;
00220 
00221     /* this cannot cause size_t overflow */
00222     n1 = ((size_t) n) + 1 ;
00223     n2 = ((size_t) n) + 2 ;
00224 
00225     Lp = CHOLMOD(malloc) (n1, sizeof (Int), Common) ;
00226     Lnz = CHOLMOD(malloc) (n, sizeof (Int), Common) ;
00227     Lprev = CHOLMOD(malloc) (n2, sizeof (Int), Common) ;
00228     Lnext = CHOLMOD(malloc) (n2, sizeof (Int), Common) ;
00229 
00230     if (Common->status < CHOLMOD_OK)
00231     {
00232   CHOLMOD(free) (n1, sizeof (Int), Lp,    Common) ;
00233   CHOLMOD(free) (n,   sizeof (Int), Lnz,   Common) ;
00234   CHOLMOD(free) (n2, sizeof (Int), Lprev, Common) ;
00235   CHOLMOD(free) (n2, sizeof (Int), Lnext, Common) ;
00236   PRINT1 (("Allocate simplicial failed\n")) ;
00237   return (FALSE) ;  /* out of memory */
00238     }
00239 
00240     /* ============================================== commit the changes to L */
00241 
00242     L->p = Lp ;
00243     L->nz = Lnz ;
00244     L->prev = Lprev ;
00245     L->next = Lnext ;
00246     /* initialize a doubly linked list for columns in natural order */
00247     natural_list (L) ;
00248     PRINT1 (("Allocate simplicial done\n")) ;
00249     return (TRUE) ;
00250 }
00251 
00252 
00253 /* ========================================================================== */
00254 /* === simplicial_symbolic_to_super_symbolic ================================ */
00255 /* ========================================================================== */
00256 
00257 /* Convert a simplicial symbolic factor supernodal symbolic factor.  Does not
00258  * initialize the new space. */
00259 
00260 static int simplicial_symbolic_to_super_symbolic
00261 (
00262     cholmod_factor *L,
00263     cholmod_common *Common
00264 )
00265 {
00266     Int nsuper, xsize, ssize ;
00267     Int *Lsuper, *Lpi, *Lpx, *Ls ;
00268     size_t nsuper1 ;
00269 
00270     ASSERT (L->xtype == CHOLMOD_PATTERN && !(L->is_super)) ;
00271 
00272     xsize  = L->xsize ;
00273     ssize  = L->ssize ;
00274     nsuper = L->nsuper ;
00275     nsuper1 = ((size_t) nsuper) + 1 ;
00276 
00277     PRINT1 (("simple sym to super sym: ssize "ID" xsize "ID" nsuper "ID""
00278   " status %d\n", ssize, xsize, nsuper, Common->status)) ;
00279 
00280     /* O(nsuper) arrays, where nsuper <= n */
00281     Lsuper = CHOLMOD(malloc) (nsuper1, sizeof (Int), Common) ;
00282     Lpi    = CHOLMOD(malloc) (nsuper1, sizeof (Int), Common) ;
00283     Lpx    = CHOLMOD(malloc) (nsuper1, sizeof (Int), Common) ;
00284 
00285     /* O(ssize) array, where ssize <= nnz(L), and usually much smaller */
00286     Ls = CHOLMOD(malloc) (ssize, sizeof (Int), Common) ;
00287 
00288     if (Common->status < CHOLMOD_OK)
00289     {
00290   CHOLMOD(free) (nsuper1, sizeof (Int), Lsuper, Common) ;
00291   CHOLMOD(free) (nsuper1, sizeof (Int), Lpi,    Common) ;
00292   CHOLMOD(free) (nsuper1, sizeof (Int), Lpx,    Common) ;
00293   CHOLMOD(free) (ssize,    sizeof (Int), Ls,     Common) ;
00294   return (FALSE) ;  /* out of memory */
00295     }
00296 
00297     /* ============================================== commit the changes to L */
00298 
00299     ASSERT (Lsuper != NULL && Lpi != NULL && Lpx != NULL && Ls != NULL) ;
00300 
00301     L->maxcsize = 0 ;
00302     L->maxesize = 0 ;
00303 
00304     L->super = Lsuper ;
00305     L->pi = Lpi ;
00306     L->px = Lpx ;
00307     L->s  = Ls ;
00308     Ls [0] = EMPTY ;      /* supernodal pattern undefined */
00309 
00310     L->is_super = TRUE ;
00311     L->is_ll = TRUE ;     /* supernodal LDL' not supported */
00312     L->xtype = CHOLMOD_PATTERN ;
00313     L->dtype = DTYPE ;
00314     L->minor = L->n ;
00315     return (TRUE) ;
00316 }
00317 
00318 
00319 /* ========================================================================== */
00320 /* === any_to_simplicial_symbolic =========================================== */
00321 /* ========================================================================== */
00322 
00323 /* Convert any factor L to a simplicial symbolic factor, leaving only L->Perm
00324  * and L->ColCount.  Cannot fail.  Any of the components of L (except Perm and
00325  * ColCount) may already be free'd.  */
00326 
00327 static void any_to_simplicial_symbolic
00328 (
00329     cholmod_factor *L,
00330     int to_ll,
00331     cholmod_common *Common
00332 )
00333 {
00334     Int n, lnz, xs, ss, s, e ;
00335     size_t n1, n2 ;
00336 
00337     /* ============================================== commit the changes to L */
00338 
00339     n = L->n ;
00340     lnz = L->nzmax ;
00341     s = L->nsuper + 1 ;
00342     xs = (L->is_super) ? ((Int) (L->xsize)) : (lnz) ;
00343     e = (L->xtype == CHOLMOD_COMPLEX ? 2 : 1) ;
00344     ss = L->ssize ;
00345 
00346     /* this cannot cause size_t overflow */
00347     n1 = ((size_t) n) + 1 ;
00348     n2 = ((size_t) n) + 2 ;
00349 
00350     /* free all but the symbolic analysis (Perm and ColCount) */
00351     L->p     = CHOLMOD(free) (n1,  sizeof (Int),      L->p,     Common) ;
00352     L->i     = CHOLMOD(free) (lnz, sizeof (Int),      L->i,     Common) ;
00353     L->x     = CHOLMOD(free) (xs,  e*sizeof (double), L->x,     Common) ;
00354     L->z     = CHOLMOD(free) (lnz, sizeof (double),   L->z,     Common) ;
00355     L->nz    = CHOLMOD(free) (n,   sizeof (Int),      L->nz,    Common) ;
00356     L->next  = CHOLMOD(free) (n2,  sizeof (Int),      L->next,  Common) ;
00357     L->prev  = CHOLMOD(free) (n2,  sizeof (Int),      L->prev,  Common) ;
00358     L->super = CHOLMOD(free) (s,   sizeof (Int),      L->super, Common) ;
00359     L->pi    = CHOLMOD(free) (s,   sizeof (Int),      L->pi,    Common) ;
00360     L->px    = CHOLMOD(free) (s,   sizeof (Int),      L->px,    Common) ;
00361     L->s     = CHOLMOD(free) (ss,  sizeof (Int),      L->s,     Common) ;
00362     L->nzmax = 0 ;
00363     L->is_super = FALSE ;
00364     L->xtype = CHOLMOD_PATTERN ;
00365     L->dtype = DTYPE ;
00366     L->minor = n ;
00367     L->is_ll = to_ll ;
00368 }
00369 
00370 
00371 /* ========================================================================== */
00372 /* === ll_super_to_super_symbolic =========================================== */
00373 /* ========================================================================== */
00374 
00375 /* Convert a numerical supernodal L to symbolic supernodal.  Cannot fail. */
00376 
00377 static void ll_super_to_super_symbolic
00378 (
00379     cholmod_factor *L,
00380     cholmod_common *Common
00381 )
00382 {
00383 
00384     /* ============================================== commit the changes to L */
00385 
00386     /* free all but the supernodal numerical factor */
00387     ASSERT (L->xtype != CHOLMOD_PATTERN && L->is_super && L->is_ll) ;
00388     DEBUG (CHOLMOD(dump_factor) (L, "start to super symbolic", Common)) ;
00389     L->x = CHOLMOD(free) (L->xsize,
00390       (L->xtype == CHOLMOD_COMPLEX ? 2 : 1) * sizeof (double), L->x,
00391       Common) ;
00392     L->xtype = CHOLMOD_PATTERN ;
00393     L->dtype = DTYPE ;
00394     L->minor = L->n ;
00395     L->is_ll = TRUE ;     /* supernodal LDL' not supported */
00396     DEBUG (CHOLMOD(dump_factor) (L, "done  to super symbolic", Common)) ;
00397 }
00398 
00399 
00400 /* ========================================================================== */
00401 /* === simplicial_symbolic_to_simplicial_numeric ============================ */
00402 /* ========================================================================== */
00403 
00404 /* Convert a simplicial symbolic L to a simplicial numeric L; allocate space
00405  * for L using L->ColCount from symbolic analysis, and set L to identity.
00406  *
00407  * If packed < 0, then this routine is creating a copy of another factor
00408  * (via cholmod_copy_factor).  In this case, the space is not initialized. */
00409 
00410 static void simplicial_symbolic_to_simplicial_numeric
00411 (
00412     cholmod_factor *L,
00413     int to_ll,
00414     int packed,
00415     int to_xtype,
00416     cholmod_common *Common
00417 )
00418 {
00419     double grow0, grow1, xlen, xlnz ;
00420     double *Lx, *Lz ;
00421     Int *Li, *Lp, *Lnz, *ColCount ;
00422     Int n, grow, grow2, p, j, lnz, len, ok, e ;
00423 
00424     ASSERT (L->xtype == CHOLMOD_PATTERN && !(L->is_super)) ;
00425     if (!allocate_simplicial_numeric (L, Common))
00426     {
00427   PRINT1 (("out of memory, allocate simplicial numeric\n")) ;
00428   return ;  /* out of memory */
00429     }
00430     ASSERT (L->ColCount != NULL && L->nz != NULL && L->p != NULL) ;
00431     ASSERT (L->x == NULL && L->z == NULL && L->i == NULL) ;
00432 
00433     ColCount = L->ColCount ;
00434     Lnz = L->nz ;
00435     Lp = L->p ;
00436     ok = TRUE ;
00437     n = L->n ;
00438 
00439     if (packed < 0)
00440     {
00441 
00442   /* ------------------------------------------------------------------ */
00443   /* used by cholmod_copy_factor to allocate a copy of a factor object */
00444   /* ------------------------------------------------------------------ */
00445 
00446   lnz = L->nzmax ;
00447   L->nzmax = 0 ;
00448 
00449     }
00450     else if (packed)
00451     {
00452 
00453   /* ------------------------------------------------------------------ */
00454   /* LDL' or LL' packed */
00455   /* ------------------------------------------------------------------ */
00456 
00457   PRINT1 (("convert to packed LL' or LDL'\n")) ;
00458   lnz = 0 ;
00459   for (j = 0 ; ok && j < n ; j++)
00460   {
00461       /* ensure len is in the range 1 to n-j */
00462       len = ColCount [j] ;
00463       len = MAX (1, len) ;
00464       len = MIN (len, n-j) ;
00465       lnz += len ;
00466       ok = (lnz >= 0) ;
00467   }
00468   for (j = 0 ; j <= n ; j++)
00469   {
00470       Lp [j] = j ;
00471   }
00472   for (j = 0 ; j < n ; j++)
00473   {
00474       Lnz [j] = 1 ;
00475   }
00476 
00477     }
00478     else
00479     {
00480 
00481   /* ------------------------------------------------------------------ */
00482   /* LDL' unpacked */
00483   /* ------------------------------------------------------------------ */
00484 
00485   PRINT1 (("convert to unpacked\n")) ;
00486   /* compute new lnzmax */
00487   /* if any parameter is NaN, grow is false */
00488   grow0 = Common->grow0 ;
00489   grow1 = Common->grow1 ;
00490   grow2 = Common->grow2 ;
00491   grow0 = IS_NAN (grow0) ? 1 : grow0 ;
00492   grow1 = IS_NAN (grow1) ? 1 : grow1 ;
00493   /* fl.pt. compare, but no NaN's: */
00494   grow = (grow0 >= 1.0) && (grow1 >= 1.0) && (grow2 > 0) ;
00495   PRINT1 (("init, grow1 %g grow2 "ID"\n", grow1, grow2)) ;
00496   /* initialize Lp and Lnz for each column */
00497   lnz = 0 ;
00498   for (j = 0 ; ok && j < n ; j++)
00499   {
00500       Lp [j] = lnz ;
00501       Lnz [j] = 1 ;
00502 
00503       /* ensure len is in the range 1 to n-j */
00504       len = ColCount [j] ;
00505       len = MAX (1, len) ;
00506       len = MIN (len, n-j) ;
00507 
00508       /* compute len in double to avoid integer overflow */
00509       PRINT1 (("ColCount ["ID"] = "ID"\n", j, len)) ;
00510       if (grow)
00511       {
00512     xlen = (double) len ;
00513     xlen = grow1 * xlen + grow2 ;
00514     xlen = MIN (xlen, n-j) ;
00515     len = (Int) xlen ;
00516       }
00517       ASSERT (len >= 1 && len <= n-j) ;
00518       lnz += len ;
00519       ok = (lnz >= 0) ;
00520   }
00521   if (ok)
00522   {
00523       Lp [n] = lnz ;
00524       if (grow)
00525       {
00526     /* add extra space */
00527     xlnz = (double) lnz ;
00528     xlnz *= grow0 ;
00529     xlnz = MIN (xlnz, Size_max) ;
00530     xlnz = MIN (xlnz, ((double) n * (double) n + (double) n) / 2) ;
00531     lnz = (Int) xlnz ;
00532       }
00533   }
00534     }
00535 
00536     lnz = MAX (1, lnz) ;
00537 
00538     if (!ok)
00539     {
00540   ERROR (CHOLMOD_TOO_LARGE, "problem too large") ;
00541     }
00542 
00543     /* allocate L->i, L->x, and L->z */
00544     PRINT1 (("resizing from zero size to lnz "ID"\n", lnz)) ;
00545     ASSERT (L->nzmax == 0) ;
00546     e = (to_xtype == CHOLMOD_COMPLEX ? 2 : 1) ;
00547     if (!ok || !CHOLMOD(realloc_multiple) (lnz, 1, to_xtype, &(L->i), NULL,
00548     &(L->x), &(L->z), &(L->nzmax), Common))
00549     {
00550   L->p    = CHOLMOD(free) (n+1, sizeof (Int),      L->p, Common) ;
00551   L->nz   = CHOLMOD(free) (n,   sizeof (Int),      L->nz, Common) ;
00552   L->prev = CHOLMOD(free) (n+2, sizeof (Int),      L->prev, Common) ;
00553   L->next = CHOLMOD(free) (n+2, sizeof (Int),      L->next, Common) ;
00554   L->i    = CHOLMOD(free) (lnz, sizeof (Int),      L->i, Common) ;
00555   L->x    = CHOLMOD(free) (lnz, e*sizeof (double), L->x, Common) ;
00556   L->z    = CHOLMOD(free) (lnz, sizeof (double),   L->z, Common) ;
00557   PRINT1 (("cannot realloc simplicial numeric\n")) ;
00558   return ;  /* out of memory */
00559     }
00560 
00561     /* ============================================== commit the changes to L */
00562 
00563     /* initialize L to be the identity matrix */
00564     L->xtype = to_xtype ;
00565     L->dtype = DTYPE ;
00566     L->minor = n ;
00567 
00568     Li = L->i ;
00569     Lx = L->x ;
00570     Lz = L->z ;
00571 
00572 #if 0
00573     if (lnz == 1)
00574     {
00575   /* the user won't expect to access this entry, but some CHOLMOD
00576    * routines may.  Set it to zero so that valgrind doesn't complain. */
00577   switch (to_xtype)
00578   {
00579       case CHOLMOD_REAL:
00580     Lx [0] = 0 ;
00581     break ;
00582 
00583       case CHOLMOD_COMPLEX:
00584     Lx [0] = 0 ;
00585     Lx [1] = 0 ;
00586     break ;
00587 
00588       case CHOLMOD_ZOMPLEX:
00589     Lx [0] = 0 ;
00590     Lz [0] = 0 ;
00591     break ;
00592   }
00593     }
00594 #endif
00595 
00596     if (packed >= 0)
00597     {
00598   /* create the unit diagonal for either the LL' or LDL' case */
00599 
00600   switch (L->xtype)
00601   {
00602       case CHOLMOD_REAL:
00603     for (j = 0 ; j < n ; j++)
00604     {
00605         ASSERT (Lp [j] < Lp [j+1]) ;
00606         p = Lp [j] ;
00607         Li [p] = j ;
00608         Lx [p] = 1 ;
00609     }
00610     break ;
00611 
00612       case CHOLMOD_COMPLEX:
00613     for (j = 0 ; j < n ; j++)
00614     {
00615         ASSERT (Lp [j] < Lp [j+1]) ;
00616         p = Lp [j] ;
00617         Li [p] = j ;
00618         Lx [2*p  ] = 1 ;
00619         Lx [2*p+1] = 0 ;
00620     }
00621     break ;
00622 
00623       case CHOLMOD_ZOMPLEX:
00624     for (j = 0 ; j < n ; j++)
00625     {
00626         ASSERT (Lp [j] < Lp [j+1]) ;
00627         p = Lp [j] ;
00628         Li [p] = j ;
00629         Lx [p] = 1 ;
00630         Lz [p] = 0 ;
00631     }
00632     break ;
00633   }
00634     }
00635 
00636     L->is_ll = to_ll ;
00637 
00638     PRINT1 (("done convert simplicial symbolic to numeric\n")) ;
00639 }
00640 
00641 
00642 /* ========================================================================== */
00643 /* === change_simplicial_numeric ============================================ */
00644 /* ========================================================================== */
00645 
00646 /* Change LL' to LDL', LDL' to LL', or leave as-is.
00647  *
00648  * If to_packed is TRUE, then the columns of L are packed and made monotonic
00649  * (to_monotonic is ignored; it is implicitly TRUE).
00650  *
00651  * If to_monotonic is TRUE but to_packed is FALSE, the columns of L are made
00652  * monotonic but not packed.
00653  *
00654  * If both to_packed and to_monotonic are FALSE, then the columns of L are
00655  * left as-is, and the conversion is done in place.
00656  *
00657  * If L is already monotonic, or if it is to be left non-monotonic, then this
00658  * conversion always succeeds.
00659  *
00660  * When converting an LDL' to LL' factorization, any column with a negative
00661  * or zero diagonal entry is not modified so that conversion back to LDL' will
00662  * succeed.  This can result in a matrix L with a negative entry on the diagonal
00663  * If the kth entry on the diagonal of D is negative, it and the kth column of
00664  * L are left unchanged.  A subsequent conversion back to an LDL' form will also
00665  * leave the column unchanged, so the correct LDL' factorization will be
00666  * restored.  L->minor is set to the smallest k for which D (k,k) is negative.
00667  */
00668 
00669 static void change_simplicial_numeric
00670 (
00671     cholmod_factor *L,
00672     int to_ll,
00673     int to_packed,
00674     int to_monotonic,
00675     cholmod_common *Common
00676 )
00677 {
00678     double grow0, grow1, xlen, xlnz ;
00679     void *newLi, *newLx, *newLz ;
00680     double *Lx, *Lz ;
00681     Int *Lp, *Li, *Lnz ;
00682     Int make_monotonic, grow2, n, j, lnz, len, grow, ok, make_ll, make_ldl ;
00683     size_t nzmax0 ;
00684 
00685     PRINT1 (("\n===Change simplicial numeric: %d %d %d\n",
00686       to_ll, to_packed, to_monotonic)) ;
00687     DEBUG (CHOLMOD(dump_factor) (L, "change simplicial numeric", Common)) ;
00688     ASSERT (L->xtype != CHOLMOD_PATTERN && !(L->is_super)) ;
00689 
00690     make_monotonic = ((to_packed || to_monotonic) && !(L->is_monotonic)) ;
00691     make_ll  = (to_ll && !(L->is_ll)) ;
00692     make_ldl = (!to_ll && L->is_ll) ;
00693 
00694     n = L->n ;
00695     Lp = L->p ;
00696     Li = L->i ;
00697     Lx = L->x ;
00698     Lz = L->z ;
00699     Lnz = L->nz ;
00700 
00701     grow = FALSE ;
00702     grow0 = Common->grow0 ;
00703     grow1 = Common->grow1 ;
00704     grow2 = Common->grow2 ;
00705     grow0 = IS_NAN (grow0) ? 1 : grow0 ;
00706     grow1 = IS_NAN (grow1) ? 1 : grow1 ;
00707     ok = TRUE ;
00708     newLi = NULL ;
00709     newLx = NULL ; 
00710     newLz = NULL ; 
00711     lnz = 0 ;
00712 
00713     if (make_monotonic)
00714     {
00715 
00716   /* ------------------------------------------------------------------ */
00717   /* Columns out of order, but will be reordered and optionally packed. */
00718   /* ------------------------------------------------------------------ */
00719 
00720   PRINT1 (("L is non-monotonic\n")) ;
00721 
00722   /* compute new L->nzmax */
00723   if (!to_packed)
00724   {
00725       /* if any parameter is NaN, grow is false */
00726       /* fl.pt. comparisons below are false if any parameter is NaN */
00727       grow = (grow0 >= 1.0) && (grow1 >= 1.0) && (grow2 > 0) ;
00728   }
00729   for (j = 0 ; ok && j < n ; j++)
00730   {
00731       len = Lnz [j] ;
00732       ASSERT (len >= 1 && len <= n-j) ;
00733 
00734       /* compute len in double to avoid integer overflow */
00735       if (grow)
00736       {
00737     xlen = (double) len ;
00738     xlen = grow1 * xlen + grow2 ;
00739     xlen = MIN (xlen, n-j) ;
00740     len = (Int) xlen ;
00741       }
00742       ASSERT (len >= Lnz [j] && len <= n-j) ;
00743 
00744       PRINT2 (("j: "ID" Lnz[j] "ID" len "ID" p "ID"\n",
00745       j, Lnz [j], len, lnz)) ;
00746 
00747       lnz += len ;
00748       ok = (lnz >= 0) ;
00749   }
00750 
00751   if (!ok)
00752   {
00753       ERROR (CHOLMOD_TOO_LARGE, "problem too large") ;
00754       return ;
00755   }
00756 
00757   if (grow)
00758   {
00759       xlnz = (double) lnz ;
00760       xlnz *= grow0 ;
00761       xlnz = MIN (xlnz, Size_max) ;
00762       xlnz = MIN (xlnz, ((double) n * (double) n + (double) n) / 2) ;
00763       lnz = (Int) xlnz ;
00764   }
00765 
00766   lnz = MAX (1, lnz) ;
00767   PRINT1 (("final lnz "ID"\n", lnz)) ;
00768   nzmax0 = 0 ;
00769 
00770   CHOLMOD(realloc_multiple) (lnz, 1, L->xtype, &newLi, NULL,
00771     &newLx, &newLz, &nzmax0, Common) ;
00772 
00773   if (Common->status < CHOLMOD_OK)
00774   {
00775       return ;      /* out of memory */
00776   }
00777     }
00778 
00779     /* ============================================== commit the changes to L */
00780 
00781     /* ---------------------------------------------------------------------- */
00782     /* convert the simplicial L, using template routine */
00783     /* ---------------------------------------------------------------------- */
00784 
00785     switch (L->xtype)
00786     {
00787 
00788   case CHOLMOD_REAL:
00789       amesos_r_change_simplicial_numeric (L, to_ll, to_packed,
00790         newLi, newLx, newLz, lnz, grow, grow1, grow2,
00791         make_ll, make_monotonic, make_ldl, Common) ;
00792       break ;
00793 
00794   case CHOLMOD_COMPLEX:
00795       amesos_c_change_simplicial_numeric (L, to_ll, to_packed,
00796         newLi, newLx, newLz, lnz, grow, grow1, grow2,
00797         make_ll, make_monotonic, make_ldl, Common) ;
00798       break ;
00799 
00800   case CHOLMOD_ZOMPLEX:
00801       amesos_z_change_simplicial_numeric (L, to_ll, to_packed,
00802         newLi, newLx, newLz, lnz, grow, grow1, grow2,
00803         make_ll, make_monotonic, make_ldl, Common) ;
00804       break ;
00805     }
00806 
00807     DEBUG (CHOLMOD(dump_factor) (L, "L simplicial changed", Common)) ;
00808 }
00809 
00810 
00811 /* ========================================================================== */
00812 /* === ll_super_to_simplicial_numeric ======================================= */
00813 /* ========================================================================== */
00814 
00815 /* Convert a supernodal numeric factorization to any simplicial numeric one.
00816  * Leaves L->xtype unchanged (real or complex, not zomplex since there is
00817  * no supernodal zomplex L). */
00818 
00819 static void ll_super_to_simplicial_numeric
00820 (
00821     cholmod_factor *L,
00822     int to_packed,
00823     int to_ll,
00824     cholmod_common *Common
00825 )
00826 {
00827     Int *Ls, *Lpi, *Lpx, *Super, *Li ;
00828     Int n, lnz, s, nsuper, psi, psend, nsrow, nscol, k1, k2, erows ;
00829 
00830     DEBUG (CHOLMOD(dump_factor) (L, "start LL super to simplicial", Common)) ;
00831     PRINT1 (("super -> simplicial (%d %d)\n", to_packed, to_ll)) ;
00832     ASSERT (L->xtype != CHOLMOD_PATTERN && L->is_ll && L->is_super) ;
00833     ASSERT (L->x != NULL && L->i == NULL) ;
00834 
00835     n = L->n ;
00836     nsuper = L->nsuper ;
00837     Lpi = L->pi ;
00838     Lpx = L->px ;
00839     Ls = L->s ;
00840     Super = L->super ;
00841 
00842     /* Int overflow cannot occur since supernodal L already exists */
00843 
00844     if (to_packed)
00845     {
00846   /* count the number of nonzeros in L.  Each supernode is of the form
00847    *
00848    *    l . . .     For this example, nscol = 4 (# columns). nsrow = 9.
00849    *    l l . .     The "." entries are allocated in the supernodal
00850    *    l l l .     factor, but not used.  They are not copied to the
00851    *    l l l l     simplicial factor.  Some "l" and "e" entries may be
00852    *    e e e e     numerically zero and even symbolically zero if a
00853    *    e e e e     tight simplicial factorization or resymbol were
00854    *    e e e e     done, because of numerical cancellation and relaxed
00855    *    e e e e     supernode amalgamation, respectively.
00856    *    e e e e
00857    */
00858   lnz = 0 ;
00859   for (s = 0 ; s < nsuper ; s++)
00860   {
00861       k1 = Super [s] ;
00862       k2 = Super [s+1] ;
00863       psi = Lpi [s] ;
00864       psend = Lpi [s+1] ;
00865       nsrow = psend - psi ;
00866       nscol = k2 - k1 ;
00867       ASSERT (nsrow >= nscol) ;
00868       erows = nsrow - nscol ;
00869 
00870       /* lower triangular part, including the diagonal,
00871        * counting the "l" terms in the figure above. */
00872       lnz += nscol * (nscol+1) / 2 ;
00873 
00874       /* rectangular part, below the diagonal block (the "e" terms) */
00875       lnz += nscol * erows ;
00876   }
00877   ASSERT (lnz <= (Int) (L->xsize)) ;
00878     }
00879     else
00880     {
00881   /* Li will be the same size as Lx */
00882   lnz = L->xsize ;
00883     }
00884     ASSERT (lnz >= 0) ;
00885     PRINT1 (("simplicial lnz = "ID"  to_packed: %d  to_ll: %d L->xsize %g\n",
00886     lnz, to_ll, to_packed, (double) L->xsize)) ;
00887 
00888     Li = CHOLMOD(malloc) (lnz, sizeof (Int), Common) ;
00889     if (Common->status < CHOLMOD_OK)
00890     {
00891   return ;  /* out of memory */
00892     }
00893 
00894     if (!allocate_simplicial_numeric (L, Common))
00895     {
00896   CHOLMOD(free) (lnz, sizeof (Int), Li, Common) ;
00897   return ;  /* out of memory */
00898     }
00899 
00900     /* ============================================== commit the changes to L */
00901 
00902     L->i = Li ;
00903     L->nzmax = lnz ;
00904 
00905     /* ---------------------------------------------------------------------- */
00906     /* convert the supernodal L, using template routine */
00907     /* ---------------------------------------------------------------------- */
00908 
00909     switch (L->xtype)
00910     {
00911 
00912   case CHOLMOD_REAL:
00913       amesos_r_ll_super_to_simplicial_numeric (L, to_packed, to_ll, Common) ;
00914       break ;
00915 
00916   case CHOLMOD_COMPLEX:
00917       amesos_c_ll_super_to_simplicial_numeric (L, to_packed, to_ll, Common) ;
00918       break ;
00919     }
00920 
00921     /* ---------------------------------------------------------------------- */
00922     /* free unused parts of L */
00923     /* ---------------------------------------------------------------------- */
00924 
00925     L->super = CHOLMOD(free) (nsuper+1, sizeof (Int), L->super, Common) ;
00926     L->pi    = CHOLMOD(free) (nsuper+1, sizeof (Int), L->pi, Common) ;
00927     L->px    = CHOLMOD(free) (nsuper+1, sizeof (Int), L->px, Common) ;
00928     L->s     = CHOLMOD(free) (L->ssize, sizeof (Int), L->s, Common) ;
00929 
00930     L->ssize = 0 ;
00931     L->xsize = 0 ;
00932     L->nsuper = 0 ;
00933     L->maxesize = 0 ;
00934     L->maxcsize = 0 ;
00935 
00936     L->is_super = FALSE ;
00937 
00938     DEBUG (CHOLMOD(dump_factor) (L, "done  LL super to simplicial", Common)) ;
00939 }
00940 
00941 
00942 /* ========================================================================== */
00943 /* === super_symbolic_to_ll_super =========================================== */
00944 /* ========================================================================== */
00945 
00946 /* Convert a supernodal symbolic factorization to a supernodal numeric
00947  * factorization by allocating L->x.  Contents of L->x are undefined.
00948  */
00949 
00950 static int super_symbolic_to_ll_super
00951 (
00952     int to_xtype,
00953     cholmod_factor *L,
00954     cholmod_common *Common
00955 )
00956 {
00957     double *Lx ;
00958     Int wentry = (to_xtype == CHOLMOD_REAL) ? 1 : 2 ;
00959     PRINT1 (("convert super sym to num\n")) ;
00960     ASSERT (L->xtype == CHOLMOD_PATTERN && L->is_super) ;
00961     Lx = CHOLMOD(malloc) (L->xsize, wentry * sizeof (double), Common) ;
00962     PRINT1 (("xsize %g\n", (double) L->xsize)) ;
00963     if (Common->status < CHOLMOD_OK)
00964     {
00965   return (FALSE) ;  /* out of memory */
00966     }
00967 
00968     /* ============================================== commit the changes to L */
00969 
00970     if (L->xsize == 1)
00971     {
00972   /* the caller won't expect to access this entry, but some CHOLMOD
00973    * routines may.  Set it to zero so that valgrind doesn't complain. */
00974   switch (to_xtype)
00975   {
00976       case CHOLMOD_REAL:
00977     Lx [0] = 0 ;
00978     break ;
00979 
00980       case CHOLMOD_COMPLEX:
00981     Lx [0] = 0 ;
00982     Lx [1] = 0 ;
00983     break ;
00984   }
00985     }
00986 
00987     L->x = Lx ;
00988     L->xtype = to_xtype ;
00989     L->dtype = DTYPE ;
00990     L->minor = L->n ;
00991     return (TRUE) ;
00992 }
00993 
00994 
00995 /* ========================================================================== */
00996 /* === cholmod_change_factor ================================================ */
00997 /* ========================================================================== */
00998 
00999 /* Convert a factor L.  Some conversions simply allocate uninitialized space
01000  * that meant to be filled later.
01001  *
01002  * If the conversion fails, the factor is left in its original form, with one
01003  * exception.  Converting a supernodal symbolic factor to a simplicial numeric
01004  * one (with L=D=I) may leave the factor in simplicial symbolic form.
01005  *
01006  * Memory allocated for each conversion is listed below.
01007  */
01008 
01009 int CHOLMOD(change_factor)
01010 (
01011     /* ---- input ---- */
01012     int to_xtype, /* convert to CHOLMOD_PATTERN, _REAL, _COMPLEX, or
01013        * _ZOMPLEX */
01014     int to_ll,    /* TRUE: convert to LL', FALSE: LDL' */
01015     int to_super, /* TRUE: convert to supernodal, FALSE: simplicial */
01016     int to_packed,  /* TRUE: pack simplicial columns, FALSE: do not pack */
01017     int to_monotonic, /* TRUE: put simplicial columns in order, FALSE: not */
01018     /* ---- in/out --- */
01019     cholmod_factor *L,  /* factor to modify */
01020     /* --------------- */
01021     cholmod_common *Common
01022 )
01023 {
01024 
01025     /* ---------------------------------------------------------------------- */
01026     /* get inputs */
01027     /* ---------------------------------------------------------------------- */
01028 
01029     RETURN_IF_NULL_COMMON (FALSE) ;
01030     RETURN_IF_NULL (L, FALSE) ;
01031     RETURN_IF_XTYPE_INVALID (L, CHOLMOD_PATTERN, CHOLMOD_ZOMPLEX, FALSE) ;
01032     if (to_xtype < CHOLMOD_PATTERN || to_xtype > CHOLMOD_ZOMPLEX)
01033     {
01034   ERROR (CHOLMOD_INVALID, "xtype invalid") ;
01035   return (FALSE) ;
01036     }
01037     Common->status = CHOLMOD_OK ;
01038 
01039     PRINT1 (("-----convert from (%d,%d,%d,%d,%d) to (%d,%d,%d,%d,%d)\n",
01040     L->xtype, L->is_ll, L->is_super, L_is_packed (L, Common), L->is_monotonic,
01041     to_xtype, to_ll,    to_super,    to_packed,               to_monotonic)) ;
01042 
01043     /* ensure all parameters are TRUE/FALSE */
01044     to_ll = BOOLEAN (to_ll) ;
01045     to_super = BOOLEAN (to_super) ;
01046 
01047     ASSERT (BOOLEAN (L->is_ll) == L->is_ll) ;
01048     ASSERT (BOOLEAN (L->is_super) == L->is_super) ;
01049 
01050     if (to_super && to_xtype == CHOLMOD_ZOMPLEX)
01051     {
01052   ERROR (CHOLMOD_INVALID, "supernodal zomplex L not supported") ;
01053   return (FALSE) ;
01054     }
01055 
01056     /* ---------------------------------------------------------------------- */
01057     /* convert */
01058     /* ---------------------------------------------------------------------- */
01059 
01060     if (to_xtype == CHOLMOD_PATTERN)
01061     {
01062 
01063   /* ------------------------------------------------------------------ */
01064   /* convert to symbolic */
01065   /* ------------------------------------------------------------------ */
01066 
01067   if (!to_super)
01068   {
01069 
01070       /* -------------------------------------------------------------- */
01071       /* convert any factor into a simplicial symbolic factor */
01072       /* -------------------------------------------------------------- */
01073 
01074       any_to_simplicial_symbolic (L, to_ll, Common) ;    /* cannot fail */
01075 
01076   }
01077   else
01078   {
01079 
01080       /* -------------------------------------------------------------- */
01081       /* convert to a supernodal symbolic factor */
01082       /* -------------------------------------------------------------- */
01083 
01084       if (L->xtype != CHOLMOD_PATTERN && L->is_super)
01085       {
01086     /* convert from supernodal numeric to supernodal symbolic.
01087      * this preserves symbolic pattern of L, discards numeric
01088      * values */
01089     ll_super_to_super_symbolic (L, Common) ;       /* cannot fail */
01090       }
01091       else if (L->xtype == CHOLMOD_PATTERN && !(L->is_super))
01092       {
01093     /* convert from simplicial symbolic to supernodal symbolic.
01094      * contents of supernodal pattern are uninitialized.  Not meant
01095      * for the end user. */
01096     simplicial_symbolic_to_super_symbolic (L, Common) ;
01097       }
01098       else
01099       {
01100     /* cannot convert from simplicial numeric to supernodal
01101      * symbolic */
01102     ERROR (CHOLMOD_INVALID,
01103       "cannot convert L to supernodal symbolic") ;
01104       }
01105   }
01106 
01107     }
01108     else
01109     {
01110 
01111   /* ------------------------------------------------------------------ */
01112   /* convert to numeric */
01113   /* ------------------------------------------------------------------ */
01114       
01115   if (to_super)
01116   {
01117 
01118       /* -------------------------------------------------------------- */
01119       /* convert to supernodal numeric factor */
01120       /* -------------------------------------------------------------- */
01121 
01122       if (L->xtype == CHOLMOD_PATTERN)
01123       {
01124     if (L->is_super)
01125     {
01126         /* Convert supernodal symbolic to supernodal numeric.
01127          * Contents of supernodal numeric values are uninitialized.
01128          * This is used by cholmod_super_numeric.  Not meant for
01129          * the end user. */
01130         super_symbolic_to_ll_super (to_xtype, L, Common) ;
01131     }
01132     else
01133     {
01134         /* Convert simplicial symbolic to supernodal numeric.
01135          * Contents not defined.  This is used by
01136          * Core/cholmod_copy_factor only.  Not meant for the end
01137          * user. */
01138         if (!simplicial_symbolic_to_super_symbolic (L, Common))
01139         {
01140       /* failure, convert back to simplicial symbolic */
01141       any_to_simplicial_symbolic (L, to_ll, Common) ;
01142         }
01143         else
01144         {
01145       /* conversion to super symbolic OK, allocate numeric
01146        * part */
01147       super_symbolic_to_ll_super (to_xtype, L, Common) ;
01148         }
01149     }
01150       }
01151       else
01152       {
01153     /* nothing to do if L is already in supernodal numeric form */
01154     if (!(L->is_super))
01155     {
01156         ERROR (CHOLMOD_INVALID,
01157       "cannot convert simplicial L to supernodal") ;
01158     }
01159     /* FUTURE WORK: convert to/from supernodal LL' and LDL' */
01160       }
01161 
01162   }
01163   else
01164   {
01165 
01166       /* -------------------------------------------------------------- */
01167       /* convert any factor to simplicial numeric */
01168       /* -------------------------------------------------------------- */
01169 
01170       if (L->xtype == CHOLMOD_PATTERN && !(L->is_super))
01171       {
01172 
01173     /* ---------------------------------------------------------- */
01174     /* convert simplicial symbolic to simplicial numeric (L=I,D=I)*/
01175     /* ---------------------------------------------------------- */
01176 
01177     simplicial_symbolic_to_simplicial_numeric (L, to_ll, to_packed,
01178       to_xtype, Common) ;
01179 
01180       }
01181       else if (L->xtype != CHOLMOD_PATTERN && L->is_super)
01182       {
01183 
01184     /* ---------------------------------------------------------- */
01185     /* convert a supernodal LL' to simplicial numeric */
01186     /* ---------------------------------------------------------- */
01187 
01188     ll_super_to_simplicial_numeric (L, to_packed, to_ll, Common) ;
01189 
01190       }
01191       else if (L->xtype == CHOLMOD_PATTERN && L->is_super)
01192       {
01193 
01194     /* ---------------------------------------------------------- */
01195     /* convert a supernodal symbolic to simplicial numeric (L=D=I)*/
01196     /* ---------------------------------------------------------- */
01197 
01198     any_to_simplicial_symbolic (L, to_ll, Common) ;
01199     /* if the following fails, it leaves the factor in simplicial
01200      * symbolic form */
01201     simplicial_symbolic_to_simplicial_numeric (L, to_ll, to_packed,
01202       to_xtype, Common) ;
01203 
01204       }
01205       else
01206       {
01207 
01208     /* ---------------------------------------------------------- */
01209     /* change a simplicial numeric factor */
01210     /* ---------------------------------------------------------- */
01211 
01212     /* change LL' to LDL', LDL' to LL', or leave as-is.  pack the
01213      * columns of L, or leave as-is.  Ensure the columns are
01214      * monotonic, or leave as-is. */
01215 
01216     change_simplicial_numeric (L, to_ll, to_packed, to_monotonic,
01217       Common) ;
01218       }
01219   }
01220     }
01221 
01222     /* ---------------------------------------------------------------------- */
01223     /* return result */
01224     /* ---------------------------------------------------------------------- */
01225 
01226     return (Common->status >= CHOLMOD_OK) ;
01227 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines