![]() |
LAPACK
3.4.0
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b CLA_GERCOND_C 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download CLA_GERCOND_C + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cla_gercond_c.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cla_gercond_c.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cla_gercond_c.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * REAL FUNCTION CLA_GERCOND_C( TRANS, N, A, LDA, AF, LDAF, IPIV, C, 00022 * CAPPLY, INFO, WORK, RWORK ) 00023 * 00024 * .. Scalar Aguments .. 00025 * CHARACTER TRANS 00026 * LOGICAL CAPPLY 00027 * INTEGER N, LDA, LDAF, INFO 00028 * .. 00029 * .. Array Arguments .. 00030 * INTEGER IPIV( * ) 00031 * COMPLEX A( LDA, * ), AF( LDAF, * ), WORK( * ) 00032 * REAL C( * ), RWORK( * ) 00033 * .. 00034 * 00035 * 00036 *> \par Purpose: 00037 * ============= 00038 *> 00039 *> \verbatim 00040 *> 00041 *> 00042 *> CLA_GERCOND_C computes the infinity norm condition number of 00043 *> op(A) * inv(diag(C)) where C is a REAL vector. 00044 *> \endverbatim 00045 * 00046 * Arguments: 00047 * ========== 00048 * 00049 *> \param[in] TRANS 00050 *> \verbatim 00051 *> TRANS is CHARACTER*1 00052 *> Specifies the form of the system of equations: 00053 *> = 'N': A * X = B (No transpose) 00054 *> = 'T': A**T * X = B (Transpose) 00055 *> = 'C': A**H * X = B (Conjugate Transpose = Transpose) 00056 *> \endverbatim 00057 *> 00058 *> \param[in] N 00059 *> \verbatim 00060 *> N is INTEGER 00061 *> The number of linear equations, i.e., the order of the 00062 *> matrix A. N >= 0. 00063 *> \endverbatim 00064 *> 00065 *> \param[in] A 00066 *> \verbatim 00067 *> A is COMPLEX array, dimension (LDA,N) 00068 *> On entry, the N-by-N matrix A 00069 *> \endverbatim 00070 *> 00071 *> \param[in] LDA 00072 *> \verbatim 00073 *> LDA is INTEGER 00074 *> The leading dimension of the array A. LDA >= max(1,N). 00075 *> \endverbatim 00076 *> 00077 *> \param[in] AF 00078 *> \verbatim 00079 *> AF is COMPLEX array, dimension (LDAF,N) 00080 *> The factors L and U from the factorization 00081 *> A = P*L*U as computed by CGETRF. 00082 *> \endverbatim 00083 *> 00084 *> \param[in] LDAF 00085 *> \verbatim 00086 *> LDAF is INTEGER 00087 *> The leading dimension of the array AF. LDAF >= max(1,N). 00088 *> \endverbatim 00089 *> 00090 *> \param[in] IPIV 00091 *> \verbatim 00092 *> IPIV is INTEGER array, dimension (N) 00093 *> The pivot indices from the factorization A = P*L*U 00094 *> as computed by CGETRF; row i of the matrix was interchanged 00095 *> with row IPIV(i). 00096 *> \endverbatim 00097 *> 00098 *> \param[in] C 00099 *> \verbatim 00100 *> C is REAL array, dimension (N) 00101 *> The vector C in the formula op(A) * inv(diag(C)). 00102 *> \endverbatim 00103 *> 00104 *> \param[in] CAPPLY 00105 *> \verbatim 00106 *> CAPPLY is LOGICAL 00107 *> If .TRUE. then access the vector C in the formula above. 00108 *> \endverbatim 00109 *> 00110 *> \param[out] INFO 00111 *> \verbatim 00112 *> INFO is INTEGER 00113 *> = 0: Successful exit. 00114 *> i > 0: The ith argument is invalid. 00115 *> \endverbatim 00116 *> 00117 *> \param[in] WORK 00118 *> \verbatim 00119 *> WORK is COMPLEX array, dimension (2*N). 00120 *> Workspace. 00121 *> \endverbatim 00122 *> 00123 *> \param[in] RWORK 00124 *> \verbatim 00125 *> RWORK is REAL array, dimension (N). 00126 *> Workspace. 00127 *> \endverbatim 00128 * 00129 * Authors: 00130 * ======== 00131 * 00132 *> \author Univ. of Tennessee 00133 *> \author Univ. of California Berkeley 00134 *> \author Univ. of Colorado Denver 00135 *> \author NAG Ltd. 00136 * 00137 *> \date November 2011 00138 * 00139 *> \ingroup complexGEcomputational 00140 * 00141 * ===================================================================== 00142 REAL FUNCTION CLA_GERCOND_C( TRANS, N, A, LDA, AF, LDAF, IPIV, C, 00143 $ CAPPLY, INFO, WORK, RWORK ) 00144 * 00145 * -- LAPACK computational routine (version 3.4.0) -- 00146 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00147 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00148 * November 2011 00149 * 00150 * .. Scalar Aguments .. 00151 CHARACTER TRANS 00152 LOGICAL CAPPLY 00153 INTEGER N, LDA, LDAF, INFO 00154 * .. 00155 * .. Array Arguments .. 00156 INTEGER IPIV( * ) 00157 COMPLEX A( LDA, * ), AF( LDAF, * ), WORK( * ) 00158 REAL C( * ), RWORK( * ) 00159 * .. 00160 * 00161 * ===================================================================== 00162 * 00163 * .. Local Scalars .. 00164 LOGICAL NOTRANS 00165 INTEGER KASE, I, J 00166 REAL AINVNM, ANORM, TMP 00167 COMPLEX ZDUM 00168 * .. 00169 * .. Local Arrays .. 00170 INTEGER ISAVE( 3 ) 00171 * .. 00172 * .. External Functions .. 00173 LOGICAL LSAME 00174 EXTERNAL LSAME 00175 * .. 00176 * .. External Subroutines .. 00177 EXTERNAL CLACN2, CGETRS, XERBLA 00178 * .. 00179 * .. Intrinsic Functions .. 00180 INTRINSIC ABS, MAX, REAL, AIMAG 00181 * .. 00182 * .. Statement Functions .. 00183 REAL CABS1 00184 * .. 00185 * .. Statement Function Definitions .. 00186 CABS1( ZDUM ) = ABS( REAL( ZDUM ) ) + ABS( AIMAG( ZDUM ) ) 00187 * .. 00188 * .. Executable Statements .. 00189 CLA_GERCOND_C = 0.0E+0 00190 * 00191 INFO = 0 00192 NOTRANS = LSAME( TRANS, 'N' ) 00193 IF ( .NOT. NOTRANS .AND. .NOT. LSAME( TRANS, 'T' ) .AND. .NOT. 00194 $ LSAME( TRANS, 'C' ) ) THEN 00195 ELSE IF( N.LT.0 ) THEN 00196 INFO = -2 00197 END IF 00198 IF( INFO.NE.0 ) THEN 00199 CALL XERBLA( 'CLA_GERCOND_C', -INFO ) 00200 RETURN 00201 END IF 00202 * 00203 * Compute norm of op(A)*op2(C). 00204 * 00205 ANORM = 0.0E+0 00206 IF ( NOTRANS ) THEN 00207 DO I = 1, N 00208 TMP = 0.0E+0 00209 IF ( CAPPLY ) THEN 00210 DO J = 1, N 00211 TMP = TMP + CABS1( A( I, J ) ) / C( J ) 00212 END DO 00213 ELSE 00214 DO J = 1, N 00215 TMP = TMP + CABS1( A( I, J ) ) 00216 END DO 00217 END IF 00218 RWORK( I ) = TMP 00219 ANORM = MAX( ANORM, TMP ) 00220 END DO 00221 ELSE 00222 DO I = 1, N 00223 TMP = 0.0E+0 00224 IF ( CAPPLY ) THEN 00225 DO J = 1, N 00226 TMP = TMP + CABS1( A( J, I ) ) / C( J ) 00227 END DO 00228 ELSE 00229 DO J = 1, N 00230 TMP = TMP + CABS1( A( J, I ) ) 00231 END DO 00232 END IF 00233 RWORK( I ) = TMP 00234 ANORM = MAX( ANORM, TMP ) 00235 END DO 00236 END IF 00237 * 00238 * Quick return if possible. 00239 * 00240 IF( N.EQ.0 ) THEN 00241 CLA_GERCOND_C = 1.0E+0 00242 RETURN 00243 ELSE IF( ANORM .EQ. 0.0E+0 ) THEN 00244 RETURN 00245 END IF 00246 * 00247 * Estimate the norm of inv(op(A)). 00248 * 00249 AINVNM = 0.0E+0 00250 * 00251 KASE = 0 00252 10 CONTINUE 00253 CALL CLACN2( N, WORK( N+1 ), WORK, AINVNM, KASE, ISAVE ) 00254 IF( KASE.NE.0 ) THEN 00255 IF( KASE.EQ.2 ) THEN 00256 * 00257 * Multiply by R. 00258 * 00259 DO I = 1, N 00260 WORK( I ) = WORK( I ) * RWORK( I ) 00261 END DO 00262 * 00263 IF (NOTRANS) THEN 00264 CALL CGETRS( 'No transpose', N, 1, AF, LDAF, IPIV, 00265 $ WORK, N, INFO ) 00266 ELSE 00267 CALL CGETRS( 'Conjugate transpose', N, 1, AF, LDAF, IPIV, 00268 $ WORK, N, INFO ) 00269 ENDIF 00270 * 00271 * Multiply by inv(C). 00272 * 00273 IF ( CAPPLY ) THEN 00274 DO I = 1, N 00275 WORK( I ) = WORK( I ) * C( I ) 00276 END DO 00277 END IF 00278 ELSE 00279 * 00280 * Multiply by inv(C**H). 00281 * 00282 IF ( CAPPLY ) THEN 00283 DO I = 1, N 00284 WORK( I ) = WORK( I ) * C( I ) 00285 END DO 00286 END IF 00287 * 00288 IF ( NOTRANS ) THEN 00289 CALL CGETRS( 'Conjugate transpose', N, 1, AF, LDAF, IPIV, 00290 $ WORK, N, INFO ) 00291 ELSE 00292 CALL CGETRS( 'No transpose', N, 1, AF, LDAF, IPIV, 00293 $ WORK, N, INFO ) 00294 END IF 00295 * 00296 * Multiply by R. 00297 * 00298 DO I = 1, N 00299 WORK( I ) = WORK( I ) * RWORK( I ) 00300 END DO 00301 END IF 00302 GO TO 10 00303 END IF 00304 * 00305 * Compute the estimate of the reciprocal condition number. 00306 * 00307 IF( AINVNM .NE. 0.0E+0 ) 00308 $ CLA_GERCOND_C = 1.0E+0 / AINVNM 00309 * 00310 RETURN 00311 * 00312 END