3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CTRTRI + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ctrtri.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ctrtri.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ctrtri.f">
21 * SUBROUTINE CTRTRI( UPLO, DIAG, N, A, LDA, INFO )
23 * .. Scalar Arguments ..
24 * CHARACTER DIAG, UPLO
25 * INTEGER INFO, LDA, N
27 * .. Array Arguments ..
37 *> CTRTRI computes the inverse of a complex 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 COMPLEX 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 complexOTHERcomputational
109 * =====================================================================
110 SUBROUTINE CTRTRI( 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, 0.0E+0 ),
130 $ ZERO = ( 0.0E+0, 0.0E+0 ) )
132 * .. Local Scalars ..
133 LOGICAL NOUNIT, UPPER
134 INTEGER J, JB, NB, NN
136 * .. External Functions ..
139 EXTERNAL LSAME, ILAENV
141 * .. External Subroutines ..
142 EXTERNAL CTRMM, CTRSM, CTRTI2, XERBLA
144 * .. Intrinsic Functions ..
147 * .. Executable Statements ..
149 * Test the input parameters.
152 UPPER = LSAME( UPLO, 'U' )
153 NOUNIT = LSAME( DIAG, 'N' )
154 IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
156 ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN
158 ELSE IF( N.LT.0 ) THEN
160 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
164 CALL XERBLA( 'CTRTRI', -INFO )
168 * Quick return if possible
173 * Check for singularity if non-unit.
177 IF( A( INFO, INFO ).EQ.ZERO )
183 * Determine the block size for this environment.
185 NB = ILAENV( 1, 'CTRTRI', UPLO // DIAG, N, -1, -1, -1 )
186 IF( NB.LE.1 .OR. NB.GE.N ) THEN
190 CALL CTRTI2( UPLO, DIAG, N, A, LDA, INFO )
197 * Compute inverse of upper triangular matrix
200 JB = MIN( NB, N-J+1 )
202 * Compute rows 1:j-1 of current block column
204 CALL CTRMM( 'Left', 'Upper', 'No transpose', DIAG, J-1,
205 $ JB, ONE, A, LDA, A( 1, J ), LDA )
206 CALL CTRSM( 'Right', 'Upper', 'No transpose', DIAG, J-1,
207 $ JB, -ONE, A( J, J ), LDA, A( 1, J ), LDA )
209 * Compute inverse of current diagonal block
211 CALL CTRTI2( 'Upper', DIAG, JB, A( J, J ), LDA, INFO )
215 * Compute inverse of lower triangular matrix
217 NN = ( ( N-1 ) / NB )*NB + 1
219 JB = MIN( NB, N-J+1 )
222 * Compute rows j+jb:n of current block column
224 CALL CTRMM( '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 CTRSM( 'Right', 'Lower', 'No transpose', DIAG,
228 $ N-J-JB+1, JB, -ONE, A( J, J ), LDA,
229 $ A( J+JB, J ), LDA )
232 * Compute inverse of current diagonal block
234 CALL CTRTI2( 'Lower', DIAG, JB, A( J, J ), LDA, INFO )