Previous Next Contents Generated Index Doc Set Home



Inverse of a Triangular Matrix in Packed Storage

The subroutines described in this section compute the inverse of a triangular matrix A in packed storage.

Calling Sequence

CALL DTPTRI 
(UPLO, DIAG, N, DA, INFO)
CALL STPTRI 
(UPLO, DIAG, N, SA, INFO)
CALL ZTPTRI 
(UPLO, DIAG, N, ZA, INFO)
CALL CTPTRI 
(UPLO, DIAG, N, CA, INFO)






void dtptri 
(char uplo, char diag, int n, double *da, int *info)
void stptri 
(char uplo, char diag, int n, float *sa, int *info)
void ztptri 
(char uplo, char diag, int n, doublecomplex *za, int 
*info)
void ctptri 
(char uplo, char diag, int n, complex *ca, 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.

DIAG

Indicates whether or not A is unit triangular. The legal values for DIAG are listed below. Any values not listed below are illegal.

'N' or 'n'

A is not unit triangular.

'U' or 'u'

A is unit triangular.

N

Order of the matrix A. N 0.

xA

On entry, the upper or lower triangular matrix A. The dimension of xA is (N × N + N) / 2.
On exit, the triangular inverse of A.

INFO

On exit:

INFO = 0

Subroutine completed normally.

INFO < 0

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

INFO > 0

A(i,i), where i = INFO, is exactly zero. The matrix is therefore singular and its inverse could not be computed.

Sample Program




      PROGRAM TEST
      IMPLICIT NONE
C
      DOUBLE PRECISION  ZERO
      INTEGER           LDA, N
      PARAMETER        (N = 4)
      PARAMETER        (LDA = ((N + 1) * N) / 2)
      PARAMETER        (ZERO = 0.0D0)
C
      DOUBLE PRECISION  A(LDA)
      INTEGER           INFO
C
      EXTERNAL  DTPTRI
C
C     Initialize the array A to store in packed triangular form
C     the matrix A shown below.
C
C         1
C     A = 1   1
C         1   1   1
C         1   1   1   1
C
      DATA A / LDA*1.0D0 /
C
C     Print the A array.
C
      PRINT 1000
      PRINT 1010, A(1), ZERO, ZERO, ZERO
      PRINT 1010, A(2), A(5), ZERO, ZERO
      PRINT 1010, A(3), A(6), A(8), ZERO
      PRINT 1010, A(4), A(7), A(9), A(10)
C
C     Compute and print A**(-1).
C
      CALL DTPTRI ('LOWER TRIANGULAR A', 'NO UNIT DIAGONAL A',
     $             N, A, INFO)
      IF (INFO .NE. 0) THEN
        PRINT 1020, INFO
        STOP 1
      END IF
      PRINT 1030
      PRINT 1010, A(1), ZERO, ZERO, ZERO
      PRINT 1010, A(2), A(5), ZERO, ZERO
      PRINT 1010, A(3), A(6), A(8), ZERO
      PRINT 1010, A(4), A(7), A(9), A(10)
C
 1000 FORMAT (1X, 'A:')
 1010 FORMAT (4(3X, F5.2))
 1020 FORMAT (/1X, 'Error inverting A, INFO = ', I5)
 1030 FORMAT (/1X, 'A**(-1):')
C
      END
 

Sample Output

 
 A:
    1.00    0.00    0.00    0.00
    1.00    1.00    0.00    0.00
    1.00    1.00    1.00    0.00
    1.00    1.00    1.00    1.00



 A**(-1):
    1.00    0.00    0.00    0.00
   -1.00    1.00    0.00    0.00
    0.00   -1.00    1.00    0.00
    0.00    0.00   -1.00    1.00






Previous Next Contents Generated Index Doc Set Home