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