LFDCG
Computes the determinant of a complex general matrix given the LU factorization of the matrix.
Required Arguments
FACT — Complex N by N matrix containing the LU factorization of the coefficient matrix A as output from routine LFCCG/DLFCCG or LFTCG/DLFTCG. (Input)
IPVT — Vector of length N containing the pivoting information for the LU factorization of A as output from routine LFCCG/DLFCCG or LFTCG/DLFTCG. (Input)
DET1 — Complex 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 * 10DET.
Optional Arguments
N — Number of equations. (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 LFDCG (FACT, IPVT, DET1, DET2 [, …])
Specific: The specific interface names are S_LFDCG and D_LFDCG.
FORTRAN 77 Interface
Single: CALL LFDCG (N, FACT, LDFACT, IPVT, DET1, DET2)
Double: The double precision name is DLFDCG.
Description
Routine LFDCG computes the determinant of a complex general coefficient matrix. To compute the determinant the coefficient matrix must first undergo an LU factorization. This may be done by calling either LFCCG or LFTCG. 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.
LFDCG is based on the LINPACK routine CGEDI; see Dongarra et al. (1979).
Example
The determinant is computed for a complex general 3 × 3 matrix.
USE LFDCG_INT
USE LFTCG_INT
USE UMACH_INT
! Declare variables
PARAMETER (LDA=3, LDFACT=3, N=3)
INTEGER IPVT(N), NOUT
REAL DET2
COMPLEX A(LDA,LDA), FACT(LDFACT,LDFACT), DET1
! Set values for A
!
! A = ( 3.0-2.0i 2.0+4.0i 0.0-3.0i)
! ( 1.0+1.0i 2.0-6.0i 1.0+2.0i)
! ( 4.0+0.0i -5.0+1.0i 3.0-2.0i)
!
DATA A/(3.0,-2.0), (1.0,1.0), (4.0,0.0), (2.0,4.0), (2.0,-6.0),&
(-5.0,1.0), (0.0,-3.0), (1.0,2.0), (3.0,-2.0)/
!
! Factor A
CALL LFTCG (A, FACT, IPVT)
! Compute the determinant for the
! factored matrix
CALL LFDCG (FACT, IPVT, DET1, DET2)
! Print results
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) DET1, DET2
!
99999 FORMAT (’ The determinant of A is’,3X,’(’,F6.3,’,’,F6.3,&
’) * 10**’,F2.0)
END
Output
The determinant of A is ( 0.700, 1.100) * 10**1.