Page 1 of 1

computing determinant

PostPosted: Mon Mar 05, 2007 2:41 pm
by shaobohou
Hi,

This has probably been asked before but I have been unable to find a satisfactory answer. I know that it is possible to compute the determinant of a matrix by first performing a PLU factorisation. This would mean computing the sign/determinant of the P matrix, is there a fast and simple way of doing this?

thanks

PostPosted: Mon Mar 05, 2007 3:28 pm
by Julien Langou
To get the sign of the determinant of the permutation matrix, you start with + and you go
through the IPIV array for I=1 to N and you change sign each time IPIV(I) is not I. (You might
want stop at N-1 and not N since IPIV(N)=N.) Then you product the diagonal term of U and
multiply with the sign of the determinant of P and you obtain the determinant of A from the
A=PLU factorization.

There is determinant computation in LINPACK, see for example the routine DGEDI.
http://www.netlib.org/linpack/dgedi.f
Computing a determinant is likely to overflow, the LINPACK's routine is specially careful
about that.

-j

PostPosted: Mon Mar 05, 2007 11:40 pm
by shaobohou
thanks very much.

regarding overflow and underflow when computing determinant, would it be more robust to compute the log determinant instead?

PostPosted: Wed Mar 14, 2007 7:04 pm
by Julien Langou
Sorry for the delay for answering.
regarding overflow and underflow when computing determinant, would it be more robust to compute the log determinant instead?


Well that's what LINPACK is doing in some sense by simply dividing by 10 each time
the determinant exceeds 10 ... It's not exactly log10 but that the same ideas. LINPACK
approach is definetely faster than computing log10 of all the diagonal entries and adding them together. Julien.