[SciPy-user] determinants

Robert Kern robert.kern@gmail....
Thu Sep 13 15:19:51 CDT 2007

Anne Archibald wrote:
> If you have problems with determinants becoming excessively large, you
> may be able to circumvent them by computing the log of the
> determinant. The easiest way to do this is to use LU decomposition:
> P,L,U = scipy.linalg.lu(M)
> d = sum(log(abs(diag(L))))
> Of course you lose track of the sign doing this (P may be either an
> even or odd permutation, though det should be reliable and efficient
> on it).
> This is not necessarily much slower than using scipy's built-in det;
> both are O(N^3), at least, and scipy may implement its det this way.

We do use an LU decomposition although we accumulate the determinant by straight
multiplication, not through logarithms.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the SciPy-user mailing list