- Compute the LDL decomposition: A lower-triangular matrix L, a block-diagonal matrix D (1-by-1 and 2-by-2 blocks), and a permutation matrix P, such that A is P*L*D*L'*P' :
Why doesnt chol work for hermitian positive semi-definite matrix?
14 views (last 30 days)
I am trying to perform factorization of form A = R'*R using matlab function 'chol' but A is not positive definite, rather its hermitian positive semi-definite. As per theory from https://en.wikipedia.org/wiki/Hermitian_matrix , I should be able to perform factorization but matlab expects A to be positive definite matrix. Is there an alternative function in matlab?
Pravarthana P on 28 Sep 2022
Hi Nikil Challa,
I understand that you are trying to perform factorization using “chol” function and are facing an issue with positive semi-definite matrix.
The “chol” function expects a symmetric positive definite matrix as input as mentioned in the documentation link.
The following can likely be a workaround to factorize positive semi-definite matrix:
[L, D, P] = ldl(A);
2.Compute the eigenvalue decomposition, set its negative eigenvalues to zero, and use QR to get two triangular factors for this modified matrix:
[U, d] = eig(A, 'vector'); % A == U*diag(d)*U'
d(d < 0) = 0; % Set negative eigenvalues of A to zero
[~, R] = qr(diag(sqrt(d))*U');
% Q*R == sqrt(D)*U', so A == U*diag(d)*U'== R'*Q'*Q*R == R'*R
% In this case, check that d(d<0) are all nearly zero.
3.Add a small number to A’s diagonal before calling Cholesky:
To know more information on why the “chol” function cannot be used to factorize positive semi-definite matrix, you can refer to the link.
I hope this information helps you.