3 int cs_spsolve (
cs *G,
const cs *B,
int k,
int *xi,
double *x,
const int *pinv,
6 int j, J, p, q, px, top, n, *Gp, *Gi, *Bp, *Bi ;
8 if (!
CS_CSC (G) || !
CS_CSC (B) || !xi || !x)
return (-1) ;
9 Gp = G->
p ; Gi = G->
i ; Gx = G->
x ; n = G->
n ;
10 Bp = B->
p ; Bi = B->
i ; Bx = B->
x ;
12 for (p = top ; p < n ; p++) x [xi [p]] = 0 ;
13 for (p = Bp [k] ; p < Bp [k+1] ; p++) x [Bi [p]] = Bx [p] ;
14 for (px = top ; px < n ; px++)
17 J = pinv ? (pinv [j]) : j ;
19 x [j] /= Gx [lo ? (Gp [J]) : (Gp [J+1]-1)] ;
20 p = lo ? (Gp [J]+1) : (Gp [J]) ;
21 q = lo ? (Gp [J+1]) : (Gp [J+1]-1) ;
24 x [Gi [p]] -= Gx [p] * x [j] ;
int cs_reach(cs *G, const cs *B, int k, int *xi, const int *pinv)
int cs_spsolve(cs *G, const cs *B, int k, int *xi, double *x, const int *pinv, int lo)