Previous Next Contents Generated Index Doc Set Home



Inverse of a Cholesky-Factored Symmetric Positive Definite Matrix

The subroutines described in this section compute the inverse of a real symmetric (or Hermitian) matrix A, which has been Cholesky-factored by xPOTRF.

Calling Sequence

CALL DPOTRI 
(UPLO, N, DA, LDA, INFO)
CALL SPOTRI 
(UPLO, N, SA, LDA, INFO)
CALL ZPOTRI 
(UPLO, N, ZA, LDA, INFO)
CALL CPOTRI 
(UPLO, N, CA, LDA, INFO)






void dpotri 
(char uplo, int n, double *da, int lda, int *info)
void spotri 
(char uplo, int n, float *sa, int lda, int *info)
void zpotri 
(char uplo, int n, doublecomplex *za, int lda, int 
*info)
void cpotri 
(char uplo, int n, complex *ca, int lda, int *info)

Arguments

UPLO

Indicates whether xA contains the upper or lower triangle of the matrix. The legal values for UPLO are listed below. Any values not listed below are illegal.

'U' or 'u'

xA contains the upper triangle.

'L' or 'l'

xA contains the lower triangle.

N

Order of the matrix A. N 0.

xA

On entry, the Cholesky factorization of the matrix A as computed by xPOTRF.
On exit, the symmetric (or Hermitian) inverse of the matrix A.

LDA

Leading dimension of the array A as specified in a dimension or type statement. LDA max(1, N).

INFO

On exit:

INFO = 0

Subroutine completed normally.

INFO < 0

The ith argument, where i = |INFO|, had an illegal value.

INFO > 0

Element (i,i) of the factor U or L, where i = INFO, is zero. The matrix is therefore singular and its inverse could not be computed.

Sample Program




      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           LDA, N
      PARAMETER        (N = 4)
      PARAMETER        (LDA = N)
C
      DOUBLE PRECISION  A(LDA,N)
      INTEGER           ICOL, INFO, IROW
C
      EXTERNAL          DPOTRF, DPOTRI
      INTRINSIC         ABS
C
C     Initialize the array A to store in symmetric form the
C     4x4 symmetric positive definite coefficient matrix A
C     shown below.
C
C         2  1  0  0
C     A = 1  2  1  0
C         0  1  2  1
C         0  0  1  1
C
      DATA A /  2.0D0, 3*8D8, 1.0D0, 2.0D0, 2*8D8, 0.0D0, 1.0D0,
     $          2.0D0, 8D8, 0.0D0, 0.0D0, 1.0D0, 1.0D0 /
C
C     Print the initial values of the arrays.
C
      PRINT 1000
      DO 100, IROW = 1, N
        PRINT 1010, (A(ICOL,IROW), ICOL = 1, IROW - 1),
     $              (A(IROW,ICOL), ICOL = IROW, N)
  100 CONTINUE
      PRINT 1020
      PRINT 1010, ((A(IROW,ICOL), ICOL = 1, N), IROW = 1, LDA)
C
C     Cholesky factor A.
C
      CALL DPOTRF ('UPPER TRIANGLE OF A STORED', N, A, LDA, INFO)
      IF (INFO .NE. 0) THEN
        PRINT 1030, INFO
        STOP 1
      END IF
C
C     Use the factored form of A to compute the inverse of A and
C     print the inverse thus computed.
C
      CALL DPOTRI ('UPPER TRIANGLE OF A STORED', N, A, LDA, INFO)
      IF (INFO .NE. 0) THEN
        PRINT 1040, ABS(INFO)
        STOP 2
      END IF
      PRINT 1050
      DO 200, IROW = 1, N
        PRINT 1010, (A(ICOL,IROW), ICOL = 1, IROW - 1),
     $              (A(IROW,ICOL), ICOL = IROW, N)
  200 CONTINUE
C
 1000 FORMAT (1X, 'A in full form:')
 1010 FORMAT (4(3X, F6.3))
 1020 FORMAT (/1X, 'A in symmetric form:  (* in unused elements)')
 1030 FORMAT (1X, 'Error factoring A, INFO = ', I5)
 1040 FORMAT (1X, 'Error computing inverse of A, INFO = ', I5)
 1050 FORMAT (/1X, 'A**(-1):')
C
      END
 

Sample Output

 
 A in full form:
    2.000    1.000    0.000    0.000
    1.000    2.000    1.000    0.000
    0.000    1.000    2.000    1.000
    0.000    0.000    1.000    1.000



 A in symmetric form:  (* in unused elements)
    2.000    1.000    0.000    0.000
   ******    2.000    1.000    0.000
   ******   ******    2.000    1.000
   ******   ******   ******    1.000



 A**(-1):
    1.000   -1.000    1.000   -1.000
   -1.000    2.000   -2.000    2.000
    1.000   -2.000    3.000   -3.000
   -1.000    2.000   -3.000    4.000






Previous Next Contents Generated Index Doc Set Home