↑ arvau

Wikipedia / Cholesky decomposition

In linear algebra, the Cholesky decomposition or Cholesky factorization (pronounced ) is a decomposition of a Hermitian, positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose, which is useful for efficient numerical solutions, e.g., Monte Carlo simulations. It was discovered by André-Louis Cholesky for real matrices, and posthumously published in 1924. When it is applicable, the Cholesky decomposition is roughly twice as efficient as the LU decomposition for solving systems of linear equations.

Statement

The Cholesky decomposition of a Hermitian positive-definite matrix is a decomposition of the form

where is a lower triangular matrix with real and positive diagonal entries, and * denotes the conjugate transpose of . Every Hermitian positive-definite matrix (and thus also every real symmetric positive-definite matrix) has a Cholesky decomposition and the lower triangular matrix is unique if we impose the diagonal to be strictly positive.

The converse holds trivially: if can be written as for some invertible , lower triangular or otherwise, then is Hermitian and positive definite.

When where is a real lower triangular matrix with positive diagonal entries.

Positive semidefinite matrices

If a Hermitian matrix is only positive semidefinite, instead of positive definite, then it still has a decomposition of the form where the diagonal entries of are allowed to be zero. for any . However, if the rank of is , then there is a unique lower triangular with exactly positive diagonal elements and columns containing all zeroes.

Alternatively, the decomposition can be made unique when a pivoting choice is fixed. Formally, if is an positive semidefinite matrix of rank , then there is at least one permutation matrix such that has a unique decomposition of the form , where is an lower triangular matrix with positive diagonal.

LDL decomposition

A closely related variant of the classical Cholesky decomposition is the LDL decomposition, also known as Bunch-Kaufman factorization

where is a lower unit triangular (unitriangular) matrix, and is a diagonal matrix. That is, the diagonal elements of are required to be 1 at the cost of introducing an additional diagonal matrix in the decomposition. The main advantage is that the LDL decomposition can be computed and used with essentially the same algorithms, but avoids extracting square roots.

For this reason, the LDL decomposition is often called the square-root-free Cholesky decomposition. For real matrices, the factorization has the form and is often referred to as decomposition (or decomposition, or LDL′). It is reminiscent of the eigendecomposition of real symmetric matrices, , but is quite different in practice because and are not similar matrices.

The LDL decomposition is related to the classical Cholesky decomposition of the form as follows:

of a positive definite matrix, if is a diagonal matrix that contains the main diagonal, then

If is positive definite then the diagonal elements of are all positive. For positive semidefinite decomposition exists where the number of non-zero elements on the diagonal is exactly the rank of . Some indefinite matrices for which no Cholesky decomposition exists have an LDL decomposition with negative entries in : it suffices that the first leading principal minors of are non-singular.

Example

Here is the Cholesky decomposition of a symmetric real matrix:

And here is its LDLT decomposition:

Geometric interpretation

The Cholesky decomposition is equivalent to a particular choice of conjugate axes of an ellipsoid. is the unit sphere in n dimensions. That is, the ellipsoid is a linear image of the unit sphere.

. Different choices of the conjugate axes correspond to different decompositions.

is lower-triangular.

Similarly, principal component analysis is an orthogonal matrix.

Applications

Numerical solution of system of linear equations

The Cholesky decomposition is mainly used for the numerical solution of linear equations. If for by forward substitution for by back substitution.

for .

For linear systems that can be put into symmetric form, the Cholesky decomposition (or its LDL variant) is the method of choice, for superior efficiency and numerical stability. Compared to the LU decomposition, it is roughly twice as efficient.

Linear least squares

In linear least squares problem one seeks a solution of an over-determined system , such that quadratic norm of the residual vector is symmetric positive definite. Symmetric equation matrix may also come from an energy functional, which must be positive from physical considerations; this happens frequently in the numerical solution of partial differential equations.

Such method is economic and works well in many applications, however it fails for near singular , where determinant of is square of that of the original system . Then it is best to apply SVD or QR decomposition. Givens QR has the advantage that similarly to normal equations there is no need to keep the whole matrix as it is possible to update Cholesky factor with consecutive rows of .

Non-linear optimization

Non-linear least squares. An approximate Newton's method into curtailed Taylor series

and repeat the whole procedure, hoping that (i) iterations converge to a solution and (ii) that the solution is the one needed. Unfortunately neither is guaranteed and must be verified.

Non-linear least squares, because of rounding errors. Such a procedure is called a differential correction of the solution. As long as iterations converge, by virtue of the Banach fixed-point theorem. Such slow convergence may be sped by is very costly, it is possible to use it from previous iterations as long as convergence is maintained. Such Cholesky procedure may work even for Hilbert matrices, notoriously difficult to invert.

Non-linear multi-variate functions may be minimized over their parameters using variants of Newton's method called quasi-Newton is the gradient is an approximation to the Hessian matrix formed by repeating rank-1 updates at each iteration. Two well-known update formulas are called Davidon–Fletcher–Powell (DFP) and Broyden–Fletcher–Goldfarb–Shanno (BFGS). Loss of the positive-definite condition through round-off error is avoided if rather than updating an approximation to the inverse of the Hessian, one updates the Cholesky decomposition of an approximation of the Hessian matrix itself.

Monte Carlo simulation

The Cholesky decomposition is commonly used in the Monte Carlo method for simulating systems with multiple correlated variables. The covariance matrix is decomposed to give the lower-triangular . Applying this to a vector of uncorrelated observations in a sample produces a sample vector Lu with the covariance properties of the system being modeled.

(for example, via a Box–Muller transform.

Kalman filters

Unscented Kalman filters commonly use the Cholesky decomposition to choose a set of so-called sigma points. The Kalman filter tracks the average state of a system as a vector of length and covariance as an matrix . The matrix is always positive semi-definite and can be decomposed into LLT. The columns of can be added and subtracted from the mean to form a set of vectors called sigma points. These sigma points completely capture the mean and covariance of the system state.

Matrix inversion

The explicit inverse multiplications). The entire inversion can even be efficiently performed in-place.

A non-Hermitian matrix can also be inverted using the following identity, where BB* will always be Hermitian:

Data Imputation

Cholesky decomposition can also be used to impute data. Variations of the expectation maximization algorithm among other data imputation algorithms, make use of Cholesky decomposition.

Computation

There are various methods for calculating the Cholesky decomposition. The computational complexity of commonly used algorithms is in general. The algorithms described below all involve about FLOPs ( multiplications and the same number of additions) for real flavors and FLOPs for complex flavors, where is the size of the matrix . Hence, they have half the cost of the LU decomposition, which uses FLOPs (see Trefethen and Bau 1997).

Which of the algorithms below is faster depends on the details of the implementation. Generally, the first algorithm will be slightly slower because it accesses the data in a less regular manner. The Cholesky decomposition was shown to be numerically stable without need for pivoting.

The Cholesky algorithm

The Cholesky algorithm, used to calculate the decomposition matrix , is a modified version of Gaussian elimination.

The recursive algorithm starts with and

  1. .

At step , the matrix where denotes the identity matrix of dimension .

If the matrix (note that since is positive definite), then Note that is an outer product, therefore this algorithm is called the outer-product version in (Golub & Van Loan).

This is repeated for from 1 to . After steps, is obtained, and hence, the lower triangular matrix sought for is calculated as

The Cholesky–Banachiewicz and Cholesky–Crout algorithms

is written out, the following is obtained:

and therefore the following formulas for the entries of :

For complex and real matrices, inconsequential arbitrary sign changes of diagonal and associated off-diagonal elements are allowed. The expression under the square root is always positive if is real and positive-definite.

For complex Hermitian matrix, the following formula applies:

is always real and positive if is positive-definite.

So it now is possible to compute the entry if the entries to the left and above are known. The computation is usually arranged in either of the following orders:

  • The Cholesky–Banachiewicz algorithm starts from the upper left corner of the matrix and proceeds to calculate the matrix row by row.

The above algorithm can be succinctly expressed as combining a dot product and matrix multiplication in vectorized programming languages such as Fortran as the following, where conjg refers to complex conjugate of the elements.

  • The Cholesky–Crout algorithm starts from the upper left corner of the matrix and proceeds to calculate the matrix column by column.

The above algorithm can be succinctly expressed as combining a dot product and matrix multiplication in vectorized programming languages such as Fortran as the following, where conjg refers to complex conjugate of the elements.

Either pattern of access allows the entire computation to be performed in-place if desired.

Stability of the computation

Suppose that there is a desire to solve a well-conditioned system of linear equations. If the LU decomposition is used, then the algorithm is unstable unless some sort of pivoting strategy is used. In the latter case, the error depends on the so-called growth factor of the matrix, which is usually (but not always) small.

Now, suppose that the Cholesky decomposition is applicable. As mentioned above, the algorithm will be twice as fast. Furthermore, no pivoting is necessary, and the error will always be small. Specifically, if , and denotes the computed solution, then solves the perturbed system ( Here ||·||2 is the matrix 2-norm, cn is a small constant depending on , and denotes the unit round-off.

One concern with the Cholesky decomposition to be aware of is the use of square roots. If the matrix being factorized is positive definite as required, the numbers under the square roots are always positive in exact arithmetic. Unfortunately, the numbers can become negative because of round-off errors, in which case the algorithm cannot continue. However, this can only happen if the matrix is very ill-conditioned. One way to address this is to add a diagonal correction matrix to the matrix being decomposed in an attempt to promote the positive-definiteness. While this might lessen the accuracy of the decomposition, it can be very favorable for other reasons; for example, when performing Newton's method in optimization, adding a diagonal matrix can improve stability when far from the optimum.

LDL decomposition

An alternative form, eliminating the need to take square roots when is symmetric, is the symmetric indefinite factorization

The following recursive relations apply for the entries of and

This works as long as the generated diagonal elements in stay non-zero. The decomposition is then unique. and are real if is real.

For complex Hermitian matrix , the following formula applies:

Again, the pattern of access allows the entire computation to be performed in-place if desired.

Block variant

When used on indefinite matrices, the LDL* factorization is known to be unstable without careful pivoting; specifically, the elements of the factorization can grow arbitrarily. A possible improvement is to perform the factorization on block sub-matrices, commonly 2 × 2:

where every element in the matrices above is a square submatrix. From this, these analogous recursive relations follow:

This involves matrix products and explicit inversion, thus limiting the practical block size.

Updating the decomposition

.

Rank-one update

, is known as a rank-one update is still positive definite.

Here is a function written in Matlab syntax that realizes a rank-one update: A rank-n update.

Adding and removing rows and columns

is represented in block form as

These formulas may be used to determine the Cholesky factor after the insertion of rows or columns in any position, if the row and column dimensions are appropriately set (including to zero). The inverse problem,

, which allows them to be efficiently calculated using procedure detailed in the previous section.

Proof for positive semi-definite matrices

Proof by limiting argument

has a Cholesky decomposition. This result can be extended to the positive semi-definite case by a limiting argument. The argument is not fully constructive, i.e., it gives no explicit numerical algorithms for computing Cholesky factors.

positive semi-definite matrix consists of positive definite matrices in operator norm. By property of the operator norm,

is a bounded set in the Banach space of operators, therefore relatively compact (because the underlying vector space,

is also.

Proof by QR decomposition

be a positive semi-definite Hermitian matrix. Then it can be written as a product of its square root matrix. Now QR decomposition completes the proof.

Generalization

The Cholesky factorization can be generalized be a sequence of Hilbert spaces. Consider the operator matrix

acting on the direct sum

where each

is a bounded operator. If is positive (semidefinite) in the sense that for all finite and for any

, then there exists a lower triangular operator matrix such that . One can also take the diagonal entries of to be positive.

Implementations in programming libraries

  • C programming language: the GNU Scientific Library provides several implementations of Cholesky decomposition.

  • Maxima computer algebra system: function cholesky computes Cholesky decomposition.

  • GNU Octave numerical computations system provides several functions to calculate, update, and apply a Cholesky decomposition.

  • The LAPACK library provides a high performance implementation of the Cholesky decomposition that can be accessed from Fortran, C and most languages. The Cholesky decomposition is available through the *POTRF family of subroutines, and the LDL decomposition through the *HETRF family of subroutines.

  • In Python, the function cholesky from the numpy.linalg module performs Cholesky decomposition. The scipy.linalg module contains the ldl function for the LDL decomposition.

  • In Matlab, the chol function gives the Cholesky decomposition. Note that chol is upper triangular. A flag can be passed to use the lower triangular factor instead.

  • In R, the chol function returns the upper triangular Cholesky factor. You can obtain the lower triangular Cholesky factor by taking the transpose of the output.

  • In Julia, the cholesky function from the LinearAlgebra standard library gives the Cholesky decomposition.

  • In Mathematica, the function "CholeskyDecomposition" can be applied to a matrix.

In C++, multiple linear algebra libraries support this decomposition:

See also

Notes

References

History of science

  • Sur la résolution numérique des systèmes d'équations linéaires, Cholesky's 1910 manuscript, online and analyzed on BibNum [for English, click 'A télécharger']

Information

Computer code

Use of the matrix in simulation

Online calculators