Previous Next Contents Generated Index Doc Set Home



Inverse of a UDU- or LDL-Factored Hermitian Matrix in Packed Storage

The subroutines described in this section compute the inverse of a Hermitian matrix A in packed storage, which has been UDU-factored or LDL-factored by xHPTRF.

Calling Sequence

CALL ZHPTRI 
(UPLO, N, ZA, IPIVOT, ZWORK, INFO)
CALL CHPTRI 
(UPLO, N, CA, IPIVOT, CWORK, INFO)






void zhptri 
(char uplo, int n, doublecomplex *za, int *ipivot, int 
*info)
void chptri 
(char uplo, int n, complex *ca, int *ipivot, 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 UDU or LDL factorization of the matrix A, as computed by xHPTRF. The dimension of xA is (N × N + N ) / 2.

On exit, the Hermitian inverse of the matrix A.

If UPLO = 'U' or 'u', the upper triangular part of the inverse is formed and the part of A below the diagonal is not used.

If UPLO = 'L' or 'l' the lower triangular part of the inverse is formed and the part of A above the diagonal is not used.

IPIVOT

Pivot indices as computed by xHPTRF.

xWORK

Scratch array with a dimension of N.

INFO

On exit:

INFO = 0

Subroutine completed normally.

INFO < 0

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

INFO > 0

D(i,i), 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     LDWORK, LENGTA, N
      PARAMETER  (N = 3)
      PARAMETER  (LDWORK = N)
      PARAMETER  (LENGTA = (N * N + N) / 2)
C
      COMPLEX*16  A(LENGTA), WORK(LDWORK)
      INTEGER     INFO, IPIVOT(N)
C
      EXTERNAL    ZHPTRF, ZHPTRI
      INTRINSIC   ABS, CONJG
C
C     Initialize the array A to store the coefficient array A
C     shown below.
C
C          1   1-i  1-i
C     A = 1+i   3   3-i
C         1+i  3+i   5
C
      DATA A / (1.0D0,0.0D0), (1.0D0,-1.0D0), (3.0D0,0.0D0),
     $         (1.0D0,-1.0D0), (3.0D0,-1.0D0), (5.0D0,0.0D0) /
C
C     Print the initial value of A.
C
      PRINT 1000
      PRINT 1010, A(1),        A(2),        A(4)
      PRINT 1010, CONJG(A(2)), A(3),        A(5)
      PRINT 1010, CONJG(A(4)), CONJG(A(5)), A(6)
C
C     Factor the matrix.
C
      CALL ZHPTRF ('UPPER TRIANGLE OF A STORED', N, A, IPIVOT,
     $             INFO)
      IF (INFO .LT. 0) THEN
        PRINT 1020, ABS(INFO)
        STOP 1
      ELSE IF (INFO .GT. 0) THEN
        PRINT 1030
        STOP 2
      END IF
C
C     Compute and print the inverse.
C
      CALL ZHPTRI ('UPPER TRIANGULAR FACTOR OF A', N, A, IPIVOT,
     $             WORK, INFO)
      IF (INFO .LT. 0) THEN
        PRINT 1040, ABS(INFO)
        STOP 3
      ELSE IF (INFO .GT. 0) THEN
        PRINT 1030
        STOP 4
      END IF
      PRINT 1050
      PRINT 1010, A(1),        A(2),        A(4)
      PRINT 1010, CONJG(A(2)), A(3),        A(5)
      PRINT 1010, CONJG(A(4)), CONJG(A(5)), A(6)
C
 1000 FORMAT (1X, 'A:')
 1010 FORMAT (1X, 10(: 2X, '(', F5.1, ',', F5.1, ')'))
 1020 FORMAT (1X, 'Illegal argument to ZHPTRF, argument #', I2)
 1030 FORMAT (1X, 'A is singular to working precision.')
 1040 FORMAT (1X, 'Illegal argument to ZHPTRI, argument #', I2)
 1050 FORMAT (/1X, 'A**(-1):')
C
      END
 

Sample Output

 
 A:
   (  1.0,  0.0)  (  1.0, -1.0)  (  1.0, -1.0)
   (  1.0,  1.0)  (  3.0,  0.0)  (  3.0, -1.0)
   (  1.0,  1.0)  (  3.0,  1.0)  (  5.0,  0.0)



 A**(-1):
   (  5.0,  0.0)  ( -1.0,  3.0)  ( -1.0, -1.0)
   ( -1.0, -3.0)  (  3.0,  0.0)  ( -1.0,  1.0)
   ( -1.0,  1.0)  ( -1.0, -1.0)  (  1.0,  0.0)






Previous Next Contents Generated Index Doc Set Home