LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ dtrti2()

subroutine dtrti2 ( character  UPLO,
character  DIAG,
integer  N,
double precision, dimension( lda, * )  A,
integer  LDA,
integer  INFO 
)

DTRTI2 computes the inverse of a triangular matrix (unblocked algorithm).

Download DTRTI2 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 DTRTI2 computes the inverse of a real upper or lower triangular
 matrix.

 This is the Level 2 BLAS version of the algorithm.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the matrix A is upper or lower triangular.
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]DIAG
          DIAG is CHARACTER*1
          Specifies whether or not the matrix A is unit triangular.
          = 'N':  Non-unit triangular
          = 'U':  Unit triangular
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in,out]A
          A is DOUBLE PRECISION array, dimension (LDA,N)
          On entry, the triangular matrix A.  If UPLO = 'U', the
          leading n by n upper triangular part of the array A contains
          the upper triangular matrix, and the strictly lower
          triangular part of A is not referenced.  If UPLO = 'L', the
          leading n by n lower triangular part of the array A contains
          the lower triangular matrix, and the strictly upper
          triangular part of A is not referenced.  If DIAG = 'U', the
          diagonal elements of A are also not referenced and are
          assumed to be 1.

          On exit, the (triangular) inverse of the original matrix, in
          the same storage format.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[out]INFO
          INFO is INTEGER
          = 0: successful exit
          < 0: if INFO = -k, the k-th argument had an illegal value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 112 of file dtrti2.f.

112 *
113 * -- LAPACK computational routine (version 3.7.0) --
114 * -- LAPACK is a software package provided by Univ. of Tennessee, --
115 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
116 * December 2016
117 *
118 * .. Scalar Arguments ..
119  CHARACTER diag, uplo
120  INTEGER info, lda, n
121 * ..
122 * .. Array Arguments ..
123  DOUBLE PRECISION a( lda, * )
124 * ..
125 *
126 * =====================================================================
127 *
128 * .. Parameters ..
129  DOUBLE PRECISION one
130  parameter( one = 1.0d+0 )
131 * ..
132 * .. Local Scalars ..
133  LOGICAL nounit, upper
134  INTEGER j
135  DOUBLE PRECISION ajj
136 * ..
137 * .. External Functions ..
138  LOGICAL lsame
139  EXTERNAL lsame
140 * ..
141 * .. External Subroutines ..
142  EXTERNAL dscal, dtrmv, xerbla
143 * ..
144 * .. Intrinsic Functions ..
145  INTRINSIC max
146 * ..
147 * .. Executable Statements ..
148 *
149 * Test the input parameters.
150 *
151  info = 0
152  upper = lsame( uplo, 'U' )
153  nounit = lsame( diag, 'N' )
154  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
155  info = -1
156  ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
157  info = -2
158  ELSE IF( n.LT.0 ) THEN
159  info = -3
160  ELSE IF( lda.LT.max( 1, n ) ) THEN
161  info = -5
162  END IF
163  IF( info.NE.0 ) THEN
164  CALL xerbla( 'DTRTI2', -info )
165  RETURN
166  END IF
167 *
168  IF( upper ) THEN
169 *
170 * Compute inverse of upper triangular matrix.
171 *
172  DO 10 j = 1, n
173  IF( nounit ) THEN
174  a( j, j ) = one / a( j, j )
175  ajj = -a( j, j )
176  ELSE
177  ajj = -one
178  END IF
179 *
180 * Compute elements 1:j-1 of j-th column.
181 *
182  CALL dtrmv( 'Upper', 'No transpose', diag, j-1, a, lda,
183  $ a( 1, j ), 1 )
184  CALL dscal( j-1, ajj, a( 1, j ), 1 )
185  10 CONTINUE
186  ELSE
187 *
188 * Compute inverse of lower triangular matrix.
189 *
190  DO 20 j = n, 1, -1
191  IF( nounit ) THEN
192  a( j, j ) = one / a( j, j )
193  ajj = -a( j, j )
194  ELSE
195  ajj = -one
196  END IF
197  IF( j.LT.n ) THEN
198 *
199 * Compute elements j+1:n of j-th column.
200 *
201  CALL dtrmv( 'Lower', 'No transpose', diag, n-j,
202  $ a( j+1, j+1 ), lda, a( j+1, j ), 1 )
203  CALL dscal( n-j, ajj, a( j+1, j ), 1 )
204  END IF
205  20 CONTINUE
206  END IF
207 *
208  RETURN
209 *
210 * End of DTRTI2
211 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine dscal(N, DA, DX, INCX)
DSCAL
Definition: dscal.f:81
subroutine dtrmv(UPLO, TRANS, DIAG, N, A, LDA, X, INCX)
DTRMV
Definition: dtrmv.f:149
Here is the call graph for this function:
Here is the caller graph for this function: