On Tuesday, February 26, 2013 09:32:47 PM John Myles White wrote:
> After some web-searching I couldn't find anything better. Right now I'm
> using the one-liner:
>
> logdet(A::Matrix) = sum(log(diag(chol(A))))
>
> I'll add that to Base now and let others replace it if there's something
> better available.
You can only use chol if it's symmetric positive definite. The vast majority of
practical uses of this are, but you need an LU-based fallback in cases where
that's not true. (The matrix can even have negative eigenvalues as long as
there are an even number of them, and logdet would still be well-defined.)
--Tim