152 for (j = 0 ; j < n ; j++)
154 PRINT3 ((
"j: "ID" Lnz "ID" Lp[j+1] "ID" Lp[j] "ID"\n", j, Lnz [j],
156 if (Lnz [j] != (Lp [j+1] - Lp [j]))
158 PRINT2 ((
"L is not packed\n")) ;
175 Int head, tail,
n, j ;
184 Lprev [head] =
EMPTY ;
185 Lnext [tail] =
EMPTY ;
187 for (j = 0 ; j < n ; j++)
211 Int *Lp, *Lnz, *Lprev, *Lnext ;
214 PRINT1 ((
"Allocate simplicial\n")) ;
225 n1 = ((size_t) n) + 1 ;
226 n2 = ((size_t) n) + 2 ;
228 Lp =
CHOLMOD(malloc) (n1,
sizeof (
Int), Common) ;
229 Lnz =
CHOLMOD(malloc) (n,
sizeof (
Int), Common) ;
230 Lprev =
CHOLMOD(malloc) (n2,
sizeof (
Int), Common) ;
231 Lnext =
CHOLMOD(malloc) (n2,
sizeof (
Int), Common) ;
235 CHOLMOD(free) (n1,
sizeof (
Int), Lp, Common) ;
236 CHOLMOD(free) (n,
sizeof (
Int), Lnz, Common) ;
237 CHOLMOD(free) (n2,
sizeof (
Int), Lprev, Common) ;
238 CHOLMOD(free) (n2,
sizeof (
Int), Lnext, Common) ;
239 PRINT1 ((
"Allocate simplicial failed\n")) ;
251 PRINT1 ((
"Allocate simplicial done\n")) ;
269 Int nsuper, xsize, ssize ;
270 Int *Lsuper, *Lpi, *Lpx, *Ls ;
278 nsuper1 = ((size_t) nsuper) + 1 ;
280 PRINT1 ((
"simple sym to super sym: ssize "ID" xsize "ID" nsuper "ID""
281 " status %d\n", ssize, xsize, nsuper, Common->
status)) ;
284 Lsuper =
CHOLMOD(malloc) (nsuper1,
sizeof (
Int), Common) ;
285 Lpi =
CHOLMOD(malloc) (nsuper1,
sizeof (
Int), Common) ;
286 Lpx =
CHOLMOD(malloc) (nsuper1,
sizeof (
Int), Common) ;
289 Ls =
CHOLMOD(malloc) (ssize,
sizeof (
Int), Common) ;
293 CHOLMOD(free) (nsuper1,
sizeof (
Int), Lsuper, Common) ;
294 CHOLMOD(free) (nsuper1,
sizeof (
Int), Lpi, Common) ;
295 CHOLMOD(free) (nsuper1,
sizeof (
Int), Lpx, Common) ;
296 CHOLMOD(free) (ssize,
sizeof (
Int), Ls, Common) ;
337 Int n, lnz, xs, ss, s, e ;
350 n1 = ((size_t) n) + 1 ;
351 n2 = ((size_t) n) + 2 ;
355 L->
i =
CHOLMOD(free) (lnz,
sizeof (
Int), L->
i, Common) ;
356 L->
x =
CHOLMOD(free) (xs, e*
sizeof (double), L->
x, Common) ;
357 L->
z =
CHOLMOD(free) (lnz,
sizeof (double), L->
z, Common) ;
422 double grow0, grow1, xlen, xlnz ;
424 Int *Li, *Lp, *Lnz, *ColCount ;
425 Int n, grow, grow2, p, j, lnz, len, ok, e ;
430 PRINT1 ((
"out of memory, allocate simplicial numeric\n")) ;
460 PRINT1 ((
"convert to packed LL' or LDL'\n")) ;
462 for (j = 0 ; ok && j < n ; j++)
467 len =
MIN (len, n-j) ;
471 for (j = 0 ; j <= n ; j++)
475 for (j = 0 ; j < n ; j++)
488 PRINT1 ((
"convert to unpacked\n")) ;
491 grow0 = Common->
grow0 ;
492 grow1 = Common->
grow1 ;
493 grow2 = Common->
grow2 ;
494 grow0 =
IS_NAN (grow0) ? 1 : grow0 ;
495 grow1 =
IS_NAN (grow1) ? 1 : grow1 ;
497 grow = (grow0 >= 1.0) && (grow1 >= 1.0) && (grow2 > 0) ;
498 PRINT1 ((
"init, grow1 %g grow2 "ID"\n", grow1, grow2)) ;
501 for (j = 0 ; ok && j < n ; j++)
509 len =
MIN (len, n-j) ;
512 PRINT1 ((
"ColCount ["ID"] = "ID"\n", j, len)) ;
515 xlen = (double) len ;
516 xlen = grow1 * xlen + grow2 ;
517 xlen =
MIN (xlen, n-j) ;
520 ASSERT (len >= 1 && len <= n-j) ;
530 xlnz = (double) lnz ;
533 xlnz =
MIN (xlnz, ((
double) n * (
double) n + (
double) n) / 2) ;
547 PRINT1 ((
"resizing from zero size to lnz "ID"\n", lnz)) ;
551 &(L->
x), &(L->
z), &(L->
nzmax), Common))
553 L->
p =
CHOLMOD(free) (n+1,
sizeof (
Int), L->
p, Common) ;
557 L->
i =
CHOLMOD(free) (lnz,
sizeof (
Int), L->
i, Common) ;
558 L->
x =
CHOLMOD(free) (lnz, e*
sizeof (double), L->
x, Common) ;
559 L->
z =
CHOLMOD(free) (lnz,
sizeof (double), L->
z, Common) ;
560 PRINT1 ((
"cannot realloc simplicial numeric\n")) ;
567 L->
xtype = to_xtype ;
606 for (j = 0 ; j < n ; j++)
608 ASSERT (Lp [j] < Lp [j+1]) ;
616 for (j = 0 ; j < n ; j++)
618 ASSERT (Lp [j] < Lp [j+1]) ;
627 for (j = 0 ; j < n ; j++)
629 ASSERT (Lp [j] < Lp [j+1]) ;
641 PRINT1 ((
"done convert simplicial symbolic to numeric\n")) ;
681 double grow0, grow1, xlen, xlnz ;
682 void *newLi, *newLx, *newLz ;
685 Int make_monotonic, grow2,
n, j, lnz, len, grow, ok, make_ll, make_ldl ;
688 PRINT1 ((
"\n===Change simplicial numeric: %d %d %d\n",
689 to_ll, to_packed, to_monotonic)) ;
693 make_monotonic = ((to_packed || to_monotonic) && !(L->
is_monotonic)) ;
694 make_ll = (to_ll && !(L->
is_ll)) ;
695 make_ldl = (!to_ll && L->
is_ll) ;
705 grow0 = Common->
grow0 ;
706 grow1 = Common->
grow1 ;
707 grow2 = Common->
grow2 ;
708 grow0 =
IS_NAN (grow0) ? 1 : grow0 ;
709 grow1 =
IS_NAN (grow1) ? 1 : grow1 ;
723 PRINT1 ((
"L is non-monotonic\n")) ;
730 grow = (grow0 >= 1.0) && (grow1 >= 1.0) && (grow2 > 0) ;
732 for (j = 0 ; ok && j < n ; j++)
735 ASSERT (len >= 1 && len <= n-j) ;
740 xlen = (double) len ;
741 xlen = grow1 * xlen + grow2 ;
742 xlen =
MIN (xlen, n-j) ;
745 ASSERT (len >= Lnz [j] && len <= n-j) ;
748 j, Lnz [j], len, lnz)) ;
762 xlnz = (double) lnz ;
765 xlnz =
MIN (xlnz, ((
double) n * (
double) n + (
double) n) / 2) ;
770 PRINT1 ((
"final lnz "ID"\n", lnz)) ;
774 &newLx, &newLz, &nzmax0, Common) ;
792 amesos_r_change_simplicial_numeric (L, to_ll, to_packed,
793 newLi, newLx, newLz, lnz, grow, grow1, grow2,
794 make_ll, make_monotonic, make_ldl, Common) ;
798 amesos_c_change_simplicial_numeric (L, to_ll, to_packed,
799 newLi, newLx, newLz, lnz, grow, grow1, grow2,
800 make_ll, make_monotonic, make_ldl, Common) ;
804 amesos_z_change_simplicial_numeric (L, to_ll, to_packed,
805 newLi, newLx, newLz, lnz, grow, grow1, grow2,
806 make_ll, make_monotonic, make_ldl, Common) ;
830 Int *Ls, *Lpi, *Lpx, *Super, *Li ;
831 Int n, lnz, s, nsuper, psi, psend, nsrow, nscol, k1, k2, erows ;
834 PRINT1 ((
"super -> simplicial (%d %d)\n", to_packed, to_ll)) ;
862 for (s = 0 ; s < nsuper ; s++)
868 nsrow = psend - psi ;
871 erows = nsrow - nscol ;
875 lnz += nscol * (nscol+1) / 2 ;
878 lnz += nscol * erows ;
888 PRINT1 ((
"simplicial lnz = "ID" to_packed: %d to_ll: %d L->xsize %g\n",
889 lnz, to_ll, to_packed, (
double) L->
xsize)) ;
891 Li =
CHOLMOD(malloc) (lnz,
sizeof (
Int), Common) ;
899 CHOLMOD(free) (lnz,
sizeof (
Int), Li, Common) ;
916 amesos_r_ll_super_to_simplicial_numeric (L, to_packed, to_ll, Common) ;
920 amesos_c_ll_super_to_simplicial_numeric (L, to_packed, to_ll, Common) ;
962 PRINT1 ((
"convert super sym to num\n")) ;
964 Lx =
CHOLMOD(malloc) (L->
xsize, wentry *
sizeof (double), Common) ;
991 L->
xtype = to_xtype ;
1042 PRINT1 ((
"-----convert from (%d,%d,%d,%d,%d) to (%d,%d,%d,%d,%d)\n",
1043 L->xtype, L->is_ll, L->is_super,
L_is_packed (L, Common), L->is_monotonic,
1044 to_xtype, to_ll, to_super, to_packed, to_monotonic)) ;
1048 to_super =
BOOLEAN (to_super) ;
1053 if (to_super && to_xtype == CHOLMOD_ZOMPLEX)
1106 "cannot convert L to supernodal symbolic") ;
1160 "cannot convert simplicial L to supernodal") ;
static void natural_list(cholmod_factor *L)
#define CHOLMOD_TOO_LARGE
static void change_simplicial_numeric(cholmod_factor *L, int to_ll, int to_packed, int to_monotonic, 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)
static int simplicial_symbolic_to_super_symbolic(cholmod_factor *L, cholmod_common *Common)
static void ll_super_to_simplicial_numeric(cholmod_factor *L, int to_packed, int to_ll, cholmod_common *Common)
#define RETURN_IF_NULL_COMMON(result)
static int super_symbolic_to_ll_super(int to_xtype, cholmod_factor *L, cholmod_common *Common)
static void any_to_simplicial_symbolic(cholmod_factor *L, int to_ll, cholmod_common *Common)
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)
#define ASSERT(expression)
static int L_is_packed(cholmod_factor *L, cholmod_common *Common)
#define RETURN_IF_NULL(A, result)
static void simplicial_symbolic_to_simplicial_numeric(cholmod_factor *L, int to_ll, int packed, int to_xtype, cholmod_common *Common)
int CHOLMOD() dump_factor(cholmod_factor *L, char *name, cholmod_common *Common)
static void ll_super_to_super_symbolic(cholmod_factor *L, cholmod_common *Common)
#define ERROR(status, msg)
#define RETURN_IF_XTYPE_INVALID(A, xtype1, xtype2, result)
static int allocate_simplicial_numeric(cholmod_factor *L, cholmod_common *Common)