5
5
int n, *c, *post, *P ;
8
if (!CS_CSC (A)) return (NULL) ; /* check inputs */
8
if (!CS_CSC (A)) return (NULL) ; /* check inputs */
10
S = cs_calloc (1, sizeof (css)) ; /* allocate result S */
11
if (!S) return (NULL) ; /* out of memory */
12
P = cs_amd (order, A) ; /* P = amd(A+A'), or natural */
13
S->pinv = cs_pinv (P, n) ; /* find inverse permutation */
10
S = cs_calloc (1, sizeof (css)) ; /* allocate result S */
11
if (!S) return (NULL) ; /* out of memory */
12
P = cs_amd (order, A) ; /* P = amd(A+A'), or natural */
13
S->pinv = cs_pinv (P, n) ; /* find inverse permutation */
15
15
if (order && !S->pinv) return (cs_sfree (S)) ;
16
C = cs_symperm (A, S->pinv, 0) ; /* C = spones(triu(A(P,P))) */
17
S->parent = cs_etree (C, 0) ; /* find etree of C */
18
post = cs_post (S->parent, n) ; /* postorder the etree */
16
C = cs_symperm (A, S->pinv, 0) ; /* C = spones(triu(A(P,P))) */
17
S->parent = cs_etree (C, 0) ; /* find etree of C */
18
post = cs_post (S->parent, n) ; /* postorder the etree */
19
19
c = cs_counts (C, S->parent, post, 0) ; /* find column counts of chol(C) */