Cholesky Decomposition - mikera/core.matrix GitHub Wiki

Cholesky Decomposition is the factorizaiton A = LLT, where A is an n n symmetric positive matrix, L is an n x n lower triangular matrix with real and positive diagonal entries and LT is the conjugate transpose of L.
Every symmetric positive definite matrix can be factorized by cholesky decomposition and this cholesky factorization is unique for every such matrix.

A symmetrix n x n real matrix is a positive definite matrix if for every z, where z is a non zero vector of size n, zTMz > 0. To put more intuitively, if all eigen values of a positive symmetric matrix are real and positive, then it is positive definite.

Just like all positive numbers, all positive symmetric matrices have "square roots". When a positive symmetric matrix is decomposed into LLT, we may think of L as a matrix square root of A. Matrix square roots of a matrix are not unique.

consider the cholesky decomposition of a 3x3 matrix A,

    ⌈a₁₁ a₁₂ aā‚ā‚ƒāŒ‰
A = |a₂₁ aā‚‚ā‚‚ aā‚‚ā‚ƒ|
	⌊aā‚ƒā‚ aā‚ƒā‚‚ aā‚ƒā‚ƒāŒ‹

    ⌈l₁₁  0   0 āŒ‰ ⌈l₁₁ l₂₁ lā‚ƒā‚āŒ‰
  =	|l₂₁ lā‚‚ā‚‚  0 | | 0  lā‚‚ā‚‚ lā‚ƒā‚‚| ≔ LL* 
	⌊lā‚ƒā‚ lā‚ƒā‚‚ lā‚ƒā‚ƒāŒ‹ ⌊ 0   0  lā‚ƒā‚ƒāŒ‹

    ⌈l₁₁l₁₁     l₂₁l₁₁             lā‚ƒā‚l₁₁       āŒ‰
  =	|l₂₁l₁₁  l₂₁l₂₁+lā‚‚ā‚‚lā‚‚ā‚‚      lā‚ƒā‚l₂₁+lā‚ƒā‚‚lā‚‚ā‚‚   |
	⌊lā‚ƒā‚l₂₁  lā‚ƒā‚l₂₁+lā‚ƒā‚‚lā‚‚ā‚‚  lā‚ƒā‚lā‚ƒā‚+lā‚ƒā‚‚lā‚ƒā‚‚+lā‚ƒā‚ƒlā‚ƒā‚ƒāŒ‹  

from here, we can generalize for diagonal elements

and for elements in L below the diagonal

to perform cholesky decomposition in core.matrix, we use the linear/cholesky function. Like all decomposition functions in this library, we can specify which matrix we want out of the resultant matrix by passing a :return parameter in the options map. If :return is not passed, both L and LT will be returned.

(let [{:keys [L L*]} (cholesky M)] ....)
(let [{:keys [L*]} (cholesky M {:return [:L*]})] ....)

Cholesky decomposition can sometimes be used instead of LU decomposition when positive definite matrices are involved

Solving Equation for a positive definite A

If we have a to solve an equation Ax = b, where A is positive definite, we factor A as A = LLT using cholesky decomposition and then solve LLTx = b

  • forward substitution: Lz = b
  • backward substitution: LTx = z
āš ļø **GitHub.com Fallback** āš ļø