The DETERM function computes the determinant of an n by n array. LU decomposition is used to represent the input array in triangular form. The determinant is then computed as the product of diagonal elements of the triangular form. Row interchanges are tracked during the LU decomposition to ensure the correct sign.
This routine is written in the IDL language. Its source code can be found in the file determ.pro in the lib subdirectory of the IDL distribution.
Note: If you are working with complex inputs, use the LA_DETERM procedure instead.
Examples
A = [[ 2.0, 1.0, 1.0], $
[ 4.0, -6.0, 0.0], $
[-2.0, 7.0, 2.0]]
PRINT, DETERM(A)
IDL prints:
-16.0000
Syntax
Result = DETERM( A [, /CHECK] [, /DOUBLE] [, ZERO=value] )
Return Value
Returns the determinant of an n by n array
Arguments
A
An n by n single- or double-precision floating-point array.
Keywords
CHECK
Set this keyword to check A for singularity. The determinant of a singular array is returned as zero if this keyword is set. Run-time errors may result if A is singular and this keyword is not set.
DOUBLE
Set this keyword to force the computation to be done in double-precision arithmetic.
ZERO
Use this keyword to set the absolute value of the floating-point zero. A floating-point zero on the main diagonal of a triangular array results in a zero determinant. For single-precision inputs, the default value is 1.0 x 10-6. For double-precision inputs, the default value is 1.0 x 10-12. Setting this keyword to a value less than the default may improve the precision of the result.
Version History
See Also
COND, INVERT, LA_DETERM