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

<math display=block>\mathbf{A} = \mathbf{L L}^{*},</math>

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 is a real matrix (hence symmetric positive-definite), the factorization may be written

<math display=block>\mathbf{A} = \mathbf{L L}^\mathsf{T},</math>

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.

The decomposition need not be unique, for example:

<math display=block>\begin{bmatrix}0 & 0 \\0 & 1\end{bmatrix} = \mathbf L \mathbf L^*, \quad \quad \mathbf L=\begin{bmatrix}0 & 0\\ \cos \theta & \sin\theta\end{bmatrix},</math>

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 with

<math display=inline> \mathbf L = \begin{bmatrix} \mathbf L_1 & 0 \\ \mathbf L_2 & 0\end{bmatrix} </math>,

where is an lower triangular matrix with positive diagonal.

LDL decomposition

A closely related variant of the classical Cholesky decomposition is the LDL decomposition,

<math display=block>\mathbf{A} = \mathbf{L D L}^*,</math>

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:

<math display=block>\mathbf{A} = \mathbf{L D L}^* = \mathbf L \mathbf D^{1/2} \left(\mathbf D^{1/2} \right)^* \mathbf L^* =

\mathbf L \mathbf D^{1/2} \left(\mathbf L \mathbf D^{1/2}\right)^*.</math>

Conversely, given the classical Cholesky decomposition <math display=inline>\mathbf A = \mathbf C \mathbf C^*</math> of a positive definite matrix, if is a diagonal matrix that contains the main diagonal of <math display="inline">\mathbf C</math>, then can be decomposed as <math display=inline>\mathbf L \mathbf D \mathbf L^*</math> where

<math display=block> \mathbf L = \mathbf C \mathbf S^{-1} </math> (this rescales each column to make diagonal elements 1),

<math display="block"> \mathbf D = \mathbf S\mathbf S^*. </math>

If is positive definite then the diagonal elements of are all positive.

For positive semidefinite , an <math display=inline>\mathbf L \mathbf D \mathbf L^*</math> 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:

<math display=block>\begin{align}

\begin{pmatrix}

4 & 12 & -16 \\

12 & 37 & -43 \\

-16 & -43 & 98 \\

\end{pmatrix}

=

\begin{pmatrix}

2 & 0 & 0 \\

6 & 1 & 0 \\

-8 & 5 & 3 \\

\end{pmatrix}

\begin{pmatrix}

2 & 6 & -8 \\

0 & 1 & 5 \\

0 & 0 & 3 \\

\end{pmatrix}.

\end{align}</math>

And here is its LDL<sup>T</sup> decomposition:

<math display=block>\begin{align}

\begin{pmatrix}

4 & 12 & -16 \\

12 & 37 & -43 \\

-16 & -43 & 98 \\

\end{pmatrix}

& =

\begin{pmatrix}

1 & 0 & 0 \\

3 & 1 & 0 \\

-4 & 5 & 1 \\

\end{pmatrix}

\begin{pmatrix}

4 & 0 & 0 \\

0 & 1 & 0 \\

0 & 0 & 9 \\

\end{pmatrix}

\begin{pmatrix}

1 & 3 & -4 \\

0 & 1 & 5 \\

0 & 0 & 1 \\

\end{pmatrix}.

\end{align}</math>

Geometric interpretation

thumb|The ellipse is a linear image of the unit circle. The two vectors <math display=inline>v_1, v_2</math> are conjugate axes of the ellipse chosen such that <math display=inline>v_1</math> is parallel to the first axis and <math display=inline>v_2</math> is within the plane spanned by the first two axes.

The Cholesky decomposition is equivalent to a particular choice of conjugate axes of an ellipsoid. In detail, let the ellipsoid be defined as <math display=inline>y^TAy = 1</math>, then by definition, a set of vectors <math display=inline>v_1, ..., v_n</math> are conjugate axes of the ellipsoid iff <math display=inline>v_i^T A v_j = \delta_{ij}</math>. Then, the ellipsoid is precisely<math display="block">\left\{ \sum_i x_i v_i : x^T x = 1 \right\} = f(\mathbb S^n)</math>where <math display=inline>f</math> maps the basis vector <math display=inline>e_i \mapsto v_i</math>, and <math display=inline>\mathbb S^n</math> is the unit sphere in n dimensions. That is, the ellipsoid is a linear image of the unit sphere.

Define the matrix <math display=inline>V := [v_1 | v_2 | \cdots | v_n]</math>, then <math display=inline>v_i^T A v_j = \delta_{ij}</math> is equivalent to <math display=inline>V^TAV = I</math>. Different choices of the conjugate axes correspond to different decompositions.

The Cholesky decomposition corresponds to choosing <math display=inline>v_1</math> to be parallel to the first axis, <math display=inline>v_2</math> to be within the plane spanned by the first two axes, and so on. This makes <math display=inline>V</math> an upper-triangular matrix. Then, there is <math display=inline>A = LL^T</math>, where <math display=inline>L = (V^{-1})^T</math> is lower-triangular.

Similarly, principal component analysis corresponds to choosing <math display=inline>v_1, ..., v_n</math> to be perpendicular. Then, let <math display=inline>\lambda = 1/\|v_i\|^2</math> and <math display=inline>\Sigma = \mathrm{diag}(\lambda_1, ..., \lambda_n)</math>, and there is <math display=inline>V = U\Sigma^{-1/2}</math> where <math display=inline>U</math> is an orthogonal matrix. This then yields <math display="inline">A = U\Sigma U^T</math>.

Applications

Numerical solution of system of linear equations

The Cholesky decomposition is mainly used for the numerical solution of linear equations <math display=inline>\mathbf{Ax} = \mathbf{b}</math>. If is symmetric and positive definite, then <math display=inline>\mathbf{Ax} = \mathbf{b}</math> can be solved by first computing the Cholesky decomposition <math display=inline>\mathbf{A} = \mathbf{LL}^\mathrm{*}</math>, then solving <math display=inline>\mathbf{Ly} = \mathbf{b}</math> for by forward substitution, and finally solving <math display=inline>\mathbf{L^*x} = \mathbf{y}</math> for by back substitution.

An alternative way to eliminate taking square roots in the <math display=inline>\mathbf{LL}^\mathrm{*}</math> decomposition is to compute the LDL decomposition <math display=inline>\mathbf{A} = \mathbf{LDL}^\mathrm{*}</math>, then solving <math display=inline>\mathbf{Ly} = \mathbf{b}</math> for , and finally solving <math display=inline>\mathbf{DL}^\mathrm{*}\mathbf{x} = \mathbf{y}</math>.

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.

Non-linear multi-variate functions may be minimized over their parameters using variants of Newton's method called quasi-Newton methods. At iteration k, the search steps in a direction <math display=inline> p_k </math> defined by solving <math display=inline> B_k p_k = -g_k </math> for <math display=inline> p_k </math>, where <math display=inline> p_k </math> is the step direction, <math display=inline> g_k </math> is the gradient, and <math display=inline> B_k </math> 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.

The following simplified example shows the economy one gets from the Cholesky decomposition: suppose the goal is to generate two correlated normal variables <math display=inline>x_1</math> and <math display=inline>x_2</math> with given correlation coefficient <math display=inline>\rho</math>. To accomplish that, it is necessary to first generate two uncorrelated Gaussian random variables <math display=inline>z_1</math> and <math display=inline>z_2</math> (for example, via a Box–Muller transform). Given the required correlation coefficient <math display=inline>\rho</math>, the correlated normal variables can be obtained via the transformations <math display=inline>x_1 = z_1</math> and <math display="inline">x_2 = \rho z_1 + \sqrt{1 - \rho^2} z_2</math>.

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 LL<sup>T</sup>. 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 of a Hermitian matrix can be computed by Cholesky decomposition, in a manner similar to solving linear systems, using <math display=inline>n^3</math> operations (<math display=inline>\tfrac{1}{2} n^3</math> multiplications).

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

:.

At step , the matrix has the following form:

<math display=block>\mathbf{A}^{(i)}=

\begin{pmatrix}

\mathbf{I}_{i-1} & 0 & 0 \\

0 & a_{i,i} & \mathbf{b}_{i}^{*} \\

0 & \mathbf{b}_{i} & \mathbf{B}^{(i)}

\end{pmatrix},

</math>

where denotes the identity matrix of dimension .

If the matrix is defined by

<math display=block>\mathbf{L}_{i}:=

\begin{pmatrix}

\mathbf{I}_{i-1} & 0 & 0 \\

0 & \sqrt{a_{i,i & 0 \\

0 & \frac{1}{\sqrt{a_{i,i} \mathbf{b}_{i} & \mathbf{I}_{n-i}

\end{pmatrix},

</math>

(note that since is positive definite),

then can be written as

<math display=block>\mathbf{A}^{(i)} = \mathbf{L}_{i} \mathbf{A}^{(i+1)} \mathbf{L}_{i}^{*}</math>

where

<math display=block>\mathbf{A}^{(i+1)}=

\begin{pmatrix}

\mathbf{I}_{i-1} & 0 & 0 \\

0 & 1 & 0 \\

0 & 0 & \mathbf{B}^{(i)} - \frac{1}{a_{i,i \mathbf{b}_{i} \mathbf{b}_{i}^{*}

\end{pmatrix}.</math>

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

<math display=block>\mathbf{L} := \mathbf{L}_{1} \mathbf{L}_{2} \dots \mathbf{L}_{n}.</math>

The Cholesky–Banachiewicz and Cholesky–Crout algorithms

thumb|Access pattern (white) and writing pattern (yellow) for the in-place Cholesky—Banachiewicz algorithm on a 5×5 matrix

If the equation

<math display=block>\begin{align}

\mathbf{A} = \mathbf{LL}^T & =

\begin{pmatrix} L_{11} & 0 & 0 \\

L_{21} & L_{22} & 0 \\

L_{31} & L_{32} & L_{33}\\

\end{pmatrix}

\begin{pmatrix} L_{11} & L_{21} & L_{31} \\

0 & L_{22} & L_{32} \\

0 & 0 & L_{33}

\end{pmatrix} \\[8pt]

& =

\begin{pmatrix} L_{11}^2 & &(\text{symmetric}) \\

L_{21}L_{11} & L_{21}^2 + L_{22}^2& \\

L_{31}L_{11} & L_{31}L_{21}+L_{32}L_{22} & L_{31}^2 + L_{32}^2+L_{33}^2

\end{pmatrix},

\end{align}</math>

is written out, the following is obtained:

<math display=block>\begin{align}

\mathbf{L} =

\begin{pmatrix} \sqrt{A_{11 & 0 & 0 \\

A_{21}/L_{11} & \sqrt{A_{22} - L_{21}^2} & 0 \\

A_{31}/L_{11} & \left( A_{32} - L_{31}L_{21} \right) /L_{22} &\sqrt{A_{33}- L_{31}^2 - L_{32}^2}

\end{pmatrix}

\end{align}</math>

and therefore the following formulas for the entries of :

<math display=block> L_{j,j} = (\pm)\sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^2 }, </math>

<math display=block> L_{i,j} = \frac{1}{L_{j,j \left( A_{i,j} - \sum_{k=1}^{j-1} L_{i,k} L_{j,k} \right) \quad \text{for } i>j. </math>

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:

<math display=block> L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, </math>

<math display=block> L_{i,j} = \frac{1}{L_{j,j \left( A_{i,j} - \sum_{k=1}^{j-1} L_{j,k}^* L_{i,k} \right) \quad \text{for } i>j. </math>

and it can be shown that <math>L_{j,j}</math> 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.

<syntaxhighlight lang="C">

for (i = 0; i < dimensionSize; i++) {

for (j = 0; j <= i; j++) {

float sum = 0;

for (k = 0; k < j; k++)

sum += L[i][k] * L[j][k];

if (i == j)

L[i][j] = sqrt(A[i][i] - sum);

else

L[i][j] = (1.0 / L[j][j] * (A[i][j] - sum));

}

}

</syntaxhighlight>

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,

<syntaxhighlight lang="Fortran">

do i = 1, size(A,1)

L(i,i) = sqrt(A(i,i) - dot_product(L(i,1:i-1), L(i,1:i-1)))

L(i+1:,i) = (A(i+1:,i) - matmul(conjg(L(i,1:i-1)), L(i+1:,1:i-1))) / L(i,i)

end do

</syntaxhighlight>

where <code>conjg</code> 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. <syntaxhighlight lang="C">

for (j = 0; j < dimensionSize; j++) {

float sum = 0;

for (k = 0; k < j; k++) {

sum += L[j][k] * L[j][k];

}

L[j][j] = sqrt(A[j][j] - sum);

for (i = j + 1; i < dimensionSize; i++) {

sum = 0;

for (k = 0; k < j; k++) {

sum += L[i][k] * L[j][k];

}

L[i][j] = (1.0 / L[j][j] * (A[i][j] - sum));

}

}

</syntaxhighlight>

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,

<syntaxhighlight lang="Fortran">

do i = 1, size(A,1)

L(i,i) = sqrt(A(i,i) - dot_product(L(1:i-1,i), L(1:i-1,i)))

L(i,i+1:) = (A(i,i+1:) - matmul(conjg(L(1:i-1,i)), L(1:i-1,i+1:))) / L(i,i)

end do

</syntaxhighlight>

where <code>conjg</code> 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 (, where

<math display=block> \|\mathbf{E}\|_2 \le c_n \varepsilon \|\mathbf{A}\|_2. </math>

Here ||·||<sub>2</sub> is the matrix 2-norm, c<sub>n</sub> 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

<math display=block>

\begin{align}

\mathbf{A} = \mathbf{LDL}^\mathrm{T} & =

\begin{pmatrix} 1 & 0 & 0 \\

L_{21} & 1 & 0 \\

L_{31} & L_{32} & 1\\

\end{pmatrix}

\begin{pmatrix} D_1 & 0 & 0 \\

0 & D_2 & 0 \\

0 & 0 & D_3\\

\end{pmatrix}

\begin{pmatrix} 1 & L_{21} & L_{31} \\

0 & 1 & L_{32} \\

0 & 0 & 1\\

\end{pmatrix} \\[8pt]

& = \begin{pmatrix} D_1 & &(\mathrm{symmetric}) \\

L_{21}D_1 & L_{21}^2D_1 + D_2& \\

L_{31}D_1 & L_{31}L_{21}D_{1}+L_{32}D_2 & L_{31}^2D_1 + L_{32}^2D_2+D_3.

\end{pmatrix}.

\end{align}

</math>

The following recursive relations apply for the entries of and :

<math display=block> D_j = A_{jj} - \sum_{k=1}^{j-1} L_{jk}^2 D_k, </math>

<math display=block> L_{ij} = \frac{1}{D_j} \left( A_{ij} - \sum_{k=1}^{j-1} L_{ik} L_{jk} D_k \right) \quad \text{for } i>j. </math>

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:

<math display=block> D_{j} = A_{jj} - \sum_{k=1}^{j-1} L_{jk}L_{jk}^* D_k, </math>

<math display=block> L_{ij} = \frac{1}{D_j} \left( A_{ij} - \sum_{k=1}^{j-1} L_{ik} L_{jk}^* D_k \right) \quad \text{for } i>j. </math>

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:

<math display=block>\begin{align}

\mathbf{A} = \mathbf{LDL}^\mathrm{T} & =

\begin{pmatrix}

\mathbf I & 0 & 0 \\

\mathbf L_{21} & \mathbf I & 0 \\

\mathbf L_{31} & \mathbf L_{32} & \mathbf I\\

\end{pmatrix}

\begin{pmatrix}

\mathbf D_1 & 0 & 0 \\

0 & \mathbf D_2 & 0 \\

0 & 0 & \mathbf D_3\\

\end{pmatrix}

\begin{pmatrix}

\mathbf I & \mathbf L_{21}^\mathrm T & \mathbf L_{31}^\mathrm T \\

0 & \mathbf I & \mathbf L_{32}^\mathrm T \\

0 & 0 & \mathbf I\\

\end{pmatrix} \\[8pt]

& = \begin{pmatrix}

\mathbf D_1 & &(\mathrm{symmetric}) \\

\mathbf L_{21} \mathbf D_1 & \mathbf L_{21} \mathbf D_1 \mathbf L_{21}^\mathrm T + \mathbf D_2& \\

\mathbf L_{31} \mathbf D_1 & \mathbf L_{31} \mathbf D_{1} \mathbf L_{21}^\mathrm T + \mathbf L_{32} \mathbf D_2 & \mathbf L_{31} \mathbf D_1 \mathbf L_{31}^\mathrm T + \mathbf L_{32} \mathbf D_2 \mathbf L_{32}^\mathrm T + \mathbf D_3

\end{pmatrix},

\end{align}

</math>

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

<math display=block>\mathbf D_j = \mathbf A_{jj} - \sum_{k=1}^{j-1} \mathbf L_{jk} \mathbf D_k \mathbf L_{jk}^\mathrm T,</math>

<math display=block>\mathbf L_{ij} = \left(\mathbf A_{ij} - \sum_{k=1}^{j-1} \mathbf L_{ik} \mathbf D_k \mathbf L_{jk}^\mathrm T\right) \mathbf D_j^{-1}.</math>

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

Updating the decomposition

A task that often arises in practice is that one needs to update a Cholesky decomposition. In more details, one has already computed the Cholesky decomposition <math display=inline>\mathbf{A} = \mathbf{L}\mathbf{L}^*</math> of some matrix <math display=inline>\mathbf{A}</math>, then one changes the matrix <math display=inline>\mathbf{A}</math> in some way into another matrix, say <math display=inline> \tilde{\mathbf{A </math>, and one wants to compute the Cholesky decomposition of the updated matrix: <math display=inline> \tilde{\mathbf{A = \tilde{\mathbf{L \tilde{\mathbf{L^* </math>. The question is now whether one can use the Cholesky decomposition of <math display=inline>\mathbf{A}</math> that was computed before to compute the Cholesky decomposition of <math display=inline> \tilde{\mathbf{A </math>.

Rank-one update

The specific case, where the updated matrix <math display=inline> \tilde{\mathbf{A </math> is related to the matrix <math display=inline>\mathbf{A}</math> by <math display="inline">\tilde{\mathbf{A = \mathbf{A} + c\,\mathbf{x} \mathbf{x}^*</math>, is known as a rank-one update. Here the constant <math> c </math> is allowed to be negative, but must always be such that the new matrix <math display="inline"> \tilde{\mathbf{A </math> is still positive definite.

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

<syntaxhighlight lang="matlab">

function L=updateChol(L,x,c)

% given the L*L' Cholesky decomposition of a matrix, compute the updated

% factor L so that we have the Cholesky decomposition of L*L'+c*x*x';

n=length(x);

for k=1:n-1

l=L(:,k); % old value of k-th column

lk=l(k);

xk=x(k);

dk=sqrt(lk^2+c*xk^2); % new diagonal value

L(:,k)=(lk/dk)*l+(c*xk/dk)*x; % new column value

x=x-l*(xk/lk);

c=c*(lk/dk)^2;

end

L(n,n)=sqrt(L(n,n)^2+c*x(n)^2);

end

</syntaxhighlight>

A rank-n update is one where for a matrix <math display=inline>\mathbf{M}</math> one updates the decomposition such that <math display=inline> \tilde{\mathbf{A = \mathbf{A} + \mathbf{M} \mathbf{M}^* </math>. This can be achieved by successively performing rank-one updates for each of the columns of <math display=inline>\mathbf{M}</math>.

Adding and removing rows and columns

If a symmetric and positive definite matrix <math display=inline> \mathbf A </math> is represented in block form as

<math display=block>

\mathbf{A} =

\begin{pmatrix}

\mathbf A_{11} & \mathbf A_{13} \\

\mathbf A_{13}^{\mathrm{T & \mathbf A_{33} \\

\end{pmatrix}

</math>

and its upper Cholesky factor

<math display=block>

\mathbf{L} =

\begin{pmatrix}

\mathbf L_{11} & \mathbf L_{13} \\

0 & \mathbf L_{33} \\

\end{pmatrix},

</math>

then for a new matrix <math display=inline> \tilde{\mathbf{A </math>, which is the same as <math display=inline> \mathbf A </math> but with the insertion of new rows and columns,

<math display=block>\begin{align}

\tilde{\mathbf{A &=

\begin{pmatrix}

\mathbf A_{11} & \mathbf A_{12} & \mathbf A_{13} \\

\mathbf A_{12}^{\mathrm{T & \mathbf A_{22} & \mathbf A_{23} \\

\mathbf A_{13}^{\mathrm{T & \mathbf A_{23}^{\mathrm{T & \mathbf A_{33} \\

\end{pmatrix}

\end{align}

</math>

Now there is an interest in finding the Cholesky factorization of <math display=inline> \tilde{\mathbf{A </math>, which can be called <math display=inline> \tilde{\mathbf S} </math>, without directly computing the entire decomposition.

<math display=block>\begin{align}

\tilde{\mathbf{S &=

\begin{pmatrix}

\mathbf S_{11} & \mathbf S_{12} & \mathbf S_{13} \\

0 & \mathbf S_{22} & \mathbf S_{23} \\

0 & 0 & \mathbf S_{33} \\

\end{pmatrix}.

\end{align}

</math>

Writing <math display=inline> \mathbf A \setminus \mathbf{b}</math> for the solution of <math display=inline> \mathbf A \mathbf x = \mathbf b</math>, which can be found easily for triangular matrices, and <math display=inline> \text{chol} (\mathbf M)</math> for the Cholesky decomposition of <math display=inline> \mathbf M </math>, the following relations can be found:

<math display=block>\begin{align}

\mathbf S_{11} &= \mathbf L_{11}, \\

\mathbf S_{12} &= \mathbf L_{11}^{\mathrm{T \setminus \mathbf A_{12}, \\

\mathbf S_{13} &= \mathbf L_{13}, \\

\mathbf S_{22} &= \mathrm{chol} \left(\mathbf A_{22} - \mathbf S_{12}^{\mathrm{T \mathbf S_{12}\right), \\

\mathbf S_{23} &= \mathbf S_{22}^{\mathrm{T \setminus \left(\mathbf A_{23} - \mathbf S_{12}^{\mathrm{T \mathbf S_{13}\right), \\

\mathbf S_{33} &= \mathrm{chol} \left(\mathbf L_{33}^{\mathrm{T \mathbf L_{33} - \mathbf S_{23}^{\mathrm{T \mathbf S_{23}\right).

\end{align}

</math>

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,

<math display=block>\begin{align}

\tilde{\mathbf{A &=

\begin{pmatrix}

\mathbf A_{11} & \mathbf A_{12} & \mathbf A_{13} \\

\mathbf A_{12}^{\mathrm{T & \mathbf A_{22} & \mathbf A_{23} \\

\mathbf A_{13}^{\mathrm{T & \mathbf A_{23}^{\mathrm{T & \mathbf A_{33} \\

\end{pmatrix}

\end{align}

</math>

with known Cholesky decomposition

<math display=block>\begin{align}

\tilde{\mathbf{S &=

\begin{pmatrix}

\mathbf S_{11} & \mathbf S_{12} & \mathbf S_{13} \\

0 & \mathbf S_{22} & \mathbf S_{23} \\

0 & 0 & \mathbf S_{33} \\

\end{pmatrix}

\end{align}

</math>

and the desire to determine the Cholesky factor

<math display=block>\begin{align}

\mathbf{L} &=

\begin{pmatrix}

\mathbf L_{11} & \mathbf L_{13} \\

0 & \mathbf L_{33} \\

\end{pmatrix}

\end{align}

</math>

of the matrix <math display=inline> \mathbf A </math> with rows and columns removed,

<math display=block>\begin{align}

\mathbf{A} &=

\begin{pmatrix}

\mathbf A_{11} & \mathbf A_{13} \\

\mathbf A_{13}^{\mathrm{T & \mathbf A_{33} \\

\end{pmatrix},

\end{align}

</math>

yields the following rules:

<math display=block>\begin{align}

\mathbf L_{11} &= \mathbf S_{11}, \\

\mathbf L_{13} &= \mathbf S_{13}, \\

\mathbf L_{33} &= \mathrm{chol} \left(\mathbf S_{33}^{\mathrm{T \mathbf S_{33} + \mathbf S_{23}^{\mathrm{T \mathbf S_{23}\right).

\end{align}

</math>

Notice that the equations above that involve finding the Cholesky decomposition of a new matrix are all of the form <math display="inline"> \tilde{\mathbf{A = \mathbf{A} +c\, \mathbf{x} \mathbf{x}^* </math> for some constant <math> c=\pm 1 </math>, which allows them to be efficiently calculated using procedure detailed in the previous section.. You can obtain the lower triangular Cholesky factor by taking the transpose of the output.

  • In Julia, the <code>cholesky</code> function from the <code>LinearAlgebra</code> standard library gives the Cholesky decomposition.
  • In Mathematica, the function "<code>CholeskyDecomposition</code>" can be applied to a matrix.
  • In C++, multiple linear algebra libraries support this decomposition:
  • The Armadillo (C++ library) supplies the command <code>chol</code> to perform Cholesky decomposition.
  • The Eigen library supplies Cholesky factorizations for both sparse and dense matrices.
  • In the ROOT package, the <code>TDecompChol</code> class is available.
  • In Analytica, the function <code>Decompose</code> gives the Cholesky decomposition.
  • The Apache Commons Math library has an implementation which can be used in Java, Scala and any other JVM language.

See also

  • Cycle rank
  • Incomplete Cholesky factorization
  • Matrix decomposition
  • Minimum degree algorithm
  • Square root of a matrix
  • Sylvester's law of inertia
  • Symbolic Cholesky decomposition

Notes

References

  • S. J. Julier and J. K. Uhlmann. "A General Method for Approximating Nonlinear Transformations of ProbabilityDistributions".
  • S. J. Julier and J. K. Uhlmann, "A new extension of the Kalman filter to nonlinear systems", in Proc. AeroSense: 11th Int. Symp. Aerospace/Defence Sensing, Simulation and Controls, 1997, pp.&nbsp;182–193.
  • Ruschel, João Paulo Tarasconi, Bachelor degree "Parallel Implementations of the Cholesky Decomposition on CPUs and GPUs" Universidade Federal Do Rio Grande Do Sul, Instituto De Informatica, 2016, pp.&nbsp;29-30.

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 <small>[for English, click 'A télécharger']</small>

Information

  • Cholesky Decomposition, The Data Analysis BriefBook
  • Cholesky Decomposition on www.math-linux.com
  • Cholesky Decomposition Made Simple on Science Meanderthal

Computer code

  • LAPACK is a collection of FORTRAN subroutines for solving dense linear algebra problems (DPOTRF, DPOTRF2, details performance)
  • ALGLIB includes a partial port of the LAPACK to C++, C#, Delphi, Visual Basic, etc. (spdmatrixcholesky, hpdmatrixcholesky)
  • libflame is a C library with LAPACK functionality.
  • Notes and video on high-performance implementation of Cholesky factorization at The University of Texas at Austin.
  • Cholesky : TBB + Threads + SSE is a book explaining the implementation of the CF with TBB, threads and SSE (in Spanish).
  • library "Ceres Solver" by Google.
  • LDL decomposition routines in Matlab.
  • Armadillo is a C++ linear algebra package
  • Rosetta Code is a programming chrestomathy site. on page topic.
  • AlgoWiki is an open encyclopedia of algorithms’ properties and features of their implementations on page topic
  • Intel® oneAPI Math Kernel Library Intel-Optimized Math Library for Numerical Computing ?potrf, ?potrs

Use of the matrix in simulation

  • Generating Correlated Random Variables and Stochastic Processes, Martin Haugh, Columbia University

Online calculators

  • Online Matrix Calculator Performs Cholesky decomposition of matrices online.

<!-- Dummy edit -->