624 #ifdef MATLAB_MEX_FILE
629 #if !defined (NPRINT) || !defined (NDEBUG)
634 #define NULL ((void *) 0)
647 #define ID UF_long_id
648 #define Int_MAX UF_long_max
650 #define CCOLAMD_recommended amesos_ccolamd_l_recommended
651 #define CCOLAMD_set_defaults amesos_ccolamd_l_set_defaults
652 #define CCOLAMD_2 amesos_ccolamd2_l
653 #define CCOLAMD_MAIN amesos_ccolamd_l
654 #define CCOLAMD_apply_order amesos_ccolamd_l_apply_order
655 #define CCOLAMD_postorder amesos_ccolamd_l_postorder
656 #define CCOLAMD_post_tree amesos_ccolamd_l_post_tree
657 #define CCOLAMD_fsize amesos_ccolamd_l_fsize
658 #define CSYMAMD_MAIN amesos_csymamd_l
659 #define CCOLAMD_report amesos_ccolamd_l_report
660 #define CSYMAMD_report amesos_csymamd_l_report
666 #define Int_MAX INT_MAX
668 #define CCOLAMD_recommended amesos_ccolamd_recommended
669 #define CCOLAMD_set_defaults amesos_ccolamd_set_defaults
670 #define CCOLAMD_2 amesos_ccolamd2
671 #define CCOLAMD_MAIN amesos_ccolamd
672 #define CCOLAMD_apply_order amesos_ccolamd_apply_order
673 #define CCOLAMD_postorder amesos_ccolamd_postorder
674 #define CCOLAMD_post_tree amesos_ccolamd_post_tree
675 #define CCOLAMD_fsize amesos_ccolamd_fsize
676 #define CSYMAMD_MAIN amesos_csymamd
677 #define CCOLAMD_report amesos_ccolamd_report
678 #define CSYMAMD_report amesos_csymamd_report
755 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
756 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
761 #define PRIVATE static
763 #define DENSE_DEGREE(alpha,n) \
764 ((Int) MAX (16.0, (alpha) * sqrt ((double) (n))))
766 #define CMEMBER(c) ((cmember == (Int *) NULL) ? (0) : (cmember [c]))
769 #define SCALAR_IS_NAN(x) ((x) != (x))
772 #define INT_OVERFLOW(x) ((!((x) * (1.0+1e-8) <= (double) Int_MAX)) \
773 || SCALAR_IS_NAN (x))
775 #define ONES_COMPLEMENT(r) (-(r)-1)
786 #define DEAD_PRINCIPAL (-1)
787 #define DEAD_NON_PRINCIPAL (-2)
790 #define ROW_IS_DEAD(r) ROW_IS_MARKED_DEAD (Row[r].shared2.mark)
791 #define ROW_IS_MARKED_DEAD(row_mark) (row_mark < ALIVE)
792 #define ROW_IS_ALIVE(r) (Row [r].shared2.mark >= ALIVE)
793 #define COL_IS_DEAD(c) (Col [c].start < ALIVE)
794 #define COL_IS_ALIVE(c) (Col [c].start >= ALIVE)
795 #define COL_IS_DEAD_PRINCIPAL(c) (Col [c].start == DEAD_PRINCIPAL)
796 #define KILL_ROW(r) { Row [r].shared2.mark = DEAD ; }
797 #define KILL_PRINCIPAL_COL(c) { Col [c].start = DEAD_PRINCIPAL ; }
798 #define KILL_NON_PRINCIPAL_COL(c) { Col [c].start = DEAD_NON_PRINCIPAL ; }
805 #if defined (MATLAB_MEX_FILE) || defined (MATHWORKS)
807 #define INDEX(i) ((i)+1)
814 #define PRINTF(params) { if (amesos_ccolamd_printf != NULL) (void) amesos_ccolamd_printf params ; }
829 #define DEBUG0(params) { PRINTF (params) ; }
830 #define DEBUG1(params) { if (ccolamd_debug >= 1) PRINTF (params) ; }
831 #define DEBUG2(params) { if (ccolamd_debug >= 2) PRINTF (params) ; }
832 #define DEBUG3(params) { if (ccolamd_debug >= 3) PRINTF (params) ; }
833 #define DEBUG4(params) { if (ccolamd_debug >= 4) PRINTF (params) ; }
835 #ifdef MATLAB_MEX_FILE
836 #define ASSERT(expression) (mxAssert ((expression), ""))
838 #define ASSERT(expression) (assert (expression))
897 #define DEBUG0(params) ;
898 #define DEBUG1(params) ;
899 #define DEBUG2(params) ;
900 #define DEBUG3(params) ;
901 #define DEBUG4(params) ;
903 #define ASSERT(expression)
940 Int *p_nnewlyempty_row,
943 Int *p_nnewlyempty_col
966 Int Front_npivcol [ ],
969 Int Front_parent [ ],
1047 static size_t t_add (
size_t a,
size_t b,
int *ok)
1049 (*ok) = (*ok) && ((a + b) >=
MAX (a,b)) ;
1050 return ((*ok) ? (a + b) : 0) ;
1054 static size_t t_mult (
size_t a,
size_t k,
int *ok)
1057 for (i = 0 ; i < k ; i++)
1059 s =
t_add (s, a, ok) ;
1065 #define CCOLAMD_C(n_col,ok) \
1066 ((t_mult (t_add (n_col, 1, ok), sizeof (CColamd_Col), ok) / sizeof (Int)))
1068 #define CCOLAMD_R(n_row,ok) \
1069 ((t_mult (t_add (n_row, 1, ok), sizeof (CColamd_Row), ok) / sizeof (Int)))
1089 s =
t_mult (nnz, 2, ok) ;
1090 t =
t_mult (n_col, 4, ok) ;
1093 s =
t_add (s, n_col, ok) ;
1098 s =
t_add (s, c, ok) ;
1099 s =
t_add (s, r, ok) ;
1101 c =
t_mult (n_col, 3, ok) ;
1102 c =
t_add (c, 1, ok) ;
1103 s =
t_add (s, c, ok) ;
1105 c =
t_add (n_col, 1, ok) ;
1107 s =
t_add (s, c, ok) ;
1109 s =
t_add (s, n_row, ok) ;
1111 return (ok ? s : 0) ;
1125 if (
nnz < 0 || n_row < 0 || n_col < 0)
1132 return (ok ? s : 0) ;
1185 void * (*allocate) (size_t, size_t),
1187 void (*release) (
void *),
1216 ccolamd_get_debug (
"csymamd") ;
1219 both = (stype == 0) ;
1220 upper = (stype > 0) ;
1221 lower = (stype < 0) ;
1227 DEBUG1 ((
"csymamd: stats not present\n")) ;
1241 DEBUG1 ((
"csymamd: A not present\n")) ;
1248 DEBUG1 ((
"csymamd: p not present\n")) ;
1256 DEBUG1 ((
"csymamd: n negative "ID" \n", n)) ;
1265 DEBUG1 ((
"csymamd: number of entries negative "ID" \n", nnz)) ;
1273 DEBUG1 ((
"csymamd: p[0] not zero "ID"\n", p [0])) ;
1282 knobs = default_knobs ;
1287 count = (
Int *) ((*allocate) (n+1,
sizeof (
Int))) ;
1291 DEBUG1 ((
"csymamd: allocate count (size "ID") failed\n", n+1)) ;
1295 mark = (
Int *) ((*allocate) (n+1,
sizeof (
Int))) ;
1299 (*release) ((
void *) count) ;
1300 DEBUG1 ((
"csymamd: allocate mark (size "ID") failed\n", n+1)) ;
1308 for (i = 0 ; i < n ; i++)
1312 for (j = 0 ; j < n ; j++)
1316 length = p [j+1] - p [j] ;
1323 (*release) ((
void *) count) ;
1324 (*release) ((
void *) mark) ;
1325 DEBUG1 ((
"csymamd: col "ID" negative length "ID"\n", j, length)) ;
1329 for (pp = p [j] ; pp < p [j+1] ; pp++)
1332 if (i < 0 || i >= n)
1339 (*release) ((
void *) count) ;
1340 (*release) ((
void *) mark) ;
1341 DEBUG1 ((
"csymamd: row "ID" col "ID" out of bounds\n", i, j)) ;
1345 if (i <= last_row || mark [i] == j)
1353 DEBUG1 ((
"csymamd: row "ID" col "ID" unsorted/dupl.\n", i, j)) ;
1358 if ((both && i != j) || (lower && i > j) || (upper && i < j))
1377 for (j = 1 ; j <= n ; j++)
1379 perm [j] = perm [j-1] + count [j-1] ;
1381 for (j = 0 ; j < n ; j++)
1383 count [j] = perm [j] ;
1391 M = (
Int *) ((*allocate) (Mlen,
sizeof (
Int))) ;
1392 DEBUG1 ((
"csymamd: M is "ID"-by-"ID" with "ID" entries, Mlen = %g\n",
1393 n_row, n, mnz, (
double) Mlen)) ;
1398 (*release) ((
void *) count) ;
1399 (*release) ((
void *) mark) ;
1400 DEBUG1 ((
"csymamd: allocate M (size %g) failed\n", (
double) Mlen)) ;
1409 for (j = 0 ; j < n ; j++)
1411 ASSERT (p [j+1] - p [j] >= 0) ;
1412 for (pp = p [j] ; pp < p [j+1] ; pp++)
1415 ASSERT (i >= 0 && i < n) ;
1416 if ((both && i != j) || (lower && i > j) || (upper && i < j))
1419 M [count [i]++] = k ;
1420 M [count [j]++] = k ;
1429 DEBUG1 ((
"csymamd: Duplicates in A.\n")) ;
1430 for (i = 0 ; i < n ; i++)
1434 for (j = 0 ; j < n ; j++)
1436 ASSERT (p [j+1] - p [j] >= 0) ;
1437 for (pp = p [j] ; pp < p [j+1] ; pp++)
1440 ASSERT (i >= 0 && i < n) ;
1443 if ((both && i != j) || (lower && i > j) || (upper && i<j))
1446 M [count [i]++] = k ;
1447 M [count [j]++] = k ;
1457 (*release) ((
void *) mark) ;
1458 (*release) ((
void *) count) ;
1465 cknobs [i] = knobs [i] ;
1477 (void)
CCOLAMD_2 (n_row, n, (
Int) Mlen, M, perm, cknobs, stats,
1488 (*release) ((
void *) M) ;
1489 DEBUG1 ((
"csymamd: done.\n")) ;
1515 double knobs [CCOLAMD_KNOBS],
1520 return (
CCOLAMD_2 (n_row, n_col, Alen, A, p, knobs, stats,
1548 Int Front_npivcol [ ],
1549 Int Front_nrows [ ],
1550 Int Front_ncols [ ],
1551 Int Front_parent [ ],
1584 Int ndense_row, nempty_row, parent, ndense_col,
1585 nempty_col, k, col, nfr, *Front_child, *Front_sibling, *Front_stack,
1586 *Front_order, *Front_size ;
1587 Int nnewlyempty_col, nnewlyempty_row ;
1598 ccolamd_get_debug (
"ccolamd") ;
1605 DEBUG1 ((
"ccolamd: stats not present\n")) ;
1619 DEBUG1 ((
"ccolamd: A not present\n")) ;
1626 DEBUG1 ((
"ccolamd: p not present\n")) ;
1634 DEBUG1 ((
"ccolamd: nrow negative "ID"\n", n_row)) ;
1642 DEBUG1 ((
"ccolamd: ncol negative "ID"\n", n_col)) ;
1651 DEBUG1 ((
"ccolamd: number of entries negative "ID"\n", nnz)) ;
1659 DEBUG1 ((
"ccolamd: p[0] not zero "ID"\n", p [0])) ;
1668 knobs = default_knobs ;
1690 if (!ok || need > (
size_t) Alen || need >
Int_MAX)
1696 DEBUG1 ((
"ccolamd: Need Alen >= "ID", given "ID"\n", need, Alen)) ;
1701 Alen -= Col_size + Row_size + (3*n_col + 1) + 5*(n_col+1) + n_row ;
1710 if (!Front_npivcol || !Front_nrows || !Front_ncols || !Front_parent ||
1711 !Front_cols || !Front_cols || !InFront)
1713 Front_npivcol = &A [ap] ; ap += (n_col + 1) ;
1714 Front_nrows = &A [ap] ; ap += (n_col + 1) ;
1715 Front_ncols = &A [ap] ; ap += (n_col + 1) ;
1716 Front_parent = &A [ap] ; ap += (n_col + 1) ;
1717 Front_cols = &A [ap] ; ap += (n_col + 1) ;
1718 InFront = &A [ap] ; ap += (n_row) ;
1723 ap += 5*(n_col+1) + n_row ;
1729 cset_start = &A [ap] ;
1733 dead_cols = &A [ap] ;
1742 temp_cstart = (
Int *) Col ;
1743 csize = temp_cstart + (n_col+1) ;
1745 ASSERT (Col_size >= 2*n_col+1) ;
1752 for (i = 0 ; i < n_col ; i++)
1764 else if (cmember == (
Int *)
NULL)
1769 DEBUG1 ((
"no cmember present\n")) ;
1774 for (i = 0 ; i < n_col ; i++)
1776 if (cmember [i] < 0 || cmember [i] > n_col)
1779 DEBUG1 ((
"ccolamd: malformed cmember \n")) ;
1782 n_cset =
MAX (n_cset, cmember [i]) ;
1783 csize [cmember [i]]++ ;
1789 ASSERT ((n_cset >= 0) && (n_cset <= n_col)) ;
1791 cset_start [0] = temp_cstart [0] = 0 ;
1792 for (i = 1 ; i <= n_cset ; i++)
1794 cset_start [i] = cset_start [i-1] + csize [i-1] ;
1795 DEBUG4 ((
" cset_start ["ID"] = "ID" \n", i , cset_start [i])) ;
1796 temp_cstart [i] = cset_start [i] ;
1802 for (i = n_col-1 ; i >= 0 ; i--)
1804 cset [temp_cstart [0]++] = i ;
1809 for (i = n_col-1 ; i >= 0 ; i--)
1811 cset [temp_cstart [cmember [i]]++] = i ;
1822 DEBUG1 ((
"ccolamd: Matrix invalid\n")) ;
1828 for (col = 0 ; col < n_col ; col++)
1830 Front_npivcol [col] = 0 ;
1831 Front_nrows [col] = 0 ;
1832 Front_ncols [col] = 0 ;
1833 Front_parent [col] =
EMPTY ;
1834 Front_cols [col] =
EMPTY ;
1840 &n_row2, &n_col2, &max_deg, cmember, n_cset, cset_start, dead_cols,
1841 &ndense_row, &nempty_row, &nnewlyempty_row,
1842 &ndense_col, &nempty_col, &nnewlyempty_col) ;
1844 ASSERT (n_row2 == n_row - nempty_row - nnewlyempty_row - ndense_row) ;
1845 ASSERT (n_col2 == n_col - nempty_col - nnewlyempty_col - ndense_col) ;
1846 DEBUG1 ((
"# dense rows "ID" cols "ID"\n", ndense_row, ndense_col)) ;
1850 ngarbage =
find_ordering (n_row, n_col, Alen, Row, Col, A, p,
1854 max_deg, 2*nnz, cset, cset_start,
1858 cmember, Front_npivcol, Front_nrows, Front_ncols, Front_parent,
1859 Front_cols, &nfr, aggressive, InFront, order_for_lu) ;
1861 ASSERT (Alen >= 5*n_col) ;
1868 Front_sibling = Front_child + nfr ;
1869 Front_stack = Front_sibling + nfr ;
1870 Front_order = Front_stack + nfr ;
1871 Front_size = Front_order + nfr ;
1874 Front_parent, Front_npivcol) ;
1877 Front_order, Front_child, Front_sibling, Front_stack, Front_cols,
1890 for (i = 0 ; i < nfr ; i++)
1892 parent = Front_parent [i] ;
1893 if (parent !=
EMPTY)
1895 Front_parent [i] = Front_order [parent] ;
1900 for (row = 0 ; row < n_row ; row++)
1906 InFront [row] = Front_order [i] ;
1915 for (i = 0 ; i < n_col ; i++)
1922 for (i = 0 ; i < nfr ; i++)
1924 ASSERT (Front_npivcol [i] > 0) ;
1926 set2 =
CMEMBER (Front_cols [i]) ;
1929 k += dead_cols [set1] ;
1930 DEBUG3 ((
"Skip null/dense columns of set "ID
"\n",set1)) ;
1935 for (col = Front_cols [i] ; col !=
EMPTY ; col = Col [col].
nextcol)
1937 ASSERT (col >= 0 && col < n_col) ;
1938 DEBUG1 ((
"ccolamd output ordering: k "ID
" col "ID
"\n", k, col)) ;
1943 ASSERT (k >= cset_start [cs] && k < cset_start [cs+1]) ;
1954 for (col = 0 ; col < n_col ; col++)
1956 if (A [col] ==
EMPTY)
1963 ASSERT (k >= cset_start [cs] && k < cset_start [cs+1]) ;
1964 DEBUG1 ((
"ccolamd output ordering: k "ID
" col "ID
1965 " (dense or null col)\n", k, col)) ;
1973 for (i = 0 ; i < n_cset ; i++)
1975 ASSERT (dead_cols [i] == 0) ;
1987 ASSERT (ndense_col + nempty_col + nnewlyempty_col == n_col - n_col2) ;
1993 DEBUG1 ((
"ccolamd: done.\n")) ;
2004 Int stats [CCOLAMD_STATS]
2017 Int stats [CCOLAMD_STATS]
2069 for (col = 0 ; col < n_col ; col++)
2071 Col [col].start = p [col] ;
2072 Col [col].length = p [col+1] - p [col] ;
2074 if (Col [col].length < 0)
2080 DEBUG1 ((
"ccolamd: col "ID" length "ID" < 0\n",
2081 col, Col [col].length)) ;
2085 Col [col].shared1.thickness = 1 ;
2086 Col [col].shared2.score = 0 ;
2087 Col [col].shared3.prev =
EMPTY ;
2088 Col [col].shared4.degree_next =
EMPTY ;
2089 Col [col].nextcol =
EMPTY ;
2090 Col [col].lastcol = col ;
2099 for (row = 0 ; row < n_row ; row++)
2101 Row [row].length = 0 ;
2102 Row [row].shared2.mark = -1 ;
2103 Row [row].thickness = 1 ;
2104 Row [row].front =
EMPTY ;
2107 for (col = 0 ; col < n_col ; col++)
2109 DEBUG1 ((
"\nCcolamd input column "ID":\n", col)) ;
2113 cp_end = &A [p [col+1]] ;
2121 if (row < 0 || row >= n_row)
2127 DEBUG1 ((
"row "ID" col "ID" out of bounds\n", row, col)) ;
2131 if (row <= last_row || Row [row].shared2.mark == col)
2139 DEBUG1 ((
"row "ID" col "ID" unsorted/duplicate\n", row, col)) ;
2142 if (Row [row].shared2.mark != col)
2144 Row [row].length++ ;
2150 Col [col].length-- ;
2154 Row [row].shared2.mark = col ;
2164 Row [0].start = p [n_col] ;
2165 Row [0].shared1.p = Row [0].start ;
2166 Row [0].shared2.mark = -1 ;
2167 for (row = 1 ; row < n_row ; row++)
2169 Row [row].start = Row [row-1].start + Row [row-1].length ;
2170 Row [row].shared1.p = Row [row].start ;
2171 Row [row].shared2.mark = -1 ;
2179 for (col = 0 ; col < n_col ; col++)
2182 cp_end = &A [p [col+1]] ;
2186 if (Row [row].shared2.mark != col)
2188 A [(Row [row].shared1.p)++] = col ;
2189 Row [row].shared2.mark = col ;
2197 for (col = 0 ; col < n_col ; col++)
2200 cp_end = &A [p [col+1]] ;
2203 A [(Row [*cp++].shared1.p)++] = col ;
2210 for (row = 0 ; row < n_row ; row++)
2212 Row [row].shared2.mark = 0 ;
2213 Row [row].shared1.degree = Row [row].length ;
2220 DEBUG1 ((
"ccolamd: reconstructing column form, matrix jumbled\n")) ;
2224 for (col = 0 ; col < n_col ; col++)
2226 p [col] = Col [col].length ;
2228 for (row = 0 ; row < n_row ; row++)
2230 rp = &A [Row [row].start] ;
2231 rp_end = rp + Row [row].length ;
2237 for (col = 0 ; col < n_col ; col++)
2251 p [0] = Col [0].start ;
2252 for (col = 1 ; col < n_col ; col++)
2256 Col [col].start = Col [col-1].start + Col [col-1].length ;
2257 p [col] = Col [col].start ;
2262 for (row = 0 ; row < n_row ; row++)
2264 rp = &A [Row [row].start] ;
2265 rp_end = rp + Row [row].length ;
2268 A [(p [*rp++])++] = row ;
2299 double knobs [CCOLAMD_KNOBS],
2309 Int *p_nnewlyempty_row,
2312 Int *p_nnewlyempty_col
2327 Int dense_row_count ;
2328 Int dense_col_count ;
2333 Int nnewlyempty_row ;
2336 Int nnewlyempty_col ;
2349 dense_row_count = n_col-1 ;
2358 dense_col_count = n_row-1 ;
2366 DEBUG1 ((
"densecount: "ID" "ID"\n", dense_row_count, dense_col_count)) ;
2374 for (s = 0 ; s < n_cset ; s++)
2376 head [s] = cset_start [s+1] ;
2381 nnewlyempty_col = 0 ;
2384 nnewlyempty_row = 0 ;
2390 for (c = n_col-1 ; c >= 0 ; c--)
2403 DEBUG1 ((
"ccolamd: null columns killed: "ID
"\n", n_col - n_col2)) ;
2408 for (c = n_col-1 ; c >= 0 ; c--)
2416 if (deg > dense_col_count)
2424 cp = &A [Col [c].
start] ;
2425 cp_end = cp + Col [c].length ;
2433 DEBUG1 ((
"Dense and null columns killed: "ID
"\n", n_col - n_col2)) ;
2441 for (r = 0 ; r < n_row ; r++)
2444 ASSERT (deg >= 0 && deg <= n_col) ;
2445 if (deg > dense_row_count)
2456 if (deg > dense_row_count || deg == 0)
2466 max_deg =
MAX (max_deg, deg) ;
2469 nnewlyempty_row = ne - nempty_row ;
2470 DEBUG1 ((
"ccolamd: Dense and null rows killed: "ID
"\n", n_row - n_row2)) ;
2480 for (c = n_col-1 ; c >= 0 ; c--)
2488 cp = &A [Col [c].
start] ;
2490 cp_end = cp + Col [c].length ;
2505 score =
MIN (score, n_col) ;
2508 col_length = (
Int) (new_cp - &A [Col [c].
start]) ;
2509 if (col_length == 0)
2513 DEBUG1 ((
"Newly null killed: "ID
"\n", c)) ;
2514 Col [c].shared2.order = -- head [
CMEMBER (c)] ;
2524 ASSERT (score <= n_col) ;
2525 Col [c].length = col_length ;
2526 Col [c].shared2.score = score ;
2529 DEBUG1 ((
"ccolamd: Dense, null, and newly-null columns killed: "ID
"\n",
2542 for (c = 0 ; c <= n_col ; c++)
2548 debug_structures (n_row, n_col, Row, Col, A, cmember, cset_start) ;
2553 *p_n_col2 = n_col2 ;
2554 *p_n_row2 = n_row2 ;
2555 *p_max_deg = max_deg ;
2556 *p_ndense_row = ndense_row ;
2557 *p_nempty_row = nempty_row ;
2558 *p_nnewlyempty_row = nnewlyempty_row ;
2559 *p_ndense_col = ndense_col ;
2560 *p_nempty_col = nempty_col ;
2561 *p_nnewlyempty_col = nnewlyempty_col ;
2597 Int Front_npivcol [ ],
2598 Int Front_nrows [ ],
2599 Int Front_ncols [ ],
2600 Int Front_parent [ ],
2617 Int pivot_row_start ;
2618 Int pivot_row_degree ;
2619 Int pivot_row_length ;
2620 Int pivot_col_score ;
2633 Int set_difference ;
2637 Int pivot_col_thickness ;
2649 Int debug_step = 0 ;
2650 Int cols_thickness = 0 ;
2654 Int pivot_row_thickness ;
2661 tag_mark =
clear_mark (0, max_mark, n_row, Row) ;
2666 DEBUG1 ((
"ccolamd: Ordering, n_col2="ID"\n", n_col2)) ;
2668 for (row = 0 ; row < n_row ; row++)
2670 InFront [row] =
EMPTY ;
2675 for (k = 0 ; k < n_col ; )
2679 ASSERT (min_score >= 0) ;
2680 ASSERT (min_score <= n_col) ;
2684 for (debug_d = 0 ; debug_d < min_score ; debug_d++)
2692 while ((k+deadcol) == cset_start [current_set+1])
2695 DEBUG1 ((
"\n\n\n============ CSET: "ID"\n", current_set)) ;
2699 ASSERT ((current_set == n_cset) == (k == n_col)) ;
2709 for (col = 0 ; col <= n_col ; col++)
2716 colstart = cset_start [current_set] ;
2717 colend = cset_start [current_set+1] ;
2719 while (colstart < colend)
2721 col = cset [colstart++] ;
2725 DEBUG1 ((
"Column "ID" is dead\n", col)) ;
2727 if (Col [col].shared2.order !=
EMPTY)
2737 score = Col [col].shared2.score ;
2738 DEBUG1 ((
"Column "ID" is alive, score "ID"\n", col, score)) ;
2740 ASSERT (min_score >= 0) ;
2741 ASSERT (min_score <= n_col) ;
2743 ASSERT (score <= n_col) ;
2747 next_col = head [score] ;
2748 Col [col].shared3.prev =
EMPTY ;
2749 Col [col].shared4.degree_next = next_col ;
2753 if (next_col !=
EMPTY)
2755 Col [next_col].shared3.prev = col ;
2757 head [score] = col ;
2760 min_score =
MIN (min_score, score) ;
2764 DEBUG1 ((
"degree lists initialized \n")) ;
2765 debug_deg_lists (n_row, n_col, Row, Col, head, min_score,
2766 ((cset_start [current_set+1]-cset_start [current_set])-deadcol),
2772 if (debug_step % 100 == 0)
2774 DEBUG2 ((
"\n... Step k: "ID" out of n_col2: "ID"\n", k, n_col2)) ;
2778 DEBUG3 ((
"\n------Step k: "ID" out of n_col2: "ID"\n", k, n_col2)) ;
2781 DEBUG1 ((
"start of step k="ID": ", k)) ;
2782 debug_deg_lists (n_row, n_col, Row, Col, head,
2783 min_score, cset_start [current_set+1]-(k+deadcol), max_deg) ;
2784 debug_matrix (n_row, n_col, Row, Col, A) ;
2789 while (head [min_score] ==
EMPTY && min_score < n_col)
2794 pivot_col = head [min_score] ;
2796 ASSERT (pivot_col >= 0 && pivot_col <= n_col) ;
2797 next_col = Col [pivot_col].shared4.degree_next ;
2798 head [min_score] = next_col ;
2799 if (next_col !=
EMPTY)
2801 Col [next_col].shared3.prev =
EMPTY ;
2807 pivot_col_score = Col [pivot_col].shared2.score ;
2810 Col [pivot_col].shared2.order = k ;
2813 pivot_col_thickness = Col [pivot_col].shared1.thickness ;
2814 k += pivot_col_thickness ;
2815 ASSERT (pivot_col_thickness > 0) ;
2816 DEBUG3 ((
"Pivot col: "ID" thick "ID"\n", pivot_col,
2817 pivot_col_thickness)) ;
2821 needed_memory =
MIN (pivot_col_score, n_col - k) ;
2822 if (pfree + needed_memory >= Alen)
2827 ASSERT (pfree + needed_memory < Alen) ;
2829 tag_mark =
clear_mark (0, max_mark, n_row, Row) ;
2832 debug_matrix (n_row, n_col, Row, Col, A) ;
2839 pivot_row_start = pfree ;
2842 pivot_row_degree = 0 ;
2843 pivot_row_thickness = 0 ;
2847 Col [pivot_col].shared1.thickness = -pivot_col_thickness ;
2850 cp = &A [Col [pivot_col].start] ;
2851 cp_end = cp + Col [pivot_col].length ;
2856 ASSERT (row >= 0 && row < n_row) ;
2862 pivot_row_thickness += Row [row].thickness ;
2864 rp = &A [Row [row].start] ;
2865 rp_end = rp + Row [row].length ;
2871 col_thickness = Col [col].shared1.thickness ;
2875 Col [col].shared1.thickness = -col_thickness ;
2879 pivot_row_degree += col_thickness ;
2880 DEBUG4 ((
"\t\t\tNew live col in pivrow: "ID
"\n",col)) ;
2885 DEBUG4 ((
"\t\t\tOld live col in pivrow: "ID
"\n",col)) ;
2896 Col [pivot_col].shared1.thickness = pivot_col_thickness ;
2897 max_deg =
MAX (max_deg, pivot_row_degree) ;
2901 debug_mark (n_row, Row, tag_mark, max_mark) ;
2907 cp = &A [Col [pivot_col].start] ;
2908 cp_end = cp + Col [pivot_col].length ;
2913 DEBUG3 ((
"Kill row in pivot col: "ID
"\n", row)) ;
2914 ASSERT (row >= 0 && row < n_row) ;
2917 if (Row [row].front !=
EMPTY)
2921 child = Row [row].front ;
2922 Front_parent [child] = nfr ;
2923 DEBUG1 ((
"Front "ID
" => front "ID
", normal\n", child, nfr));
2929 InFront [row] = nfr ;
2930 DEBUG1 ((
"Row "ID
" => front "ID
", normal\n", row, nfr)) ;
2935 Row [row].thickness = 0 ;
2940 pivot_row_length = pfree - pivot_row_start ;
2941 if (pivot_row_length > 0)
2944 pivot_row = A [Col [pivot_col].start] ;
2945 DEBUG3 ((
"Pivotal row is "ID
"\n", pivot_row)) ;
2951 ASSERT (pivot_row_length == 0) ;
2953 ASSERT (Col [pivot_col].length > 0 || pivot_row_length == 0) ;
2976 DEBUG3 ((
"** Computing set differences phase. **\n")) ;
2980 DEBUG3 ((
"Pivot row: ")) ;
2982 rp = &A [pivot_row_start] ;
2983 rp_end = rp + pivot_row_length ;
2988 DEBUG3 ((
"Col: "ID
"\n", col)) ;
2991 col_thickness = -Col [col].shared1.thickness ;
2992 ASSERT (col_thickness > 0) ;
2993 Col [col].shared1.thickness = col_thickness ;
2998 if (
CMEMBER (col) == current_set)
3001 cols_thickness += col_thickness ;
3003 cur_score = Col [col].shared2.score ;
3004 prev_col = Col [col].shared3.prev ;
3005 next_col = Col [col].shared4.degree_next ;
3006 DEBUG3 ((
" cur_score "ID
" prev_col "ID
" next_col "ID
"\n",
3007 cur_score, prev_col, next_col)) ;
3008 ASSERT (cur_score >= 0) ;
3009 ASSERT (cur_score <= n_col) ;
3011 if (prev_col ==
EMPTY)
3013 head [cur_score] = next_col ;
3017 Col [prev_col].shared4.degree_next = next_col ;
3019 if (next_col !=
EMPTY)
3021 Col [next_col].shared3.prev = prev_col ;
3027 cp = &A [Col [col].start] ;
3028 cp_end = cp + Col [col].length ;
3033 row_mark = Row [row].shared2.mark ;
3039 ASSERT (row != pivot_row) ;
3040 set_difference = row_mark - tag_mark ;
3042 if (set_difference < 0)
3044 ASSERT (Row [row].shared1.degree <= max_deg) ;
3045 set_difference = Row [row].shared1.degree ;
3048 set_difference -= col_thickness ;
3049 ASSERT (set_difference >= 0) ;
3051 if (set_difference == 0 && aggressive)
3053 DEBUG3 ((
"aggressive absorption. Row: "ID
"\n", row)) ;
3055 if (Row [row].front !=
EMPTY)
3058 child = Row [row].front ;
3059 Front_parent [child] = nfr ;
3060 DEBUG1 ((
"Front "ID
" => front "ID
", aggressive\n",
3067 InFront [row] = nfr ;
3068 DEBUG1 ((
"Row "ID
" => front "ID
", aggressive\n",
3075 pivot_row_thickness += Row [row].thickness ;
3076 Row [row].thickness = 0 ;
3081 Row [row].shared2.mark = set_difference + tag_mark ;
3087 debug_deg_lists (n_row, n_col, Row, Col, head, min_score,
3088 cset_start [current_set+1]-(k+deadcol)-(cols_thickness),
3090 cols_thickness = 0 ;
3095 DEBUG3 ((
"** Adding set differences phase. **\n")) ;
3098 rp = &A [pivot_row_start] ;
3099 rp_end = rp + pivot_row_length ;
3107 cp = &A [Col [col].start] ;
3110 cp_end = cp + Col [col].length ;
3112 DEBUG4 ((
"Adding set diffs for Col: "ID
".\n", col)) ;
3118 ASSERT (row >= 0 && row < n_row) ;
3119 row_mark = Row [row].shared2.mark ;
3123 DEBUG4 ((
" Row "ID
", dead\n", row)) ;
3126 DEBUG4 ((
" Row "ID
", set diff "ID
"\n", row, row_mark-tag_mark));
3127 ASSERT (row_mark >= tag_mark) ;
3133 cur_score += row_mark - tag_mark ;
3135 cur_score =
MIN (cur_score, n_col) ;
3139 Col [col].length = (
Int) (new_cp - &A [Col [col].
start]) ;
3143 if (Col [col].length == 0 &&
CMEMBER (col) == current_set)
3145 DEBUG4 ((
"further mass elimination. Col: "ID
"\n", col)) ;
3148 pivot_row_degree -= Col [col].shared1.thickness ;
3149 ASSERT (pivot_row_degree >= 0) ;
3151 Col [col].shared2.order = k ;
3153 k += Col [col].shared1.thickness ;
3154 pivot_col_thickness += Col [col].shared1.thickness ;
3160 Col [Col [col].lastcol].nextcol = Front_cols [nfr] ;
3161 Front_cols [nfr] = col ;
3167 DEBUG4 ((
"Preparing supercol detection for Col: "ID
".\n", col));
3170 Col [col].shared2.score = cur_score ;
3175 DEBUG4 ((
" Hash = "ID
", n_col = "ID
".\n", hash, n_col)) ;
3178 head_column = head [hash] ;
3179 if (head_column >
EMPTY)
3183 first_col = Col [head_column].shared3.headhash ;
3184 Col [head_column].shared3.headhash = col ;
3189 first_col = - (head_column + 2) ;
3190 head [hash] = - (col + 2) ;
3192 Col [col].shared4.hash_next = first_col ;
3195 Col [col].shared3.hash = (
Int) hash ;
3204 DEBUG3 ((
"** Supercolumn detection phase. **\n")) ;
3210 Col, A, head, pivot_row_start, pivot_row_length, cmember) ;
3214 DEBUG1 ((
" KILLING column detect supercols "ID
" \n", pivot_col)) ;
3222 Col [Col [pivot_col].lastcol].nextcol = Front_cols [nfr] ;
3223 Front_cols [nfr] = pivot_col ;
3227 tag_mark =
clear_mark (tag_mark+max_deg+1, max_mark, n_row, Row) ;
3231 debug_mark (n_row, Row, tag_mark, max_mark) ;
3236 DEBUG3 ((
"** Finalize scores phase. **\n")) ;
3239 rp = &A [pivot_row_start] ;
3242 rp_end = rp + pivot_row_length ;
3253 A [Col [col].start + (Col [col].length++)] = pivot_row ;
3258 cur_score = Col [col].shared2.score + pivot_row_degree ;
3263 max_score = n_col - k - Col [col].shared1.thickness ;
3266 cur_score -= Col [col].shared1.thickness ;
3269 cur_score =
MIN (cur_score, max_score) ;
3270 ASSERT (cur_score >= 0) ;
3273 Col [col].shared2.score = cur_score ;
3277 if (
CMEMBER (col) == current_set)
3279 ASSERT (min_score >= 0) ;
3280 ASSERT (min_score <= n_col) ;
3281 ASSERT (cur_score >= 0) ;
3282 ASSERT (cur_score <= n_col) ;
3284 next_col = head [cur_score] ;
3285 Col [col].shared4.degree_next = next_col ;
3286 Col [col].shared3.prev =
EMPTY ;
3287 if (next_col !=
EMPTY)
3289 Col [next_col].shared3.prev = col ;
3291 head [cur_score] = col ;
3293 min_score =
MIN (min_score, cur_score) ;
3297 Col [col].shared4.degree_next =
EMPTY ;
3298 Col [col].shared3.prev =
EMPTY ;
3303 debug_deg_lists (n_row, n_col, Row, Col, head,
3304 min_score, cset_start [current_set+1]-(k+deadcol), max_deg) ;
3311 Front_npivcol [nfr] = pivot_col_thickness ;
3314 Front_nrows [nfr] = pivot_row_thickness ;
3317 Front_ncols [nfr] = pivot_col_thickness + pivot_row_degree ;
3319 Front_parent [nfr] =
EMPTY ;
3321 pivot_row_thickness -= pivot_col_thickness ;
3322 DEBUG1 ((
"Front "ID
" Pivot_row_thickness after pivot cols elim: "ID
"\n",
3323 nfr, pivot_row_thickness)) ;
3324 pivot_row_thickness =
MAX (0, pivot_row_thickness) ;
3328 if ((pivot_row_degree > 0 && pivot_row_thickness > 0 && (order_for_lu))
3329 || (pivot_row_degree > 0 && (!order_for_lu)))
3333 Row [pivot_row].start = pivot_row_start ;
3334 Row [pivot_row].length = (
Int) (new_rp - &A[pivot_row_start]) ;
3335 Row [pivot_row].shared1.degree = pivot_row_degree ;
3336 Row [pivot_row].shared2.mark = 0 ;
3337 Row [pivot_row].thickness = pivot_row_thickness ;
3338 Row [pivot_row].front = nfr ;
3340 DEBUG1 ((
"Resurrect Pivot_row "ID
" deg: "ID
"\n",
3341 pivot_row, pivot_row_degree)) ;
3345 DEBUG1 ((
"Front "ID
" : "ID
" "ID
" "ID
" ", nfr,
3346 Front_npivcol [nfr], Front_nrows [nfr], Front_ncols [nfr])) ;
3349 for (col = Front_cols [nfr] ; col !=
EMPTY ; col = Col [col].nextcol)
3352 ASSERT (col >= 0 && col < n_col) ;
3355 ASSERT (debug_d <= pivot_col_thickness) ;
3357 ASSERT (debug_d == pivot_col_thickness) ;
3439 rp = &A [row_start] ;
3440 rp_end = rp + row_length ;
3450 hash = Col [col].shared3.hash ;
3455 head_column = head [hash] ;
3456 if (head_column >
EMPTY)
3458 first_col = Col [head_column].shared3.headhash ;
3462 first_col = - (head_column + 2) ;
3467 for (super_c = first_col ; super_c !=
EMPTY ;
3468 super_c = Col [super_c].shared4.hash_next)
3471 ASSERT (Col [super_c].shared3.hash == hash) ;
3472 length = Col [super_c].length ;
3479 for (c = Col [super_c].shared4.hash_next ;
3480 c !=
EMPTY ; c = Col [c].shared4.hash_next)
3484 ASSERT (Col [c].shared3.hash == hash) ;
3488 if (Col [c].length != length ||
3489 Col [c].shared2.score != Col [super_c].shared2.score
3497 cp1 = &A [Col [super_c].start] ;
3498 cp2 = &A [Col [c].start] ;
3500 for (i = 0 ; i < length ; i++)
3507 if (*cp1++ != *cp2++)
3523 ASSERT (Col [c].shared2.score == Col [super_c].shared2.score) ;
3525 Col [super_c].shared1.thickness += Col [c].shared1.thickness ;
3526 Col [c].shared1.parent = super_c ;
3529 Col [c].shared2.order =
EMPTY ;
3531 Col [prev_c].shared4.hash_next = Col [c].shared4.hash_next ;
3534 ASSERT (Col [super_c].lastcol >= 0) ;
3535 ASSERT (Col [super_c].lastcol < n_col) ;
3536 Col [Col [super_c].lastcol].nextcol = c ;
3537 Col [super_c].lastcol = Col [c].lastcol ;
3548 if (head_column >
EMPTY)
3551 Col [head_column].shared3.headhash =
EMPTY ;
3556 head [hash] =
EMPTY ;
3598 DEBUG2 ((
"Defrag..\n")) ;
3599 for (psrc = &A[0] ; psrc < pfree ; psrc++) ASSERT (*psrc >= 0) ;
3606 for (c = 0 ; c < n_col ; c++)
3610 psrc = &A [Col [c].start] ;
3614 Col [c].start = (
Int) (pdest - &A [0]) ;
3615 length = Col [c].length ;
3616 for (j = 0 ; j < length ; j++)
3624 Col [c].length = (
Int) (pdest - &A [Col [c].
start]) ;
3630 for (r = 0 ; r < n_row ; r++)
3643 psrc = &A [Row [r].start] ;
3644 Row [r].shared2.first_column = *psrc ;
3657 while (psrc < pfree)
3665 ASSERT (r >= 0 && r < n_row) ;
3667 *psrc = Row [r].shared2.first_column ;
3672 Row [r].start = (
Int) (pdest - &A [0]) ;
3673 length = Row [r].length ;
3674 for (j = 0 ; j < length ; j++)
3682 Row [r].length = (
Int) (pdest - &A [Row [r].
start]) ;
3690 ASSERT (debug_rows == 0) ;
3694 return ((
Int) (pdest - &A [0])) ;
3722 if (tag_mark <= 0 || tag_mark >= max_mark)
3724 for (r = 0 ; r < n_row ; r++)
3728 Row [r].shared2.mark = 0 ;
3747 Int stats [CCOLAMD_STATS]
3753 PRINTF ((
"\n%s version %d.%d, %s: ", method,
3758 PRINTF ((
"No statistics available.\n")) ;
3780 PRINTF((
"Matrix has unsorted or duplicate row indices.\n")) ;
3782 PRINTF((
"%s: duplicate or out-of-order row indices: "ID"\n",
3785 PRINTF((
"%s: last seen duplicate or out-of-order row: "ID"\n",
3786 method,
INDEX (i2))) ;
3788 PRINTF((
"%s: last seen in column: "ID"",
3789 method,
INDEX (i1))) ;
3797 PRINTF((
"%s: number of dense or empty rows ignored: "ID"\n",
3800 PRINTF((
"%s: number of dense or empty columns ignored: "ID"\n",
3803 PRINTF((
"%s: number of garbage collections performed: "ID"\n",
3809 PRINTF((
"Array A (row indices of matrix) not present.\n")) ;
3814 PRINTF((
"Array p (column pointers for matrix) not present.\n")) ;
3819 PRINTF((
"Invalid number of rows ("ID").\n", i1)) ;
3824 PRINTF((
"Invalid number of columns ("ID").\n", i1)) ;
3829 PRINTF((
"Invalid number of nonzero entries ("ID").\n", i1)) ;
3834 PRINTF((
"Invalid column pointer, p [0] = "ID", must be 0.\n", i1)) ;
3839 PRINTF((
"Array A too small.\n")) ;
3840 PRINTF((
" Need Alen >= "ID", but given only Alen = "ID".\n",
3846 PRINTF((
"Column "ID
" has a negative number of entries ("ID
").\n",
3852 PRINTF((
"Row index (row "ID
") out of bounds ("ID
" to "ID
") in"
3859 PRINTF((
"Out of memory.\n")) ;
3864 PRINTF((
"cmember invalid\n")) ;
3891 const Int Order [ ],
3900 for (i = 0 ; i < nn ; i++)
3906 Temp [k] = Front [i] ;
3910 for (k = 0 ; k < nfr ; k++)
3912 Front [k] = Temp [k] ;
3936 Int j, parent, frsize, r, c ;
3938 for (j = 0 ; j < nn ; j++)
3947 DEBUG1 ((
"\n\n========================================FRONTS:\n")) ;
3948 for (j = 0 ; j < nn ; j++)
3953 parent = Parent [j] ;
3961 j, Npiv [j], frsize, parent)) ;
3962 Fsize [j] =
MAX (Fsize [j], frsize) ;
3963 DEBUG1 ((
"Fsize [j = "ID
"] = "ID
"\n", j, Fsize [j])) ;
3964 if (parent !=
EMPTY)
3967 ASSERT (Npiv [parent] > 0) ;
3969 Fsize [parent] =
MAX (Fsize [parent], Fsize [j]) ;
3970 DEBUG1 ((
"Fsize [parent = "ID
"] = "ID
"\n",
3971 parent, Fsize [parent]));
3975 DEBUG1 ((
"fsize done\n")) ;
4007 Int i, j, k, parent, frsize,
f, fprev, maxfrsize, bigfprev, bigf, fnext ;
4009 for (j = 0 ; j < nn ; j++)
4012 Sibling [j] =
EMPTY ;
4019 for (j = nn-1 ; j >= 0 ; j--)
4024 parent = Parent [j] ;
4025 if (parent !=
EMPTY)
4029 Sibling [j] = Child [parent] ;
4032 Child [parent] = j ;
4040 Int nels, ff, nchild ;
4041 DEBUG1 ((
"\n\n================================ ccolamd_postorder:\n"));
4043 for (j = 0 ; j < nn ; j++)
4048 " parent "ID" maxfr "ID"\n", j, nels,
4049 Nv [j], Fsize [j], Parent [j], Fsize [j])) ;
4053 DEBUG1 ((
" Children: ")) ;
4054 for (ff = Child [j] ; ff !=
EMPTY ; ff = Sibling [ff])
4061 parent = Parent [j] ;
4072 for (i = 0 ; i < nn ; i++)
4074 if (Nv [i] > 0 && Child [i] !=
EMPTY)
4079 DEBUG1 ((
"Before partial sort, element "ID"\n", i)) ;
4081 for (f = Child [i] ; f !=
EMPTY ; f = Sibling [f])
4083 DEBUG1 ((
" f: "ID" size: "ID"\n", f, Fsize [f])) ;
4093 for (f = Child [i] ; f !=
EMPTY ; f = Sibling [f])
4095 frsize = Fsize [f] ;
4096 if (frsize >= maxfrsize)
4099 maxfrsize = frsize ;
4106 fnext = Sibling [bigf] ;
4109 " fprev " ID"\n", bigf, maxfrsize, bigfprev, fnext, fprev)) ;
4115 if (bigfprev ==
EMPTY)
4123 Sibling [bigfprev] = fnext ;
4127 Sibling [bigf] =
EMPTY ;
4128 Sibling [fprev] = bigf ;
4132 DEBUG1 ((
"After partial sort, element "ID
"\n", i)) ;
4133 for (f = Child [i] ; f !=
EMPTY ; f = Sibling [f])
4135 DEBUG1 ((
" "ID
" "ID
"\n", f, Fsize [f])) ;
4146 for (i = 0 ; i < nn ; i++)
4153 for (i = 0 ; i < nn ; i++)
4155 if ((Parent [i] ==
EMPTY
4156 || (
CMEMBER (Front_cols [Parent [i]]) !=
CMEMBER (Front_cols [i])))
4159 DEBUG1 ((
"Root of assembly tree "ID"\n", i)) ;
4180 const Int Sibling [ ],
4200 for (f = Child [i] ; f !=
EMPTY ; f = Sibling [f])
4220 DEBUG1 ((
"head of stack "ID" \n", i)) ;
4222 if (Child [i] !=
EMPTY)
4228 for (f = Child [i] ; f !=
EMPTY ; f = Sibling [f])
4233 for (f = Child [i] ; f !=
EMPTY ; f = Sibling [f])
4237 DEBUG1 ((
"push "ID" on stack\n", f)) ;
4239 ASSERT (Stack [h] == i) ;
4255 for (h = head ; h >= 0 ; h--)
4318 for (c = 0 ; c < n_col ; c++)
4324 DEBUG4 ((
"initial live col %5d %5d %5d\n", c, len, score)) ;
4328 cp = &A [Col [c].
start] ;
4338 i = Col [c].shared2.order ;
4340 ASSERT (i >= cset_start [cs] && i < cset_start [cs+1]) ;
4344 for (r = 0 ; r < n_row ; r++)
4353 rp = &A [Row [r].
start] ;
4403 if (n_col > 10000 && ccolamd_debug <= 0)
4408 DEBUG4 ((
"Degree lists: "ID"\n", min_score)) ;
4409 for (deg = 0 ; deg <= n_col ; deg++)
4418 while (col !=
EMPTY)
4427 DEBUG4 ((
"should "ID" have "ID"\n", should, have)) ;
4428 ASSERT (should == have) ;
4432 if (n_row > 10000 && ccolamd_debug <= 0)
4436 for (row = 0 ; row < n_row ; row++)
4471 ASSERT (tag_mark > 0 && tag_mark <= max_mark) ;
4472 if (n_row > 10000 && ccolamd_debug <= 0)
4476 for (r = 0 ; r < n_row ; r++)
4511 if (ccolamd_debug < 3)
4515 DEBUG3 ((
"DUMP MATRIX:\n")) ;
4516 for (r = 0 ; r < n_row ; r++)
4524 DEBUG3 ((
"start "ID
" length "ID
" degree "ID
"\nthickness "ID
"\n",
4525 Row [r].
start, Row [r].length, Row [r].shared1.
degree,
4528 rp = &A [Row [r].
start] ;
4529 rp_end = rp + Row [r].length ;
4537 for (c = 0 ; c < n_col ; c++)
4544 DEBUG3 ((
"start "ID
" length "ID
" shared1 "ID
" shared2 "ID
"\n",
4545 Col [c].
start, Col [c].length,
4547 cp = &A [Col [c].
start] ;
4548 cp_end = cp + Col [c].length ;
4573 for (col = super_c ; col !=
EMPTY ; col = Col [col].
nextcol)
4576 ASSERT (col >= 0 && col < n_col) ;
4581 if (Col [col].nextcol ==
EMPTY)
4583 ASSERT (col == Col [super_c].lastcol) ;
4597 PRIVATE void ccolamd_get_debug
4606 debug_file = fopen (
"debug",
"r") ;
4609 (void) fscanf (debug_file,
""ID
"", &ccolamd_debug) ;
4610 (void) fclose (debug_file) ;
4614 DEBUG1 ((
"%s: debug version, D = "ID
" (THIS WILL BE SLOW!)\n",
4615 method, ccolamd_debug)) ;
4616 DEBUG1 ((
" Debug printing level: "ID
"\n", ccolamd_debug)) ;
static size_t ccolamd_need(Int nnz, Int n_row, Int n_col, int *ok)
union CColamd_Col_struct::@0 shared1
#define CCOLAMD_recommended
#define CCOLAMD_apply_order
#define CCOLAMD_ERROR_ncol_negative
UF_long CHOLMOD() nnz(cholmod_sparse *A, cholmod_common *Common)
#define CCOLAMD_ERROR_p_not_present
PRIVATE Int garbage_collection(Int n_row, Int n_col, CColamd_Row Row[], CColamd_Col Col[], Int A[], Int *pfree)
#define CCOLAMD_DEFRAG_COUNT
#define CCOLAMD_NEWLY_EMPTY_ROW
#define CCOLAMD_OK_BUT_JUMBLED
#define CCOLAMD_AGGRESSIVE
PRIVATE Int clear_mark(Int tag_mark, Int max_mark, Int n_row, CColamd_Row Row[])
#define CCOLAMD_ERROR_nnz_negative
union CColamd_Row_struct::@5 shared2
static size_t t_add(size_t a, size_t b, int *ok)
static size_t t_mult(size_t a, size_t k, int *ok)
PRIVATE void init_scoring(Int n_row, Int n_col, CColamd_Row Row[], CColamd_Col Col[], Int A[], Int head[], double knobs[CCOLAMD_KNOBS], Int *p_n_row2, Int *p_n_col2, Int *p_max_deg, Int cmember[], Int n_cset, Int cset_start[], Int dead_cols[], Int *p_ndense_row, Int *p_nempty_row, Int *p_nnewlyempty_row, Int *p_ndense_col, Int *p_nempty_col, Int *p_nnewlyempty_col)
#define KILL_NON_PRINCIPAL_COL(c)
#define CCOLAMD_ERROR_invalid_cmember
#define CCOLAMD_ERROR_nrow_negative
#define ONES_COMPLEMENT(r)
#define CCOLAMD_NEWLY_EMPTY_COL
union CColamd_Col_struct::@3 shared4
#define CCOLAMD_EMPTY_COL
#define CCOLAMD_postorder
PRIVATE Int init_rows_cols(Int n_row, Int n_col, CColamd_Row Row[], CColamd_Col Col[], Int A[], Int p[], Int stats[CCOLAMD_STATS])
union CColamd_Col_struct::@1 shared2
#define CCOLAMD_ERROR_A_not_present
#define CCOLAMD_ERROR_col_length_negative
#define CCOLAMD_MAIN_VERSION
#define CCOLAMD_post_tree
#define DENSE_DEGREE(alpha, n)
int CHOLMOD() start(cholmod_common *Common)
#define CCOLAMD_R(n_row, ok)
#define CCOLAMD_DENSE_ROW
PRIVATE void detect_super_cols(CColamd_Col Col[], Int A[], Int head[], Int row_start, Int row_length, Int in_set[])
PRIVATE Int find_ordering(Int n_row, Int n_col, Int Alen, CColamd_Row Row[], CColamd_Col Col[], Int A[], Int head[], Int max_deg, Int pfree, Int cset[], Int cset_start[], Int cmember[], Int Front_npivcol[], Int Front_nrows[], Int Front_ncols[], Int Front_parent[], Int Front_cols[], Int *p_nfr, Int aggressive, Int InFront[], Int order_for_lu)
#define CCOLAMD_set_defaults
void CHOLMOD() dump_super(UF_long s, Int *Super, Int *Lpi, Int *Ls, Int *Lpx, double *Lx, int xentry, cholmod_common *Common)
#define CCOLAMD_SUB_VERSION
#define KILL_PRINCIPAL_COL(c)
union CColamd_Col_struct::@2 shared3
#define CCOLAMD_C(n_col, ok)
struct CColamd_Col_struct CColamd_Col
#define ROW_IS_MARKED_DEAD(row_mark)
struct CColamd_Row_struct CColamd_Row
#define ASSERT(expression)
#define CCOLAMD_ERROR_row_index_out_of_bounds
union CColamd_Row_struct::@4 shared1
#define CCOLAMD_ERROR_p0_nonzero
#define CCOLAMD_ERROR_A_too_small
#define CCOLAMD_ERROR_out_of_memory
PRIVATE void print_report(char *method, Int stats[CCOLAMD_STATS])
#define CCOLAMD_DENSE_COL