3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download STRTRI + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/strtri.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/strtri.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/strtri.f">
21 * SUBROUTINE STRTRI( UPLO, DIAG, N, A, LDA, INFO )
23 * .. Scalar Arguments ..
24 * CHARACTER DIAG, UPLO
25 * INTEGER INFO, LDA, N
27 * .. Array Arguments ..
37 *> STRTRI computes the inverse of a real upper or lower triangular
40 *> This is the Level 3 BLAS version of the algorithm.
48 *> UPLO is CHARACTER*1
49 *> = 'U': A is upper triangular;
50 *> = 'L': A is lower triangular.
55 *> DIAG is CHARACTER*1
56 *> = 'N': A is non-unit triangular;
57 *> = 'U': A is unit triangular.
63 *> The order of the matrix A. N >= 0.
68 *> A is REAL array, dimension (LDA,N)
69 *> On entry, the triangular matrix A. If UPLO = 'U', the
70 *> leading N-by-N upper triangular part of the array A contains
71 *> the upper triangular matrix, and the strictly lower
72 *> triangular part of A is not referenced. If UPLO = 'L', the
73 *> leading N-by-N lower triangular part of the array A contains
74 *> the lower triangular matrix, and the strictly upper
75 *> triangular part of A is not referenced. If DIAG = 'U', the
76 *> diagonal elements of A are also not referenced and are
78 *> On exit, the (triangular) inverse of the original matrix, in
79 *> the same storage format.
85 *> The leading dimension of the array A. LDA >= max(1,N).
91 *> = 0: successful exit
92 *> < 0: if INFO = -i, the i-th argument had an illegal value
93 *> > 0: if INFO = i, A(i,i) is exactly zero. The triangular
94 *> matrix is singular and its inverse can not be computed.
100 *> \author Univ. of Tennessee
101 *> \author Univ. of California Berkeley
102 *> \author Univ. of Colorado Denver
105 *> \date November 2011
107 *> \ingroup realOTHERcomputational
109 * =====================================================================
110 SUBROUTINE STRTRI( UPLO, DIAG, N, A, LDA, INFO )
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..--
117 * .. Scalar Arguments ..
121 * .. Array Arguments ..
125 * =====================================================================
129 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
131 * .. Local Scalars ..
132 LOGICAL NOUNIT, UPPER
133 INTEGER J, JB, NB, NN
135 * .. External Functions ..
138 EXTERNAL LSAME, ILAENV
140 * .. External Subroutines ..
141 EXTERNAL STRMM, STRSM, STRTI2, XERBLA
143 * .. Intrinsic Functions ..
146 * .. Executable Statements ..
148 * Test the input parameters.
151 UPPER = LSAME( UPLO, 'U' )
152 NOUNIT = LSAME( DIAG, 'N' )
153 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
155 ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN
157 ELSE IF( N.LT.0 ) THEN
159 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
163 CALL XERBLA( 'STRTRI', -INFO )
167 * Quick return if possible
172 * Check for singularity if non-unit.
176 IF( A( INFO, INFO ).EQ.ZERO )
182 * Determine the block size for this environment.
184 NB = ILAENV( 1, 'STRTRI', UPLO // DIAG, N, -1, -1, -1 )
185 IF( NB.LE.1 .OR. NB.GE.N ) THEN
189 CALL STRTI2( UPLO, DIAG, N, A, LDA, INFO )
196 * Compute inverse of upper triangular matrix
199 JB = MIN( NB, N-J+1 )
201 * Compute rows 1:j-1 of current block column
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 )
208 * Compute inverse of current diagonal block
210 CALL STRTI2( 'Upper', DIAG, JB, A( J, J ), LDA, INFO )
214 * Compute inverse of lower triangular matrix
216 NN = ( ( N-1 ) / NB )*NB + 1
218 JB = MIN( NB, N-J+1 )
221 * Compute rows j+jb:n of current block column
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 )
231 * Compute inverse of current diagonal block
233 CALL STRTI2( 'Lower', DIAG, JB, A( J, J ), LDA, INFO )