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