LFDRG
Computes the determinant of a real general matrix given the LU factorization of the matrix.
Required Arguments
FACTN by N matrix containing the LU factorization of the matrix A as output from routine LFTRG/DLFTRG or LFCRG/DLFCRG. (Input)
IPVT — Vector of length N containing the pivoting information for the LU factorization as output from routine LFTRG/DLFTRG or LFCRG/DLFCRG. (Input).
DET1 — Scalar containing the mantissa of the determinant. (Output)
The value DET1 is normalized so that 1.0 |DET1| < 10.0 or DET1 = 0.0.
DET2 — Scalar containing the exponent of the determinant. (Output)
The determinant is returned in the form det(A) = DET1 * 10DET2.
Optional Arguments
N — Order of the matrix. (Input)
Default: N = size (FACT,2).
LDFACT — Leading dimension of FACT exactly as specified in the dimension statement of the calling program. (Input)
Default: LDFACT = size (FACT,1).
FORTRAN 90 Interface
Generic: CALL LFDRG (FACT, IPVT, DET1, DET2 [])
Specific: The specific interface names are S_LFDRG and D_LFDRG.
FORTRAN 77 Interface
Single: CALL LFDRG (N, FACT, LDFACT, IPVT, DET1, DET2)
Double: The double precision name is DLFDRG.
Description
Routine LFDRG computes the determinant of a real general coefficient matrix. To compute the determinant, the coefficient matrix must first undergo an LU factorization. This may be done by calling either LFCRG or LFTRG. The formula det A = det L det U is used to compute the determinant. Since the determinant of a triangular matrix is the product of the diagonal elements
(The matrix U is stored in the upper triangle of FACT.) Since L is the product of triangular matrices with unit diagonals and of permutation matrices, det L = (1)k where k is the number of pivoting interchanges.
Routine LFDRG is based on the LINPACK routine SGEDI; see Dongarra et al. (1979)
Example
The determinant is computed for a real general 3 × 3 matrix.
 
USE LFDRG_INT
USE LFTRG_INT
USE UMACH_INT
! Declare variables
PARAMETER (LDA=3, LDFACT=3, N=3)
INTEGER IPVT(N), NOUT
REAL A(LDA,LDA), DET1, DET2, FACT(LDFACT,LDFACT)
!
! Set values for A
! A = ( 33.0 16.0 72.0)
! (-24.0 -10.0 -57.0)
! ( 18.0 -11.0 7.0)
!
DATA A/33.0, -24.0, 18.0, 16.0, -10.0, -11.0, 72.0, -57.0, 7.0/
!
CALL LFTRG (A, FACT, IPVT)
! Compute the determinant
CALL LFDRG (FACT, IPVT, DET1, DET2)
! Print the results
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) DET1, DET2
!
99999 FORMAT (’ The determinant of A is ’, F6.3, ’ * 10**’, F2.0)
END
Output
 
The determinant of A is -4.761 * 10**3.