![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b SLAQSY 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download SLAQSY + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slaqsy.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slaqsy.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slaqsy.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE SLAQSY( UPLO, N, A, LDA, S, SCOND, AMAX, EQUED ) 00022 * 00023 * .. Scalar Arguments .. 00024 * CHARACTER EQUED, UPLO 00025 * INTEGER LDA, N 00026 * REAL AMAX, SCOND 00027 * .. 00028 * .. Array Arguments .. 00029 * REAL A( LDA, * ), S( * ) 00030 * .. 00031 * 00032 * 00033 *> \par Purpose: 00034 * ============= 00035 *> 00036 *> \verbatim 00037 *> 00038 *> SLAQSY equilibrates a symmetric matrix A using the scaling factors 00039 *> in the vector S. 00040 *> \endverbatim 00041 * 00042 * Arguments: 00043 * ========== 00044 * 00045 *> \param[in] UPLO 00046 *> \verbatim 00047 *> UPLO is CHARACTER*1 00048 *> Specifies whether the upper or lower triangular part of the 00049 *> symmetric matrix A is stored. 00050 *> = 'U': Upper triangular 00051 *> = 'L': Lower triangular 00052 *> \endverbatim 00053 *> 00054 *> \param[in] N 00055 *> \verbatim 00056 *> N is INTEGER 00057 *> The order of the matrix A. N >= 0. 00058 *> \endverbatim 00059 *> 00060 *> \param[in,out] A 00061 *> \verbatim 00062 *> A is REAL array, dimension (LDA,N) 00063 *> On entry, the symmetric matrix A. If UPLO = 'U', the leading 00064 *> n by n upper triangular part of A contains the upper 00065 *> triangular part of the matrix A, and the strictly lower 00066 *> triangular part of A is not referenced. If UPLO = 'L', the 00067 *> leading n by n lower triangular part of A contains the lower 00068 *> triangular part of the matrix A, and the strictly upper 00069 *> triangular part of A is not referenced. 00070 *> 00071 *> On exit, if EQUED = 'Y', the equilibrated matrix: 00072 *> diag(S) * A * diag(S). 00073 *> \endverbatim 00074 *> 00075 *> \param[in] LDA 00076 *> \verbatim 00077 *> LDA is INTEGER 00078 *> The leading dimension of the array A. LDA >= max(N,1). 00079 *> \endverbatim 00080 *> 00081 *> \param[in] S 00082 *> \verbatim 00083 *> S is REAL array, dimension (N) 00084 *> The scale factors for A. 00085 *> \endverbatim 00086 *> 00087 *> \param[in] SCOND 00088 *> \verbatim 00089 *> SCOND is REAL 00090 *> Ratio of the smallest S(i) to the largest S(i). 00091 *> \endverbatim 00092 *> 00093 *> \param[in] AMAX 00094 *> \verbatim 00095 *> AMAX is REAL 00096 *> Absolute value of largest matrix entry. 00097 *> \endverbatim 00098 *> 00099 *> \param[out] EQUED 00100 *> \verbatim 00101 *> EQUED is CHARACTER*1 00102 *> Specifies whether or not equilibration was done. 00103 *> = 'N': No equilibration. 00104 *> = 'Y': Equilibration was done, i.e., A has been replaced by 00105 *> diag(S) * A * diag(S). 00106 *> \endverbatim 00107 * 00108 *> \par Internal Parameters: 00109 * ========================= 00110 *> 00111 *> \verbatim 00112 *> THRESH is a threshold value used to decide if scaling should be done 00113 *> based on the ratio of the scaling factors. If SCOND < THRESH, 00114 *> scaling is done. 00115 *> 00116 *> LARGE and SMALL are threshold values used to decide if scaling should 00117 *> be done based on the absolute size of the largest matrix element. 00118 *> If AMAX > LARGE or AMAX < SMALL, scaling is done. 00119 *> \endverbatim 00120 * 00121 * Authors: 00122 * ======== 00123 * 00124 *> \author Univ. of Tennessee 00125 *> \author Univ. of California Berkeley 00126 *> \author Univ. of Colorado Denver 00127 *> \author NAG Ltd. 00128 * 00129 *> \date November 2011 00130 * 00131 *> \ingroup realSYauxiliary 00132 * 00133 * ===================================================================== 00134 SUBROUTINE SLAQSY( UPLO, N, A, LDA, S, SCOND, AMAX, EQUED ) 00135 * 00136 * -- LAPACK auxiliary routine (version 3.4.0) -- 00137 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00138 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00139 * November 2011 00140 * 00141 * .. Scalar Arguments .. 00142 CHARACTER EQUED, UPLO 00143 INTEGER LDA, N 00144 REAL AMAX, SCOND 00145 * .. 00146 * .. Array Arguments .. 00147 REAL A( LDA, * ), S( * ) 00148 * .. 00149 * 00150 * ===================================================================== 00151 * 00152 * .. Parameters .. 00153 REAL ONE, THRESH 00154 PARAMETER ( ONE = 1.0E+0, THRESH = 0.1E+0 ) 00155 * .. 00156 * .. Local Scalars .. 00157 INTEGER I, J 00158 REAL CJ, LARGE, SMALL 00159 * .. 00160 * .. External Functions .. 00161 LOGICAL LSAME 00162 REAL SLAMCH 00163 EXTERNAL LSAME, SLAMCH 00164 * .. 00165 * .. Executable Statements .. 00166 * 00167 * Quick return if possible 00168 * 00169 IF( N.LE.0 ) THEN 00170 EQUED = 'N' 00171 RETURN 00172 END IF 00173 * 00174 * Initialize LARGE and SMALL. 00175 * 00176 SMALL = SLAMCH( 'Safe minimum' ) / SLAMCH( 'Precision' ) 00177 LARGE = ONE / SMALL 00178 * 00179 IF( SCOND.GE.THRESH .AND. AMAX.GE.SMALL .AND. AMAX.LE.LARGE ) THEN 00180 * 00181 * No equilibration 00182 * 00183 EQUED = 'N' 00184 ELSE 00185 * 00186 * Replace A by diag(S) * A * diag(S). 00187 * 00188 IF( LSAME( UPLO, 'U' ) ) THEN 00189 * 00190 * Upper triangle of A is stored. 00191 * 00192 DO 20 J = 1, N 00193 CJ = S( J ) 00194 DO 10 I = 1, J 00195 A( I, J ) = CJ*S( I )*A( I, J ) 00196 10 CONTINUE 00197 20 CONTINUE 00198 ELSE 00199 * 00200 * Lower triangle of A is stored. 00201 * 00202 DO 40 J = 1, N 00203 CJ = S( J ) 00204 DO 30 I = J, N 00205 A( I, J ) = CJ*S( I )*A( I, J ) 00206 30 CONTINUE 00207 40 CONTINUE 00208 END IF 00209 EQUED = 'Y' 00210 END IF 00211 * 00212 RETURN 00213 * 00214 * End of SLAQSY 00215 * 00216 END