EVSL  1.1.0
EigenValues Slicing Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
cs_cholsol.c
Go to the documentation of this file.
1 #include "cs.h"
2 /* x=A\b where A is symmetric positive definite; b overwritten with solution */
3 CS_INT cs_cholsol (CS_INT order, const cs *A, CS_ENTRY *b)
4 {
5  CS_ENTRY *x ;
6  css *S ;
7  csn *N ;
8  CS_INT n, ok ;
9  if (!CS_CSC (A) || !b) return (0) ; /* check inputs */
10  n = A->n ;
11  S = cs_schol (order, A) ; /* ordering and symbolic analysis */
12  N = cs_chol (A, S) ; /* numeric Cholesky factorization */
13  x = cs_malloc (n, sizeof (CS_ENTRY)) ; /* get workspace */
14  ok = (S && N && x) ;
15  if (ok)
16  {
17  cs_ipvec (S->pinv, b, x, n) ; /* x = P*b */
18  cs_lsolve (N->L, x) ; /* x = L\x */
19  cs_ltsolve (N->L, x) ; /* x = L'\x */
20  cs_pvec (S->pinv, x, b, n) ; /* b = P'*x */
21  }
22  cs_free (x) ;
23  cs_sfree (S) ;
24  cs_nfree (N) ;
25  return (ok) ;
26 }
CS_INT cs_lsolve(const cs *L, CS_ENTRY *x)
Definition: cs_lsolve.c:3
void * cs_free(void *p)
Definition: cs_malloc.c:22
css * cs_sfree(css *S)
Definition: cs_util.c:54
#define cs
Definition: cs.h:637
#define css
Definition: cs.h:688
#define CS_ENTRY
Definition: cs.h:635
csn * cs_chol(const cs *A, const css *S)
Definition: cs_chol.c:3
CS_INT cs_ipvec(const CS_INT *p, const CS_ENTRY *b, CS_ENTRY *x, CS_INT n)
Definition: cs_ipvec.c:3
CS_INT cs_ltsolve(const cs *L, CS_ENTRY *x)
Definition: cs_ltsolve.c:3
#define csn
Definition: cs.h:689
#define CS_CSC(A)
Definition: cs.h:659
CS_INT cs_cholsol(CS_INT order, const cs *A, CS_ENTRY *b)
Definition: cs_cholsol.c:3
#define CS_INT
Definition: cs.h:627
csn * cs_nfree(csn *N)
Definition: cs_util.c:43
void * cs_malloc(CS_INT n, size_t size)
Definition: cs_malloc.c:10
css * cs_schol(CS_INT order, const cs *A)
Definition: cs_schol.c:3
CS_INT cs_pvec(const CS_INT *p, const CS_ENTRY *b, CS_ENTRY *x, CS_INT n)
Definition: cs_pvec.c:3