Previous Next Contents Generated Index Doc Set Home



Determinant and Inverse of a Cholesky-Factored Symmetric Positive Definite Matrix in Packed Storage

The subroutines described in this section compute the determinant and inverse of a symmetric positive definite matrix A in packed storage, which has been Cholesky-factored by xPPCO or xPPFA.

Calling Sequence

CALL DPPDI 
(DA, N, DDET, JOB)
CALL SPPDI 
(SA, N, SDET, JOB)
CALL ZPPDI 
(ZA, N, DDET, JOB)
CALL CPPDI 
(CA, N, SDET, JOB)






void dppdi 
(double *da, int n, double *ddet, int job)
void sppdi 
(float *sa, int n, float *sdet, int job)
void zppdi 
(doublecomplex *za, int n, double *ddet, int job)
void cppdi 
(complex *ca, int n, float *sdet, int job)

Arguments

xA

On entry, the Cholesky factorization of the matrix A, as computed by xPPCO or xPPFA.
On exit, the inverse of the original matrix A if the inverse was requested, otherwise A is unchanged. The strict lower triangle of A is not referenced.

N

Order of the original matrix A. N 0.

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.

JOB

Determines 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, LENGTA, N
      PARAMETER        (INVDET = 11)
      PARAMETER        (N = 4)
      PARAMETER        (LENGTA = (N * N + N) / 2)
C
      DOUBLE PRECISION  A(LENGTA), DET(2)
      INTEGER           INFO, JOB
C
      EXTERNAL          DPPFA, DPPDI
C
C     Initialize the array A to store in packed symmetric storage
C     mode the matrix A shown below.  Initialize the array B to
C     store the vector B shown below.
C
C         4  3  2  1
C     A = 3  4  3  2
C         2  3  4  3
C         1  2  3  4
C
      DATA A / 4.0D0, 3.0D0, 4.0D0, 2.0D0, 3.0D0, 4.0D0,
     $         1.0D0, 2.0D0, 3.0D0, 4.0D0 /
C
      PRINT 1000
      PRINT 1010, A(1), A(2), A(4), A(7)
      PRINT 1010, A(2), A(3), A(5), A(8)
      PRINT 1010, A(4), A(5), A(6), A(9)
      PRINT 1010, A(7), A(8), A(9), A(10)
      CALL DPPFA (A, N, INFO)
      IF (INFO .EQ. 0) THEN
        JOB = INVDET
        CALL DPPDI (A, N, DET, JOB)
        PRINT 1020, DET(1) * (1.0D1 ** DET(2))
        PRINT 1030
        PRINT 1010, A(1), A(2), A(4), A(7)
        PRINT 1010, A(2), A(3), A(5), A(8)
        PRINT 1010, A(4), A(5), A(6), A(9)
        PRINT 1010, A(7), A(8), A(9), A(10)
      ELSE
        PRINT 1040
      END IF
C
 1000 FORMAT (1X, 'A in full form:')
 1010 FORMAT (4(3X, F5.1))
 1020 FORMAT (/1X, 'Determinant of A is ', F4.1)
 1030 FORMAT (/1X, 'A**(-1):')
 1040 FORMAT (/1X, 'A is too ill-conditioned.')
C
      END
 

Sample Output

 
 A in full form:
     4.0     3.0     2.0     1.0
     3.0     4.0     3.0     2.0
     2.0     3.0     4.0     3.0
     1.0     2.0     3.0     4.0



 Determinant of A is 20.0



 A**(-1):
     0.6    -0.5     0.0     0.1
    -0.5     1.0    -0.5     0.0
     0.0    -0.5     1.0    -0.5
     0.1     0.0    -0.5     0.6






Previous Next Contents Generated Index Doc Set Home