HOME

TheInfoList



OR:

In
linear algebra Linear algebra is the branch of mathematics concerning linear equations such as: :a_1x_1+\cdots +a_nx_n=b, linear maps such as: :(x_1, \ldots, x_n) \mapsto a_1x_1+\cdots +a_nx_n, and their representations in vector spaces and through matrice ...
, the Cholesky decomposition or Cholesky factorization (pronounced ) is a
decomposition Decomposition or rot is the process by which dead organic substances are broken down into simpler organic or inorganic matter such as carbon dioxide, water, simple sugars and mineral salts. The process is a part of the nutrient cycle and ...
of a
Hermitian {{Short description, none Numerous things are named after the French mathematician Charles Hermite (1822–1901): Hermite * Cubic Hermite spline, a type of third-degree spline * Gauss–Hermite quadrature, an extension of Gaussian quadrature m ...
,
positive-definite matrix In mathematics, a symmetric matrix M with real entries is positive-definite if the real number z^\textsfMz is positive for every nonzero real column vector z, where z^\textsf is the transpose of More generally, a Hermitian matrix (that is, a ...
into the product of a
lower triangular matrix In mathematics, a triangular matrix is a special kind of square matrix. A square matrix is called if all the entries ''above'' the main diagonal are zero. Similarly, a square matrix is called if all the entries ''below'' the main diagonal a ...
and its
conjugate transpose In mathematics, the conjugate transpose, also known as the Hermitian transpose, of an m \times n complex matrix \boldsymbol is an n \times m matrix obtained by transposing \boldsymbol and applying complex conjugate on each entry (the complex c ...
, which is useful for efficient numerical solutions, e.g.,
Monte Carlo simulation Monte Carlo methods, or Monte Carlo experiments, are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. The underlying concept is to use randomness to solve problems that might be determi ...
s. 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 In numerical analysis and linear algebra, lower–upper (LU) decomposition or factorization factors a matrix as the product of a lower triangular matrix and an upper triangular matrix (see matrix decomposition). The product sometimes includes a p ...
for solving systems of linear equations.


Statement

The Cholesky decomposition of a
Hermitian {{Short description, none Numerous things are named after the French mathematician Charles Hermite (1822–1901): Hermite * Cubic Hermite spline, a type of third-degree spline * Gauss–Hermite quadrature, an extension of Gaussian quadrature m ...
positive-definite matrix In mathematics, a symmetric matrix M with real entries is positive-definite if the real number z^\textsfMz is positive for every nonzero real column vector z, where z^\textsf is the transpose of More generally, a Hermitian matrix (that is, a ...
A, is a decomposition of the form : \mathbf = \mathbf^*, where L is a
lower triangular matrix In mathematics, a triangular matrix is a special kind of square matrix. A square matrix is called if all the entries ''above'' the main diagonal are zero. Similarly, a square matrix is called if all the entries ''below'' the main diagonal a ...
with real and positive diagonal entries, and L* denotes the
conjugate transpose In mathematics, the conjugate transpose, also known as the Hermitian transpose, of an m \times n complex matrix \boldsymbol is an n \times m matrix obtained by transposing \boldsymbol and applying complex conjugate on each entry (the complex c ...
of L. Every Hermitian positive-definite matrix (and thus also every real-valued symmetric positive-definite matrix) has a unique Cholesky decomposition. The converse holds trivially: if A can be written as LL* for some invertible L, lower triangular or otherwise, then A is Hermitian and positive definite. When A is a real matrix (hence symmetric positive-definite), the factorization may be written : \mathbf = \mathbf^\mathsf, where L is a real lower triangular matrix with positive diagonal entries.


Positive semidefinite matrices

If a Hermitian matrix A is only positive semidefinite, instead of positive definite, then it still has a decomposition of the form where the diagonal entries of L are allowed to be zero. The decomposition need not be unique, for example: : \begin0 & 0 \\0 & 1\end = \mathbf L \mathbf L^*, \quad \quad \mathbf L=\begin0 & 0\\ \cos \theta & \sin\theta\end. However, if the rank of A is ''r'', then there is a unique lower triangular L with exactly ''r'' positive diagonal elements and ''n''−''r'' columns containing all zeroes. Alternatively, the decomposition can be made unique when a pivoting choice is fixed. Formally, if A is an positive semidefinite matrix of rank ''r'', then there is at least one permutation matrix P such that has a unique decomposition of the form with \mathbf L = \begin \mathbf L_1 & 0 \\ \mathbf L_2 & 0\end , where L1 is an lower triangular matrix with positive diagonal.


LDL decomposition

A closely related variant of the classical Cholesky decomposition is the LDL decomposition, : \mathbf = \mathbf^*, where L is a lower unit triangular (unitriangular) matrix, and D is a
diagonal In geometry, a diagonal is a line segment joining two vertices of a polygon or polyhedron, when those vertices are not on the same edge. Informally, any sloping line is called diagonal. The word ''diagonal'' derives from the ancient Greek δ� ...
matrix. That is, the diagonal elements of L are required to be 1 at the cost of introducing an additional diagonal matrix D 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 LDLT decomposition (or LDLT decomposition, or LDL′). It is reminiscent of the eigendecomposition of real symmetric matrices, , but is quite different in practice because Λ and D are not similar matrices. The LDL decomposition is related to the classical Cholesky decomposition of the form LL* as follows: : \mathbf = \mathbf^* = \mathbf L \mathbf D^ \left(\mathbf D^ \right)^* \mathbf L^* = \mathbf L \mathbf D^ \left(\mathbf L \mathbf D^\right)^*. Conversely, given the classical Cholesky decomposition \mathbf A = \mathbf C \mathbf C^* of a positive definite matrix, if S is a diagonal matrix that contains the main diagonal of \mathbf C, then a A can be decomposed as \mathbf L \mathbf D \mathbf L^* where : \mathbf L = \mathbf C \mathbf S^ (this rescales each column to make diagonal elements 1), : \mathbf D = \mathbf S^2. If A is positive definite then the diagonal elements of D are all positive. For positive semidefinite A, an \mathbf L \mathbf D \mathbf L^* decomposition exists where the number of non-zero elements on the diagonal D is exactly the rank of A. Some indefinite matrices for which no Cholesky decomposition exists have an LDL decomposition with negative entries in D: it suffices that the first ''n''−1 leading principal minors of A are non-singular.


Example

Here is the Cholesky decomposition of a symmetric real matrix: : \begin \left( \begin 4 & 12 & -16 \\ 12 & 37 & -43 \\ -16 & -43 & 98 \\ \end \right) = \left( \begin 2 & 0 & 0 \\ 6 & 1 & 0 \\ -8 & 5 & 3 \\ \end \right) \left( \begin 2 & 6 & -8 \\ 0 & 1 & 5 \\ 0 & 0 & 3 \\ \end \right). \end And here is its LDLT decomposition: : \begin \left( \begin 4 & 12 & -16 \\ 12 & 37 & -43 \\ -16 & -43 & 98 \\ \end \right) & = \left( \begin 1 & 0 & 0 \\ 3 & 1 & 0 \\ -4 & 5 & 1 \\ \end \right) \left( \begin 4 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 9 \\ \end \right) \left( \begin 1 & 3 & -4 \\ 0 & 1 & 5 \\ 0 & 0 & 1 \\ \end \right). \end


Applications

The Cholesky decomposition is mainly used for the numerical solution of
linear equations In mathematics, a linear equation is an equation that may be put in the form a_1x_1+\ldots+a_nx_n+b=0, where x_1,\ldots,x_n are the variables (or unknowns), and b,a_1,\ldots,a_n are the coefficients, which are often real numbers. The coeffici ...
\mathbf = \mathbf. If A is symmetric and positive definite, then we can solve \mathbf = \mathbf by first computing the Cholesky decomposition \mathbf = \mathbf^\mathrm, then solving \mathbf = \mathbf for y by
forward substitution In mathematics, a triangular matrix is a special kind of square matrix. A square matrix is called if all the entries ''above'' the main diagonal are zero. Similarly, a square matrix is called if all the entries ''below'' the main diagonal are ...
, and finally solving \mathbf = \mathbf for x by back substitution. An alternative way to eliminate taking square roots in the \mathbf^\mathrm decomposition is to compute the Cholesky decomposition \mathbf = \mathbf^\mathrm, then solving \mathbf = \mathbf for y, and finally solving \mathbf^\mathrm\mathbf = \mathbf. 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 In numerical analysis and linear algebra, lower–upper (LU) decomposition or factorization factors a matrix as the product of a lower triangular matrix and an upper triangular matrix (see matrix decomposition). The product sometimes includes a p ...
, it is roughly twice as efficient.


Linear least squares

Systems of the form Ax = b with A symmetric and positive definite arise quite often in applications. For instance, the normal equations in linear least squares problems are of this form. It may also happen that matrix A comes from an energy functional, which must be positive from physical considerations; this happens frequently in the numerical solution of
partial differential equation In mathematics, a partial differential equation (PDE) is an equation which imposes relations between the various partial derivatives of a multivariable function. The function is often thought of as an "unknown" to be solved for, similarly to h ...
s.


Non-linear optimization

Non-linear multi-variate functions may be minimized over their parameters using variants of
Newton's method In numerical analysis, Newton's method, also known as the Newton–Raphson method, named after Isaac Newton and Joseph Raphson, is a root-finding algorithm which produces successively better approximations to the roots (or zeroes) of a real- ...
called ''quasi-Newton'' methods. At iteration k, the search steps in a direction p_k defined by solving B_k p_k = -g_k for p_k , where p_k is the step direction, g_k is the
gradient In vector calculus, the gradient of a scalar-valued differentiable function of several variables is the vector field (or vector-valued function) \nabla f whose value at a point p is the "direction and rate of fastest increase". If the gr ...
, and B_k is an approximation to the
Hessian matrix In mathematics, the Hessian matrix or Hessian is a square matrix of second-order partial derivatives of a scalar-valued function, or scalar field. It describes the local curvature of a function of many variables. The Hessian matrix was developed ...
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 Monte Carlo methods, or Monte Carlo experiments, are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. The underlying concept is to use randomness to solve problems that might be deter ...
for simulating systems with multiple correlated variables. The
covariance matrix In probability theory and statistics, a covariance matrix (also known as auto-covariance matrix, dispersion matrix, variance matrix, or variance–covariance matrix) is a square matrix giving the covariance between each pair of elements of ...
is decomposed to give the lower-triangular L. Applying this to a vector of uncorrelated samples u produces a sample vector Lu with the covariance properties of the system being modeled.Matlab randn documentation
mathworks.com.
The following simplified example shows the economy one gets from the Cholesky decomposition: suppose the goal is to generate two correlated normal variables x_1 and x_2 with given correlation coefficient \rho. To accomplish that, it is necessary to first generate two uncorrelated Gaussian random variables z_1 and z_2, which can be done using a
Box–Muller transform The Box–Muller transform, by George Edward Pelham Box and Mervin Edgar Muller, is a random number sampling method for generating pairs of independent, standard, normally distributed (zero expectation, unit variance) random numbers, given a ...
. Given the required correlation coefficient \rho, the correlated normal variables can be obtained via the transformations x_1 = z_1 and x_2 = \rho z_1 + \sqrt z_2.


Kalman filters

Unscented Kalman filter For statistics and control theory, Kalman filtering, also known as linear quadratic estimation (LQE), is an algorithm that uses a series of measurements observed over time, including statistical noise and other inaccuracies, and produces estima ...
s 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 x of length ''N'' and covariance as an ''N'' × ''N'' matrix P. The matrix P is always positive semi-definite and can be decomposed into LLT. The columns of L can be added and subtracted from the mean x to form a set of 2''N'' vectors called ''sigma points''. These sigma points completely capture the mean and covariance of the system state.


Matrix inversion

The explicit
inverse Inverse or invert may refer to: Science and mathematics * Inverse (logic), a type of conditional sentence which is an immediate inference made from another conditional sentence * Additive inverse (negation), the inverse of a number that, when a ...
of a Hermitian matrix can be computed by Cholesky decomposition, in a manner similar to solving linear systems, using n^3 operations (\tfrac n^3 multiplications). The entire inversion can even be efficiently performed in-place. A non-Hermitian matrix B can also be inverted using the following identity, where BB* will always be Hermitian: : \mathbf^ = \mathbf^* (\mathbf^*)^.


Computation

There are various methods for calculating the Cholesky decomposition. The computational complexity of commonly used algorithms is ''O''(''n''3) in general. The algorithms described below all involve about (1/3)''n''3
FLOP In computing, floating point operations per second (FLOPS, flops or flop/s) is a measure of computer performance, useful in fields of scientific computations that require floating-point calculations. For such cases, it is a more accurate meas ...
s (''n''3/6 multiplications and the same number of additions) for real flavors and (4/3)''n''3
FLOP In computing, floating point operations per second (FLOPS, flops or flop/s) is a measure of computer performance, useful in fields of scientific computations that require floating-point calculations. For such cases, it is a more accurate meas ...
s for complex flavors, where ''n'' is the size of the matrix A. Hence, they have half the cost of the
LU decomposition In numerical analysis and linear algebra, lower–upper (LU) decomposition or factorization factors a matrix as the product of a lower triangular matrix and an upper triangular matrix (see matrix decomposition). The product sometimes includes a p ...
, which uses 2''n''3/3 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 algorithm

The Cholesky algorithm, used to calculate the decomposition matrix ''L'', is a modified version of
Gaussian elimination In mathematics, Gaussian elimination, also known as row reduction, is an algorithm for solving systems of linear equations. It consists of a sequence of operations performed on the corresponding matrix of coefficients. This method can also be used ...
. The recursive algorithm starts with ''i'' := 1 and :A(1) := A. At step ''i'', the matrix A(''i'') has the following form: :\mathbf^= \begin \mathbf_ & 0 & 0 \\ 0 & a_ & \mathbf_^ \\ 0 & \mathbf_ & \mathbf^ \end, where I''i''−1 denotes the
identity matrix In linear algebra, the identity matrix of size n is the n\times n square matrix with ones on the main diagonal and zeros elsewhere. Terminology and notation The identity matrix is often denoted by I_n, or simply by I if the size is immaterial or ...
of dimension ''i'' − 1. If we now define the matrix L''i'' by :\mathbf_:= \begin \mathbf_ & 0 & 0 \\ 0 & \sqrt & 0 \\ 0 & \frac \mathbf_ & \mathbf_ \end, (note that ''a''''i,i'' > 0 since A(''i'') is positive definite), then we can write A(''i'') as :\mathbf^ = \mathbf_ \mathbf^ \mathbf_^ where :\mathbf^= \begin \mathbf_ & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & \mathbf^ - \frac \mathbf_ \mathbf_^ \end. Note that b''i'' b*''i'' is an
outer product In linear algebra, the outer product of two coordinate vectors is a matrix. If the two vectors have dimensions ''n'' and ''m'', then their outer product is an ''n'' × ''m'' matrix. More generally, given two tensors (multidimensional arrays of nu ...
, therefore this algorithm is called the ''outer-product version'' in (Golub & Van Loan). We repeat this for ''i'' from 1 to ''n''. After ''n'' steps, we get A(''n''+1) = I. Hence, the lower triangular matrix ''L'' we are looking for is calculated as :\mathbf := \mathbf_ \mathbf_ \dots \mathbf_.


The Cholesky–Banachiewicz and Cholesky–Crout algorithms

If we write out the equation :\begin \mathbf = \mathbf^T & = \begin L_ & 0 & 0 \\ L_ & L_ & 0 \\ L_ & L_ & L_\\ \end \begin L_ & L_ & L_ \\ 0 & L_ & L_ \\ 0 & 0 & L_ \end \\ pt& = \begin L_^2 & &(\text) \\ L_L_ & L_^2 + L_^2& \\ L_L_ & L_L_+L_L_ & L_^2 + L_^2+L_^2 \end, \end we obtain the following: :\begin \mathbf = \begin \sqrt & 0 & 0 \\ A_/L_ & \sqrt & 0 \\ A_/L_ & \left( A_ - L_L_ \right) /L_ &\sqrt \end \end and therefore the following formulas for the entries of L: : L_ = (\pm)\sqrt, : L_ = \frac \left( A_ - \sum_^ L_ L_ \right) \quad \text 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 In mathematics, a square root of a number is a number such that ; in other words, a number whose '' square'' (the result of multiplying the number by itself, or  ⋅ ) is . For example, 4 and −4 are square roots of 16, because . ...
is always positive if A is real and positive-definite. For complex Hermitian matrix, the following formula applies: : L_ = \sqrt, : L_ = \frac \left( A_ - \sum_^ L_ L_^* \right) \quad \text i>j. So we can compute the (''i'', ''j'') entry if we know the entries to the left and above. The computation is usually arranged in either of the following orders: * The Cholesky–Banachiewicz algorithm starts from the upper left corner of the matrix ''L'' and proceeds to calculate the matrix row by row. for (i = 0; i < dimensionSize; i++) * The Cholesky–Crout algorithm starts from the upper left corner of the matrix ''L'' and proceeds to calculate the matrix column by column. for (j = 0; j < dimensionSize; j++) Either pattern of access allows the entire computation to be performed in-place if desired.


Stability of the computation

Suppose that we want to solve a
well-conditioned In numerical analysis, the condition number of a function measures how much the output value of the function can change for a small change in the input argument. This is used to measure how sensitive a function is to changes or errors in the input ...
system of linear equations. If the LU decomposition is used, then the algorithm is unstable unless we use some sort of pivoting strategy. 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 we want to solve Ax = b, and y denotes the computed solution, then y solves the perturbed system (A + E)y = b, where : \, \mathbf\, _2 \le c_n \varepsilon \, \mathbf\, _2. Here , , ·, , 2 is the matrix 2-norm, ''cn'' is a small constant depending on ''n'', and ''ε'' denotes the
unit round-off Machine epsilon or machine precision is an upper bound on the relative approximation error due to rounding in floating point arithmetic. This value characterizes computer arithmetic in the field of numerical analysis, and by extension in the subjec ...
. 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 error A roundoff error, also called rounding error, is the difference between the result produced by a given algorithm using exact arithmetic and the result produced by the same algorithm using finite-precision, rounded arithmetic. Rounding errors are d ...
s, 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 In calculus, Newton's method is an iterative method for finding the roots of a differentiable function , which are solutions to the equation . As such, Newton's method can be applied to the derivative of a twice-differentiable function to fi ...
, 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 A is symmetric, is the symmetric indefinite factorization : \begin \mathbf = \mathbf^\mathrm & = \begin 1 & 0 & 0 \\ L_ & 1 & 0 \\ L_ & L_ & 1\\ \end \begin D_1 & 0 & 0 \\ 0 & D_2 & 0 \\ 0 & 0 & D_3\\ \end \begin 1 & L_ & L_ \\ 0 & 1 & L_ \\ 0 & 0 & 1\\ \end \\ pt& = \begin D_1 & &(\mathrm) \\ L_D_1 & L_^2D_1 + D_2& \\ L_D_1 & L_L_D_+L_D_2 & L_^2D_1 + L_^2D_2+D_3. \end. \end The following recursive relations apply for the entries of D and L: : D_j = A_ - \sum_^ L_^2 D_k, : L_ = \frac \left( A_ - \sum_^ L_ L_ D_k \right) \quad \text i>j. This works as long as the generated diagonal elements in D stay non-zero. The decomposition is then unique. D and L are real if A is real. For complex Hermitian matrix A, the following formula applies: : D_ = A_ - \sum_^ L_L_^* D_k, : L_ = \frac \left( A_ - \sum_^ L_ L_^* D_k \right) \quad \text 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; specifically, the elements of the factorization can grow arbitrarily. A possible improvement is to perform the factorization on block sub-matrices, commonly 2 × 2: :\begin \mathbf = \mathbf^\mathrm & = \begin \mathbf I & 0 & 0 \\ \mathbf L_ & \mathbf I & 0 \\ \mathbf L_ & \mathbf L_ & \mathbf I\\ \end \begin \mathbf D_1 & 0 & 0 \\ 0 & \mathbf D_2 & 0 \\ 0 & 0 & \mathbf D_3\\ \end \begin \mathbf I & \mathbf L_^\mathrm T & \mathbf L_^\mathrm T \\ 0 & \mathbf I & \mathbf L_^\mathrm T \\ 0 & 0 & \mathbf I\\ \end \\ pt& = \begin \mathbf D_1 & &(\mathrm) \\ \mathbf L_ \mathbf D_1 & \mathbf L_ \mathbf D_1 \mathbf L_^\mathrm T + \mathbf D_2& \\ \mathbf L_ \mathbf D_1 & \mathbf L_ \mathbf D_ \mathbf L_^\mathrm T + \mathbf L_ \mathbf D_2 & \mathbf L_ \mathbf D_1 \mathbf L_^\mathrm T + \mathbf L_ \mathbf D_2 \mathbf L_^\mathrm T + \mathbf D_3 \end, \end where every element in the matrices above is a square submatrix. From this, these analogous recursive relations follow: :\mathbf D_j = \mathbf A_ - \sum_^ \mathbf L_ \mathbf D_k \mathbf L_^\mathrm T, :\mathbf L_ = \left(\mathbf A_ - \sum_^ \mathbf L_ \mathbf D_k \mathbf L_^\mathrm T\right) \mathbf D_j^. 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 \mathbf = \mathbf\mathbf^* of some matrix \mathbf, then one changes the matrix \mathbf in some way into another matrix, say \tilde , and one wants to compute the Cholesky decomposition of the updated matrix: \tilde = \tilde \tilde^* . The question is now whether one can use the Cholesky decomposition of \mathbf that was computed before to compute the Cholesky decomposition of \tilde .


Rank-one update

The specific case, where the updated matrix \tilde is related to the matrix \mathbf by \tilde = \mathbf + \mathbf \mathbf^* , is known as a ''rank-one update''. Here is a function written in
Matlab MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementat ...
syntax that realizes a rank-one update: function = 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 \mathbf one updates the decomposition such that \tilde = \mathbf + \mathbf \mathbf^* . This can be achieved by successively performing rank-one updates for each of the columns of \mathbf.


Rank-one downdate

A ''rank-one downdate'' is similar to a rank-one update, except that the addition is replaced by subtraction: \tilde = \mathbf - \mathbf \mathbf^* . This only works if the new matrix \tilde 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 we have a symmetric and positive definite matrix \mathbf A represented in block form as : \mathbf = \begin \mathbf A_ & \mathbf A_ \\ \mathbf A_^ & \mathbf A_ \\ \end and its upper Cholesky factor : \mathbf = \begin \mathbf L_ & \mathbf L_ \\ 0 & \mathbf L_ \\ \end, then for a new matrix \tilde , which is the same as \mathbf A but with the insertion of new rows and columns, :\begin \tilde &= \begin \mathbf A_ & \mathbf A_ & \mathbf A_ \\ \mathbf A_^ & \mathbf A_ & \mathbf A_ \\ \mathbf A_^ & \mathbf A_^ & \mathbf A_ \\ \end \end we are interested in finding the Cholesky factorization of \tilde , which we call \tilde , without directly computing the entire decomposition. :\begin \tilde &= \begin \mathbf S_ & \mathbf S_ & \mathbf S_ \\ 0 & \mathbf S_ & \mathbf S_ \\ 0 & 0 & \mathbf S_ \\ \end. \end Writing \mathbf A \setminus \mathbf for the solution of \mathbf A \mathbf x = \mathbf b, which can be found easily for triangular matrices, and \text (\mathbf M) for the Cholesky decomposition of \mathbf M , the following relations can be found: :\begin \mathbf S_ &= \mathbf L_, \\ \mathbf S_ &= \mathbf L_^ \setminus \mathbf A_, \\ \mathbf S_ &= \mathbf L_, \\ \mathbf S_ &= \mathrm \left(\mathbf A_ - \mathbf S_^ \mathbf S_\right), \\ \mathbf S_ &= \mathbf S_^ \setminus \left(\mathbf A_ - \mathbf S_^ \mathbf S_\right), \\ \mathbf S_ &= \mathrm \left(\mathbf L_^ \mathbf L_ - \mathbf S_^ \mathbf S_\right). \end These formulas may be used to determine the Cholesky factor after the insertion of rows or columns in any position, if we set the row and column dimensions appropriately (including to zero). The inverse problem, when we have :\begin \tilde &= \begin \mathbf A_ & \mathbf A_ & \mathbf A_ \\ \mathbf A_^ & \mathbf A_ & \mathbf A_ \\ \mathbf A_^ & \mathbf A_^ & \mathbf A_ \\ \end \end with known Cholesky decomposition :\begin \tilde &= \begin \mathbf S_ & \mathbf S_ & \mathbf S_ \\ 0 & \mathbf S_ & \mathbf S_ \\ 0 & 0 & \mathbf S_ \\ \end \end and wish to determine the Cholesky factor :\begin \mathbf &= \begin \mathbf L_ & \mathbf L_ \\ 0 & \mathbf L_ \\ \end \end of the matrix \mathbf A with rows and columns removed, :\begin \mathbf &= \begin \mathbf A_ & \mathbf A_ \\ \mathbf A_^ & \mathbf A_ \\ \end, \end yields the following rules: :\begin \mathbf L_ &= \mathbf S_, \\ \mathbf L_ &= \mathbf S_, \\ \mathbf L_ &= \mathrm \left(\mathbf S_^ \mathbf S_ + \mathbf S_^ \mathbf S_\right). \end Notice that the equations above that involve finding the Cholesky decomposition of a new matrix are all of the form \tilde = \mathbf \pm \mathbf \mathbf^* , which allows them to be efficiently calculated using the update and downdate procedures detailed in the previous section.Osborne, M. (2010), Appendix B.


Proof for positive semi-definite matrices


Proof by limiting argument

The above algorithms show that every positive definite matrix \mathbf 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 \mathbf is an n \times n
positive semi-definite matrix In mathematics, a symmetric matrix M with real entries is positive-definite if the real number z^\textsfMz is positive for every nonzero real column vector z, where z^\textsf is the transpose of More generally, a Hermitian matrix (that is, a ...
, then the sequence \left(\mathbf_k\right)_k := \left(\mathbf + \frac \mathbf_n\right)_k consists of
positive definite matrices In mathematics, a symmetric matrix M with real entries is positive-definite if the real number z^\textsfMz is positive for every nonzero real column vector z, where z^\textsf is the transpose of More generally, a Hermitian matrix (that is, a c ...
. (This is an immediate consequence of, for example, the spectral mapping theorem for the polynomial functional calculus.) Also, : \mathbf_k \rightarrow \mathbf \quad \text \quad k \rightarrow \infty in
operator norm In mathematics, the operator norm measures the "size" of certain linear operators by assigning each a real number called its . Formally, it is a norm defined on the space of bounded linear operators between two given normed vector spaces. Introd ...
. From the positive definite case, each \mathbf_k has Cholesky decomposition \mathbf_k = \mathbf_k\mathbf_k^* . By property of the operator norm, :\, \mathbf_k \, ^2 \leq \, \mathbf_k \mathbf_k^* \, = \, \mathbf_k \, \,. The \leq holds because M_n(\mathbb) equipped with the operator norm is a C* algebra. So \left(\mathbf_k \right)_k is a bounded set in the
Banach space In mathematics, more specifically in functional analysis, a Banach space (pronounced ) is a complete normed vector space. Thus, a Banach space is a vector space with a metric that allows the computation of vector length and distance between vector ...
of operators, therefore
relatively compact In mathematics, a relatively compact subspace (or relatively compact subset, or precompact subset) of a topological space is a subset whose closure is compact. Properties Every subset of a compact topological space is relatively compact (sinc ...
(because the underlying vector space is finite-dimensional). Consequently, it has a convergent subsequence, also denoted by \left( \mathbf_k \right)_k, with limit \mathbf. It can be easily checked that this \mathbf has the desired properties, i.e. \mathbf = \mathbf\mathbf^* , and \mathbf is lower triangular with non-negative diagonal entries: for all x and y, : \langle \mathbf x, y \rangle = \left\langle \lim \mathbf_k x, y \right\rangle = \langle \lim \mathbf_k \mathbf_k^* x, y \rangle = \langle \mathbf \mathbf^*x, y \rangle \,. Therefore, \mathbf = \mathbf\mathbf^* . Because the underlying vector space is finite-dimensional, all topologies on the space of operators are equivalent. So \left( \mathbf_k \right)_k tends to \mathbf in norm means \left( \mathbf_k \right)_k tends to \mathbf entrywise. This in turn implies that, since each \mathbf_k is lower triangular with non-negative diagonal entries, \mathbf is also.


Proof by QR decomposition

Let \mathbf be a positive semi-definite Hermitian matrix. Then it can be written as a product of its square root matrix, \mathbf = \mathbf \mathbf^*. Now
QR decomposition In linear algebra, a QR decomposition, also known as a QR factorization or QU factorization, is a decomposition of a matrix ''A'' into a product ''A'' = ''QR'' of an orthogonal matrix ''Q'' and an upper triangular matrix ''R''. QR decomp ...
can be applied to \mathbf^*, resulting in \mathbf^* = \mathbf\mathbf , where \mathbf is unitary and \mathbf is upper triangular. Inserting the decomposition into the original equality yields A = \mathbf \mathbf^* = (\mathbf)^*\mathbf = \mathbf^*\mathbf^*\mathbf = \mathbf^*\mathbf. Setting \mathbf = \mathbf^* completes the proof.


Generalization

The Cholesky factorization can be generalized to (not necessarily finite) matrices with operator entries. Let \ be a sequence of
Hilbert spaces In mathematics, Hilbert spaces (named after David Hilbert) allow generalizing the methods of linear algebra and calculus from (finite-dimensional) Euclidean vector spaces to spaces that may be infinite-dimensional. Hilbert spaces arise naturally ...
. Consider the operator matrix : \mathbf = \begin \mathbf_ & \mathbf_ & \mathbf_ & \; \\ \mathbf_^* & \mathbf_ & \mathbf_ & \; \\ \mathbf _^* & \mathbf_^* & \mathbf_ & \; \\ \; & \; & \; & \ddots \end acting on the direct sum :\mathcal = \bigoplus_n \mathcal_n, where each :\mathbf_ : \mathcal_j \rightarrow \mathcal _i is a
bounded operator In functional analysis and operator theory, a bounded linear operator is a linear transformation L : X \to Y between topological vector spaces (TVSs) X and Y that maps bounded subsets of X to bounded subsets of Y. If X and Y are normed vector ...
. If A is positive (semidefinite) in the sense that for all finite ''k'' and for any :h \in \bigoplus_^k \mathcal_k , we have \langle h, \mathbf h\rangle \ge 0, then there exists a lower triangular operator matrix L such that A = LL*. One can also take the diagonal entries of L to be positive.


Implementations in programming libraries

*
C programming language ''The C Programming Language'' (sometimes termed ''K&R'', after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well a ...
: the
GNU Scientific Library The GNU Scientific Library (or GSL) is a software library for numerical computations in applied mathematics and science. The GSL is written in C; wrappers are available for other programming languages. The GSL is part of the GNU Project and is ...
provides several implementations of Cholesky decomposition. * Maxima computer algebra system: function cholesky computes Cholesky decomposition. *
GNU Octave GNU Octave is a high-level programming language primarily intended for scientific computing and numerical computation. Octave helps in solving linear and nonlinear problems numerically, and for performing other numerical experiments using a lan ...
numerical computations system provides several functions to calculate, update, and apply a Cholesky decomposition. * The
LAPACK LAPACK ("Linear Algebra Package") is a standard software library for numerical linear algebra. It provides routines for solving systems of linear equations and linear least squares, eigenvalue problems, and singular value decomposition. It als ...
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 MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementat ...
, 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 Julia is usually a feminine given name. It is a Latinate feminine form of the name Julio and Julius. (For further details on etymology, see the Wiktionary entry "Julius".) The given name ''Julia'' had been in use throughout Late Antiquity (e.g ...
, the cholesky function from the LinearAlgebra standard library gives the Cholesky decomposition. * In
Mathematica Wolfram Mathematica is a software system with built-in libraries for several areas of technical computing that allow machine learning, statistics, symbolic computation, data manipulation, network analysis, time series analysis, NLP, optimiza ...
, the function "CholeskyDecomposition" can be applied to a matrix. * In
C++ C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
, multiple linear algebra libraries support this decomposition: ** The
Armadillo (C++ library) Armadillo is a linear algebra software library for the C++ programming language. It aims to provide efficient and streamlined base calculations, while at the same time having a straightforward and easy-to-use interface. Its intended target user ...
supplies the command chol to perform Cholesky decomposition. ** The Eigen library supplies Cholesky factorizations for both sparse and dense matrices. ** In the
ROOT In vascular plants, the roots are the organs of a plant that are modified to provide anchorage for the plant and take in water and nutrients into the plant body, which allows plants to grow taller and faster. They are most often below the su ...
package, the TDecompChol class is available. * In Analytica, the function Decompose gives the Cholesky decomposition. * Th
Apache Commons Math library has an implementation
which can be used in Java, Scala and any other JVM language.


See also

*
Cycle rank In graph theory, the cycle rank of a directed graph is a digraph connectivity measure proposed first by Eggan and Büchi . Intuitively, this concept measures how close a digraph is to a directed acyclic graph (DAG), in the sense that a DAG has ...
*
Incomplete Cholesky factorization In numerical analysis, an incomplete Cholesky factorization of a symmetric positive definite matrix is a sparse approximation of the Cholesky factorization. An incomplete Cholesky factorization is often used as a preconditioner for algorithms like ...
*
Matrix decomposition In the mathematical discipline of linear algebra, a matrix decomposition or matrix factorization is a factorization of a matrix into a product of matrices. There are many different matrix decompositions; each finds use among a particular class of ...
*
Minimum degree algorithm In numerical analysis, the minimum degree algorithm is an algorithm used to permute the rows and columns of a symmetric sparse matrix before applying the Cholesky decomposition, to reduce the number of non-zeros in the Cholesky factor. This results ...
* Square root of a matrix *
Sylvester's law of inertia Sylvester's law of inertia is a theorem in matrix algebra about certain properties of the coefficient matrix of a real quadratic form that remain invariant under a change of basis. Namely, if ''A'' is the symmetric matrix that defines the quadra ...
* 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. 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. 29-30.


External links


History of science

* ''Sur la résolution numérique des systèmes d'équations linéaires'', Cholesky's 1910 manuscript, online and analyzed o
BibNum
or 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


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.

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.

routines in Matlab.

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 implementation
on page topic


Intel-Optimized Math Library for Numerical Computin

h2>

Use of the matrix in simulation


Generating Correlated Random Variables and Stochastic Processes
Martin Haugh,
Columbia University Columbia University (also known as Columbia, and officially as Columbia University in the City of New York) is a private research university in New York City. Established in 1754 as King's College on the grounds of Trinity Church in Manhatt ...


Online calculators


Online Matrix Calculator
Performs Cholesky decomposition of matrices online. {{Numerical linear algebra Operator theory Matrix decompositions Numerical linear algebra Articles with example MATLAB/Octave code