5 int i, k, p, pa, n = A->
n, m = A->
m, *Ap = A->
p, *Ai = A->
i, *
next, *
head,
6 *
tail, *nque, *pinv, *leftmost, *w, *parent = S->
parent ;
9 w = (
int*)
cs_malloc (m+3*n,
sizeof (
int)) ;
10 if (!pinv || !w || !leftmost)
15 next = w ; head = w + m ; tail = w + m + n ; nque = w + m + 2*n ;
16 for (k = 0 ; k < n ; k++) head [k] = -1 ;
17 for (k = 0 ; k < n ; k++) tail [k] = -1 ;
18 for (k = 0 ; k < n ; k++) nque [k] = 0 ;
19 for (i = 0 ; i < m ; i++) leftmost [i] = -1 ;
20 for (k = n-1 ; k >= 0 ; k--)
22 for (p = Ap [k] ; p < Ap [k+1] ; p++)
24 leftmost [Ai [p]] = k ;
27 for (i = m-1 ; i >= 0 ; i--)
31 if (k == -1) continue ;
32 if (nque [k]++ == 0) tail [k] = i ;
38 for (k = 0 ; k < n ; k++)
42 if (i < 0) i = S->
m2++ ;
44 if (--nque [k] <= 0) continue ;
46 if ((pa = parent [k]) != -1)
48 if (nque [pa] == 0) tail [pa] = tail [k] ;
49 next [tail [k]] = head [pa] ;
50 head [pa] =
next [i] ;
51 nque [pa] += nque [k] ;
54 for (i = 0 ; i < m ; i++)
if (pinv [i] < 0) pinv [i] = k++ ;
62 int n, k, ok = 1, *post ;
64 if (!
CS_CSC (A))
return (NULL) ;
67 if (!S)
return (NULL) ;
69 if (order && !S->
q)
return (
cs_sfree (S)) ;
78 if (ok)
for (S->
unz = 0, k = 0 ; k < n ; k++) S->
unz += S->
cp [k] ;
79 ok = ok && S->
lnz >= 0 && S->
unz >= 0 ;
84 S->
unz = 4*(A->
p [n]) + n ;
css * cs_sqr(int order, const cs *A, int qr)
cs * cs_permute(const cs *A, const int *pinv, const int *q, int values)
int * cs_post(const int *parent, int n)
static int cs_vcount(const cs *A, css *S)
int * cs_etree(const cs *A, int ata)
SegmentReturnType tail(Index vecSize)
void * cs_calloc(int n, size_t size)
void * cs_malloc(int n, size_t size)
SegmentReturnType head(Index vecSize)
int * cs_amd(int order, const cs *A)
Expression next(const Expression &arg)
int * cs_counts(const cs *A, const int *parent, const int *post, int ata)