Files
2026-07-13 13:30:25 +08:00

11 lines
272 B
Matlab
Executable File

function W = invpd(M)
% Compute A\B where A is a positive definite matrix
% Input:
% M: a positive difinie matrix
% Written by Michael Chen (sth4nth@gmail.com).
[U,p] = chol(M);
if p > 0
error('ERROR: the matrix is not positive definite.');
end
V = inv(U);
W = V*V';