Mercurial > hg > ishara
view general/numerical/matrix/logdet.m @ 16:db7f4afd27c5
Rearranging numerical toolbox.
author | samer |
---|---|
date | Thu, 17 Jan 2013 13:20:44 +0000 |
parents | general/numerical/logdet.m@e44f49929e56 |
children |
line wrap: on
line source
function y = logdet(A) % logdet - logdet(X)=log(det(X)) where A is positive-definite and Hermitian. % % logdet :: [[N,N]] -> nonneg. % % This is faster and more stable than using log(det(A)). % Samer: Use LOGABSDET for general matrices. % From Tom Minka's lightspeed toolbox [U,p] = chol(A); if p>0, y=-inf; else y = 2*sum(log(full(diag(U)))); end