# chol

Cholesky factorization

## Syntax

## Description

specifies which triangular factor of `R`

= chol(`A`

,`triangle`

)`A`

to use in computing the
factorization. For example, if `triangle`

is `'lower'`

,
then `chol`

uses only the diagonal and lower triangular portion of
`A`

to produce a lower triangular matrix `R`

that
satisfies `A = R*R'`

. The default value of `triangle`

is
`'upper'`

.

`[`

also returns the output `R`

,`flag`

] = chol(___)`flag`

indicating whether `A`

is
symmetric positive
definite. You can use any of the input argument combinations in previous syntaxes.
When you specify the `flag`

output, `chol`

does not
generate an error if the input matrix is not symmetric positive definite.

If

`flag = 0`

then the input matrix is symmetric positive definite and the factorization was successful.If

`flag`

is not zero, then the input matrix is*not*symmetric positive definite and`flag`

is an integer indicating the index of the pivot position where the factorization failed.

`[`

specifies whether to return the permutation information `R`

,`flag`

,`P`

] = chol(___,`outputForm`

)`P`

as a matrix or
vector, using any of the input argument combinations in previous syntaxes. This option is
only available for sparse matrix inputs. For example, if `outputForm`

is
`'vector'`

and `flag = 0`

, then ```
S(p,p) =
R'*R
```

. The default value of `outputForm`

is
`'matrix'`

such that `R'*R = P'*S*P`

.

## Examples

## Input Arguments

## Output Arguments

## More About

## Tips

Use

`chol`

(instead of`eig`

) to efficiently determine whether a matrix is symmetric positive definite. See Determine Whether Matrix Is Symmetric Positive Definite for more information.

## References

[1] Anderson, E., ed. *LAPACK Users’ Guide*. 3rd ed. Software, Environments, Tools.
Philadelphia: Society for Industrial and Applied Mathematics, 1999. https://doi.org/10.1137/1.9780898719604.

[2] Chen, Yanqing, Timothy A. Davis,
William W. Hager, and Sivasankaran Rajamanickam. “Algorithm 887: CHOLMOD, Supernodal Sparse
Cholesky Factorization and Update/Downdate.” *ACM Transactions on Mathematical
Software* 35, no. 3 (October 2008): 1–14. https://doi.org/10.1145/1391989.1391995.

## Extended Capabilities

## Version History

**Introduced before R2006a**