Qu

chol

Builtin index · Core maths

result = chol(A)

Input: A · Output: result

What it is

Lower-triangular Cholesky factor L of A = L·Lᵀ, where A is a symmetric positive-definite n×n Mat; errors clearly if A isn't positive-definite.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = chol(A)
A Matnot documented yet
result Mat
Returns an n×n Mat.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

A = [25, 15, -5; 15, 18, 0; -5, 0, 11]
L = chol(A)
print("L * L' == A: {L * L'}")
output
L * L' == A: [25, 15, -5; 15, 18, 0; -5, 0, 11]

from numerics-dsp

A = [4, 1; 1, 3]
L = chol(A)
print(L * L.ctranspose())   # reproduces A


r = svd(A)
print(r.s)   # singular values

output
[4, 1; 1, 3]
[4.618034, 2.381966]

from core-math

How it works

chol(A) — the lower-triangular factor L of A = L * L^T for a symmetric positive-definite A (a covariance matrix is the common case). Errors clearly (not a NaN-filled result) if A isn't positive-definite — the same discipline inv already applies to a singular matrix.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.