00001 #include "cs.h" 00002 /* solve L'x=b where x and b are dense. x=b on input, solution on output. */ 00003 int cs_ltsolve (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 = n-1 ; j >= 0 ; j--) 00010 { 00011 for (p = Lp [j]+1 ; p < Lp [j+1] ; p++) 00012 { 00013 x [j] -= Lx [p] * x [Li [p]] ; 00014 } 00015 x [j] /= Lx [Lp [j]] ; 00016 } 00017 return (1) ; 00018 }