ldl
ldl(A) returns the LDL factorization for Hermitian indefinite matrices.
- L = ldl(A): returns the permuted lower triangular matrix L
- [L,D] = ldl(A): satisfies A = L*D*LT, where L is a permuted lower triangular square matrix, D is a diagonal matrix, and LT is the transpose of L
- [L,D,p] = ldl(A): returns L, the lower triangular square matrix with ones in its diagonal, the diagonal D and the permutation matrix p, such that p'*A*p = L*D*L'
- ldl(A,'upper'): the output matrix L is upper triangular
Examples
>> A = [2 -1 0;-1 2 -1;0 -1 1] [L D] = ldl(A) [A:3x3 double] [L:3x3 double] [D:3x3 double] >> L# 1 0 0 -0.5 1 0 0 -0.666667 1 >> D# 2 0 0 0 1.5 0 0 0 0.333333 >> ldl(A,'upper')# 1 -0.5 0 0 1 -0.666667 0 0 1
>> A = [1 1 4 -1;1 5 0 -1;4 0 21 -4;-1 -1 -4 10]; ldl(A)# 0.190476 -0.0257732 0.199157 1 0 -0.108247 1 0 1 0 0 0 -0.190476 1 0 0 >> [L D p] = ldl(A) [L:4x4 double] [D:4x4 double] [p:4x4 double] >> L# 1 0 0 0 -0.190476 1 0 0 0 -0.108247 1 0 0.190476 -0.0257732 0.199157 1 >> p# 0 0 0 1 0 0 1 0 1 0 0 0 0 1 0 0