00001 #include "cs.h" 00002 /* solve Lx=b where x and b are dense. x=b on input, solution on output. */ 00003 int cs_lsolve (const cs *L, double *x) 00004 { 00005 int p, j, n, *Lp, *Li ; 00006 double *Lx ; 00007 if (!CS_CSC (L) || !x) return (0) ; /* check inputs */ 00008 n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ; 00009 for (j = 0 ; j < n ; j++) 00010 { 00011 x [j] /= Lx [Lp [j]] ; 00012 for (p = Lp [j]+1 ; p < Lp [j+1] ; p++) 00013 { 00014 x [Li [p]] -= Lx [p] * x [j] ; 00015 } 00016 } 00017 return (1) ; 00018 }