dgedi(3P)
NAME
dgedi - compute the determinant and inverse of a general matrix A, which has been LU-factored by xGECO or xGEFA.
SYNOPSIS
CALL DGEDI (DA, LDA, N, IPIVOT, DDET, DWORK, JOB)
CALL SGEDI (SA, LDA, N, IPIVOT, SDET, SWORK, JOB)
CALL ZGEDI (ZA, LDA, N, IPIVOT, ZDET, ZWORK, JOB)
CALL CGEDI (CA, LDA, N, IPIVOT, CDET, CWORK, JOB)
void dgedi(double ∗da, long int lda, long int n, long int ∗ipivot,
double ∗det, long int job)
void sgedi(float ∗sa, long int lda, long int n, long int ∗ipivot, float
∗det, long int job)
void zgedi(doublecomplex ∗za, long int lda, long int n,
long int ∗ipivot, doublecomplex ∗det, long int job)
void cgedi(complex ∗ca, long int lda, long int n, long int ∗ipivot,
complex ∗det, long int job)
ARGUMENTS
xAOn entry, the LU factorization of the matrix A, as computed by
xGECO or xGEFA. On exit, the inverse of the original matrix A if the inverse was requested, otherwise it is unchanged.
LDALeading dimension of the array A as specified in a dimension or type statement. LDA >= max(1,N).
NOrder of the original matrix A. N >= 0.
IPIVOTPivot vector as computed by xGECO or xGEFA.
xDETOn exit, the determinant of the matrix A. The determinant is
stored as b ∗ (10∗∗expon) where b is stored in DET(1) and expon is stored in DET(2). 1.0 >= |DET(1)| >= 10.0 or DET(1) = 0.0.
xWORKScratch array with a dimension of N.
JOBDetermines which operation the subroutine will perform:
11 both determinant and inverse
01 inverse only
10 determinant only
SAMPLE PROGRAM
PROGRAM TEST
IMPLICIT NONE
C
INTEGER INVDET, LDA, N
PARAMETER (INVDET = 11)
PARAMETER (N = 4)
PARAMETER (LDA = N)
C
DOUBLE PRECISION A(LDA,N), DET(2), RCOND, WORK(N)
INTEGER ICOL, IPIVOT(N), IROW, JOB
C
EXTERNAL DGECO, DGEDI
C
C Initialize the array A to store the matrix A shown below. Its
C exact inverse also is shown below.
C
C -3 1 1 1 1 1 1
C A = 1 -2 1 A∗∗(-1) = - --- ∗ 1 3 3 3
C 1 -2 1 2 1 3 5 5
C 1 -1 1 3 5 7
C
DATA A / -3.0D0, 1.0D0, 2∗0.0D0, 1.0D0, -2.0D0, 1.0D0, 2∗0.0D0,
$ 1.0D0, -2.0D0, 1.0D0, 2∗0.0D0, 1.0D0, -1.0D0 /
C
PRINT 1000
PRINT 1010, ((A(IROW,ICOL), ICOL = 1, N), IROW = 1, N)
CALL DGECO (A, LDA, N, IPIVOT, RCOND, WORK)
JOB = INVDET
CALL DGEDI (A, LDA, N, IPIVOT, DET, WORK, JOB)
PRINT 1020
PRINT 1010, ((A(IROW,ICOL), ICOL = 1, N), IROW = 1, N)
PRINT 1030, DET(1) ∗ (1.0D1 ∗∗ DET(2))
C
1000 FORMAT (1X, ’A:’)
1010 FORMAT (4(3X, F5.1))
1020 FORMAT (/1X, ’A∗∗(-1):’)
1030 FORMAT (/1X, ’det(A) =’, F6.1)
C
END
SAMPLE OUTPUT
A:
-3.0 1.0 0.0 0.0
1.0 -2.0 1.0 0.0
0.0 1.0 -2.0 1.0
0.0 0.0 1.0 -1.0
A∗∗(-1):
-0.5 -0.5 -0.5 -0.5
-0.5 -1.5 -1.5 -1.5
-0.5 -1.5 -2.5 -2.5
-0.5 -1.5 -2.5 -3.5
det(A) = 2.0
Sun, Inc. — Last change: 20 Sep 1996