5 int p, j, nz = 0, anz, *
Cp, *Ci, *Bp, m, n, bnz, *w, values, *Bi ;
9 if (A->
n != B->
m)
return (NULL) ;
10 m = A->
m ; anz = A->
p [A->
n] ;
11 n = B->
n ; Bp = B->
p ; Bi = B->
i ; Bx = B->
x ; bnz = Bp [n] ;
13 values = (A->
x != NULL) && (Bx != NULL) ;
14 x = values ? (
double*)
cs_malloc (m,
sizeof (
double)) : NULL ;
16 if (!C || !w || (values && !x))
return (
cs_done (C, w, x, 0)) ;
18 for (j = 0 ; j < n ; j++)
20 if (nz + m > C->nzmax && !
cs_sprealloc (C, 2*(C->nzmax)+m))
24 Ci = C->i ; Cx = C->x ;
26 for (p = Bp [j] ; p < Bp [j+1] ; p++)
28 nz =
cs_scatter (A, Bi [p], Bx ? Bx [p] : 1, w, x, j+1, C, nz) ;
30 if (values)
for (p = Cp [j] ; p < nz ; p++) Cx [p] = x [Ci [p]] ;
cs * cs_spalloc(int m, int n, int nzmax, int values, int triplet)
cs * cs_done(cs *C, void *w, void *x, int ok)
int cs_sprealloc(cs *A, int nzmax)
int cs_scatter(const cs *A, int j, double beta, int *w, double *x, int mark, cs *C, int nz)
cs * cs_multiply(const cs *A, const cs *B)
void * cs_calloc(int n, size_t size)
void * cs_malloc(int n, size_t size)