ldl

LDL decomposition.

Syntax

[U,D,P] = ldl(A)

[U,D,P] = ldl(A,'upper')

[L,D,P] = ldl(A,'lower')

Inputs

A
The Hermitian matrix to decompose, typically indefinite.
Type: double | complex
Dimension: matrix

Outputs

U
Upper triangular matrix.
L
Lower triangular matrix.
D
Diagonal or block diagonal matrix.
P
Permutation matrix.

Example

A = [2, -1, 3; -1, 2, 2; 3, 2, 5]
[U,D,P] = ldl(A)
U = [Matrix] 3 x 3
1.00000  0.00000  0.60000
0.00000  1.00000  0.40000
0.00000  0.00000  1.00000
D = [Matrix] 3 x 3
 0.20000  -2.20000  0.00000
-2.20000   1.20000  0.00000
 0.00000   0.00000  5.00000
P = [Matrix] 3 x 3
1  0  0
0  1  0
0  0  1

Comments

[U,D,P] = ldl(A,'upper') computes matrix U such that A = P*U*D*U'*P'

[L,D,P] = ldl(A,'lower') computes matrix L such that A = P*L*D*L'*P'

ldl uses the LAPACK routines 'dsytrf', 'dsyconv', 'zhetrf' and 'zsyconv'.

A is assumed to be real symmetric or Hermitian, with the second argument specifying which triangle is used. The default is 'upper'.