Background:

I ran into numerical problems when computing the posterior pdf  for a
high dim problem. The trick is to use the log of the posterior which
includes computing the log of the determinant of a covariance matrix.
This can be done using, for example,

d = sum(log(eig(Q))),

where Q is the (pos-def) covariance matrix [the direct call log(det(Q))
will result in an Inf value].

A faster method is:

RQ = chol(Q);
d = 2*sum(log(diag(RQ)));

A logdet function would probably also be useful for other applications
so I'm not sure which package to add it to [one should perhaps test for
positive definiteness of Q as well (or let chol report the error)].

Regards,

Fredrik

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to