5 CS_INT i, j, p, q, i2, j2, n, *Ap, *Ai, *Cp, *Ci, *w ;
8 if (!
CS_CSC (A))
return (NULL) ;
9 n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ;
10 C =
cs_spalloc (n, n, Ap [n], values && (Ax != NULL), 0) ;
12 if (!C || !w)
return (
cs_done (C, w, NULL, 0)) ;
13 Cp = C->p ; Ci = C->i ; Cx = C->x ;
14 for (j = 0 ; j < n ; j++)
16 j2 = pinv ? pinv [j] : j ;
17 for (p = Ap [j] ; p < Ap [j+1] ; p++)
21 i2 = pinv ? pinv [i] : i ;
26 for (j = 0 ; j < n ; j++)
28 j2 = pinv ? pinv [j] : j ;
29 for (p = Ap [j] ; p < Ap [j+1] ; p++)
33 i2 = pinv ? pinv [i] : i ;
35 if (Cx) Cx [q] = (i2 <= j2) ? Ax [p] :
CS_CONJ (Ax [p]) ;
38 return (
cs_done (C, w, NULL, 1)) ;
double cs_cumsum(CS_INT *p, CS_INT *c, CS_INT n)
cs * cs_spalloc(CS_INT m, CS_INT n, CS_INT nzmax, CS_INT values, CS_INT triplet)
void * cs_calloc(CS_INT n, size_t size)
cs * cs_done(cs *C, void *w, void *x, CS_INT ok)
cs * cs_symperm(const cs *A, const CS_INT *pinv, CS_INT values)