cs_cholsol.c
Go to the documentation of this file.
00001 #include "cs.h"
00002 /* x=A\b where A is symmetric positive definite; b overwritten with solution */
00003 int cs_cholsol (int order, const cs *A, double *b)
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_schol (order, A) ;               /* ordering and symbolic analysis */
00012     N = cs_chol (A, S) ;                    /* numeric Cholesky factorization */
00013     x = cs_malloc (n, sizeof (double)) ;    /* get workspace */
00014     ok = (S && N && x) ;
00015     if (ok)
00016     {
00017         cs_ipvec (S->pinv, b, x, n) ;   /* x = P*b */
00018         cs_lsolve (N->L, x) ;           /* x = L\x */
00019         cs_ltsolve (N->L, x) ;          /* x = L'\x */
00020         cs_pvec (S->pinv, x, b, n) ;    /* b = P'*x */
00021     }
00022     cs_free (x) ;
00023     cs_sfree (S) ;
00024     cs_nfree (N) ;
00025     return (ok) ;
00026 }
00027 


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