149 for (j = 0 ; j < n ; j++)
151 PRINT3 ((
"j: "ID" Lnz "ID" Lp[j+1] "ID" Lp[j] "ID"\n", j, Lnz [j],
153 if (Lnz [j] != (Lp [j+1] - Lp [j]))
155 PRINT2 ((
"L is not packed\n")) ;
172 Int head, tail,
n, j ;
181 Lprev [head] =
EMPTY ;
182 Lnext [tail] =
EMPTY ;
184 for (j = 0 ; j < n ; j++)
208 Int *Lp, *Lnz, *Lprev, *Lnext ;
211 PRINT1 ((
"Allocate simplicial\n")) ;
222 n1 = ((size_t) n) + 1 ;
223 n2 = ((size_t) n) + 2 ;
225 Lp =
CHOLMOD(malloc) (n1,
sizeof (
Int), Common) ;
226 Lnz =
CHOLMOD(malloc) (n,
sizeof (
Int), Common) ;
227 Lprev =
CHOLMOD(malloc) (n2,
sizeof (
Int), Common) ;
228 Lnext =
CHOLMOD(malloc) (n2,
sizeof (
Int), Common) ;
232 CHOLMOD(free) (n1,
sizeof (
Int), Lp, Common) ;
233 CHOLMOD(free) (n,
sizeof (
Int), Lnz, Common) ;
234 CHOLMOD(free) (n2,
sizeof (
Int), Lprev, Common) ;
235 CHOLMOD(free) (n2,
sizeof (
Int), Lnext, Common) ;
236 PRINT1 ((
"Allocate simplicial failed\n")) ;
248 PRINT1 ((
"Allocate simplicial done\n")) ;
266 Int nsuper, xsize, ssize ;
267 Int *Lsuper, *Lpi, *Lpx, *Ls ;
275 nsuper1 = ((size_t) nsuper) + 1 ;
277 PRINT1 ((
"simple sym to super sym: ssize "ID" xsize "ID" nsuper "ID""
278 " status %d\n", ssize, xsize, nsuper, Common->
status)) ;
281 Lsuper =
CHOLMOD(malloc) (nsuper1,
sizeof (
Int), Common) ;
282 Lpi =
CHOLMOD(malloc) (nsuper1,
sizeof (
Int), Common) ;
283 Lpx =
CHOLMOD(malloc) (nsuper1,
sizeof (
Int), Common) ;
286 Ls =
CHOLMOD(malloc) (ssize,
sizeof (
Int), Common) ;
290 CHOLMOD(free) (nsuper1,
sizeof (
Int), Lsuper, Common) ;
291 CHOLMOD(free) (nsuper1,
sizeof (
Int), Lpi, Common) ;
292 CHOLMOD(free) (nsuper1,
sizeof (
Int), Lpx, Common) ;
293 CHOLMOD(free) (ssize,
sizeof (
Int), Ls, Common) ;
334 Int n, lnz, xs, ss, s, e ;
347 n1 = ((size_t) n) + 1 ;
348 n2 = ((size_t) n) + 2 ;
352 L->
i =
CHOLMOD(free) (lnz,
sizeof (
Int), L->
i, Common) ;
353 L->
x =
CHOLMOD(free) (xs, e*
sizeof (double), L->
x, Common) ;
354 L->
z =
CHOLMOD(free) (lnz,
sizeof (double), L->
z, Common) ;
419 double grow0, grow1, xlen, xlnz ;
421 Int *Li, *Lp, *Lnz, *ColCount ;
422 Int n, grow, grow2, p, j, lnz, len, ok, e ;
427 PRINT1 ((
"out of memory, allocate simplicial numeric\n")) ;
457 PRINT1 ((
"convert to packed LL' or LDL'\n")) ;
459 for (j = 0 ; ok && j < n ; j++)
464 len =
MIN (len, n-j) ;
468 for (j = 0 ; j <= n ; j++)
472 for (j = 0 ; j < n ; j++)
485 PRINT1 ((
"convert to unpacked\n")) ;
488 grow0 = Common->
grow0 ;
489 grow1 = Common->
grow1 ;
490 grow2 = Common->
grow2 ;
491 grow0 =
IS_NAN (grow0) ? 1 : grow0 ;
492 grow1 =
IS_NAN (grow1) ? 1 : grow1 ;
494 grow = (grow0 >= 1.0) && (grow1 >= 1.0) && (grow2 > 0) ;
495 PRINT1 ((
"init, grow1 %g grow2 "ID"\n", grow1, grow2)) ;
498 for (j = 0 ; ok && j < n ; j++)
506 len =
MIN (len, n-j) ;
509 PRINT1 ((
"ColCount ["ID"] = "ID"\n", j, len)) ;
512 xlen = (double) len ;
513 xlen = grow1 * xlen + grow2 ;
514 xlen =
MIN (xlen, n-j) ;
517 ASSERT (len >= 1 && len <= n-j) ;
527 xlnz = (double) lnz ;
530 xlnz =
MIN (xlnz, ((
double) n * (
double) n + (
double) n) / 2) ;
544 PRINT1 ((
"resizing from zero size to lnz "ID"\n", lnz)) ;
548 &(L->
x), &(L->
z), &(L->
nzmax), Common))
550 L->
p =
CHOLMOD(free) (n+1,
sizeof (
Int), L->
p, Common) ;
554 L->
i =
CHOLMOD(free) (lnz,
sizeof (
Int), L->
i, Common) ;
555 L->
x =
CHOLMOD(free) (lnz, e*
sizeof (double), L->
x, Common) ;
556 L->
z =
CHOLMOD(free) (lnz,
sizeof (double), L->
z, Common) ;
557 PRINT1 ((
"cannot realloc simplicial numeric\n")) ;
564 L->
xtype = to_xtype ;
603 for (j = 0 ; j < n ; j++)
605 ASSERT (Lp [j] < Lp [j+1]) ;
613 for (j = 0 ; j < n ; j++)
615 ASSERT (Lp [j] < Lp [j+1]) ;
624 for (j = 0 ; j < n ; j++)
626 ASSERT (Lp [j] < Lp [j+1]) ;
638 PRINT1 ((
"done convert simplicial symbolic to numeric\n")) ;
678 double grow0, grow1, xlen, xlnz ;
679 void *newLi, *newLx, *newLz ;
682 Int make_monotonic, grow2,
n, j, lnz, len, grow, ok, make_ll, make_ldl ;
685 PRINT1 ((
"\n===Change simplicial numeric: %d %d %d\n",
686 to_ll, to_packed, to_monotonic)) ;
690 make_monotonic = ((to_packed || to_monotonic) && !(L->
is_monotonic)) ;
691 make_ll = (to_ll && !(L->
is_ll)) ;
692 make_ldl = (!to_ll && L->
is_ll) ;
702 grow0 = Common->
grow0 ;
703 grow1 = Common->
grow1 ;
704 grow2 = Common->
grow2 ;
705 grow0 =
IS_NAN (grow0) ? 1 : grow0 ;
706 grow1 =
IS_NAN (grow1) ? 1 : grow1 ;
720 PRINT1 ((
"L is non-monotonic\n")) ;
727 grow = (grow0 >= 1.0) && (grow1 >= 1.0) && (grow2 > 0) ;
729 for (j = 0 ; ok && j < n ; j++)
732 ASSERT (len >= 1 && len <= n-j) ;
737 xlen = (double) len ;
738 xlen = grow1 * xlen + grow2 ;
739 xlen =
MIN (xlen, n-j) ;
742 ASSERT (len >= Lnz [j] && len <= n-j) ;
745 j, Lnz [j], len, lnz)) ;
759 xlnz = (double) lnz ;
762 xlnz =
MIN (xlnz, ((
double) n * (
double) n + (
double) n) / 2) ;
767 PRINT1 ((
"final lnz "ID"\n", lnz)) ;
771 &newLx, &newLz, &nzmax0, Common) ;
789 amesos_r_change_simplicial_numeric (L, to_ll, to_packed,
790 newLi, newLx, newLz, lnz, grow, grow1, grow2,
791 make_ll, make_monotonic, make_ldl, Common) ;
795 amesos_c_change_simplicial_numeric (L, to_ll, to_packed,
796 newLi, newLx, newLz, lnz, grow, grow1, grow2,
797 make_ll, make_monotonic, make_ldl, Common) ;
801 amesos_z_change_simplicial_numeric (L, to_ll, to_packed,
802 newLi, newLx, newLz, lnz, grow, grow1, grow2,
803 make_ll, make_monotonic, make_ldl, Common) ;
827 Int *Ls, *Lpi, *Lpx, *Super, *Li ;
828 Int n, lnz, s, nsuper, psi, psend, nsrow, nscol, k1, k2, erows ;
831 PRINT1 ((
"super -> simplicial (%d %d)\n", to_packed, to_ll)) ;
859 for (s = 0 ; s < nsuper ; s++)
865 nsrow = psend - psi ;
868 erows = nsrow - nscol ;
872 lnz += nscol * (nscol+1) / 2 ;
875 lnz += nscol * erows ;
885 PRINT1 ((
"simplicial lnz = "ID" to_packed: %d to_ll: %d L->xsize %g\n",
886 lnz, to_ll, to_packed, (
double) L->
xsize)) ;
888 Li =
CHOLMOD(malloc) (lnz,
sizeof (
Int), Common) ;
896 CHOLMOD(free) (lnz,
sizeof (
Int), Li, Common) ;
913 amesos_r_ll_super_to_simplicial_numeric (L, to_packed, to_ll, Common) ;
917 amesos_c_ll_super_to_simplicial_numeric (L, to_packed, to_ll, Common) ;
959 PRINT1 ((
"convert super sym to num\n")) ;
961 Lx =
CHOLMOD(malloc) (L->
xsize, wentry *
sizeof (double), Common) ;
988 L->
xtype = to_xtype ;
1039 PRINT1 ((
"-----convert from (%d,%d,%d,%d,%d) to (%d,%d,%d,%d,%d)\n",
1040 L->xtype, L->is_ll, L->is_super,
L_is_packed (L, Common), L->is_monotonic,
1041 to_xtype, to_ll, to_super, to_packed, to_monotonic)) ;
1045 to_super =
BOOLEAN (to_super) ;
1050 if (to_super && to_xtype == CHOLMOD_ZOMPLEX)
1103 "cannot convert L to supernodal symbolic") ;
1157 "cannot convert simplicial L to supernodal") ;
static void simplicial_symbolic_to_simplicial_numeric(cholmod_factor *L, int to_ll, int packed, int to_xtype, cholmod_common *Common)
#define CHOLMOD_TOO_LARGE
static void ll_super_to_simplicial_numeric(cholmod_factor *L, int to_packed, int to_ll, cholmod_common *Common)
int CHOLMOD() realloc_multiple(size_t nnew, int nint, int xtype, void **I, void **J, void **X, void **Z, size_t *nold_p, cholmod_common *Common)
#define RETURN_IF_NULL_COMMON(result)
static void any_to_simplicial_symbolic(cholmod_factor *L, int to_ll, cholmod_common *Common)
#define ASSERT(expression)
static void ll_super_to_super_symbolic(cholmod_factor *L, cholmod_common *Common)
static int L_is_packed(cholmod_factor *L, cholmod_common *Common)
static int allocate_simplicial_numeric(cholmod_factor *L, cholmod_common *Common)
static int super_symbolic_to_ll_super(int to_xtype, cholmod_factor *L, cholmod_common *Common)
static int simplicial_symbolic_to_super_symbolic(cholmod_factor *L, cholmod_common *Common)
#define RETURN_IF_NULL(A, result)
int CHOLMOD() change_factor(int to_xtype, int to_ll, int to_super, int to_packed, int to_monotonic, cholmod_factor *L, cholmod_common *Common)
int CHOLMOD() dump_factor(cholmod_factor *L, char *name, cholmod_common *Common)
static void natural_list(cholmod_factor *L)
#define ERROR(status, msg)
#define RETURN_IF_XTYPE_INVALID(A, xtype1, xtype2, result)
static void change_simplicial_numeric(cholmod_factor *L, int to_ll, int to_packed, int to_monotonic, cholmod_common *Common)