HMatrices.jl icon indicating copy to clipboard operation
HMatrices.jl copied to clipboard

log determinant of HMatrix

Open ngiann opened this issue 1 year ago • 2 comments

A question please: how do I go about calculating the log-determinant of an HMatrix? Thanks.

ngiann avatar Jul 18 '24 15:07 ngiann

It seems you can use the Cholesky decomposition:

\log(det(H)) = \log(det(L L^\top)) = \log(det(L)^2) = 2 \log(det(L))

Do you have a MWE example? You can call cholesky to factor an HMatrix, but you may need to tweak a bit with the internals to extract the diagonal of L.

Disclaimer: I know nothing about log determinants 😅

maltezfaria avatar Jul 22 '24 16:07 maltezfaria

@ngiann Did you manage to compute the logdet of an HMatrix? If you are still interested I think adding the functionality should be straightforward (essentially we need to overload the diag function to compute the diagonal of hierarchical matrices, and wrap cholesky + diagonal with the simple computation above to compute the logdet).

maltezfaria avatar Sep 15 '24 12:09 maltezfaria