3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CTRCON + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ctrcon.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ctrcon.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ctrcon.f">
21 * SUBROUTINE CTRCON( NORM, UPLO, DIAG, N, A, LDA, RCOND, WORK,
24 * .. Scalar Arguments ..
25 * CHARACTER DIAG, NORM, UPLO
26 * INTEGER INFO, LDA, N
29 * .. Array Arguments ..
31 * COMPLEX A( LDA, * ), WORK( * )
40 *> CTRCON estimates the reciprocal of the condition number of a
41 *> triangular matrix A, in either the 1-norm or the infinity-norm.
43 *> The norm of A is computed and an estimate is obtained for
44 *> norm(inv(A)), then the reciprocal of the condition number is
46 *> RCOND = 1 / ( norm(A) * norm(inv(A)) ).
54 *> NORM is CHARACTER*1
55 *> Specifies whether the 1-norm condition number or the
56 *> infinity-norm condition number is required:
57 *> = '1' or 'O': 1-norm;
58 *> = 'I': Infinity-norm.
63 *> UPLO is CHARACTER*1
64 *> = 'U': A is upper triangular;
65 *> = 'L': A is lower triangular.
70 *> DIAG is CHARACTER*1
71 *> = 'N': A is non-unit triangular;
72 *> = 'U': A is unit triangular.
78 *> The order of the matrix A. N >= 0.
83 *> A is COMPLEX array, dimension (LDA,N)
84 *> The triangular matrix A. If UPLO = 'U', the leading N-by-N
85 *> upper triangular part of the array A contains the upper
86 *> triangular matrix, and the strictly lower triangular part of
87 *> A is not referenced. If UPLO = 'L', the leading N-by-N lower
88 *> triangular part of the array A contains the lower triangular
89 *> matrix, and the strictly upper triangular part of A is not
90 *> referenced. If DIAG = 'U', the diagonal elements of A are
91 *> also not referenced and are assumed to be 1.
97 *> The leading dimension of the array A. LDA >= max(1,N).
103 *> The reciprocal of the condition number of the matrix A,
104 *> computed as RCOND = 1/(norm(A) * norm(inv(A))).
109 *> WORK is COMPLEX array, dimension (2*N)
114 *> RWORK is REAL array, dimension (N)
120 *> = 0: successful exit
121 *> < 0: if INFO = -i, the i-th argument had an illegal value
127 *> \author Univ. of Tennessee
128 *> \author Univ. of California Berkeley
129 *> \author Univ. of Colorado Denver
132 *> \date November 2011
134 *> \ingroup complexOTHERcomputational
136 * =====================================================================
137 SUBROUTINE CTRCON( NORM, UPLO, DIAG, N, A, LDA, RCOND, WORK,
140 * -- LAPACK computational routine (version 3.4.0) --
141 * -- LAPACK is a software package provided by Univ. of Tennessee, --
142 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
145 * .. Scalar Arguments ..
146 CHARACTER DIAG, NORM, UPLO
150 * .. Array Arguments ..
152 COMPLEX A( LDA, * ), WORK( * )
155 * =====================================================================
159 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
161 * .. Local Scalars ..
162 LOGICAL NOUNIT, ONENRM, UPPER
164 INTEGER IX, KASE, KASE1
165 REAL AINVNM, ANORM, SCALE, SMLNUM, XNORM
171 * .. External Functions ..
175 EXTERNAL LSAME, ICAMAX, CLANTR, SLAMCH
177 * .. External Subroutines ..
178 EXTERNAL CLACN2, CLATRS, CSRSCL, XERBLA
180 * .. Intrinsic Functions ..
181 INTRINSIC ABS, AIMAG, MAX, REAL
183 * .. Statement Functions ..
186 * .. Statement Function definitions ..
187 CABS1( ZDUM ) = ABS( REAL( ZDUM ) ) + ABS( AIMAG( ZDUM ) )
189 * .. Executable Statements ..
191 * Test the input parameters.
194 UPPER = LSAME( UPLO, 'U' )
195 ONENRM = NORM.EQ.'1' .OR. LSAME( NORM, 'O' )
196 NOUNIT = LSAME( DIAG, 'N' )
198 IF( .NOT.ONENRM .AND. .NOT.LSAME( NORM, 'I' ) ) THEN
200 ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
202 ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN
204 ELSE IF( N.LT.0 ) THEN
206 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
210 CALL XERBLA( 'CTRCON', -INFO )
214 * Quick return if possible
222 SMLNUM = SLAMCH( 'Safe minimum' )*REAL( MAX( 1, N ) )
224 * Compute the norm of the triangular matrix A.
226 ANORM = CLANTR( NORM, UPLO, DIAG, N, N, A, LDA, RWORK )
228 * Continue only if ANORM > 0.
230 IF( ANORM.GT.ZERO ) THEN
232 * Estimate the norm of the inverse of A.
243 CALL CLACN2( N, WORK( N+1 ), WORK, AINVNM, KASE, ISAVE )
245 IF( KASE.EQ.KASE1 ) THEN
247 * Multiply by inv(A).
249 CALL CLATRS( UPLO, 'No transpose', DIAG, NORMIN, N, A,
250 $ LDA, WORK, SCALE, RWORK, INFO )
253 * Multiply by inv(A**H).
255 CALL CLATRS( UPLO, 'Conjugate transpose', DIAG, NORMIN,
256 $ N, A, LDA, WORK, SCALE, RWORK, INFO )
260 * Multiply by 1/SCALE if doing so will not cause overflow.
262 IF( SCALE.NE.ONE ) THEN
263 IX = ICAMAX( N, WORK, 1 )
264 XNORM = CABS1( WORK( IX ) )
265 IF( SCALE.LT.XNORM*SMLNUM .OR. SCALE.EQ.ZERO )
267 CALL CSRSCL( N, SCALE, WORK, 1 )
272 * Compute the estimate of the reciprocal condition number.
275 $ RCOND = ( ONE / ANORM ) / AINVNM