00001 REAL FUNCTION CLA_SYRPVGRW( UPLO, N, INFO, A, LDA, AF, LDAF, IPIV,
00002 $ WORK )
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 IMPLICIT NONE
00013
00014
00015 CHARACTER*1 UPLO
00016 INTEGER N, INFO, LDA, LDAF
00017
00018
00019 COMPLEX A( LDA, * ), AF( LDAF, * )
00020 REAL WORK( * )
00021 INTEGER IPIV( * )
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 INTEGER NCOLS, I, J, K, KP
00075 REAL AMAX, UMAX, RPVGRW, TMP
00076 LOGICAL UPPER
00077 COMPLEX ZDUM
00078
00079
00080 INTRINSIC ABS, REAL, AIMAG, MAX, MIN
00081
00082
00083 EXTERNAL LSAME, CLASET
00084 LOGICAL LSAME
00085
00086
00087 REAL CABS1
00088
00089
00090 CABS1( ZDUM ) = ABS( REAL ( ZDUM ) ) + ABS( AIMAG ( ZDUM ) )
00091
00092
00093
00094 UPPER = LSAME( 'Upper', UPLO )
00095 IF ( INFO.EQ.0 ) THEN
00096 IF ( UPPER ) THEN
00097 NCOLS = 1
00098 ELSE
00099 NCOLS = N
00100 END IF
00101 ELSE
00102 NCOLS = INFO
00103 END IF
00104
00105 RPVGRW = 1.0
00106 DO I = 1, 2*N
00107 WORK( I ) = 0.0
00108 END DO
00109
00110
00111
00112
00113
00114 IF ( UPPER ) THEN
00115 DO J = 1, N
00116 DO I = 1, J
00117 WORK( N+I ) = MAX( CABS1( A( I, J ) ), WORK( N+I ) )
00118 WORK( N+J ) = MAX( CABS1( A( I, J ) ), WORK( N+J ) )
00119 END DO
00120 END DO
00121 ELSE
00122 DO J = 1, N
00123 DO I = J, N
00124 WORK( N+I ) = MAX( CABS1( A( I, J ) ), WORK( N+I ) )
00125 WORK( N+J ) = MAX( CABS1( A( I, J ) ), WORK( N+J ) )
00126 END DO
00127 END DO
00128 END IF
00129
00130
00131
00132
00133
00134
00135
00136
00137 IF ( UPPER ) THEN
00138 K = N
00139 DO WHILE ( K .LT. NCOLS .AND. K.GT.0 )
00140 IF ( IPIV( K ).GT.0 ) THEN
00141
00142 KP = IPIV( K )
00143 IF ( KP .NE. K ) THEN
00144 TMP = WORK( N+K )
00145 WORK( N+K ) = WORK( N+KP )
00146 WORK( N+KP ) = TMP
00147 END IF
00148 DO I = 1, K
00149 WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
00150 END DO
00151 K = K - 1
00152 ELSE
00153
00154 KP = -IPIV( K )
00155 TMP = WORK( N+K-1 )
00156 WORK( N+K-1 ) = WORK( N+KP )
00157 WORK( N+KP ) = TMP
00158 DO I = 1, K-1
00159 WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
00160 WORK( K-1 ) =
00161 $ MAX( CABS1( AF( I, K-1 ) ), WORK( K-1 ) )
00162 END DO
00163 WORK( K ) = MAX( CABS1( AF( K, K ) ), WORK( K ) )
00164 K = K - 2
00165 END IF
00166 END DO
00167 K = NCOLS
00168 DO WHILE ( K .LE. N )
00169 IF ( IPIV( K ).GT.0 ) THEN
00170 KP = IPIV( K )
00171 IF ( KP .NE. K ) THEN
00172 TMP = WORK( N+K )
00173 WORK( N+K ) = WORK( N+KP )
00174 WORK( N+KP ) = TMP
00175 END IF
00176 K = K + 1
00177 ELSE
00178 KP = -IPIV( K )
00179 TMP = WORK( N+K )
00180 WORK( N+K ) = WORK( N+KP )
00181 WORK( N+KP ) = TMP
00182 K = K + 2
00183 END IF
00184 END DO
00185 ELSE
00186 K = 1
00187 DO WHILE ( K .LE. NCOLS )
00188 IF ( IPIV( K ).GT.0 ) THEN
00189
00190 KP = IPIV( K )
00191 IF ( KP .NE. K ) THEN
00192 TMP = WORK( N+K )
00193 WORK( N+K ) = WORK( N+KP )
00194 WORK( N+KP ) = TMP
00195 END IF
00196 DO I = K, N
00197 WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
00198 END DO
00199 K = K + 1
00200 ELSE
00201
00202 KP = -IPIV( K )
00203 TMP = WORK( N+K+1 )
00204 WORK( N+K+1 ) = WORK( N+KP )
00205 WORK( N+KP ) = TMP
00206 DO I = K+1, N
00207 WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
00208 WORK( K+1 ) =
00209 $ MAX( CABS1( AF( I, K+1 ) ), WORK( K+1 ) )
00210 END DO
00211 WORK( K ) = MAX( CABS1( AF( K, K ) ), WORK( K ) )
00212 K = K + 2
00213 END IF
00214 END DO
00215 K = NCOLS
00216 DO WHILE ( K .GE. 1 )
00217 IF ( IPIV( K ).GT.0 ) THEN
00218 KP = IPIV( K )
00219 IF ( KP .NE. K ) THEN
00220 TMP = WORK( N+K )
00221 WORK( N+K ) = WORK( N+KP )
00222 WORK( N+KP ) = TMP
00223 END IF
00224 K = K - 1
00225 ELSE
00226 KP = -IPIV( K )
00227 TMP = WORK( N+K )
00228 WORK( N+K ) = WORK( N+KP )
00229 WORK( N+KP ) = TMP
00230 K = K - 2
00231 ENDIF
00232 END DO
00233 END IF
00234
00235
00236
00237
00238
00239
00240
00241
00242 IF ( UPPER ) THEN
00243 DO I = NCOLS, N
00244 UMAX = WORK( I )
00245 AMAX = WORK( N+I )
00246 IF ( UMAX /= 0.0 ) THEN
00247 RPVGRW = MIN( AMAX / UMAX, RPVGRW )
00248 END IF
00249 END DO
00250 ELSE
00251 DO I = 1, NCOLS
00252 UMAX = WORK( I )
00253 AMAX = WORK( N+I )
00254 IF ( UMAX /= 0.0 ) THEN
00255 RPVGRW = MIN( AMAX / UMAX, RPVGRW )
00256 END IF
00257 END DO
00258 END IF
00259
00260 CLA_SYRPVGRW = RPVGRW
00261 END