5 int p, j, nz = 0, anz, *
Cp, *Ci, *Bp, m, n, bnz, *w, values ;
9 if (A->
m != B->
m || A->
n != B->
n)
return (NULL) ;
10 m = A->
m ; anz = A->
p [A->
n] ;
11 n = B->
n ; Bp = B->
p ; 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)) ;
17 Cp = C->p ; Ci = C->i ; Cx = C->x ;
18 for (j = 0 ; j < n ; j++)
21 nz =
cs_scatter (A, j, alpha, w, x, j+1, C, nz) ;
22 nz =
cs_scatter (B, j, beta, w, x, j+1, C, nz) ;
23 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)
void * cs_calloc(int n, size_t size)
void * cs_malloc(int n, size_t size)
cs * cs_add(const cs *A, const cs *B, double alpha, double beta)