chol

Cholesky decomposition.

Syntax

R = chol(A)

[R,p] = chol(A,'upper')

[L,p] = chol(A,'lower')

Inputs

A
The symmetric positive definite matrix to decompose.
Type: double
Dimension: matrix

Outputs

R
The upper triangular matrix.
L
The lower triangular matrix.
p
Success/Fail flag.

Example

chol([1,2,3;2,20,26;3,26,70])
R = [Matrix] 3 x 3
1 2 3
0 4 5
0 0 6

Comments

[R] = chol(A,'upper') computes matrix R such that A = R'R

[L] = chol(A,'lower') computes matrix L such that A = LL'

For [...,p] = chol(A,...), if p != 0 then the decomposition failed, and only the first p-1 rows and columns of R or L is returned.

chol uses the LAPACK routine 'dpotrf'. Symmetry is assumed for A.