Previous Next Contents Generated Index Doc Set Home



Determinant of an LU-Factored General Matrix in Banded Storage

The subroutines described in this section compute the determinant of a general matrix A in banded storage, which has been LU-factored by xGBCO or xGBFA.

Calling Sequence

CALL DGBDI 
(DA, LDA, N, NSUB, NSUPER, IPIVOT, DDET)
CALL SGBDI 
(SA, LDA, N, NSUB, NSUPER, IPIVOT, SDET)
CALL ZGBDI 
(ZA, LDA, N, NSUB, NSUPER, IPIVOT, ZDET)
CALL CGBDI 
(CA, LDA, N, NSUB, NSUPER, IPIVOT, CDET)






void dgbdi 
(double *da, int lda, int n, int nsub, int nsuper, int 
*ipivot, double *ddet)
void sgbdi 
(float *sa, int lda, int n, int nsub, int nsuper, int 
*ipivot, float *sdet)
void zgbdi 
(doublecomplex *za, int lda, int n, int nsub, int 
nsuper, int *ipivot, doublecomplex *zdet)
void cgbdi 
(complex *ca, int lda, int n, int nsub, int nsuper, int 
*ipivot, complex *cdet)

Arguments

xA

LU factorization of the matrix A, as computed by xGBCO or xGBFA.

LDA

Leading dimension of the array A as specified in a dimension or type statement. LDA 2 × NSUB + NSUPER + 1.

N

Order of the original matrix A. N 0.

NSUB

Number of subdiagonals of A. N-1 NSUB 0 but if N = 0 then NSUB = 0.

NSUPER

Number of superdiagonals of A. N-1 NSUPER 0 but if N = 0 then NSUPER = 0.

IPIVOT

Pivot vector as computed by xGBCO or xGBFA.

xDET

On exit, the determinant of the matrix A. The determinant is stored as b × 10expon 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.

Sample Program

 
      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           LDA, LDAB, LENGAB, N, NDIAG, NSUB, NSUPER
      PARAMETER        (N = 5)
      PARAMETER        (NSUB = 4)
      PARAMETER        (NSUPER = 0)
      PARAMETER        (NDIAG = NSUB + 1 + NSUPER)
      PARAMETER        (LDA = N)
      PARAMETER        (LDAB = 2 * NSUB + 1 + NDIAG)
      PARAMETER        (LENGAB = LDAB * N)
C
      DOUBLE PRECISION  A(LDA,N), AB(LDAB, N), DET(2)
      INTEGER           ICOL, INFO, IPIVOT(N), IROW, IROWB, I1, I2
C
      EXTERNAL          DGBDI, DGBFA
C
C     Initialize the array A to store the 5x5 matrix A with four
C     subdiagonals and no superdiagonals shown below.
C
C         1
C         1  -1
C     A = 1  -2  1
C         1  -3  3  -1
C         1  -4  6  -4  1
C
      DATA A / 1.0D0, 1.0D0, 1.0D0, 1.0D0, 1.0D0,
     $        0.0D0, -1.0D0, -2.0D0, -3.0D0, -4.0D0,
     $        0.0D0, 0.0D0, 1.0D0, 3.0D0, 6.0D0,
     $        0.0D0, 0.0D0, 0.0D0, -1.0D0, -4.0D0,
     $        0.0D0, 0.0D0, 0.0D0, 0.0D0, 1.0D0 /
      DATA AB / LENGAB*8D8 /



      DO 20, ICOL = 1, N
        I1 = MAX0 (1, ICOL - NSUPER)
        I2 = MIN0 (N, ICOL + NSUB)
        DO 10, IROW = I1, I2
          IROWB = IROW - ICOL + NDIAG
          AB(IROWB, ICOL) = A(IROW, ICOL)
   10   CONTINUE
   20 CONTINUE
C
C     Print the initial values of the arrays.
C
      PRINT 1000
      PRINT 1010, ((A(IROW, ICOL), ICOL = 1, N), IROW = 1, N)
      PRINT 1020
      PRINT 1010, ((AB(IROW, ICOL), ICOL = 1, N),
     $              IROW = 1, 2 * NSUB + 1 + NSUPER)
C
C     Factor the matrix in banded form.
C
      CALL DGBFA (AB, LDAB, N, NSUB, NSUPER, IPIVOT, INFO)
      IF (INFO .EQ. 0) THEN
        CALL DGBDI (AB, LDAB, N, NSUB, NSUPER, IPIVOT, DET)
        PRINT 1030, DET(1) * (1.0D0 ** DET(2))
      ELSE
        PRINT 1040, INFO
      END IF
C
 1000 FORMAT (1X, 'A in full form:')
 1010 FORMAT (5(3X, F4.1))
 1020 FORMAT (/1X, 'A in banded form:  (* in unused elements)')
 1030 FORMAT (/1X, 'det(A) = ', F4.1)
 1040 FORMAT (/1X, 'A appears singular at ', I2)
C
      END
 

Sample Output

 
 A in full form:
    1.0    0.0    0.0    0.0    0.0
    1.0   -1.0    0.0    0.0    0.0
    1.0   -2.0    1.0    0.0    0.0
    1.0   -3.0    3.0   -1.0    0.0
    1.0   -4.0    6.0   -4.0    1.0



 A in banded form:  (* in unused elements)
   ****   ****   ****   ****   ****
   ****   ****   ****   ****   ****
   ****   ****   ****   ****   ****
   ****   ****   ****   ****   ****
    1.0   -1.0    1.0   -1.0    1.0
    1.0   -2.0    3.0   -4.0   ****
    1.0   -3.0    6.0   ****   ****
    1.0   -4.0   ****   ****   ****
    1.0   ****   ****   ****   ****



 det(A) =  1.0






Previous Next Contents Generated Index Doc Set Home