## computing determinant

Open discussion regarding features, bugs, issues, vendors, etc.

### computing determinant

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
shaobohou

Posts: 4
Joined: Fri Aug 26, 2005 10:44 am

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

-j
Julien Langou

Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

thanks very much.

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

Posts: 4
Joined: Fri Aug 26, 2005 10:44 am

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.
Julien Langou

Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA