cs_schol.c
Go to the documentation of this file.
00001 #include "cs.h"
00002 /* ordering and symbolic analysis for a Cholesky factorization */
00003 css *cs_schol (int order, const cs *A)
00004 {
00005     int n, *c, *post, *P ;
00006     cs *C ;
00007     css *S ;
00008     if (!CS_CSC (A)) return (NULL) ;        /* check inputs */
00009     n = A->n ;
00010     S = cs_calloc (1, sizeof (css)) ;       /* allocate result S */
00011     if (!S) return (NULL) ;                 /* out of memory */
00012     P = cs_amd (order, A) ;                 /* P = amd(A+A'), or natural */
00013     S->pinv = cs_pinv (P, n) ;              /* find inverse permutation */
00014     cs_free (P) ;
00015     if (order && !S->pinv) return (cs_sfree (S)) ;
00016     C = cs_symperm (A, S->pinv, 0) ;        /* C = spones(triu(A(P,P))) */
00017     S->parent = cs_etree (C, 0) ;           /* find etree of C */
00018     post = cs_post (S->parent, n) ;         /* postorder the etree */
00019     c = cs_counts (C, S->parent, post, 0) ; /* find column counts of chol(C) */
00020     cs_free (post) ;
00021     cs_spfree (C) ;
00022     S->cp = cs_malloc (n+1, sizeof (int)) ; /* allocate result S->cp */
00023     S->unz = S->lnz = cs_cumsum (S->cp, c, n) ; /* find column pointers for L */
00024     cs_free (c) ;
00025     return ((S->lnz >= 0) ? S : cs_sfree (S)) ;
00026 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


hogman_minimal
Author(s): Maintained by Juergen Sturm
autogenerated on Wed Dec 26 2012 15:36:47