Cholesky decomposition
In linear algebra, the Cholesky decomposition or Cholesky factorization (pronounced ) is a decomposition of a Hermitian, positive-definite matrix into the product of a lower triangular matrix and its conjugate transpose, which is useful for efficient numerical solutions, e.g., Monte Carlo simulations. It was discovered by André-Louis Cholesky for real matrices, and posthumously published in 1924. When it is applicable, the Cholesky decomposition is roughly twice as efficient as the LU decomposition for solving systems of linear equations. Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.
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. \mathbf{A} = \mathbf{L L}^{*}, 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 \mathbf{A} = \mathbf{L L}^\mathsf{T}, where is a real lower triangular matrix with positive diagonal entries. \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}, 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 \mathbf L = \begin{bmatrix} \mathbf L_1 & 0 \\ \mathbf L_2 & 0\end{bmatrix} , where is an lower triangular matrix with positive diagonal. \mathbf{A} = \mathbf{L D L}^*, 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: \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)^*. Conversely, given the classical Cholesky decomposition \mathbf A = \mathbf C \mathbf C^* of a positive definite matrix, if is a diagonal matrix that contains the main diagonal of \mathbf C , then can be decomposed as \mathbf L \mathbf D \mathbf L^* where \mathbf L = \mathbf C \mathbf S^{-1} (this rescales each column to make diagonal elements 1), \mathbf D = \mathbf S\mathbf S^*. If is positive definite then the diagonal elements of are all positive. For positive semidefinite , an \mathbf L \mathbf D \mathbf L^* 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. \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} And here is its LDL T decomposition: \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} The Cholesky decomposition is equivalent to a particular choice of conjugate axes of an ellipsoid. In detail, let the ellipsoid be defined as y^TAy = 1 , then by definition, a set of vectors v_1, ..., v_n are conjugate axes of the ellipsoid iff v_i^T A v_j = \delta_{ij} . Then, the ellipsoid is precisely \left\{ \sum_i x_i v_i : x^T x = 1 \right\} = f(\mathbb S^n) where f maps the basis vector e_i \mapsto v_i , and \mathbb S^n is the unit sphere in n dimensions. That is, the ellipsoid is a linear image of the unit sphere. Define the matrix V := [v_1 | v_2 | \cdots | v_n] , then v_i^T A v_j = \delta_{ij} is equivalent to V^TAV = I . Different choices of the conjugate axes correspond to different decompositions. The Cholesky decomposition corresponds to choosing v_1 to be parallel to the first axis, v_2 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 = LL^T , where L = (V^{-1})^T is lower-triangular. Similarly, principal component analysis corresponds to choosing v_1, ..., v_n to be perpendicular. Then, let \lambda = 1/\|v_i\|^2 and \Sigma = \mathrm{diag}(\lambda_1, ..., \lambda_n) , and there is V = U\Sigma^{-1/2} where U is an orthogonal matrix. This then yields A = U\Sigma U^T . ===Numerical solution of system of linear equations=== The Cholesky decomposition is mainly used for the numerical solution of linear equations \mathbf{Ax} = \mathbf{b} . If is symmetric and positive definite, then \mathbf{Ax} = \mathbf{b} can be solved by first computing the Cholesky decomposition \mathbf{A} = \mathbf{LL}^\mathrm{*} , then solving \mathbf{Ly} = \mathbf{b} for by forward substitution, and finally solving \mathbf{L^*x} = \mathbf{y} for by back substitution. An alternative way to eliminate taking square roots in the \mathbf{LL}^\mathrm{*} decomposition is to compute the LDL decomposition \mathbf{A} = \mathbf{LDL}^\mathrm{*} , then solving \mathbf{Ly} = \mathbf{b} for , and finally solving \mathbf{DL}^\mathrm{*}\mathbf{x} = \mathbf{y} . For linear systems that can be put into symmetric form, the Cholesky decomposition (or its LDL variant) is the method of choice, for superior efficiency and numerical stability. Compared to the LU decomposition, it is roughly twice as efficient. ===Linear least squares=== In linear least squares problem one seeks a solution of an over-determined system , such that quadratic norm of the residual vector is minimum. This may be accomplished by solving by Cholesky decomposition normal equations \mathbf{Nx}=\mathbf{A}^\mathsf{T}\mathbf{l} , where \mathbf{N}=\mathbf{A}^\mathsf{T}\mathbf{A} 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 . This is best illustrated in pathological case of square \mathbf{A} , where determinant of is square of that of the original system . Then it is best to apply SVD or QR decomposition. Givens QR has the advantage that similarly to normal equations there is no need to keep the whole matrix as it is possible to update Cholesky factor with consecutive rows of . ===Non-linear optimization=== Non-linear least squares are a particular case of nonlinear optimization. Let \mathbf{f}(\mathbf{x})=\mathbf{l} be an over-determined system of equations with a non-linear function \mathbf{f} returning vector results. The aim is to minimize square norm of residuals \mathbf{v}=\mathbf{f}(\mathbf{x})-\mathbf{l} . An approximate Newton's method solution is obtained by expanding \mathbf{f} into curtailed Taylor series \bf f(x_{\rm 0}+\delta x)\approx f(x_{\rm 0})+(\partial f/\partial x)\delta x yielding linear least squares problem for \bf\delta x {\bf(\partial f/\partial x)\delta x=l-f(x_{\rm 0})=v,\;\;\min_{\delta x}=\|v\|^2}. 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 \bf x_{\rm n+1}=x_{\rm n}+\delta x 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 \bf x_{\rm 0}=0 and \bf f(x_{\rm 0})=Ax . This may be useful if Cholesky decomposition yields an inaccurate inverse \bf R^{\rm -1} for the triangle matrix where \bf R^{\rm T}R=N , because of rounding errors. Such a procedure is called a differential correction of the solution. As long as iterations converge, by virtue of the Banach fixed-point theorem they yield the solution with a precision that is only limited by the precision of the calculated residuals \bf v=Ax-l . The precision is independent rounding errors in \bf R^{\rm -1} . Poor \bf R^{\rm -1} may restrict region of initial \bf x_{\rm 0} yielding convergence or altogether preventing it. Usually convergence is slower e.g. linear so that \bf\|\delta x_{\rm n+1}\|\approx\|=\alpha\delta x_{\rm n}\| where constant \alpha . Such slow convergence may be sped by Aitken \delta^2 method. If calculation of \bf R^{\rm -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. 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 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, and B_k 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 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 (for example, via a Box–Muller transform). 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{1 - \rho^2} z_2 . ===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 T . 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 n^3 operations ( \tfrac{1}{2} n^3 multiplications). The entire inversion can even be efficiently performed in-place. A non-Hermitian matrix can also be inverted using the following identity, where BB* will always be Hermitian: \mathbf{B}^{-1} = \mathbf{B}^* (\mathbf{B B}^*)^{-1}. ===Data Imputation=== Cholesky decomposition can also be used to impute data. Variations of the expectation maximization algorithm among other data imputation algorithms, make use of Cholesky decomposition. \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}, where denotes the identity matrix of dimension . If the matrix is defined by \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}, (note that since is positive definite), then can be written as \mathbf{A}^{(i)} = \mathbf{L}_{i} \mathbf{A}^{(i+1)} \mathbf{L}_{i}^{*} where \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}. 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 \mathbf{L} := \mathbf{L}_{1} \mathbf{L}_{2} \dots \mathbf{L}_{n}. \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} is written out, the following is obtained: \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} and therefore the following formulas for the entries of : L_{j,j} = (\pm)\sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^2 }, 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. 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: L_{j,j} = \sqrt{ A_{j,j} - \sum_{k=1}^{j-1} L_{j,k}^*L_{j,k} }, 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. and it can be shown that L_{j,j} 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. for (i = 0; i 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 and proceeds to calculate the matrix column by column. for (j = 0; j 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. \|\mathbf{E}\|_2 \le c_n \varepsilon \|\mathbf{A}\|_2. Here ||·|| 2 is the matrix 2-norm, c n 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. \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} The following recursive relations apply for the entries of and : D_j = A_{jj} - \sum_{k=1}^{j-1} L_{jk}^2 D_k, 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. 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: D_{j} = A_{jj} - \sum_{k=1}^{j-1} L_{jk}L_{jk}^* D_k, 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. 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{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} where every element in the matrices above is a square submatrix. From this, these analogous recursive relations follow: \mathbf D_j = \mathbf A_{jj} - \sum_{k=1}^{j-1} \mathbf L_{jk} \mathbf D_k \mathbf L_{jk}^\mathrm T, \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}. 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{A} = \mathbf{L}\mathbf{L}^* of some matrix \mathbf{A} , then one changes the matrix \mathbf{A} in some way into another matrix, say \tilde{\mathbf{A}} , and one wants to compute the Cholesky decomposition of the updated matrix: \tilde{\mathbf{A}} = \tilde{\mathbf{L}} \tilde{\mathbf{L}}^* . The question is now whether one can use the Cholesky decomposition of \mathbf{A} that was computed before to compute the Cholesky decomposition of \tilde{\mathbf{A}} . The specific case, where the updated matrix \tilde{\mathbf{A}} is related to the matrix \mathbf{A} by \tilde{\mathbf{A}} = \mathbf{A} + c\,\mathbf{x} \mathbf{x}^* , is known as a rank-one update. Here the constant c is allowed to be negative, but must always be such that the new matrix \tilde{\mathbf{A}} is still positive definite. Here is a function written in Matlab syntax that realizes a rank-one update: 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 A rank-n update is one where for a matrix \mathbf{M} one updates the decomposition such that \tilde{\mathbf{A}} = \mathbf{A} + \mathbf{M} \mathbf{M}^* . This can be achieved by successively performing rank-one updates for each of the columns of \mathbf{M} . If a symmetric and positive definite matrix \mathbf A is represented in block form as \mathbf{A} = \begin{pmatrix} \mathbf A_{11} & \mathbf A_{13} \\ \mathbf A_{13}^{\mathrm{T}} & \mathbf A_{33} \\ \end{pmatrix} and its upper Cholesky factor \mathbf{L} = \begin{pmatrix} \mathbf L_{11} & \mathbf L_{13} \\ 0 & \mathbf L_{33} \\ \end{pmatrix}, then for a new matrix \tilde{\mathbf{A}} , which is the same as \mathbf A but with the insertion of new rows and columns, \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} Now there is an interest in finding the Cholesky factorization of \tilde{\mathbf{A}} , which can be called \tilde{\mathbf S} , without directly computing the entire decomposition. \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} Writing \mathbf A \setminus \mathbf{b} for the solution of \mathbf A \mathbf x = \mathbf b , which can be found easily for triangular matrices, and \text{chol} (\mathbf M) for the Cholesky decomposition of \mathbf M , the following relations can be found: \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} 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, \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} with known Cholesky decomposition \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} and the desire to determine the Cholesky factor \begin{align} \mathbf{L} &= \begin{pmatrix} \mathbf L_{11} & \mathbf L_{13} \\ 0 & \mathbf L_{33} \\ \end{pmatrix} \end{align} of the matrix \mathbf A with rows and columns removed, \begin{align} \mathbf{A} &= \begin{pmatrix} \mathbf A_{11} & \mathbf A_{13} \\ \mathbf A_{13}^{\mathrm{T}} & \mathbf A_{33} \\ \end{pmatrix}, \end{align} yields the following rules: \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} Notice that the equations above that involve finding the Cholesky decomposition of a new matrix are all of the form \tilde{\mathbf{A}} = \mathbf{A} +c\, \mathbf{x} \mathbf{x}^* for some constant c=\pm 1 , which allows them to be efficiently calculated using procedure detailed in the previous section. The above algorithms show that every positive definite matrix \mathbf{A} 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{A} is an n \times n positive semi-definite matrix, then the sequence \left(\mathbf{A}_k\right)_k := \left(\mathbf{A} + \frac{1}{k} \mathbf{I}_n\right)_k consists of positive definite matrices. (This is an immediate consequence of, for example, the spectral mapping theorem for the polynomial functional calculus.) Also, \mathbf{A}_k \rightarrow \mathbf{A} \quad \text{for} \quad k \rightarrow \infty in operator norm. From the positive definite case, each \mathbf{A}_k has Cholesky decomposition \mathbf{A}_k = \mathbf{L}_k\mathbf{L}_k^* . By property of the operator norm, \| \mathbf{L}_k \|^2 \leq \| \mathbf{L}_k \mathbf{L}_k^* \| = \| \mathbf{A}_k \| \,. The \leq holds because M_n(\mathbb{C}) equipped with the operator norm is a C* algebra. So \left(\mathbf{L}_k \right)_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 \left( \mathbf{L}_k \right)_k , with limit \mathbf{L} . It can be easily checked that this \mathbf{L} has the desired properties, i.e. \mathbf{A} = \mathbf{L}\mathbf{L}^* , and \mathbf{L} is lower triangular with non-negative diagonal entries: for all x and y , \langle \mathbf{A} x, y \rangle = \left\langle \lim \mathbf{A}_k x, y \right\rangle = \langle \lim \mathbf{L}_k \mathbf{L}_k^* x, y \rangle = \langle \mathbf{L} \mathbf{L}^*x, y \rangle \,. Therefore, \mathbf{A} = \mathbf{L}\mathbf{L}^* . Because the underlying vector space is finite-dimensional, all topologies on the space of operators are equivalent. So \left( \mathbf{L}_k \right)_k tends to \mathbf{L} in norm means \left( \mathbf{L}_k \right)_k tends to \mathbf{L} entrywise. This in turn implies that, since each \mathbf{L}_k is lower triangular with non-negative diagonal entries, \mathbf{L} is also. Let \mathbf{A} be a positive semi-definite Hermitian matrix. Then it can be written as a product of its square root matrix, \mathbf{A} = \mathbf{B} \mathbf{B}^* . Now QR decomposition can be applied to \mathbf{B}^* , resulting in \mathbf{B}^* = \mathbf{Q}\mathbf{R} , where \mathbf{Q} is unitary and \mathbf{R} is upper triangular. Inserting the decomposition into the original equality yields A = \mathbf{B} \mathbf{B}^* = (\mathbf{QR})^*\mathbf{QR} = \mathbf{R}^*\mathbf{Q}^*\mathbf{QR} = \mathbf{R}^*\mathbf{R} . Setting \mathbf{L} = \mathbf{R}^* completes the proof. The Cholesky factorization can be generalized to (not necessarily finite) matrices with operator entries. Let \{\mathcal{H}_n \} be a sequence of Hilbert spaces. Consider the operator matrix \mathbf{A} = \begin{bmatrix} \mathbf{A}_{11} & \mathbf{A}_{12} & \mathbf{A}_{13} & \; \\ \mathbf{A}_{12}^* & \mathbf{A}_{22} & \mathbf{A}_{23} & \; \\ \mathbf{A} _{13}^* & \mathbf{A}_{23}^* & \mathbf{A}_{33} & \; \\ \; & \; & \; & \ddots \end{bmatrix} acting on the direct sum \mathcal{H} = \bigoplus_n \mathcal{H}_n, where each \mathbf{A}_{ij} : \mathcal{H}_j \rightarrow \mathcal{H} _i is a bounded operator. If is positive (semidefinite) in the sense that for all finite and for any h \in \bigoplus_{n = 1}^k \mathcal{H}_k , there is \langle h, \mathbf{A} h\rangle \ge 0 , then there exists a lower triangular operator matrix such that . One can also take the diagonal entries of to be positive. 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 returns the upper triangular Cholesky factor . You can obtain the lower triangular Cholesky factor by taking the transpose of the output. In Julia, the cholesky function from the LinearAlgebra standard library gives the Cholesky decomposition. In Mathematica, the function " CholeskyDecomposition " can be applied to a matrix. In C++, multiple linear algebra libraries support this decomposition: 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. In Analytica, the function Decompose 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. 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. ===History of science=== Sur la résolution numérique des systèmes d'équations linéaires, Cholesky's 1910 manuscript, online and analyzed on BibNum [for English, click 'A télécharger'] ===Information=== 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.
Cite this
"Cholesky decomposition". 1787837821. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1371639196 JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy