Cholesky decomposition

From testwiki
Jump to navigation Jump to search

Template:Short description Template:CS1 config In linear algebra, the Cholesky decomposition or Cholesky factorization (pronounced Template:IPAc-en Template:Respell) 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.[1] When it is applicable, the Cholesky decomposition is roughly twice as efficient as the LU decomposition for solving systems of linear equations.[2]

Statement

The Cholesky decomposition of a Hermitian positive-definite matrix Template:Math, is a decomposition of the form

𝐀=𝐋𝐋*,

where Template:Math is a lower triangular matrix with real and positive diagonal entries, and Template:Math* denotes the conjugate transpose of Template:Math. Every Hermitian positive-definite matrix (and thus also every real-valued symmetric positive-definite matrix) has a unique Cholesky decomposition.[3]

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

When Template:Math is a real matrix (hence symmetric positive-definite), the factorization may be written 𝐀=𝐋𝐋𝖳, where Template:Math is a real lower triangular matrix with positive diagonal entries.[4][5][6]

Positive semidefinite matrices

If a Hermitian matrix Template:Math is only positive semidefinite, instead of positive definite, then it still has a decomposition of the form Template:Math where the diagonal entries of Template:Math are allowed to be zero.[7] The decomposition need not be unique, for example: [0001]=𝐋𝐋*,𝐋=[00cosθsinθ], for any Template:Mvar. However, if the rank of Template:Math is Template:Mvar, then there is a unique lower triangular Template:Math with exactly Template:Mvar positive diagonal elements and Template:Math columns containing all zeroes.[8]

Alternatively, the decomposition can be made unique when a pivoting choice is fixed. Formally, if Template:Math is an Template:Math positive semidefinite matrix of rank Template:Mvar, then there is at least one permutation matrix Template:Math such that Template:Math has a unique decomposition of the form Template:Math with 𝐋=[𝐋10𝐋20], where Template:Math is an Template:Math lower triangular matrix with positive diagonal.[9]

LDL decomposition

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

𝐀=𝐋𝐃𝐋*,

where Template:Math is a lower unit triangular (unitriangular) matrix, and Template:Math is a diagonal matrix. That is, the diagonal elements of Template:Math are required to be 1 at the cost of introducing an additional diagonal matrix Template:Math 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.[10]

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

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

𝐀=𝐋𝐃𝐋*=𝐋𝐃1/2(𝐃1/2)*𝐋*=𝐋𝐃1/2(𝐋𝐃1/2)*.

Conversely, given the classical Cholesky decomposition 𝐀=𝐂𝐂* of a positive definite matrix, if Template:Math is a diagonal matrix that contains the main diagonal of 𝐂, then Template:Math can be decomposed as 𝐋𝐃𝐋* where 𝐋=𝐂𝐒1 (this rescales each column to make diagonal elements 1), 𝐃=𝐒2.

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

Example

Here is the Cholesky decomposition of a symmetric real matrix:

(41216123743164398)=(200610853)(268015003).

And here is its LDLT decomposition:

(41216123743164398)=(100310451)(400010009)(134015001).

Geometric interpretation

Template:See also

The ellipse is a linear image of the unit circle. The two vectors v1,v2 are conjugate axes of the ellipse chosen such that v1 is parallel to the first axis and v2 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.[13] In detail, let the ellipsoid be defined as yTAy=1, then by definition, a set of vectors v1,...,vn are conjugate axes of the ellipsoid iff viTAvj=δij. Then, the ellipsoid is precisely{ixivi:xTx=1}=f(𝕊n)where f maps the basis vector eivi, and 𝕊n is the unit sphere in n dimensions. That is, the ellipsoid is a linear image of the unit sphere.

Define the matrix V:=[v1|v2||vn], then viTAvj=δij is equivalent to VTAV=I. Different choices of the conjugate axes correspond to different decompositions.

The Cholesky decomposition corresponds to choosing v1 to be parallel to the first axis, v2 to be within the plane spanned by the first two axes, and so on. This makes V an upper-triangular matrix. Then, there is A=LLT, where L=(V1)T is lower-triangular.

Similarly, principal component analysis corresponds to choosing v1,...,vn to be perpendicular. Then, let λ=1/vi2 and Σ=diag(λ1,...,λn), and there is V=UΣ1/2 where U is an orthogonal matrix. This then yields A=UΣUT.

Applications

Numerical solution of system of linear equations

The Cholesky decomposition is mainly used for the numerical solution of linear equations 𝐀𝐱=𝐛. If Template:Math is symmetric and positive definite, then 𝐀𝐱=𝐛 can be solved by first computing the Cholesky decomposition 𝐀=𝐋𝐋*, then solving 𝐋𝐲=𝐛 for Template:Math by forward substitution, and finally solving 𝐋*𝐱=𝐲 for Template:Math by back substitution.

An alternative way to eliminate taking square roots in the 𝐋𝐋* decomposition is to compute the LDL decomposition 𝐀=𝐋𝐃𝐋*, then solving 𝐋𝐲=𝐛 for Template:Math, and finally solving 𝐃𝐋*𝐱=𝐲.

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.[2]

Linear least squares

In linear least squares problem one seeks a solution Template:Math of an over-determined system Template:Math, such that quadratic norm of the residual vector Template:Math is minimum. This may be accomplished by solving by Cholesky decomposition normal equations 𝐍𝐱=𝐀𝖳𝐥, where 𝐍=𝐀𝖳𝐀 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 Template:Math. This is best illustrated in pathological case of square 𝐀, where determinant of Template:Math is square of that of the original system Template:Math. 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 Template:Math as it is possible to update Cholesky factor with consecutive rows of Template:Math.

Non-linear optimization

Non-linear least squares are a particular case of nonlinear optimization. Let 𝐟(𝐱)=𝐥 is an over-determined system of equations with a non-linear function 𝐟 returning vector results. The aim is to minimize square norm of residuals 𝐯=𝐟(𝐱)𝐥. An approximate Newton's method solution is obtained by expanding 𝐟 into curtailed Taylor series 𝐟(𝐱0+δ𝐱)𝐟(𝐱0)+(𝐟/𝐱)δ𝐱 yielding linear least squares problem for δ𝐱

(𝐟/𝐱)δ𝐱=𝐥𝐟(𝐱0)=𝐯,minδ𝐱=𝐯𝟐.

Of course because of neglect of higher Taylor terms such solution is only approximate, if it ever exists. Now one could update expansion point to 𝐱n+1=𝐱n+δ𝐱 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 may be also applied to the linear least squares problem by setting 𝐱0=𝟎 and 𝐟(𝐱0)=𝐀𝐱. This may be useful if Cholesky decomposition yields inaccurate inverse triangle matrix 𝐑1 where 𝐑T𝐑=𝐍, because of rounding errors. Such procedure is called differential correction of solution. As long as iterations converge, by virtue of Banach fixed point theorem they yield the solution which precision is only limited by precision of calculated residuals 𝐯=𝐀𝐱𝐥, but independent rounding errors of 𝐑1. Poor 𝐑1 may restrict region of initial 𝐱0 yielding convergence or altogether preventing it. Usually convergence is slower e.g. linear so that δ𝐱n+1=αδ𝐱n where constant α<1. Such slow convergence may be sped by Aitken δ2 method. If calculation of 𝐑1 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.[14]

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 pk defined by solving Bkpk=gk for pk, where pk is the step direction, gk is the gradient, and Bk 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.[15]

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 Template:Math. Applying this to a vector of uncorrelated observations in a sample Template:Math produces a sample vector Lu with the covariance properties of the system being modeled.[16]

The following simplified example shows the economy one gets from the Cholesky decomposition: suppose the goal is to generate two correlated normal variables x1 and x2 with given correlation coefficient ρ. To accomplish that, it is necessary to first generate two uncorrelated Gaussian random variables z1 and z2 (for example, via a Box–Muller transform). Given the required correlation coefficient ρ, the correlated normal variables can be obtained via the transformations x1=z1 and x2=ρz1+1ρ2z2.

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 Template:Math of length Template:Mvar and covariance as an Template:Math matrix Template:Math. The matrix Template:Math is always positive semi-definite and can be decomposed into LLT. The columns of Template:Math can be added and subtracted from the mean Template:Math to form a set of Template:Math 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 n3 operations (12n3 multiplications).[10] The entire inversion can even be efficiently performed in-place.

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

𝐁1=𝐁*(𝐁𝐁*)1.

Computation

There are various methods for calculating the Cholesky decomposition. The computational complexity of commonly used algorithms is Template:Math in general.Template:Citation needed The algorithms described below all involve about Template:Math FLOPs (Template:Math multiplications and the same number of additions) for real flavors and Template:Math FLOPs for complex flavors,[17] where Template:Mvar is the size of the matrix Template:Math. Hence, they have half the cost of the LU decomposition, which uses Template:Math 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.[18]

The Cholesky algorithm

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

The recursive algorithm starts with Template:Math and

Template:Math.

At step Template:Mvar, the matrix Template:Math has the following form: 𝐀(i)=(𝐈i1000ai,i𝐛i*0𝐛i𝐁(i)), where Template:Math denotes the identity matrix of dimension Template:Math.

If the matrix Template:Math is defined by 𝐋i:=(𝐈i1000ai,i001ai,i𝐛i𝐈ni), (note that Template:Math since Template:Math is positive definite), then Template:Math can be written as 𝐀(i)=𝐋i𝐀(i+1)𝐋i* where 𝐀(i+1)=(𝐈i10001000𝐁(i)1ai,i𝐛i𝐛i*). Note that Template:Math is an outer product, therefore this algorithm is called the outer-product version in (Golub & Van Loan).

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

𝐋:=𝐋1𝐋2𝐋n.

The Cholesky–Banachiewicz and Cholesky–Crout algorithms

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

If the equation 𝐀=𝐋𝐋T=(L1100L21L220L31L32L33)(L11L21L310L22L3200L33)=(L112(symmetric)L21L11L212+L222L31L11L31L21+L32L22L312+L322+L332),

is written out, the following is obtained:

𝐋=(A1100A21/L11A22L2120A31/L11(A32L31L21)/L22A33L312L322)

and therefore the following formulas for the entries of Template:Math:

Lj,j=(±)Aj,jk=1j1Lj,k2, Li,j=1Lj,j(Ai,jk=1j1Li,kLj,k)for i>j.

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 Template:Math is real and positive-definite.

For complex Hermitian matrix, the following formula applies:

Lj,j=Aj,jk=1j1Lj,k*Lj,k, Li,j=1Lj,j(Ai,jk=1j1Lj,k*Li,k)for i>j.

So it now is possible to compute the Template:Math 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 Template:Mvar and proceeds to calculate the matrix row by row.
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));
    }
}

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,

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

where conjg refers to complex conjugate of the elements.

  • The Cholesky–Crout algorithm starts from the upper left corner of the matrix Template:Mvar and proceeds to calculate the matrix column by column.
    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));
        }
    }
    

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,

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

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 Template:Math, and Template:Math denotes the computed solution, then Template:Math solves the perturbed system (Template:Math, where 𝐄2cnε𝐀2. Here ||·||2 is the matrix 2-norm, cn is a small constant depending on Template:Mvar, and Template:Mvar 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.[19] 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 Template:Math is symmetric, is the symmetric indefinite factorization[20] 𝐀=𝐋𝐃𝐋T=(100L2110L31L321)(D1000D2000D3)(1L21L3101L32001)=(D1(symmetric)L21D1L212D1+D2L31D1L31L21D1+L32D2L312D1+L322D2+D3.).

The following recursive relations apply for the entries of Template:Math and Template:Math: Dj=Ajjk=1j1Ljk2Dk, Lij=1Dj(Aijk=1j1LikLjkDk)for i>j.

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

For complex Hermitian matrix Template:Math, the following formula applies:

Dj=Ajjk=1j1LjkLjk*Dk, Lij=1Dj(Aijk=1j1LikLjk*Dk)for i>j.

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;[21] specifically, the elements of the factorization can grow arbitrarily. A possible improvement is to perform the factorization on block sub-matrices, commonly 2 × 2:[22]

𝐀=𝐋𝐃𝐋T=(𝐈00𝐋21𝐈0𝐋31𝐋32𝐈)(𝐃1000𝐃2000𝐃3)(𝐈𝐋21T𝐋31T0𝐈𝐋32T00𝐈)=(𝐃1(symmetric)𝐋21𝐃1𝐋21𝐃1𝐋21T+𝐃2𝐋31𝐃1𝐋31𝐃1𝐋21T+𝐋32𝐃2𝐋31𝐃1𝐋31T+𝐋32𝐃2𝐋32T+𝐃3),

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

𝐃j=𝐀jjk=1j1𝐋jk𝐃k𝐋jkT, 𝐋ij=(𝐀ijk=1j1𝐋ik𝐃k𝐋jkT)𝐃j1.

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 𝐀=𝐋𝐋* of some matrix 𝐀, then one changes the matrix 𝐀 in some way into another matrix, say 𝐀~, and one wants to compute the Cholesky decomposition of the updated matrix: 𝐀~=𝐋~𝐋~*. The question is now whether one can use the Cholesky decomposition of 𝐀 that was computed before to compute the Cholesky decomposition of 𝐀~.

Rank-one update

The specific case, where the updated matrix 𝐀~ is related to the matrix 𝐀 by 𝐀~=𝐀+𝐱𝐱*, is known as a rank-one update.

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

function [L] = cholupdate(L, x)
    n = length(x);
    for k = 1:n
        r = sqrt(L(k, k)^2 + x(k)^2);
        c = r / L(k, k);
        s = x(k) / L(k, k);
        L(k, k) = r;
        if k < n
            L((k+1):n, k) = (L((k+1):n, k) + s * x((k+1):n)) / c;
            x((k+1):n) = c * x((k+1):n) - s * L((k+1):n, k);
        end
    end
end

A rank-n update is one where for a matrix 𝐌 one updates the decomposition such that 𝐀~=𝐀+𝐌𝐌*. This can be achieved by successively performing rank-one updates for each of the columns of 𝐌.

Rank-one downdate

A rank-one downdate is similar to a rank-one update, except that the addition is replaced by subtraction: 𝐀~=𝐀𝐱𝐱*. This only works if the new matrix 𝐀~ is still positive definite.

The code for the rank-one update shown above can easily be adapted to do a rank-one downdate: one merely needs to replace the two additions in the assignment to r and L((k+1):n, k) by subtractions.

Adding and removing rows and columns

If a symmetric and positive definite matrix 𝐀 is represented in block form as

𝐀=(𝐀11𝐀13𝐀13T𝐀33)

and its upper Cholesky factor 𝐋=(𝐋11𝐋130𝐋33),

then for a new matrix 𝐀~, which is the same as 𝐀 but with the insertion of new rows and columns, 𝐀~=(𝐀11𝐀12𝐀13𝐀12T𝐀22𝐀23𝐀13T𝐀23T𝐀33)

Now there is an interest in finding the Cholesky factorization of 𝐀~, which can be called 𝐒~, without directly computing the entire decomposition. 𝐒~=(𝐒11𝐒12𝐒130𝐒22𝐒2300𝐒33).

Writing 𝐀𝐛 for the solution of 𝐀𝐱=𝐛, which can be found easily for triangular matrices, and chol(𝐌) for the Cholesky decomposition of 𝐌, the following relations can be found: 𝐒11=𝐋11,𝐒12=𝐋11T𝐀12,𝐒13=𝐋13,𝐒22=chol(𝐀22𝐒12T𝐒12),𝐒23=𝐒22T(𝐀23𝐒12T𝐒13),𝐒33=chol(𝐋33T𝐋33𝐒23T𝐒23).

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,

𝐀~=(𝐀11𝐀12𝐀13𝐀12T𝐀22𝐀23𝐀13T𝐀23T𝐀33) with known Cholesky decomposition 𝐒~=(𝐒11𝐒12𝐒130𝐒22𝐒2300𝐒33)

and the desire to determine the Cholesky factor 𝐋=(𝐋11𝐋130𝐋33)

of the matrix 𝐀 with rows and columns removed, 𝐀=(𝐀11𝐀13𝐀13T𝐀33),

yields the following rules: 𝐋11=𝐒11,𝐋13=𝐒13,𝐋33=chol(𝐒33T𝐒33+𝐒23T𝐒23).

Notice that the equations above that involve finding the Cholesky decomposition of a new matrix are all of the form 𝐀~=𝐀±𝐱𝐱*, which allows them to be efficiently calculated using the update and downdate procedures detailed in the previous section.[24]

Proof for positive semi-definite matrices

Proof by limiting argument

The above algorithms show that every positive definite matrix 𝐀 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.

If 𝐀 is an n×n positive semi-definite matrix, then the sequence (𝐀k)k:=(𝐀+1k𝐈n)k consists of positive definite matrices. (This is an immediate consequence of, for example, the spectral mapping theorem for the polynomial functional calculus.) Also, 𝐀k𝐀fork in operator norm. From the positive definite case, each 𝐀k has Cholesky decomposition 𝐀k=𝐋k𝐋k*. By property of the operator norm,

𝐋k2𝐋k𝐋k*=𝐀k.

The holds because Mn() equipped with the operator norm is a C* algebra. So (𝐋k)k is a bounded set in the Banach space of operators, therefore relatively compact (because the underlying vector space is finite-dimensional). Consequently, it has a convergent subsequence, also denoted by (𝐋k)k, with limit 𝐋. It can be easily checked that this 𝐋 has the desired properties, i.e. 𝐀=𝐋𝐋*, and 𝐋 is lower triangular with non-negative diagonal entries: for all x and y,

𝐀x,y=lim𝐀kx,y=lim𝐋k𝐋k*x,y=𝐋𝐋*x,y.

Therefore, 𝐀=𝐋𝐋*. Because the underlying vector space is finite-dimensional, all topologies on the space of operators are equivalent. So (𝐋k)k tends to 𝐋 in norm means (𝐋k)k tends to 𝐋 entrywise. This in turn implies that, since each 𝐋k is lower triangular with non-negative diagonal entries, 𝐋 is also.

Proof by QR decomposition

Let 𝐀 be a positive semi-definite Hermitian matrix. Then it can be written as a product of its square root matrix, 𝐀=𝐁𝐁*. Now QR decomposition can be applied to 𝐁*, resulting in 𝐁*=𝐐𝐑 , where 𝐐 is unitary and 𝐑 is upper triangular. Inserting the decomposition into the original equality yields A=𝐁𝐁*=(𝐐𝐑)*𝐐𝐑=𝐑*𝐐*𝐐𝐑=𝐑*𝐑. Setting 𝐋=𝐑* completes the proof.

Generalization

The Cholesky factorization can be generalized Template:Citation needed to (not necessarily finite) matrices with operator entries. Let {n} be a sequence of Hilbert spaces. Consider the operator matrix

𝐀=[𝐀11𝐀12𝐀13𝐀12*𝐀22𝐀23𝐀13*𝐀23*𝐀33]

acting on the direct sum

=nn,

where each

𝐀ij:ji

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

hn=1kk,

there is h,𝐀h0, then there exists a lower triangular operator matrix Template:Math such that Template:Math. One can also take the diagonal entries of Template:Math 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.
  • In Python, the function cholesky from the numpy.linalg module performs Cholesky decomposition.
  • In Matlab, the chol function gives the Cholesky decomposition. Note that chol uses the upper triangular factor of the input matrix by default, i.e. it computes A=R*R where R is upper triangular. A flag can be passed to use the lower triangular factor instead.
  • In R, the chol function gives the Cholesky decomposition.
  • 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:
    • The Armadillo (C++ library) supplies the command chol to perform Cholesky decomposition.
    • The Eigen library supplies Cholesky factorizations for both sparse and dense matrices.
    • In the ROOT package, the TDecompChol class is available.

See also

Notes

Template:Reflist

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 Template:In lang [for English, click 'A télécharger']

Information

Computer code

Use of the matrix in simulation

Online calculators

Template:Numerical linear algebra