627 #ifdef MATLAB_MEX_FILE
632 #if !defined (NPRINT) || !defined (NDEBUG)
637 #define NULL ((void *) 0)
650 #define ID UF_long_id
651 #define Int_MAX UF_long_max
653 #define CCOLAMD_recommended amesos_ccolamd_l_recommended
654 #define CCOLAMD_set_defaults amesos_ccolamd_l_set_defaults
655 #define CCOLAMD_2 amesos_ccolamd2_l
656 #define CCOLAMD_MAIN amesos_ccolamd_l
657 #define CCOLAMD_apply_order amesos_ccolamd_l_apply_order
658 #define CCOLAMD_postorder amesos_ccolamd_l_postorder
659 #define CCOLAMD_post_tree amesos_ccolamd_l_post_tree
660 #define CCOLAMD_fsize amesos_ccolamd_l_fsize
661 #define CSYMAMD_MAIN amesos_csymamd_l
662 #define CCOLAMD_report amesos_ccolamd_l_report
663 #define CSYMAMD_report amesos_csymamd_l_report
669 #define Int_MAX INT_MAX
671 #define CCOLAMD_recommended amesos_ccolamd_recommended
672 #define CCOLAMD_set_defaults amesos_ccolamd_set_defaults
673 #define CCOLAMD_2 amesos_ccolamd2
674 #define CCOLAMD_MAIN amesos_ccolamd
675 #define CCOLAMD_apply_order amesos_ccolamd_apply_order
676 #define CCOLAMD_postorder amesos_ccolamd_postorder
677 #define CCOLAMD_post_tree amesos_ccolamd_post_tree
678 #define CCOLAMD_fsize amesos_ccolamd_fsize
679 #define CSYMAMD_MAIN amesos_csymamd
680 #define CCOLAMD_report amesos_ccolamd_report
681 #define CSYMAMD_report amesos_csymamd_report
758 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
759 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
764 #define PRIVATE static
766 #define DENSE_DEGREE(alpha,n) \
767 ((Int) MAX (16.0, (alpha) * sqrt ((double) (n))))
769 #define CMEMBER(c) ((cmember == (Int *) NULL) ? (0) : (cmember [c]))
772 #define SCALAR_IS_NAN(x) ((x) != (x))
775 #define INT_OVERFLOW(x) ((!((x) * (1.0+1e-8) <= (double) Int_MAX)) \
776 || SCALAR_IS_NAN (x))
778 #define ONES_COMPLEMENT(r) (-(r)-1)
789 #define DEAD_PRINCIPAL (-1)
790 #define DEAD_NON_PRINCIPAL (-2)
793 #define ROW_IS_DEAD(r) ROW_IS_MARKED_DEAD (Row[r].shared2.mark)
794 #define ROW_IS_MARKED_DEAD(row_mark) (row_mark < ALIVE)
795 #define ROW_IS_ALIVE(r) (Row [r].shared2.mark >= ALIVE)
796 #define COL_IS_DEAD(c) (Col [c].start < ALIVE)
797 #define COL_IS_ALIVE(c) (Col [c].start >= ALIVE)
798 #define COL_IS_DEAD_PRINCIPAL(c) (Col [c].start == DEAD_PRINCIPAL)
799 #define KILL_ROW(r) { Row [r].shared2.mark = DEAD ; }
800 #define KILL_PRINCIPAL_COL(c) { Col [c].start = DEAD_PRINCIPAL ; }
801 #define KILL_NON_PRINCIPAL_COL(c) { Col [c].start = DEAD_NON_PRINCIPAL ; }
808 #if defined (MATLAB_MEX_FILE) || defined (MATHWORKS)
810 #define INDEX(i) ((i)+1)
817 #define PRINTF(params) { if (amesos_ccolamd_printf != NULL) (void) amesos_ccolamd_printf params ; }
832 #define DEBUG0(params) { PRINTF (params) ; }
833 #define DEBUG1(params) { if (ccolamd_debug >= 1) PRINTF (params) ; }
834 #define DEBUG2(params) { if (ccolamd_debug >= 2) PRINTF (params) ; }
835 #define DEBUG3(params) { if (ccolamd_debug >= 3) PRINTF (params) ; }
836 #define DEBUG4(params) { if (ccolamd_debug >= 4) PRINTF (params) ; }
838 #ifdef MATLAB_MEX_FILE
839 #define ASSERT(expression) (mxAssert ((expression), ""))
841 #define ASSERT(expression) (assert (expression))
900 #define DEBUG0(params) ;
901 #define DEBUG1(params) ;
902 #define DEBUG2(params) ;
903 #define DEBUG3(params) ;
904 #define DEBUG4(params) ;
906 #define ASSERT(expression)
943 Int *p_nnewlyempty_row,
946 Int *p_nnewlyempty_col
969 Int Front_npivcol [ ],
972 Int Front_parent [ ],
1050 static size_t t_add (
size_t a,
size_t b,
int *ok)
1052 (*ok) = (*ok) && ((a + b) >=
MAX (a,b)) ;
1053 return ((*ok) ? (a + b) : 0) ;
1057 static size_t t_mult (
size_t a,
size_t k,
int *ok)
1060 for (i = 0 ; i < k ; i++)
1062 s =
t_add (s, a, ok) ;
1068 #define CCOLAMD_C(n_col,ok) \
1069 ((t_mult (t_add (n_col, 1, ok), sizeof (CColamd_Col), ok) / sizeof (Int)))
1071 #define CCOLAMD_R(n_row,ok) \
1072 ((t_mult (t_add (n_row, 1, ok), sizeof (CColamd_Row), ok) / sizeof (Int)))
1092 s =
t_mult (nnz, 2, ok) ;
1093 t =
t_mult (n_col, 4, ok) ;
1096 s =
t_add (s, n_col, ok) ;
1101 s =
t_add (s, c, ok) ;
1102 s =
t_add (s, r, ok) ;
1104 c =
t_mult (n_col, 3, ok) ;
1105 c =
t_add (c, 1, ok) ;
1106 s =
t_add (s, c, ok) ;
1108 c =
t_add (n_col, 1, ok) ;
1110 s =
t_add (s, c, ok) ;
1112 s =
t_add (s, n_row, ok) ;
1114 return (ok ? s : 0) ;
1128 if (
nnz < 0 || n_row < 0 || n_col < 0)
1135 return (ok ? s : 0) ;
1188 void * (*allocate) (size_t, size_t),
1190 void (*release) (
void *),
1219 ccolamd_get_debug (
"csymamd") ;
1222 both = (stype == 0) ;
1223 upper = (stype > 0) ;
1224 lower = (stype < 0) ;
1230 DEBUG1 ((
"csymamd: stats not present\n")) ;
1244 DEBUG1 ((
"csymamd: A not present\n")) ;
1251 DEBUG1 ((
"csymamd: p not present\n")) ;
1259 DEBUG1 ((
"csymamd: n negative "ID" \n", n)) ;
1268 DEBUG1 ((
"csymamd: number of entries negative "ID" \n", nnz)) ;
1276 DEBUG1 ((
"csymamd: p[0] not zero "ID"\n", p [0])) ;
1285 knobs = default_knobs ;
1290 count = (
Int *) ((*allocate) (n+1,
sizeof (
Int))) ;
1294 DEBUG1 ((
"csymamd: allocate count (size "ID") failed\n", n+1)) ;
1298 mark = (
Int *) ((*allocate) (n+1,
sizeof (
Int))) ;
1302 (*release) ((
void *) count) ;
1303 DEBUG1 ((
"csymamd: allocate mark (size "ID") failed\n", n+1)) ;
1311 for (i = 0 ; i < n ; i++)
1315 for (j = 0 ; j < n ; j++)
1319 length = p [j+1] - p [j] ;
1326 (*release) ((
void *) count) ;
1327 (*release) ((
void *) mark) ;
1328 DEBUG1 ((
"csymamd: col "ID" negative length "ID"\n", j, length)) ;
1332 for (pp = p [j] ; pp < p [j+1] ; pp++)
1335 if (i < 0 || i >= n)
1342 (*release) ((
void *) count) ;
1343 (*release) ((
void *) mark) ;
1344 DEBUG1 ((
"csymamd: row "ID" col "ID" out of bounds\n", i, j)) ;
1348 if (i <= last_row || mark [i] == j)
1356 DEBUG1 ((
"csymamd: row "ID" col "ID" unsorted/dupl.\n", i, j)) ;
1361 if ((both && i != j) || (lower && i > j) || (upper && i < j))
1380 for (j = 1 ; j <= n ; j++)
1382 perm [j] = perm [j-1] + count [j-1] ;
1384 for (j = 0 ; j < n ; j++)
1386 count [j] = perm [j] ;
1394 M = (
Int *) ((*allocate) (Mlen,
sizeof (
Int))) ;
1395 DEBUG1 ((
"csymamd: M is "ID"-by-"ID" with "ID" entries, Mlen = %g\n",
1396 n_row, n, mnz, (
double) Mlen)) ;
1401 (*release) ((
void *) count) ;
1402 (*release) ((
void *) mark) ;
1403 DEBUG1 ((
"csymamd: allocate M (size %g) failed\n", (
double) Mlen)) ;
1412 for (j = 0 ; j < n ; j++)
1414 ASSERT (p [j+1] - p [j] >= 0) ;
1415 for (pp = p [j] ; pp < p [j+1] ; pp++)
1418 ASSERT (i >= 0 && i < n) ;
1419 if ((both && i != j) || (lower && i > j) || (upper && i < j))
1422 M [count [i]++] = k ;
1423 M [count [j]++] = k ;
1432 DEBUG1 ((
"csymamd: Duplicates in A.\n")) ;
1433 for (i = 0 ; i < n ; i++)
1437 for (j = 0 ; j < n ; j++)
1439 ASSERT (p [j+1] - p [j] >= 0) ;
1440 for (pp = p [j] ; pp < p [j+1] ; pp++)
1443 ASSERT (i >= 0 && i < n) ;
1446 if ((both && i != j) || (lower && i > j) || (upper && i<j))
1449 M [count [i]++] = k ;
1450 M [count [j]++] = k ;
1460 (*release) ((
void *) mark) ;
1461 (*release) ((
void *) count) ;
1468 cknobs [i] = knobs [i] ;
1480 (void)
CCOLAMD_2 (n_row, n, (
Int) Mlen, M, perm, cknobs, stats,
1491 (*release) ((
void *) M) ;
1492 DEBUG1 ((
"csymamd: done.\n")) ;
1518 double knobs [CCOLAMD_KNOBS],
1523 return (
CCOLAMD_2 (n_row, n_col, Alen, A, p, knobs, stats,
1551 Int Front_npivcol [ ],
1552 Int Front_nrows [ ],
1553 Int Front_ncols [ ],
1554 Int Front_parent [ ],
1587 Int ndense_row, nempty_row, parent, ndense_col,
1588 nempty_col, k, col, nfr, *Front_child, *Front_sibling, *Front_stack,
1589 *Front_order, *Front_size ;
1590 Int nnewlyempty_col, nnewlyempty_row ;
1601 ccolamd_get_debug (
"ccolamd") ;
1608 DEBUG1 ((
"ccolamd: stats not present\n")) ;
1622 DEBUG1 ((
"ccolamd: A not present\n")) ;
1629 DEBUG1 ((
"ccolamd: p not present\n")) ;
1637 DEBUG1 ((
"ccolamd: nrow negative "ID"\n", n_row)) ;
1645 DEBUG1 ((
"ccolamd: ncol negative "ID"\n", n_col)) ;
1654 DEBUG1 ((
"ccolamd: number of entries negative "ID"\n", nnz)) ;
1662 DEBUG1 ((
"ccolamd: p[0] not zero "ID"\n", p [0])) ;
1671 knobs = default_knobs ;
1693 if (!ok || need > (
size_t) Alen || need >
Int_MAX)
1699 DEBUG1 ((
"ccolamd: Need Alen >= "ID", given "ID"\n", need, Alen)) ;
1704 Alen -= Col_size + Row_size + (3*n_col + 1) + 5*(n_col+1) + n_row ;
1713 if (!Front_npivcol || !Front_nrows || !Front_ncols || !Front_parent ||
1714 !Front_cols || !Front_cols || !InFront)
1716 Front_npivcol = &A [ap] ; ap += (n_col + 1) ;
1717 Front_nrows = &A [ap] ; ap += (n_col + 1) ;
1718 Front_ncols = &A [ap] ; ap += (n_col + 1) ;
1719 Front_parent = &A [ap] ; ap += (n_col + 1) ;
1720 Front_cols = &A [ap] ; ap += (n_col + 1) ;
1721 InFront = &A [ap] ; ap += (n_row) ;
1726 ap += 5*(n_col+1) + n_row ;
1732 cset_start = &A [ap] ;
1736 dead_cols = &A [ap] ;
1745 temp_cstart = (
Int *) Col ;
1746 csize = temp_cstart + (n_col+1) ;
1748 ASSERT (Col_size >= 2*n_col+1) ;
1755 for (i = 0 ; i < n_col ; i++)
1767 else if (cmember == (
Int *)
NULL)
1772 DEBUG1 ((
"no cmember present\n")) ;
1777 for (i = 0 ; i < n_col ; i++)
1779 if (cmember [i] < 0 || cmember [i] > n_col)
1782 DEBUG1 ((
"ccolamd: malformed cmember \n")) ;
1785 n_cset =
MAX (n_cset, cmember [i]) ;
1786 csize [cmember [i]]++ ;
1792 ASSERT ((n_cset >= 0) && (n_cset <= n_col)) ;
1794 cset_start [0] = temp_cstart [0] = 0 ;
1795 for (i = 1 ; i <= n_cset ; i++)
1797 cset_start [i] = cset_start [i-1] + csize [i-1] ;
1798 DEBUG4 ((
" cset_start ["ID"] = "ID" \n", i , cset_start [i])) ;
1799 temp_cstart [i] = cset_start [i] ;
1805 for (i = n_col-1 ; i >= 0 ; i--)
1807 cset [temp_cstart [0]++] = i ;
1812 for (i = n_col-1 ; i >= 0 ; i--)
1814 cset [temp_cstart [cmember [i]]++] = i ;
1825 DEBUG1 ((
"ccolamd: Matrix invalid\n")) ;
1831 for (col = 0 ; col < n_col ; col++)
1833 Front_npivcol [col] = 0 ;
1834 Front_nrows [col] = 0 ;
1835 Front_ncols [col] = 0 ;
1836 Front_parent [col] =
EMPTY ;
1837 Front_cols [col] =
EMPTY ;
1843 &n_row2, &n_col2, &max_deg, cmember, n_cset, cset_start, dead_cols,
1844 &ndense_row, &nempty_row, &nnewlyempty_row,
1845 &ndense_col, &nempty_col, &nnewlyempty_col) ;
1847 ASSERT (n_row2 == n_row - nempty_row - nnewlyempty_row - ndense_row) ;
1848 ASSERT (n_col2 == n_col - nempty_col - nnewlyempty_col - ndense_col) ;
1849 DEBUG1 ((
"# dense rows "ID" cols "ID"\n", ndense_row, ndense_col)) ;
1853 ngarbage =
find_ordering (n_row, n_col, Alen, Row, Col, A, p,
1857 max_deg, 2*nnz, cset, cset_start,
1861 cmember, Front_npivcol, Front_nrows, Front_ncols, Front_parent,
1862 Front_cols, &nfr, aggressive, InFront, order_for_lu) ;
1864 ASSERT (Alen >= 5*n_col) ;
1871 Front_sibling = Front_child + nfr ;
1872 Front_stack = Front_sibling + nfr ;
1873 Front_order = Front_stack + nfr ;
1874 Front_size = Front_order + nfr ;
1877 Front_parent, Front_npivcol) ;
1880 Front_order, Front_child, Front_sibling, Front_stack, Front_cols,
1893 for (i = 0 ; i < nfr ; i++)
1895 parent = Front_parent [i] ;
1896 if (parent !=
EMPTY)
1898 Front_parent [i] = Front_order [parent] ;
1903 for (row = 0 ; row < n_row ; row++)
1909 InFront [row] = Front_order [i] ;
1918 for (i = 0 ; i < n_col ; i++)
1925 for (i = 0 ; i < nfr ; i++)
1927 ASSERT (Front_npivcol [i] > 0) ;
1929 set2 =
CMEMBER (Front_cols [i]) ;
1932 k += dead_cols [set1] ;
1933 DEBUG3 ((
"Skip null/dense columns of set "ID
"\n",set1)) ;
1938 for (col = Front_cols [i] ; col !=
EMPTY ; col = Col [col].
nextcol)
1940 ASSERT (col >= 0 && col < n_col) ;
1941 DEBUG1 ((
"ccolamd output ordering: k "ID
" col "ID
"\n", k, col)) ;
1946 ASSERT (k >= cset_start [cs] && k < cset_start [cs+1]) ;
1957 for (col = 0 ; col < n_col ; col++)
1959 if (A [col] ==
EMPTY)
1966 ASSERT (k >= cset_start [cs] && k < cset_start [cs+1]) ;
1967 DEBUG1 ((
"ccolamd output ordering: k "ID
" col "ID
1968 " (dense or null col)\n", k, col)) ;
1976 for (i = 0 ; i < n_cset ; i++)
1978 ASSERT (dead_cols [i] == 0) ;
1990 ASSERT (ndense_col + nempty_col + nnewlyempty_col == n_col - n_col2) ;
1996 DEBUG1 ((
"ccolamd: done.\n")) ;
2007 Int stats [CCOLAMD_STATS]
2020 Int stats [CCOLAMD_STATS]
2072 for (col = 0 ; col < n_col ; col++)
2074 Col [col].start = p [col] ;
2075 Col [col].length = p [col+1] - p [col] ;
2077 if (Col [col].length < 0)
2083 DEBUG1 ((
"ccolamd: col "ID" length "ID" < 0\n",
2084 col, Col [col].length)) ;
2088 Col [col].shared1.thickness = 1 ;
2089 Col [col].shared2.score = 0 ;
2090 Col [col].shared3.prev =
EMPTY ;
2091 Col [col].shared4.degree_next =
EMPTY ;
2092 Col [col].nextcol =
EMPTY ;
2093 Col [col].lastcol = col ;
2102 for (row = 0 ; row < n_row ; row++)
2104 Row [row].length = 0 ;
2105 Row [row].shared2.mark = -1 ;
2106 Row [row].thickness = 1 ;
2107 Row [row].front =
EMPTY ;
2110 for (col = 0 ; col < n_col ; col++)
2112 DEBUG1 ((
"\nCcolamd input column "ID":\n", col)) ;
2116 cp_end = &A [p [col+1]] ;
2124 if (row < 0 || row >= n_row)
2130 DEBUG1 ((
"row "ID" col "ID" out of bounds\n", row, col)) ;
2134 if (row <= last_row || Row [row].shared2.mark == col)
2142 DEBUG1 ((
"row "ID" col "ID" unsorted/duplicate\n", row, col)) ;
2145 if (Row [row].shared2.mark != col)
2147 Row [row].length++ ;
2153 Col [col].length-- ;
2157 Row [row].shared2.mark = col ;
2167 Row [0].start = p [n_col] ;
2168 Row [0].shared1.p = Row [0].start ;
2169 Row [0].shared2.mark = -1 ;
2170 for (row = 1 ; row < n_row ; row++)
2172 Row [row].start = Row [row-1].start + Row [row-1].length ;
2173 Row [row].shared1.p = Row [row].start ;
2174 Row [row].shared2.mark = -1 ;
2182 for (col = 0 ; col < n_col ; col++)
2185 cp_end = &A [p [col+1]] ;
2189 if (Row [row].shared2.mark != col)
2191 A [(Row [row].shared1.p)++] = col ;
2192 Row [row].shared2.mark = col ;
2200 for (col = 0 ; col < n_col ; col++)
2203 cp_end = &A [p [col+1]] ;
2206 A [(Row [*cp++].shared1.p)++] = col ;
2213 for (row = 0 ; row < n_row ; row++)
2215 Row [row].shared2.mark = 0 ;
2216 Row [row].shared1.degree = Row [row].length ;
2223 DEBUG1 ((
"ccolamd: reconstructing column form, matrix jumbled\n")) ;
2227 for (col = 0 ; col < n_col ; col++)
2229 p [col] = Col [col].length ;
2231 for (row = 0 ; row < n_row ; row++)
2233 rp = &A [Row [row].start] ;
2234 rp_end = rp + Row [row].length ;
2240 for (col = 0 ; col < n_col ; col++)
2254 p [0] = Col [0].start ;
2255 for (col = 1 ; col < n_col ; col++)
2259 Col [col].start = Col [col-1].start + Col [col-1].length ;
2260 p [col] = Col [col].start ;
2265 for (row = 0 ; row < n_row ; row++)
2267 rp = &A [Row [row].start] ;
2268 rp_end = rp + Row [row].length ;
2271 A [(p [*rp++])++] = row ;
2302 double knobs [CCOLAMD_KNOBS],
2312 Int *p_nnewlyempty_row,
2315 Int *p_nnewlyempty_col
2330 Int dense_row_count ;
2331 Int dense_col_count ;
2336 Int nnewlyempty_row ;
2339 Int nnewlyempty_col ;
2352 dense_row_count = n_col-1 ;
2361 dense_col_count = n_row-1 ;
2369 DEBUG1 ((
"densecount: "ID" "ID"\n", dense_row_count, dense_col_count)) ;
2377 for (s = 0 ; s < n_cset ; s++)
2379 head [s] = cset_start [s+1] ;
2384 nnewlyempty_col = 0 ;
2387 nnewlyempty_row = 0 ;
2393 for (c = n_col-1 ; c >= 0 ; c--)
2406 DEBUG1 ((
"ccolamd: null columns killed: "ID
"\n", n_col - n_col2)) ;
2411 for (c = n_col-1 ; c >= 0 ; c--)
2419 if (deg > dense_col_count)
2427 cp = &A [Col [c].
start] ;
2428 cp_end = cp + Col [c].length ;
2436 DEBUG1 ((
"Dense and null columns killed: "ID
"\n", n_col - n_col2)) ;
2444 for (r = 0 ; r < n_row ; r++)
2447 ASSERT (deg >= 0 && deg <= n_col) ;
2448 if (deg > dense_row_count)
2459 if (deg > dense_row_count || deg == 0)
2469 max_deg =
MAX (max_deg, deg) ;
2472 nnewlyempty_row = ne - nempty_row ;
2473 DEBUG1 ((
"ccolamd: Dense and null rows killed: "ID
"\n", n_row - n_row2)) ;
2483 for (c = n_col-1 ; c >= 0 ; c--)
2491 cp = &A [Col [c].
start] ;
2493 cp_end = cp + Col [c].length ;
2508 score =
MIN (score, n_col) ;
2511 col_length = (
Int) (new_cp - &A [Col [c].
start]) ;
2512 if (col_length == 0)
2516 DEBUG1 ((
"Newly null killed: "ID
"\n", c)) ;
2517 Col [c].shared2.order = -- head [
CMEMBER (c)] ;
2527 ASSERT (score <= n_col) ;
2528 Col [c].length = col_length ;
2529 Col [c].shared2.score = score ;
2532 DEBUG1 ((
"ccolamd: Dense, null, and newly-null columns killed: "ID
"\n",
2545 for (c = 0 ; c <= n_col ; c++)
2551 debug_structures (n_row, n_col, Row, Col, A, cmember, cset_start) ;
2556 *p_n_col2 = n_col2 ;
2557 *p_n_row2 = n_row2 ;
2558 *p_max_deg = max_deg ;
2559 *p_ndense_row = ndense_row ;
2560 *p_nempty_row = nempty_row ;
2561 *p_nnewlyempty_row = nnewlyempty_row ;
2562 *p_ndense_col = ndense_col ;
2563 *p_nempty_col = nempty_col ;
2564 *p_nnewlyempty_col = nnewlyempty_col ;
2600 Int Front_npivcol [ ],
2601 Int Front_nrows [ ],
2602 Int Front_ncols [ ],
2603 Int Front_parent [ ],
2620 Int pivot_row_start ;
2621 Int pivot_row_degree ;
2622 Int pivot_row_length ;
2623 Int pivot_col_score ;
2636 Int set_difference ;
2640 Int pivot_col_thickness ;
2652 Int debug_step = 0 ;
2653 Int cols_thickness = 0 ;
2657 Int pivot_row_thickness ;
2664 tag_mark =
clear_mark (0, max_mark, n_row, Row) ;
2669 DEBUG1 ((
"ccolamd: Ordering, n_col2="ID"\n", n_col2)) ;
2671 for (row = 0 ; row < n_row ; row++)
2673 InFront [row] =
EMPTY ;
2678 for (k = 0 ; k < n_col ; )
2682 ASSERT (min_score >= 0) ;
2683 ASSERT (min_score <= n_col) ;
2687 for (debug_d = 0 ; debug_d < min_score ; debug_d++)
2695 while ((k+deadcol) == cset_start [current_set+1])
2698 DEBUG1 ((
"\n\n\n============ CSET: "ID"\n", current_set)) ;
2702 ASSERT ((current_set == n_cset) == (k == n_col)) ;
2712 for (col = 0 ; col <= n_col ; col++)
2719 colstart = cset_start [current_set] ;
2720 colend = cset_start [current_set+1] ;
2722 while (colstart < colend)
2724 col = cset [colstart++] ;
2728 DEBUG1 ((
"Column "ID" is dead\n", col)) ;
2730 if (Col [col].shared2.order !=
EMPTY)
2740 score = Col [col].shared2.score ;
2741 DEBUG1 ((
"Column "ID" is alive, score "ID"\n", col, score)) ;
2743 ASSERT (min_score >= 0) ;
2744 ASSERT (min_score <= n_col) ;
2746 ASSERT (score <= n_col) ;
2750 next_col = head [score] ;
2751 Col [col].shared3.prev =
EMPTY ;
2752 Col [col].shared4.degree_next = next_col ;
2756 if (next_col !=
EMPTY)
2758 Col [next_col].shared3.prev = col ;
2760 head [score] = col ;
2763 min_score =
MIN (min_score, score) ;
2767 DEBUG1 ((
"degree lists initialized \n")) ;
2768 debug_deg_lists (n_row, n_col, Row, Col, head, min_score,
2769 ((cset_start [current_set+1]-cset_start [current_set])-deadcol),
2775 if (debug_step % 100 == 0)
2777 DEBUG2 ((
"\n... Step k: "ID" out of n_col2: "ID"\n", k, n_col2)) ;
2781 DEBUG3 ((
"\n------Step k: "ID" out of n_col2: "ID"\n", k, n_col2)) ;
2784 DEBUG1 ((
"start of step k="ID": ", k)) ;
2785 debug_deg_lists (n_row, n_col, Row, Col, head,
2786 min_score, cset_start [current_set+1]-(k+deadcol), max_deg) ;
2787 debug_matrix (n_row, n_col, Row, Col, A) ;
2792 while (head [min_score] ==
EMPTY && min_score < n_col)
2797 pivot_col = head [min_score] ;
2799 ASSERT (pivot_col >= 0 && pivot_col <= n_col) ;
2800 next_col = Col [pivot_col].shared4.degree_next ;
2801 head [min_score] = next_col ;
2802 if (next_col !=
EMPTY)
2804 Col [next_col].shared3.prev =
EMPTY ;
2810 pivot_col_score = Col [pivot_col].shared2.score ;
2813 Col [pivot_col].shared2.order = k ;
2816 pivot_col_thickness = Col [pivot_col].shared1.thickness ;
2817 k += pivot_col_thickness ;
2818 ASSERT (pivot_col_thickness > 0) ;
2819 DEBUG3 ((
"Pivot col: "ID" thick "ID"\n", pivot_col,
2820 pivot_col_thickness)) ;
2824 needed_memory =
MIN (pivot_col_score, n_col - k) ;
2825 if (pfree + needed_memory >= Alen)
2830 ASSERT (pfree + needed_memory < Alen) ;
2832 tag_mark =
clear_mark (0, max_mark, n_row, Row) ;
2835 debug_matrix (n_row, n_col, Row, Col, A) ;
2842 pivot_row_start = pfree ;
2845 pivot_row_degree = 0 ;
2846 pivot_row_thickness = 0 ;
2850 Col [pivot_col].shared1.thickness = -pivot_col_thickness ;
2853 cp = &A [Col [pivot_col].start] ;
2854 cp_end = cp + Col [pivot_col].length ;
2859 ASSERT (row >= 0 && row < n_row) ;
2865 pivot_row_thickness += Row [row].thickness ;
2867 rp = &A [Row [row].start] ;
2868 rp_end = rp + Row [row].length ;
2874 col_thickness = Col [col].shared1.thickness ;
2878 Col [col].shared1.thickness = -col_thickness ;
2882 pivot_row_degree += col_thickness ;
2883 DEBUG4 ((
"\t\t\tNew live col in pivrow: "ID
"\n",col)) ;
2888 DEBUG4 ((
"\t\t\tOld live col in pivrow: "ID
"\n",col)) ;
2899 Col [pivot_col].shared1.thickness = pivot_col_thickness ;
2900 max_deg =
MAX (max_deg, pivot_row_degree) ;
2904 debug_mark (n_row, Row, tag_mark, max_mark) ;
2910 cp = &A [Col [pivot_col].start] ;
2911 cp_end = cp + Col [pivot_col].length ;
2916 DEBUG3 ((
"Kill row in pivot col: "ID
"\n", row)) ;
2917 ASSERT (row >= 0 && row < n_row) ;
2920 if (Row [row].front !=
EMPTY)
2924 child = Row [row].front ;
2925 Front_parent [child] = nfr ;
2926 DEBUG1 ((
"Front "ID
" => front "ID
", normal\n", child, nfr));
2932 InFront [row] = nfr ;
2933 DEBUG1 ((
"Row "ID
" => front "ID
", normal\n", row, nfr)) ;
2938 Row [row].thickness = 0 ;
2943 pivot_row_length = pfree - pivot_row_start ;
2944 if (pivot_row_length > 0)
2947 pivot_row = A [Col [pivot_col].start] ;
2948 DEBUG3 ((
"Pivotal row is "ID
"\n", pivot_row)) ;
2954 ASSERT (pivot_row_length == 0) ;
2956 ASSERT (Col [pivot_col].length > 0 || pivot_row_length == 0) ;
2979 DEBUG3 ((
"** Computing set differences phase. **\n")) ;
2983 DEBUG3 ((
"Pivot row: ")) ;
2985 rp = &A [pivot_row_start] ;
2986 rp_end = rp + pivot_row_length ;
2991 DEBUG3 ((
"Col: "ID
"\n", col)) ;
2994 col_thickness = -Col [col].shared1.thickness ;
2995 ASSERT (col_thickness > 0) ;
2996 Col [col].shared1.thickness = col_thickness ;
3001 if (
CMEMBER (col) == current_set)
3004 cols_thickness += col_thickness ;
3006 cur_score = Col [col].shared2.score ;
3007 prev_col = Col [col].shared3.prev ;
3008 next_col = Col [col].shared4.degree_next ;
3009 DEBUG3 ((
" cur_score "ID
" prev_col "ID
" next_col "ID
"\n",
3010 cur_score, prev_col, next_col)) ;
3011 ASSERT (cur_score >= 0) ;
3012 ASSERT (cur_score <= n_col) ;
3014 if (prev_col ==
EMPTY)
3016 head [cur_score] = next_col ;
3020 Col [prev_col].shared4.degree_next = next_col ;
3022 if (next_col !=
EMPTY)
3024 Col [next_col].shared3.prev = prev_col ;
3030 cp = &A [Col [col].start] ;
3031 cp_end = cp + Col [col].length ;
3036 row_mark = Row [row].shared2.mark ;
3042 ASSERT (row != pivot_row) ;
3043 set_difference = row_mark - tag_mark ;
3045 if (set_difference < 0)
3047 ASSERT (Row [row].shared1.degree <= max_deg) ;
3048 set_difference = Row [row].shared1.degree ;
3051 set_difference -= col_thickness ;
3052 ASSERT (set_difference >= 0) ;
3054 if (set_difference == 0 && aggressive)
3056 DEBUG3 ((
"aggressive absorption. Row: "ID
"\n", row)) ;
3058 if (Row [row].front !=
EMPTY)
3061 child = Row [row].front ;
3062 Front_parent [child] = nfr ;
3063 DEBUG1 ((
"Front "ID
" => front "ID
", aggressive\n",
3070 InFront [row] = nfr ;
3071 DEBUG1 ((
"Row "ID
" => front "ID
", aggressive\n",
3078 pivot_row_thickness += Row [row].thickness ;
3079 Row [row].thickness = 0 ;
3084 Row [row].shared2.mark = set_difference + tag_mark ;
3090 debug_deg_lists (n_row, n_col, Row, Col, head, min_score,
3091 cset_start [current_set+1]-(k+deadcol)-(cols_thickness),
3093 cols_thickness = 0 ;
3098 DEBUG3 ((
"** Adding set differences phase. **\n")) ;
3101 rp = &A [pivot_row_start] ;
3102 rp_end = rp + pivot_row_length ;
3110 cp = &A [Col [col].start] ;
3113 cp_end = cp + Col [col].length ;
3115 DEBUG4 ((
"Adding set diffs for Col: "ID
".\n", col)) ;
3121 ASSERT (row >= 0 && row < n_row) ;
3122 row_mark = Row [row].shared2.mark ;
3126 DEBUG4 ((
" Row "ID
", dead\n", row)) ;
3129 DEBUG4 ((
" Row "ID
", set diff "ID
"\n", row, row_mark-tag_mark));
3130 ASSERT (row_mark >= tag_mark) ;
3136 cur_score += row_mark - tag_mark ;
3138 cur_score =
MIN (cur_score, n_col) ;
3142 Col [col].length = (
Int) (new_cp - &A [Col [col].
start]) ;
3146 if (Col [col].length == 0 &&
CMEMBER (col) == current_set)
3148 DEBUG4 ((
"further mass elimination. Col: "ID
"\n", col)) ;
3151 pivot_row_degree -= Col [col].shared1.thickness ;
3152 ASSERT (pivot_row_degree >= 0) ;
3154 Col [col].shared2.order = k ;
3156 k += Col [col].shared1.thickness ;
3157 pivot_col_thickness += Col [col].shared1.thickness ;
3163 Col [Col [col].lastcol].nextcol = Front_cols [nfr] ;
3164 Front_cols [nfr] = col ;
3170 DEBUG4 ((
"Preparing supercol detection for Col: "ID
".\n", col));
3173 Col [col].shared2.score = cur_score ;
3178 DEBUG4 ((
" Hash = "ID
", n_col = "ID
".\n", hash, n_col)) ;
3181 head_column = head [hash] ;
3182 if (head_column >
EMPTY)
3186 first_col = Col [head_column].shared3.headhash ;
3187 Col [head_column].shared3.headhash = col ;
3192 first_col = - (head_column + 2) ;
3193 head [hash] = - (col + 2) ;
3195 Col [col].shared4.hash_next = first_col ;
3198 Col [col].shared3.hash = (
Int) hash ;
3207 DEBUG3 ((
"** Supercolumn detection phase. **\n")) ;
3213 Col, A, head, pivot_row_start, pivot_row_length, cmember) ;
3217 DEBUG1 ((
" KILLING column detect supercols "ID
" \n", pivot_col)) ;
3225 Col [Col [pivot_col].lastcol].nextcol = Front_cols [nfr] ;
3226 Front_cols [nfr] = pivot_col ;
3230 tag_mark =
clear_mark (tag_mark+max_deg+1, max_mark, n_row, Row) ;
3234 debug_mark (n_row, Row, tag_mark, max_mark) ;
3239 DEBUG3 ((
"** Finalize scores phase. **\n")) ;
3242 rp = &A [pivot_row_start] ;
3245 rp_end = rp + pivot_row_length ;
3256 A [Col [col].start + (Col [col].length++)] = pivot_row ;
3261 cur_score = Col [col].shared2.score + pivot_row_degree ;
3266 max_score = n_col - k - Col [col].shared1.thickness ;
3269 cur_score -= Col [col].shared1.thickness ;
3272 cur_score =
MIN (cur_score, max_score) ;
3273 ASSERT (cur_score >= 0) ;
3276 Col [col].shared2.score = cur_score ;
3280 if (
CMEMBER (col) == current_set)
3282 ASSERT (min_score >= 0) ;
3283 ASSERT (min_score <= n_col) ;
3284 ASSERT (cur_score >= 0) ;
3285 ASSERT (cur_score <= n_col) ;
3287 next_col = head [cur_score] ;
3288 Col [col].shared4.degree_next = next_col ;
3289 Col [col].shared3.prev =
EMPTY ;
3290 if (next_col !=
EMPTY)
3292 Col [next_col].shared3.prev = col ;
3294 head [cur_score] = col ;
3296 min_score =
MIN (min_score, cur_score) ;
3300 Col [col].shared4.degree_next =
EMPTY ;
3301 Col [col].shared3.prev =
EMPTY ;
3306 debug_deg_lists (n_row, n_col, Row, Col, head,
3307 min_score, cset_start [current_set+1]-(k+deadcol), max_deg) ;
3314 Front_npivcol [nfr] = pivot_col_thickness ;
3317 Front_nrows [nfr] = pivot_row_thickness ;
3320 Front_ncols [nfr] = pivot_col_thickness + pivot_row_degree ;
3322 Front_parent [nfr] =
EMPTY ;
3324 pivot_row_thickness -= pivot_col_thickness ;
3325 DEBUG1 ((
"Front "ID
" Pivot_row_thickness after pivot cols elim: "ID
"\n",
3326 nfr, pivot_row_thickness)) ;
3327 pivot_row_thickness =
MAX (0, pivot_row_thickness) ;
3331 if ((pivot_row_degree > 0 && pivot_row_thickness > 0 && (order_for_lu))
3332 || (pivot_row_degree > 0 && (!order_for_lu)))
3336 Row [pivot_row].start = pivot_row_start ;
3337 Row [pivot_row].length = (
Int) (new_rp - &A[pivot_row_start]) ;
3338 Row [pivot_row].shared1.degree = pivot_row_degree ;
3339 Row [pivot_row].shared2.mark = 0 ;
3340 Row [pivot_row].thickness = pivot_row_thickness ;
3341 Row [pivot_row].front = nfr ;
3343 DEBUG1 ((
"Resurrect Pivot_row "ID
" deg: "ID
"\n",
3344 pivot_row, pivot_row_degree)) ;
3348 DEBUG1 ((
"Front "ID
" : "ID
" "ID
" "ID
" ", nfr,
3349 Front_npivcol [nfr], Front_nrows [nfr], Front_ncols [nfr])) ;
3352 for (col = Front_cols [nfr] ; col !=
EMPTY ; col = Col [col].nextcol)
3355 ASSERT (col >= 0 && col < n_col) ;
3358 ASSERT (debug_d <= pivot_col_thickness) ;
3360 ASSERT (debug_d == pivot_col_thickness) ;
3442 rp = &A [row_start] ;
3443 rp_end = rp + row_length ;
3453 hash = Col [col].shared3.hash ;
3458 head_column = head [hash] ;
3459 if (head_column >
EMPTY)
3461 first_col = Col [head_column].shared3.headhash ;
3465 first_col = - (head_column + 2) ;
3470 for (super_c = first_col ; super_c !=
EMPTY ;
3471 super_c = Col [super_c].shared4.hash_next)
3474 ASSERT (Col [super_c].shared3.hash == hash) ;
3475 length = Col [super_c].length ;
3482 for (c = Col [super_c].shared4.hash_next ;
3483 c !=
EMPTY ; c = Col [c].shared4.hash_next)
3487 ASSERT (Col [c].shared3.hash == hash) ;
3491 if (Col [c].length != length ||
3492 Col [c].shared2.score != Col [super_c].shared2.score
3500 cp1 = &A [Col [super_c].start] ;
3501 cp2 = &A [Col [c].start] ;
3503 for (i = 0 ; i < length ; i++)
3510 if (*cp1++ != *cp2++)
3526 ASSERT (Col [c].shared2.score == Col [super_c].shared2.score) ;
3528 Col [super_c].shared1.thickness += Col [c].shared1.thickness ;
3529 Col [c].shared1.parent = super_c ;
3532 Col [c].shared2.order =
EMPTY ;
3534 Col [prev_c].shared4.hash_next = Col [c].shared4.hash_next ;
3537 ASSERT (Col [super_c].lastcol >= 0) ;
3538 ASSERT (Col [super_c].lastcol < n_col) ;
3539 Col [Col [super_c].lastcol].nextcol = c ;
3540 Col [super_c].lastcol = Col [c].lastcol ;
3551 if (head_column >
EMPTY)
3554 Col [head_column].shared3.headhash =
EMPTY ;
3559 head [hash] =
EMPTY ;
3601 DEBUG2 ((
"Defrag..\n")) ;
3602 for (psrc = &A[0] ; psrc < pfree ; psrc++) ASSERT (*psrc >= 0) ;
3609 for (c = 0 ; c < n_col ; c++)
3613 psrc = &A [Col [c].start] ;
3617 Col [c].start = (
Int) (pdest - &A [0]) ;
3618 length = Col [c].length ;
3619 for (j = 0 ; j < length ; j++)
3627 Col [c].length = (
Int) (pdest - &A [Col [c].
start]) ;
3633 for (r = 0 ; r < n_row ; r++)
3646 psrc = &A [Row [r].start] ;
3647 Row [r].shared2.first_column = *psrc ;
3660 while (psrc < pfree)
3668 ASSERT (r >= 0 && r < n_row) ;
3670 *psrc = Row [r].shared2.first_column ;
3675 Row [r].start = (
Int) (pdest - &A [0]) ;
3676 length = Row [r].length ;
3677 for (j = 0 ; j < length ; j++)
3685 Row [r].length = (
Int) (pdest - &A [Row [r].
start]) ;
3693 ASSERT (debug_rows == 0) ;
3697 return ((
Int) (pdest - &A [0])) ;
3725 if (tag_mark <= 0 || tag_mark >= max_mark)
3727 for (r = 0 ; r < n_row ; r++)
3731 Row [r].shared2.mark = 0 ;
3750 Int stats [CCOLAMD_STATS]
3756 PRINTF ((
"\n%s version %d.%d, %s: ", method,
3761 PRINTF ((
"No statistics available.\n")) ;
3783 PRINTF((
"Matrix has unsorted or duplicate row indices.\n")) ;
3785 PRINTF((
"%s: duplicate or out-of-order row indices: "ID"\n",
3788 PRINTF((
"%s: last seen duplicate or out-of-order row: "ID"\n",
3789 method,
INDEX (i2))) ;
3791 PRINTF((
"%s: last seen in column: "ID"",
3792 method,
INDEX (i1))) ;
3800 PRINTF((
"%s: number of dense or empty rows ignored: "ID"\n",
3803 PRINTF((
"%s: number of dense or empty columns ignored: "ID"\n",
3806 PRINTF((
"%s: number of garbage collections performed: "ID"\n",
3812 PRINTF((
"Array A (row indices of matrix) not present.\n")) ;
3817 PRINTF((
"Array p (column pointers for matrix) not present.\n")) ;
3822 PRINTF((
"Invalid number of rows ("ID").\n", i1)) ;
3827 PRINTF((
"Invalid number of columns ("ID").\n", i1)) ;
3832 PRINTF((
"Invalid number of nonzero entries ("ID").\n", i1)) ;
3837 PRINTF((
"Invalid column pointer, p [0] = "ID", must be 0.\n", i1)) ;
3842 PRINTF((
"Array A too small.\n")) ;
3843 PRINTF((
" Need Alen >= "ID", but given only Alen = "ID".\n",
3849 PRINTF((
"Column "ID
" has a negative number of entries ("ID
").\n",
3855 PRINTF((
"Row index (row "ID
") out of bounds ("ID
" to "ID
") in"
3862 PRINTF((
"Out of memory.\n")) ;
3867 PRINTF((
"cmember invalid\n")) ;
3894 const Int Order [ ],
3903 for (i = 0 ; i < nn ; i++)
3909 Temp [k] = Front [i] ;
3913 for (k = 0 ; k < nfr ; k++)
3915 Front [k] = Temp [k] ;
3939 Int j, parent, frsize, r, c ;
3941 for (j = 0 ; j < nn ; j++)
3950 DEBUG1 ((
"\n\n========================================FRONTS:\n")) ;
3951 for (j = 0 ; j < nn ; j++)
3956 parent = Parent [j] ;
3964 j, Npiv [j], frsize, parent)) ;
3965 Fsize [j] =
MAX (Fsize [j], frsize) ;
3966 DEBUG1 ((
"Fsize [j = "ID
"] = "ID
"\n", j, Fsize [j])) ;
3967 if (parent !=
EMPTY)
3970 ASSERT (Npiv [parent] > 0) ;
3972 Fsize [parent] =
MAX (Fsize [parent], Fsize [j]) ;
3973 DEBUG1 ((
"Fsize [parent = "ID
"] = "ID
"\n",
3974 parent, Fsize [parent]));
3978 DEBUG1 ((
"fsize done\n")) ;
4010 Int i, j, k, parent, frsize,
f, fprev, maxfrsize, bigfprev, bigf, fnext ;
4012 for (j = 0 ; j < nn ; j++)
4015 Sibling [j] =
EMPTY ;
4022 for (j = nn-1 ; j >= 0 ; j--)
4027 parent = Parent [j] ;
4028 if (parent !=
EMPTY)
4032 Sibling [j] = Child [parent] ;
4035 Child [parent] = j ;
4043 Int nels, ff, nchild ;
4044 DEBUG1 ((
"\n\n================================ ccolamd_postorder:\n"));
4046 for (j = 0 ; j < nn ; j++)
4051 " parent "ID" maxfr "ID"\n", j, nels,
4052 Nv [j], Fsize [j], Parent [j], Fsize [j])) ;
4056 DEBUG1 ((
" Children: ")) ;
4057 for (ff = Child [j] ; ff !=
EMPTY ; ff = Sibling [ff])
4064 parent = Parent [j] ;
4075 for (i = 0 ; i < nn ; i++)
4077 if (Nv [i] > 0 && Child [i] !=
EMPTY)
4082 DEBUG1 ((
"Before partial sort, element "ID"\n", i)) ;
4084 for (f = Child [i] ; f !=
EMPTY ; f = Sibling [f])
4086 DEBUG1 ((
" f: "ID" size: "ID"\n", f, Fsize [f])) ;
4096 for (f = Child [i] ; f !=
EMPTY ; f = Sibling [f])
4098 frsize = Fsize [f] ;
4099 if (frsize >= maxfrsize)
4102 maxfrsize = frsize ;
4109 fnext = Sibling [bigf] ;
4112 " fprev " ID"\n", bigf, maxfrsize, bigfprev, fnext, fprev)) ;
4118 if (bigfprev ==
EMPTY)
4126 Sibling [bigfprev] = fnext ;
4130 Sibling [bigf] =
EMPTY ;
4131 Sibling [fprev] = bigf ;
4135 DEBUG1 ((
"After partial sort, element "ID
"\n", i)) ;
4136 for (f = Child [i] ; f !=
EMPTY ; f = Sibling [f])
4138 DEBUG1 ((
" "ID
" "ID
"\n", f, Fsize [f])) ;
4149 for (i = 0 ; i < nn ; i++)
4156 for (i = 0 ; i < nn ; i++)
4158 if ((Parent [i] ==
EMPTY
4159 || (
CMEMBER (Front_cols [Parent [i]]) !=
CMEMBER (Front_cols [i])))
4162 DEBUG1 ((
"Root of assembly tree "ID"\n", i)) ;
4183 const Int Sibling [ ],
4203 for (f = Child [i] ; f !=
EMPTY ; f = Sibling [f])
4223 DEBUG1 ((
"head of stack "ID" \n", i)) ;
4225 if (Child [i] !=
EMPTY)
4231 for (f = Child [i] ; f !=
EMPTY ; f = Sibling [f])
4236 for (f = Child [i] ; f !=
EMPTY ; f = Sibling [f])
4240 DEBUG1 ((
"push "ID" on stack\n", f)) ;
4242 ASSERT (Stack [h] == i) ;
4258 for (h = head ; h >= 0 ; h--)
4321 for (c = 0 ; c < n_col ; c++)
4327 DEBUG4 ((
"initial live col %5d %5d %5d\n", c, len, score)) ;
4331 cp = &A [Col [c].
start] ;
4341 i = Col [c].shared2.order ;
4343 ASSERT (i >= cset_start [cs] && i < cset_start [cs+1]) ;
4347 for (r = 0 ; r < n_row ; r++)
4356 rp = &A [Row [r].
start] ;
4406 if (n_col > 10000 && ccolamd_debug <= 0)
4411 DEBUG4 ((
"Degree lists: "ID"\n", min_score)) ;
4412 for (deg = 0 ; deg <= n_col ; deg++)
4421 while (col !=
EMPTY)
4430 DEBUG4 ((
"should "ID" have "ID"\n", should, have)) ;
4431 ASSERT (should == have) ;
4435 if (n_row > 10000 && ccolamd_debug <= 0)
4439 for (row = 0 ; row < n_row ; row++)
4474 ASSERT (tag_mark > 0 && tag_mark <= max_mark) ;
4475 if (n_row > 10000 && ccolamd_debug <= 0)
4479 for (r = 0 ; r < n_row ; r++)
4514 if (ccolamd_debug < 3)
4518 DEBUG3 ((
"DUMP MATRIX:\n")) ;
4519 for (r = 0 ; r < n_row ; r++)
4527 DEBUG3 ((
"start "ID
" length "ID
" degree "ID
"\nthickness "ID
"\n",
4528 Row [r].
start, Row [r].length, Row [r].shared1.
degree,
4531 rp = &A [Row [r].
start] ;
4532 rp_end = rp + Row [r].length ;
4540 for (c = 0 ; c < n_col ; c++)
4547 DEBUG3 ((
"start "ID
" length "ID
" shared1 "ID
" shared2 "ID
"\n",
4548 Col [c].
start, Col [c].length,
4550 cp = &A [Col [c].
start] ;
4551 cp_end = cp + Col [c].length ;
4576 for (col = super_c ; col !=
EMPTY ; col = Col [col].
nextcol)
4579 ASSERT (col >= 0 && col < n_col) ;
4584 if (Col [col].nextcol ==
EMPTY)
4586 ASSERT (col == Col [super_c].lastcol) ;
4600 PRIVATE void ccolamd_get_debug
4609 debug_file = fopen (
"debug",
"r") ;
4612 (void) fscanf (debug_file,
""ID
"", &ccolamd_debug) ;
4613 (void) fclose (debug_file) ;
4617 DEBUG1 ((
"%s: debug version, D = "ID
" (THIS WILL BE SLOW!)\n",
4618 method, ccolamd_debug)) ;
4619 DEBUG1 ((
" Debug printing level: "ID
"\n", ccolamd_debug)) ;
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 CCOLAMD_postorder
union CColamd_Col_struct::@0 shared1
struct CColamd_Col_struct CColamd_Col
struct CColamd_Row_struct CColamd_Row
#define CCOLAMD_ERROR_ncol_negative
#define KILL_PRINCIPAL_COL(c)
UF_long CHOLMOD() nnz(cholmod_sparse *A, cholmod_common *Common)
static size_t t_mult(size_t a, size_t k, int *ok)
#define CCOLAMD_ERROR_p_not_present
#define CCOLAMD_set_defaults
#define CCOLAMD_DEFRAG_COUNT
#define CCOLAMD_NEWLY_EMPTY_ROW
#define CCOLAMD_OK_BUT_JUMBLED
#define CCOLAMD_AGGRESSIVE
#define DENSE_DEGREE(alpha, n)
#define CCOLAMD_post_tree
#define CCOLAMD_ERROR_nnz_negative
static size_t ccolamd_need(Int nnz, Int n_row, Int n_col, int *ok)
PRIVATE void print_report(char *method, Int stats[CCOLAMD_STATS])
union CColamd_Row_struct::@5 shared2
#define ROW_IS_MARKED_DEAD(row_mark)
#define ONES_COMPLEMENT(r)
#define CCOLAMD_ERROR_invalid_cmember
#define CCOLAMD_ERROR_nrow_negative
#define CCOLAMD_C(n_col, ok)
#define ASSERT(expression)
#define CCOLAMD_NEWLY_EMPTY_COL
union CColamd_Col_struct::@3 shared4
#define CCOLAMD_EMPTY_COL
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
int CHOLMOD() start(cholmod_common *Common)
#define CCOLAMD_DENSE_ROW
PRIVATE Int clear_mark(Int tag_mark, Int max_mark, Int n_row, CColamd_Row Row[])
static size_t t_add(size_t a, size_t b, int *ok)
#define KILL_NON_PRINCIPAL_COL(c)
PRIVATE void detect_super_cols(CColamd_Col Col[], Int A[], Int head[], Int row_start, Int row_length, Int in_set[])
void CHOLMOD() dump_super(UF_long s, Int *Super, Int *Lpi, Int *Ls, Int *Lpx, double *Lx, int xentry, cholmod_common *Common)
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_SUB_VERSION
union CColamd_Col_struct::@2 shared3
#define CCOLAMD_recommended
#define CCOLAMD_apply_order
#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
#define CCOLAMD_R(n_row, ok)
PRIVATE Int garbage_collection(Int n_row, Int n_col, CColamd_Row Row[], CColamd_Col Col[], Int A[], Int *pfree)
#define CCOLAMD_DENSE_COL