![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b ZTRCON 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download ZTRCON + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ztrcon.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ztrcon.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ztrcon.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE ZTRCON( NORM, UPLO, DIAG, N, A, LDA, RCOND, WORK, 00022 * RWORK, INFO ) 00023 * 00024 * .. Scalar Arguments .. 00025 * CHARACTER DIAG, NORM, UPLO 00026 * INTEGER INFO, LDA, N 00027 * DOUBLE PRECISION RCOND 00028 * .. 00029 * .. Array Arguments .. 00030 * DOUBLE PRECISION RWORK( * ) 00031 * COMPLEX*16 A( LDA, * ), WORK( * ) 00032 * .. 00033 * 00034 * 00035 *> \par Purpose: 00036 * ============= 00037 *> 00038 *> \verbatim 00039 *> 00040 *> ZTRCON estimates the reciprocal of the condition number of a 00041 *> triangular matrix A, in either the 1-norm or the infinity-norm. 00042 *> 00043 *> The norm of A is computed and an estimate is obtained for 00044 *> norm(inv(A)), then the reciprocal of the condition number is 00045 *> computed as 00046 *> RCOND = 1 / ( norm(A) * norm(inv(A)) ). 00047 *> \endverbatim 00048 * 00049 * Arguments: 00050 * ========== 00051 * 00052 *> \param[in] NORM 00053 *> \verbatim 00054 *> NORM is CHARACTER*1 00055 *> Specifies whether the 1-norm condition number or the 00056 *> infinity-norm condition number is required: 00057 *> = '1' or 'O': 1-norm; 00058 *> = 'I': Infinity-norm. 00059 *> \endverbatim 00060 *> 00061 *> \param[in] UPLO 00062 *> \verbatim 00063 *> UPLO is CHARACTER*1 00064 *> = 'U': A is upper triangular; 00065 *> = 'L': A is lower triangular. 00066 *> \endverbatim 00067 *> 00068 *> \param[in] DIAG 00069 *> \verbatim 00070 *> DIAG is CHARACTER*1 00071 *> = 'N': A is non-unit triangular; 00072 *> = 'U': A is unit triangular. 00073 *> \endverbatim 00074 *> 00075 *> \param[in] N 00076 *> \verbatim 00077 *> N is INTEGER 00078 *> The order of the matrix A. N >= 0. 00079 *> \endverbatim 00080 *> 00081 *> \param[in] A 00082 *> \verbatim 00083 *> A is COMPLEX*16 array, dimension (LDA,N) 00084 *> The triangular matrix A. If UPLO = 'U', the leading N-by-N 00085 *> upper triangular part of the array A contains the upper 00086 *> triangular matrix, and the strictly lower triangular part of 00087 *> A is not referenced. If UPLO = 'L', the leading N-by-N lower 00088 *> triangular part of the array A contains the lower triangular 00089 *> matrix, and the strictly upper triangular part of A is not 00090 *> referenced. If DIAG = 'U', the diagonal elements of A are 00091 *> also not referenced and are assumed to be 1. 00092 *> \endverbatim 00093 *> 00094 *> \param[in] LDA 00095 *> \verbatim 00096 *> LDA is INTEGER 00097 *> The leading dimension of the array A. LDA >= max(1,N). 00098 *> \endverbatim 00099 *> 00100 *> \param[out] RCOND 00101 *> \verbatim 00102 *> RCOND is DOUBLE PRECISION 00103 *> The reciprocal of the condition number of the matrix A, 00104 *> computed as RCOND = 1/(norm(A) * norm(inv(A))). 00105 *> \endverbatim 00106 *> 00107 *> \param[out] WORK 00108 *> \verbatim 00109 *> WORK is COMPLEX*16 array, dimension (2*N) 00110 *> \endverbatim 00111 *> 00112 *> \param[out] RWORK 00113 *> \verbatim 00114 *> RWORK is DOUBLE PRECISION array, dimension (N) 00115 *> \endverbatim 00116 *> 00117 *> \param[out] INFO 00118 *> \verbatim 00119 *> INFO is INTEGER 00120 *> = 0: successful exit 00121 *> < 0: if INFO = -i, the i-th argument had an illegal value 00122 *> \endverbatim 00123 * 00124 * Authors: 00125 * ======== 00126 * 00127 *> \author Univ. of Tennessee 00128 *> \author Univ. of California Berkeley 00129 *> \author Univ. of Colorado Denver 00130 *> \author NAG Ltd. 00131 * 00132 *> \date November 2011 00133 * 00134 *> \ingroup complex16OTHERcomputational 00135 * 00136 * ===================================================================== 00137 SUBROUTINE ZTRCON( NORM, UPLO, DIAG, N, A, LDA, RCOND, WORK, 00138 $ RWORK, INFO ) 00139 * 00140 * -- LAPACK computational routine (version 3.4.0) -- 00141 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00142 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00143 * November 2011 00144 * 00145 * .. Scalar Arguments .. 00146 CHARACTER DIAG, NORM, UPLO 00147 INTEGER INFO, LDA, N 00148 DOUBLE PRECISION RCOND 00149 * .. 00150 * .. Array Arguments .. 00151 DOUBLE PRECISION RWORK( * ) 00152 COMPLEX*16 A( LDA, * ), WORK( * ) 00153 * .. 00154 * 00155 * ===================================================================== 00156 * 00157 * .. Parameters .. 00158 DOUBLE PRECISION ONE, ZERO 00159 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) 00160 * .. 00161 * .. Local Scalars .. 00162 LOGICAL NOUNIT, ONENRM, UPPER 00163 CHARACTER NORMIN 00164 INTEGER IX, KASE, KASE1 00165 DOUBLE PRECISION AINVNM, ANORM, SCALE, SMLNUM, XNORM 00166 COMPLEX*16 ZDUM 00167 * .. 00168 * .. Local Arrays .. 00169 INTEGER ISAVE( 3 ) 00170 * .. 00171 * .. External Functions .. 00172 LOGICAL LSAME 00173 INTEGER IZAMAX 00174 DOUBLE PRECISION DLAMCH, ZLANTR 00175 EXTERNAL LSAME, IZAMAX, DLAMCH, ZLANTR 00176 * .. 00177 * .. External Subroutines .. 00178 EXTERNAL XERBLA, ZDRSCL, ZLACN2, ZLATRS 00179 * .. 00180 * .. Intrinsic Functions .. 00181 INTRINSIC ABS, DBLE, DIMAG, MAX 00182 * .. 00183 * .. Statement Functions .. 00184 DOUBLE PRECISION CABS1 00185 * .. 00186 * .. Statement Function definitions .. 00187 CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) ) 00188 * .. 00189 * .. Executable Statements .. 00190 * 00191 * Test the input parameters. 00192 * 00193 INFO = 0 00194 UPPER = LSAME( UPLO, 'U' ) 00195 ONENRM = NORM.EQ.'1' .OR. LSAME( NORM, 'O' ) 00196 NOUNIT = LSAME( DIAG, 'N' ) 00197 * 00198 IF( .NOT.ONENRM .AND. .NOT.LSAME( NORM, 'I' ) ) THEN 00199 INFO = -1 00200 ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN 00201 INFO = -2 00202 ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN 00203 INFO = -3 00204 ELSE IF( N.LT.0 ) THEN 00205 INFO = -4 00206 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN 00207 INFO = -6 00208 END IF 00209 IF( INFO.NE.0 ) THEN 00210 CALL XERBLA( 'ZTRCON', -INFO ) 00211 RETURN 00212 END IF 00213 * 00214 * Quick return if possible 00215 * 00216 IF( N.EQ.0 ) THEN 00217 RCOND = ONE 00218 RETURN 00219 END IF 00220 * 00221 RCOND = ZERO 00222 SMLNUM = DLAMCH( 'Safe minimum' )*DBLE( MAX( 1, N ) ) 00223 * 00224 * Compute the norm of the triangular matrix A. 00225 * 00226 ANORM = ZLANTR( NORM, UPLO, DIAG, N, N, A, LDA, RWORK ) 00227 * 00228 * Continue only if ANORM > 0. 00229 * 00230 IF( ANORM.GT.ZERO ) THEN 00231 * 00232 * Estimate the norm of the inverse of A. 00233 * 00234 AINVNM = ZERO 00235 NORMIN = 'N' 00236 IF( ONENRM ) THEN 00237 KASE1 = 1 00238 ELSE 00239 KASE1 = 2 00240 END IF 00241 KASE = 0 00242 10 CONTINUE 00243 CALL ZLACN2( N, WORK( N+1 ), WORK, AINVNM, KASE, ISAVE ) 00244 IF( KASE.NE.0 ) THEN 00245 IF( KASE.EQ.KASE1 ) THEN 00246 * 00247 * Multiply by inv(A). 00248 * 00249 CALL ZLATRS( UPLO, 'No transpose', DIAG, NORMIN, N, A, 00250 $ LDA, WORK, SCALE, RWORK, INFO ) 00251 ELSE 00252 * 00253 * Multiply by inv(A**H). 00254 * 00255 CALL ZLATRS( UPLO, 'Conjugate transpose', DIAG, NORMIN, 00256 $ N, A, LDA, WORK, SCALE, RWORK, INFO ) 00257 END IF 00258 NORMIN = 'Y' 00259 * 00260 * Multiply by 1/SCALE if doing so will not cause overflow. 00261 * 00262 IF( SCALE.NE.ONE ) THEN 00263 IX = IZAMAX( N, WORK, 1 ) 00264 XNORM = CABS1( WORK( IX ) ) 00265 IF( SCALE.LT.XNORM*SMLNUM .OR. SCALE.EQ.ZERO ) 00266 $ GO TO 20 00267 CALL ZDRSCL( N, SCALE, WORK, 1 ) 00268 END IF 00269 GO TO 10 00270 END IF 00271 * 00272 * Compute the estimate of the reciprocal condition number. 00273 * 00274 IF( AINVNM.NE.ZERO ) 00275 $ RCOND = ( ONE / ANORM ) / AINVNM 00276 END IF 00277 * 00278 20 CONTINUE 00279 RETURN 00280 * 00281 * End of ZTRCON 00282 * 00283 END