cs_lusol.c
Go to the documentation of this file.
00001 #include "cs.h"
00002 /* x=A\b where A is unsymmetric; b overwritten with solution */
00003 int cs_lusol (int order, const cs *A, double *b, double tol)
00004 {
00005     double *x ;
00006     css *S ;
00007     csn *N ;
00008     int n, ok ;
00009     if (!CS_CSC (A) || !b) return (0) ;     /* check inputs */
00010     n = A->n ;
00011     S = cs_sqr (order, A, 0) ;              /* ordering and symbolic analysis */
00012     N = cs_lu (A, S, tol) ;                 /* numeric LU factorization */
00013     x = cs_malloc (n, sizeof (double)) ;    /* get workspace */
00014     ok = (S && N && x) ;
00015     if (ok)
00016     {
00017         cs_ipvec (N->pinv, b, x, n) ;       /* x = b(p) */
00018         cs_lsolve (N->L, x) ;               /* x = L\x */
00019         cs_usolve (N->U, x) ;               /* x = U\x */
00020         cs_ipvec (S->q, x, b, n) ;          /* b(q) = x */
00021     }
00022     cs_free (x) ;
00023     cs_sfree (S) ;
00024     cs_nfree (N) ;
00025     return (ok) ;
00026 }


hogman_minimal
Author(s): Maintained by Juergen Sturm
autogenerated on Mon Oct 6 2014 00:06:58