![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b DTPCON 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download DTPCON + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dtpcon.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dtpcon.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dtpcon.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE DTPCON( NORM, UPLO, DIAG, N, AP, RCOND, WORK, IWORK, 00022 * INFO ) 00023 * 00024 * .. Scalar Arguments .. 00025 * CHARACTER DIAG, NORM, UPLO 00026 * INTEGER INFO, N 00027 * DOUBLE PRECISION RCOND 00028 * .. 00029 * .. Array Arguments .. 00030 * INTEGER IWORK( * ) 00031 * DOUBLE PRECISION AP( * ), WORK( * ) 00032 * .. 00033 * 00034 * 00035 *> \par Purpose: 00036 * ============= 00037 *> 00038 *> \verbatim 00039 *> 00040 *> DTPCON estimates the reciprocal of the condition number of a packed 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] AP 00082 *> \verbatim 00083 *> AP is DOUBLE PRECISION array, dimension (N*(N+1)/2) 00084 *> The upper or lower triangular matrix A, packed columnwise in 00085 *> a linear array. The j-th column of A is stored in the array 00086 *> AP as follows: 00087 *> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; 00088 *> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n. 00089 *> If DIAG = 'U', the diagonal elements of A are not referenced 00090 *> and are assumed to be 1. 00091 *> \endverbatim 00092 *> 00093 *> \param[out] RCOND 00094 *> \verbatim 00095 *> RCOND is DOUBLE PRECISION 00096 *> The reciprocal of the condition number of the matrix A, 00097 *> computed as RCOND = 1/(norm(A) * norm(inv(A))). 00098 *> \endverbatim 00099 *> 00100 *> \param[out] WORK 00101 *> \verbatim 00102 *> WORK is DOUBLE PRECISION array, dimension (3*N) 00103 *> \endverbatim 00104 *> 00105 *> \param[out] IWORK 00106 *> \verbatim 00107 *> IWORK is INTEGER array, dimension (N) 00108 *> \endverbatim 00109 *> 00110 *> \param[out] INFO 00111 *> \verbatim 00112 *> INFO is INTEGER 00113 *> = 0: successful exit 00114 *> < 0: if INFO = -i, the i-th argument had an illegal value 00115 *> \endverbatim 00116 * 00117 * Authors: 00118 * ======== 00119 * 00120 *> \author Univ. of Tennessee 00121 *> \author Univ. of California Berkeley 00122 *> \author Univ. of Colorado Denver 00123 *> \author NAG Ltd. 00124 * 00125 *> \date November 2011 00126 * 00127 *> \ingroup doubleOTHERcomputational 00128 * 00129 * ===================================================================== 00130 SUBROUTINE DTPCON( NORM, UPLO, DIAG, N, AP, RCOND, WORK, IWORK, 00131 $ INFO ) 00132 * 00133 * -- LAPACK computational routine (version 3.4.0) -- 00134 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00135 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00136 * November 2011 00137 * 00138 * .. Scalar Arguments .. 00139 CHARACTER DIAG, NORM, UPLO 00140 INTEGER INFO, N 00141 DOUBLE PRECISION RCOND 00142 * .. 00143 * .. Array Arguments .. 00144 INTEGER IWORK( * ) 00145 DOUBLE PRECISION AP( * ), WORK( * ) 00146 * .. 00147 * 00148 * ===================================================================== 00149 * 00150 * .. Parameters .. 00151 DOUBLE PRECISION ONE, ZERO 00152 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) 00153 * .. 00154 * .. Local Scalars .. 00155 LOGICAL NOUNIT, ONENRM, UPPER 00156 CHARACTER NORMIN 00157 INTEGER IX, KASE, KASE1 00158 DOUBLE PRECISION AINVNM, ANORM, SCALE, SMLNUM, XNORM 00159 * .. 00160 * .. Local Arrays .. 00161 INTEGER ISAVE( 3 ) 00162 * .. 00163 * .. External Functions .. 00164 LOGICAL LSAME 00165 INTEGER IDAMAX 00166 DOUBLE PRECISION DLAMCH, DLANTP 00167 EXTERNAL LSAME, IDAMAX, DLAMCH, DLANTP 00168 * .. 00169 * .. External Subroutines .. 00170 EXTERNAL DLACN2, DLATPS, DRSCL, XERBLA 00171 * .. 00172 * .. Intrinsic Functions .. 00173 INTRINSIC ABS, DBLE, MAX 00174 * .. 00175 * .. Executable Statements .. 00176 * 00177 * Test the input parameters. 00178 * 00179 INFO = 0 00180 UPPER = LSAME( UPLO, 'U' ) 00181 ONENRM = NORM.EQ.'1' .OR. LSAME( NORM, 'O' ) 00182 NOUNIT = LSAME( DIAG, 'N' ) 00183 * 00184 IF( .NOT.ONENRM .AND. .NOT.LSAME( NORM, 'I' ) ) THEN 00185 INFO = -1 00186 ELSE IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN 00187 INFO = -2 00188 ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN 00189 INFO = -3 00190 ELSE IF( N.LT.0 ) THEN 00191 INFO = -4 00192 END IF 00193 IF( INFO.NE.0 ) THEN 00194 CALL XERBLA( 'DTPCON', -INFO ) 00195 RETURN 00196 END IF 00197 * 00198 * Quick return if possible 00199 * 00200 IF( N.EQ.0 ) THEN 00201 RCOND = ONE 00202 RETURN 00203 END IF 00204 * 00205 RCOND = ZERO 00206 SMLNUM = DLAMCH( 'Safe minimum' )*DBLE( MAX( 1, N ) ) 00207 * 00208 * Compute the norm of the triangular matrix A. 00209 * 00210 ANORM = DLANTP( NORM, UPLO, DIAG, N, AP, WORK ) 00211 * 00212 * Continue only if ANORM > 0. 00213 * 00214 IF( ANORM.GT.ZERO ) THEN 00215 * 00216 * Estimate the norm of the inverse of A. 00217 * 00218 AINVNM = ZERO 00219 NORMIN = 'N' 00220 IF( ONENRM ) THEN 00221 KASE1 = 1 00222 ELSE 00223 KASE1 = 2 00224 END IF 00225 KASE = 0 00226 10 CONTINUE 00227 CALL DLACN2( N, WORK( N+1 ), WORK, IWORK, AINVNM, KASE, ISAVE ) 00228 IF( KASE.NE.0 ) THEN 00229 IF( KASE.EQ.KASE1 ) THEN 00230 * 00231 * Multiply by inv(A). 00232 * 00233 CALL DLATPS( UPLO, 'No transpose', DIAG, NORMIN, N, AP, 00234 $ WORK, SCALE, WORK( 2*N+1 ), INFO ) 00235 ELSE 00236 * 00237 * Multiply by inv(A**T). 00238 * 00239 CALL DLATPS( UPLO, 'Transpose', DIAG, NORMIN, N, AP, 00240 $ WORK, SCALE, WORK( 2*N+1 ), INFO ) 00241 END IF 00242 NORMIN = 'Y' 00243 * 00244 * Multiply by 1/SCALE if doing so will not cause overflow. 00245 * 00246 IF( SCALE.NE.ONE ) THEN 00247 IX = IDAMAX( N, WORK, 1 ) 00248 XNORM = ABS( WORK( IX ) ) 00249 IF( SCALE.LT.XNORM*SMLNUM .OR. SCALE.EQ.ZERO ) 00250 $ GO TO 20 00251 CALL DRSCL( N, SCALE, WORK, 1 ) 00252 END IF 00253 GO TO 10 00254 END IF 00255 * 00256 * Compute the estimate of the reciprocal condition number. 00257 * 00258 IF( AINVNM.NE.ZERO ) 00259 $ RCOND = ( ONE / ANORM ) / AINVNM 00260 END IF 00261 * 00262 20 CONTINUE 00263 RETURN 00264 * 00265 * End of DTPCON 00266 * 00267 END