MATLAB Function Reference |

**Syntax**

**Description**

The `chol`

function uses only the diagonal and upper triangle of `X`

. The lower triangular is assumed to be the (complex conjugate) transpose of the upper. That is, `X`

is Hermitian.

```
R = chol(X),
```

where `X`

is positive definite produces an upper triangular `R`

so that `R'*R`

`=`

`X`

. If `X`

is not positive definite, an error message is printed.

```
[R,p] = chol(X),
```

with two output arguments, never produces an error message. If `X`

is positive definite, then `p`

is 0 and `R`

is the same as above. If `X`

is not positive definite, then `p`

is a positive integer and `R`

is an upper triangular matrix of order `q`

`=`

`p-1`

so that `R'*R`

`=`

`X(1:q,1:q`

).

**Examples**

The binomial coefficients arranged in a symmetric array create an interesting positive definite matrix.

It is interesting because its Cholesky factor consists of the same coefficients, arranged in an upper triangular matrix.

Destroy the positive definiteness (and actually make the matrix singular) by subtracting 1 from the last element.

Now an attempt to find the Cholesky factorization fails.

**Algorithm**

`chol`

uses the the LAPACK subroutines `DPOTRF`

(real) and `ZPOTRF`

(complex).

**References**

[1] Anderson, E., Z. Bai, C. Bischof, S. Blackford, J. Demmel, J. Dongarra,
J. Du Croz, A. Greenbaum, S. Hammarling, A. McKenney, and D. Sorensen,
*LAPACK User's Guide* (http://www.netlib.org/lapack/lug/
lapack_lug.html), Third Edition, SIAM, Philadelphia, 1999.

**See Also**

checkout | cholinc |