ldl
LDL factorization of a symmetric matrix.
Category: Mathematics > Linear Algebra
Syntax
[L, D] = ldl(A)
Returns a (permuted) unit lower triangular L and block diagonal D with L*D*L' = A.
[L, D, P] = ldl(A)
Returns a permutation matrix too, with P'*A*P = L*D*L'.
Description
ldl extends the Cholesky idea to symmetric matrices that are indefinite, where chol fails. Because it avoids square roots it does not require positive pivots, and it takes advantage of symmetry to use about half the work of lu.
The diagonal factor D may hold 2-by-2 blocks, which keep the method stable when a 1-by-1 pivot would be too small. For positive definite input D is diagonal with positive entries.
Input arguments
A- Symmetric (or Hermitian) square matrix, not necessarily positive definite.
Output arguments
L- Unit lower triangular factor (possibly permuted).
D- Block diagonal matrix with 1-by-1 and 2-by-2 blocks.
P- Permutation matrix.
Example
Positive definite and indefinite input
[L, D] = ldl([4 1; 1 3])
[L, D, P] = ldl([2 1; 1 -3]);
L*D*L'
Output
L = 2×2
1.0000 0
0.2500 1.0000
D = 2×2
4.0000 0
0 2.7500
ans = 2×2
2 1
1 -3