![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b ZPOEQUB 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download ZPOEQUB + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zpoequb.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zpoequb.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zpoequb.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE ZPOEQUB( N, A, LDA, S, SCOND, AMAX, INFO ) 00022 * 00023 * .. Scalar Arguments .. 00024 * INTEGER INFO, LDA, N 00025 * DOUBLE PRECISION AMAX, SCOND 00026 * .. 00027 * .. Array Arguments .. 00028 * COMPLEX*16 A( LDA, * ) 00029 * DOUBLE PRECISION S( * ) 00030 * .. 00031 * 00032 * 00033 *> \par Purpose: 00034 * ============= 00035 *> 00036 *> \verbatim 00037 *> 00038 *> ZPOEQUB computes row and column scalings intended to equilibrate a 00039 *> symmetric positive definite matrix A and reduce its condition number 00040 *> (with respect to the two-norm). S contains the scale factors, 00041 *> S(i) = 1/sqrt(A(i,i)), chosen so that the scaled matrix B with 00042 *> elements B(i,j) = S(i)*A(i,j)*S(j) has ones on the diagonal. This 00043 *> choice of S puts the condition number of B within a factor N of the 00044 *> smallest possible condition number over all possible diagonal 00045 *> scalings. 00046 *> \endverbatim 00047 * 00048 * Arguments: 00049 * ========== 00050 * 00051 *> \param[in] N 00052 *> \verbatim 00053 *> N is INTEGER 00054 *> The order of the matrix A. N >= 0. 00055 *> \endverbatim 00056 *> 00057 *> \param[in] A 00058 *> \verbatim 00059 *> A is COMPLEX*16 array, dimension (LDA,N) 00060 *> The N-by-N symmetric positive definite matrix whose scaling 00061 *> factors are to be computed. Only the diagonal elements of A 00062 *> are referenced. 00063 *> \endverbatim 00064 *> 00065 *> \param[in] LDA 00066 *> \verbatim 00067 *> LDA is INTEGER 00068 *> The leading dimension of the array A. LDA >= max(1,N). 00069 *> \endverbatim 00070 *> 00071 *> \param[out] S 00072 *> \verbatim 00073 *> S is DOUBLE PRECISION array, dimension (N) 00074 *> If INFO = 0, S contains the scale factors for A. 00075 *> \endverbatim 00076 *> 00077 *> \param[out] SCOND 00078 *> \verbatim 00079 *> SCOND is DOUBLE PRECISION 00080 *> If INFO = 0, S contains the ratio of the smallest S(i) to 00081 *> the largest S(i). If SCOND >= 0.1 and AMAX is neither too 00082 *> large nor too small, it is not worth scaling by S. 00083 *> \endverbatim 00084 *> 00085 *> \param[out] AMAX 00086 *> \verbatim 00087 *> AMAX is DOUBLE PRECISION 00088 *> Absolute value of largest matrix element. If AMAX is very 00089 *> close to overflow or very close to underflow, the matrix 00090 *> should be scaled. 00091 *> \endverbatim 00092 *> 00093 *> \param[out] INFO 00094 *> \verbatim 00095 *> INFO is INTEGER 00096 *> = 0: successful exit 00097 *> < 0: if INFO = -i, the i-th argument had an illegal value 00098 *> > 0: if INFO = i, the i-th diagonal element is nonpositive. 00099 *> \endverbatim 00100 * 00101 * Authors: 00102 * ======== 00103 * 00104 *> \author Univ. of Tennessee 00105 *> \author Univ. of California Berkeley 00106 *> \author Univ. of Colorado Denver 00107 *> \author NAG Ltd. 00108 * 00109 *> \date November 2011 00110 * 00111 *> \ingroup complex16POcomputational 00112 * 00113 * ===================================================================== 00114 SUBROUTINE ZPOEQUB( N, A, LDA, S, SCOND, AMAX, INFO ) 00115 * 00116 * -- LAPACK computational routine (version 3.4.0) -- 00117 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00118 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00119 * November 2011 00120 * 00121 * .. Scalar Arguments .. 00122 INTEGER INFO, LDA, N 00123 DOUBLE PRECISION AMAX, SCOND 00124 * .. 00125 * .. Array Arguments .. 00126 COMPLEX*16 A( LDA, * ) 00127 DOUBLE PRECISION S( * ) 00128 * .. 00129 * 00130 * ===================================================================== 00131 * 00132 * .. Parameters .. 00133 DOUBLE PRECISION ZERO, ONE 00134 PARAMETER ( ZERO = 0.0D+0, ONE = 1.0D+0 ) 00135 * .. 00136 * .. Local Scalars .. 00137 INTEGER I 00138 DOUBLE PRECISION SMIN, BASE, TMP 00139 * .. 00140 * .. External Functions .. 00141 DOUBLE PRECISION DLAMCH 00142 EXTERNAL DLAMCH 00143 * .. 00144 * .. External Subroutines .. 00145 EXTERNAL XERBLA 00146 * .. 00147 * .. Intrinsic Functions .. 00148 INTRINSIC MAX, MIN, SQRT, LOG, INT, REAL, DIMAG 00149 * .. 00150 * .. Executable Statements .. 00151 * 00152 * Test the input parameters. 00153 * 00154 * Positive definite only performs 1 pass of equilibration. 00155 * 00156 INFO = 0 00157 IF( N.LT.0 ) THEN 00158 INFO = -1 00159 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN 00160 INFO = -3 00161 END IF 00162 IF( INFO.NE.0 ) THEN 00163 CALL XERBLA( 'ZPOEQUB', -INFO ) 00164 RETURN 00165 END IF 00166 * 00167 * Quick return if possible. 00168 * 00169 IF( N.EQ.0 ) THEN 00170 SCOND = ONE 00171 AMAX = ZERO 00172 RETURN 00173 END IF 00174 00175 BASE = DLAMCH( 'B' ) 00176 TMP = -0.5D+0 / LOG ( BASE ) 00177 * 00178 * Find the minimum and maximum diagonal elements. 00179 * 00180 S( 1 ) = A( 1, 1 ) 00181 SMIN = S( 1 ) 00182 AMAX = S( 1 ) 00183 DO 10 I = 2, N 00184 S( I ) = A( I, I ) 00185 SMIN = MIN( SMIN, S( I ) ) 00186 AMAX = MAX( AMAX, S( I ) ) 00187 10 CONTINUE 00188 * 00189 IF( SMIN.LE.ZERO ) THEN 00190 * 00191 * Find the first non-positive diagonal element and return. 00192 * 00193 DO 20 I = 1, N 00194 IF( S( I ).LE.ZERO ) THEN 00195 INFO = I 00196 RETURN 00197 END IF 00198 20 CONTINUE 00199 ELSE 00200 * 00201 * Set the scale factors to the reciprocals 00202 * of the diagonal elements. 00203 * 00204 DO 30 I = 1, N 00205 S( I ) = BASE ** INT( TMP * LOG( S( I ) ) ) 00206 30 CONTINUE 00207 * 00208 * Compute SCOND = min(S(I)) / max(S(I)). 00209 * 00210 SCOND = SQRT( SMIN ) / SQRT( AMAX ) 00211 END IF 00212 * 00213 RETURN 00214 * 00215 * End of ZPOEQUB 00216 * 00217 END