5 CS_INT p, q, j, *Cp, *Ci, n, m, *Ap, *Ai, *w ;
8 if (!
CS_CSC (A))
return (NULL) ;
9 m = A->m ; n = A->n ; Ap = A->p ; Ai = A->i ; Ax = A->x ;
10 C =
cs_spalloc (n, m, Ap [n], values && Ax, 0) ;
12 if (!C || !w)
return (
cs_done (C, w, NULL, 0)) ;
13 Cp = C->p ; Ci = C->i ; Cx = C->x ;
14 for (p = 0 ; p < Ap [n] ; p++) w [Ai [p]]++ ;
16 for (j = 0 ; j < n ; j++)
18 for (p = Ap [j] ; p < Ap [j+1] ; p++)
20 Ci [q = w [Ai [p]]++] = j ;
21 if (Cx) Cx [q] = (values > 0) ?
CS_CONJ (Ax [p]) : Ax [p] ;
24 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_transpose(const cs *A, CS_INT values)
cs * cs_done(cs *C, void *w, void *x, CS_INT ok)