The standard implementation of ldl factorization in Matlab does not work correctly
The ldl(P) applied to symmetric matrix P should return a lover-triangular matrix L and a diagonal matrix D, such that:
.
The attached file contain the 9×9 symmetric matrix P, which ldl doesn’t works with correctly:
load(‘ldl_fail.mat’);
P % original symmetric matrix
max(max(P-P’))
[L,D] = ldl(P);
L % incorrect lover-triangular matrix factor
diag(D)’
L_ = chol(P)’; D_ = diag(L_).^2; L_ = tril(L,-1)+eye(size(L));
L_ % correct lover-triangular matrix factor (obtained with chol() function)
D_’The ldl(P) applied to symmetric matrix P should return a lover-triangular matrix L and a diagonal matrix D, such that:
.
The attached file contain the 9×9 symmetric matrix P, which ldl doesn’t works with correctly:
load(‘ldl_fail.mat’);
P % original symmetric matrix
max(max(P-P’))
[L,D] = ldl(P);
L % incorrect lover-triangular matrix factor
diag(D)’
L_ = chol(P)’; D_ = diag(L_).^2; L_ = tril(L,-1)+eye(size(L));
L_ % correct lover-triangular matrix factor (obtained with chol() function)
D_’ The ldl(P) applied to symmetric matrix P should return a lover-triangular matrix L and a diagonal matrix D, such that:
.
The attached file contain the 9×9 symmetric matrix P, which ldl doesn’t works with correctly:
load(‘ldl_fail.mat’);
P % original symmetric matrix
max(max(P-P’))
[L,D] = ldl(P);
L % incorrect lover-triangular matrix factor
diag(D)’
L_ = chol(P)’; D_ = diag(L_).^2; L_ = tril(L,-1)+eye(size(L));
L_ % correct lover-triangular matrix factor (obtained with chol() function)
D_’ matrix decomposition error, standard implementation error MATLAB Answers — New Questions