5 CS_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) ;
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_add(const cs *A, const cs *B, CS_ENTRY alpha, CS_ENTRY beta)
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_INT cs_sprealloc(cs *A, CS_INT nzmax)
CS_INT cs_scatter(const cs *A, CS_INT j, CS_ENTRY beta, CS_INT *w, CS_ENTRY *x, CS_INT mark, cs *C, CS_INT nz)
void * cs_malloc(CS_INT n, size_t size)