BOOL choldcmp(double** a, int n, double* p)
Given a positive-definite symmetric matrix a, this routine constructs its Colesky decomposition, a = LL'. On input, only the upper triangle of a need be given; it is not modified. The Cholesky factor L is returned in the lower traingle of a, except for its diagonal elements which are returned in p. The routine returns true if the inversion was successful, otherwise it returns false.
Parameters:
a | Matrix to decompose |
---|---|
n | Size of a. |
p | Diagonal elements of decomposed matrix. |
Returns:
TRUE if a was successfully decomposed, FALSE otherwise. On return, the lower triangle of a contains the Cholesky factor, except for the diagonal, which is returned in p.
Usage:
double** a;
double* p
BOOL success;
a = dmatrix(0, 3, 0, 3);
p = dvector(0, 3);
// initialize the a[i][j] elements
success = choldcmp(a, 4, p);
free_dmatrix(a, 0, 3, 0);
free_dvector(p, 0);
Header:
#include "linalg.h"
See Also:
choldcmp