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

ZTRTRI

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

Purpose:
 ZTRTRI computes the inverse of a complex 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 COMPLEX*16 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 ztrtri.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  COMPLEX*16 a( lda, * )
123 * ..
124 *
125 * =====================================================================
126 *
127 * .. Parameters ..
128  COMPLEX*16 one, zero
129  parameter ( one = ( 1.0d+0, 0.0d+0 ),
130  $ zero = ( 0.0d+0, 0.0d+0 ) )
131 * ..
132 * .. Local Scalars ..
133  LOGICAL nounit, upper
134  INTEGER j, jb, nb, nn
135 * ..
136 * .. External Functions ..
137  LOGICAL lsame
138  INTEGER ilaenv
139  EXTERNAL lsame, ilaenv
140 * ..
141 * .. External Subroutines ..
142  EXTERNAL xerbla, ztrmm, ztrsm, ztrti2
143 * ..
144 * .. Intrinsic Functions ..
145  INTRINSIC max, min
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( 'ZTRTRI', -info )
165  RETURN
166  END IF
167 *
168 * Quick return if possible
169 *
170  IF( n.EQ.0 )
171  $ RETURN
172 *
173 * Check for singularity if non-unit.
174 *
175  IF( nounit ) THEN
176  DO 10 info = 1, n
177  IF( a( info, info ).EQ.zero )
178  $ RETURN
179  10 CONTINUE
180  info = 0
181  END IF
182 *
183 * Determine the block size for this environment.
184 *
185  nb = ilaenv( 1, 'ZTRTRI', uplo // diag, n, -1, -1, -1 )
186  IF( nb.LE.1 .OR. nb.GE.n ) THEN
187 *
188 * Use unblocked code
189 *
190  CALL ztrti2( uplo, diag, n, a, lda, info )
191  ELSE
192 *
193 * Use blocked code
194 *
195  IF( upper ) THEN
196 *
197 * Compute inverse of upper triangular matrix
198 *
199  DO 20 j = 1, n, nb
200  jb = min( nb, n-j+1 )
201 *
202 * Compute rows 1:j-1 of current block column
203 *
204  CALL ztrmm( 'Left', 'Upper', 'No transpose', diag, j-1,
205  $ jb, one, a, lda, a( 1, j ), lda )
206  CALL ztrsm( 'Right', 'Upper', 'No transpose', diag, j-1,
207  $ jb, -one, a( j, j ), lda, a( 1, j ), lda )
208 *
209 * Compute inverse of current diagonal block
210 *
211  CALL ztrti2( 'Upper', diag, jb, a( j, j ), lda, info )
212  20 CONTINUE
213  ELSE
214 *
215 * Compute inverse of lower triangular matrix
216 *
217  nn = ( ( n-1 ) / nb )*nb + 1
218  DO 30 j = nn, 1, -nb
219  jb = min( nb, n-j+1 )
220  IF( j+jb.LE.n ) THEN
221 *
222 * Compute rows j+jb:n of current block column
223 *
224  CALL ztrmm( 'Left', 'Lower', 'No transpose', diag,
225  $ n-j-jb+1, jb, one, a( j+jb, j+jb ), lda,
226  $ a( j+jb, j ), lda )
227  CALL ztrsm( 'Right', 'Lower', 'No transpose', diag,
228  $ n-j-jb+1, jb, -one, a( j, j ), lda,
229  $ a( j+jb, j ), lda )
230  END IF
231 *
232 * Compute inverse of current diagonal block
233 *
234  CALL ztrti2( 'Lower', diag, jb, a( j, j ), lda, info )
235  30 CONTINUE
236  END IF
237  END IF
238 *
239  RETURN
240 *
241 * End of ZTRTRI
242 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine ztrmm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
ZTRMM
Definition: ztrmm.f:179
integer function ilaenv(ISPEC, NAME, OPTS, N1, N2, N3, N4)
Definition: tstiee.f:83
subroutine ztrsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
ZTRSM
Definition: ztrsm.f:182
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine ztrti2(UPLO, DIAG, N, A, LDA, INFO)
ZTRTI2 computes the inverse of a triangular matrix (unblocked algorithm).
Definition: ztrti2.f:112

Here is the call graph for this function:

Here is the caller graph for this function: