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