LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine strtri ( character  UPLO,
character  DIAG,
integer  N,
real, dimension( lda, * )  A,
integer  LDA,
integer  INFO 
)

STRTRI

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

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

 This is the Level 3 BLAS version of the algorithm.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          = 'U':  A is upper triangular;
          = 'L':  A is lower triangular.
[in]DIAG
          DIAG is CHARACTER*1
          = 'N':  A is non-unit triangular;
          = 'U':  A is unit triangular.
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in,out]A
          A is REAL 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 = -i, the i-th argument had an illegal value
          > 0: if INFO = i, A(i,i) is exactly zero.  The triangular
               matrix is singular and its inverse can not be computed.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011

Definition at line 111 of file strtri.f.

111 *
112 * -- LAPACK computational routine (version 3.4.0) --
113 * -- LAPACK is a software package provided by Univ. of Tennessee, --
114 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
115 * November 2011
116 *
117 * .. Scalar Arguments ..
118  CHARACTER diag, uplo
119  INTEGER info, lda, n
120 * ..
121 * .. Array Arguments ..
122  REAL a( lda, * )
123 * ..
124 *
125 * =====================================================================
126 *
127 * .. Parameters ..
128  REAL one, zero
129  parameter ( one = 1.0e+0, zero = 0.0e+0 )
130 * ..
131 * .. Local Scalars ..
132  LOGICAL nounit, upper
133  INTEGER j, jb, nb, nn
134 * ..
135 * .. External Functions ..
136  LOGICAL lsame
137  INTEGER ilaenv
138  EXTERNAL lsame, ilaenv
139 * ..
140 * .. External Subroutines ..
141  EXTERNAL strmm, strsm, strti2, xerbla
142 * ..
143 * .. Intrinsic Functions ..
144  INTRINSIC max, min
145 * ..
146 * .. Executable Statements ..
147 *
148 * Test the input parameters.
149 *
150  info = 0
151  upper = lsame( uplo, 'U' )
152  nounit = lsame( diag, 'N' )
153  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
154  info = -1
155  ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag, 'U' ) ) THEN
156  info = -2
157  ELSE IF( n.LT.0 ) THEN
158  info = -3
159  ELSE IF( lda.LT.max( 1, n ) ) THEN
160  info = -5
161  END IF
162  IF( info.NE.0 ) THEN
163  CALL xerbla( 'STRTRI', -info )
164  RETURN
165  END IF
166 *
167 * Quick return if possible
168 *
169  IF( n.EQ.0 )
170  $ RETURN
171 *
172 * Check for singularity if non-unit.
173 *
174  IF( nounit ) THEN
175  DO 10 info = 1, n
176  IF( a( info, info ).EQ.zero )
177  $ RETURN
178  10 CONTINUE
179  info = 0
180  END IF
181 *
182 * Determine the block size for this environment.
183 *
184  nb = ilaenv( 1, 'STRTRI', uplo // diag, n, -1, -1, -1 )
185  IF( nb.LE.1 .OR. nb.GE.n ) THEN
186 *
187 * Use unblocked code
188 *
189  CALL strti2( uplo, diag, n, a, lda, info )
190  ELSE
191 *
192 * Use blocked code
193 *
194  IF( upper ) THEN
195 *
196 * Compute inverse of upper triangular matrix
197 *
198  DO 20 j = 1, n, nb
199  jb = min( nb, n-j+1 )
200 *
201 * Compute rows 1:j-1 of current block column
202 *
203  CALL strmm( 'Left', 'Upper', 'No transpose', diag, j-1,
204  $ jb, one, a, lda, a( 1, j ), lda )
205  CALL strsm( 'Right', 'Upper', 'No transpose', diag, j-1,
206  $ jb, -one, a( j, j ), lda, a( 1, j ), lda )
207 *
208 * Compute inverse of current diagonal block
209 *
210  CALL strti2( 'Upper', diag, jb, a( j, j ), lda, info )
211  20 CONTINUE
212  ELSE
213 *
214 * Compute inverse of lower triangular matrix
215 *
216  nn = ( ( n-1 ) / nb )*nb + 1
217  DO 30 j = nn, 1, -nb
218  jb = min( nb, n-j+1 )
219  IF( j+jb.LE.n ) THEN
220 *
221 * Compute rows j+jb:n of current block column
222 *
223  CALL strmm( 'Left', 'Lower', 'No transpose', diag,
224  $ n-j-jb+1, jb, one, a( j+jb, j+jb ), lda,
225  $ a( j+jb, j ), lda )
226  CALL strsm( 'Right', 'Lower', 'No transpose', diag,
227  $ n-j-jb+1, jb, -one, a( j, j ), lda,
228  $ a( j+jb, j ), lda )
229  END IF
230 *
231 * Compute inverse of current diagonal block
232 *
233  CALL strti2( 'Lower', diag, jb, a( j, j ), lda, info )
234  30 CONTINUE
235  END IF
236  END IF
237 *
238  RETURN
239 *
240 * End of STRTRI
241 *
subroutine strsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
STRSM
Definition: strsm.f:183
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine strmm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
STRMM
Definition: strmm.f:179
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
Definition: tstiee.f:83
subroutine strti2(UPLO, DIAG, N, A, LDA, INFO)
STRTI2 computes the inverse of a triangular matrix (unblocked algorithm).
Definition: strti2.f:112
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function: