Cholesky factorization

`R = chol(A)`

`R = chol(A,triangle)`

`[R,flag] = chol(___)`

`[R,flag,P] = chol(S)`

`[R,flag,P] = chol(___,outputForm)`

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
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`

.

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.