EVSL
1.1.0
EigenValues Slicing Library
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
EXTERNAL
CXSparse
Source
cs_schol.c
Go to the documentation of this file.
1
#include "
cs.h
"
2
/* ordering and symbolic analysis for a Cholesky factorization */
3
css
*
cs_schol
(
CS_INT
order,
const
cs
*A)
4
{
5
CS_INT
n, *c, *post, *P ;
6
cs
*C ;
7
css
*S ;
8
if
(!
CS_CSC
(A))
return
(NULL) ;
/* check inputs */
9
n = A->n ;
10
S =
cs_calloc
(1,
sizeof
(
css
)) ;
/* allocate result S */
11
if
(!S)
return
(NULL) ;
/* out of memory */
12
P =
cs_amd
(order, A) ;
/* P = amd(A+A'), or natural */
13
S->pinv =
cs_pinv
(P, n) ;
/* find inverse permutation */
14
cs_free
(P) ;
15
if
(order && !S->pinv)
return
(
cs_sfree
(S)) ;
16
C =
cs_symperm
(A, S->pinv, 0) ;
/* C = spones(triu(A(P,P))) */
17
S->parent =
cs_etree
(C, 0) ;
/* find etree of C */
18
post =
cs_post
(S->parent, n) ;
/* postorder the etree */
19
c =
cs_counts
(C, S->parent, post, 0) ;
/* find column counts of chol(C) */
20
cs_free
(post) ;
21
cs_spfree
(C) ;
22
S->cp =
cs_malloc
(n+1,
sizeof
(
CS_INT
)) ;
/* allocate result S->cp */
23
S->unz = S->lnz =
cs_cumsum
(S->cp, c, n) ;
/* find column pointers for L */
24
cs_free
(c) ;
25
return
((S->lnz >= 0) ? S :
cs_sfree
(S)) ;
26
}
cs_post
CS_INT * cs_post(const CS_INT *parent, CS_INT n)
Definition:
cs_post.c:3
cs_free
void * cs_free(void *p)
Definition:
cs_malloc.c:22
cs_sfree
css * cs_sfree(css *S)
Definition:
cs_util.c:54
cs_pinv
CS_INT * cs_pinv(CS_INT const *p, CS_INT n)
Definition:
cs_pinv.c:3
cs
#define cs
Definition:
cs.h:637
cs_cumsum
double cs_cumsum(CS_INT *p, CS_INT *c, CS_INT n)
Definition:
cs_cumsum.c:3
css
#define css
Definition:
cs.h:688
cs_spfree
cs * cs_spfree(cs *A)
Definition:
cs_util.c:33
cs_etree
CS_INT * cs_etree(const cs *A, CS_INT ata)
Definition:
cs_etree.c:3
cs.h
cs_amd
CS_INT * cs_amd(CS_INT order, const cs *A)
Definition:
cs_amd.c:18
CS_CSC
#define CS_CSC(A)
Definition:
cs.h:659
cs_calloc
void * cs_calloc(CS_INT n, size_t size)
Definition:
cs_malloc.c:16
CS_INT
#define CS_INT
Definition:
cs.h:627
cs_symperm
cs * cs_symperm(const cs *A, const CS_INT *pinv, CS_INT values)
Definition:
cs_symperm.c:3
cs_counts
CS_INT * cs_counts(const cs *A, const CS_INT *parent, const CS_INT *post, CS_INT ata)
Definition:
cs_counts.c:17
cs_malloc
void * cs_malloc(CS_INT n, size_t size)
Definition:
cs_malloc.c:10
cs_schol
css * cs_schol(CS_INT order, const cs *A)
Definition:
cs_schol.c:3
Generated by
1.8.6