Skip to content

chol

Cholesky factorization of a Hermitian positive-definite matrix.

R = chol(A)
R = chol(A, 'lower')
[R, p] = chol(A)
[R, p, S] = chol(A, 'vector') % sparse

Returns the upper-triangular R such that R'*R = A, assuming A is Hermitian positive-definite. Pass 'lower' to return lower-triangular R with R*R' = A.

The optional second output p is 0 if A is positive-definite and a positive integer otherwise, indicating where the factorization failed (the leading minor of order p-1 was not positive-definite). For sparse matrices, the third output is a permutation that improves fill-in.

A = [4 12 -16; 12 37 -43; -16 -43 98];
R = chol(A)
norm(R' * R - A) % near-zero
  • lu — LU decomposition (with partial pivoting).
  • qr — QR decomposition.
  • linsolve — Solve a linear system with optional structure hints.