linalg::factorCholesky

The Cholesky decomposition of a matrix

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

linalg::factorCholesky(A, <NoCheck>, <Real>)

Description

linalg::factorCholesky(A) computes the Cholesky factorization of a Hermitian positive definite matrix A and returns a lower triangular matrix L, such that LLH = A. Here, LH is the Hermitian conjugate of L (the complex conjugate of the transpose).

The component ring of A must be a field (a domain of category Cat::Field).

If A is not a Hermitian positive definite matrix, then linalg::factorCholesky throws an error. If you use NoCheck, linalg::factorCholesky does not check whether the matrix is Hermitian positive definite. See Example 2.

If you use Real, then linalg::factorCholesky assumes that A is real and symmetric and, therefore, does not apply complex conjugate in the course of the algorithm.

linalg::factorCholesky returns FAIL if it fails to compute the matrix L over the component ring of A. (The algorithm requires the computation of square roots of some elements in L).

Environment Interactions

Properties of identifiers are taken into account.

Examples

Example 1

Define matrix S as follows:

S := Dom::Matrix(Dom::Rational)(
  [[4, -2, 4, 2], [-2, 10, -2, -7], [4, -2, 8, 4], [2, -7, 4, 7]] 
)

Compute the Cholesky factorization of S:

L := linalg::factorCholesky(S)

Verify the result:

is(L * htranspose(L) = S)

Example 2

Define matrix H as follows:

H := matrix([[a, b], [b, a]])

linalg::factorCholesky cannot compute the Cholesky factorization because it cannot prove that H is a Hermitian matrix:

linalg::factorCholesky(H)
Error: A Hermitian matrix is expected. [linalg::factorCholesky]

If you assume that a and b are real, then matrix H is Hermitian. Still, linalg::factorCholesky cannot compute the Cholesky factorization:

linalg::factorCholesky(H) assuming a in R_ and b in R_
Error: Cannot check whether the matrix component is positive. [linalg::factorCholesky]

Use the NoCheck option to skip checking whether this matrix is Hermitian positive definite. Now, linalg::factorCholesky computes the factorization:

L := linalg::factorCholesky(H, NoCheck)

This result is not generally valid:

L*htranspose(L) = H

It is valid for 0 < a < b:

simplify(L*htranspose(L) = H) assuming 0 < b < a

Example 3

Compute the Cholesky factorization of matrix H using NoCheck to skip checking whether it is Hermitian positive definite. By default, linalg::factorCholesky computes a Hermitian factorization A = LLH . Thus, the result contains complex conjugates (implied by |a| = a*ā).

H := matrix([[a, b], [b, a]]):
L := linalg::factorCholesky(H, NoCheck)

To avoid complex conjugates in the result, use Real:

L := linalg::factorCholesky(H, NoCheck, Real)

With this option, linalg::factorCholesky computes a symmetric factorization A = LLt instead of a Hermitian factorization A = LLH :

simplify(L*transpose(L) = H)

Parameters

A

Square matrix of a domain of category Cat::Matrix.

Options

NoCheck

Skip checking whether A is Hermitian positive definite. When you use this option, the identity LLH = A is guaranteed to hold only if A is a Hermitian positive definite matrix.

Real

Compute the Cholesky factorization assuming that matrix A is symmetric and all its symbolic parameters are real. In this case, the transpose of the matrix is its Hermitian transpose. Use this option if A contains symbolic parameters, and you want to avoid complex conjugates. When using this option, the identity LLT = A is guaranteed to hold.

Return Values

Matrix of the same domain type as A, or the value FAIL.

Algorithms

The Cholesky factorization of a Hermitian positive definite n×n matrix A is a decomposition of A in a product LLH = A, such that L is a lower triangular matrix with positive entries on the main diagonal. L is called the "Cholesky factor" of A.

If L = (li, j), where 1 ≤ in, 1 ≤ jn, is the Cholesky factor of A, then .

See Also

MuPAD Functions

Related Examples

Was this topic helpful?