Contents Previous Next Subchapters

Log Of The Determinant Of A Matrix
Syntax [sd] = logdet(A)
See Also det , qred , cond

Description
Computes the log of the determinant of the matrix A, where A is an real, double-precision, or complex square matrix .

s
is set to the sign of the determinant as a scalar with the same type as A. If the determinant is zero, s is zero, otherwise the absolute value of s is equal to one and the determinant of A is equal to s * exp(d).

d
is set to the log of the absolute value of the determinant as a scalar with the same type as A. (If s is zero, the value of d is not defined.)

Example
     x = {[1, 0], [0, 2]}
     [s, d] = logdet(real(x))
     print s * exp(d)
returns
     2

Algorithm
This function uses an LU factorization of A, to compute the log of the determinant The function qred use as QR factorization to compute the determinant.

Discussion
It is possible that the determinant can be a number outside the limits corresponding to the type of A, but the log of the determinant is with in the limits (see REAL_MAX, REAL_MIN, DOUBLE_MAX, and DOUBLE_MIN, in autoexec for these limits).