00001 REAL FUNCTION CLA_HERPVGRW( 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 INTEGER IPIV( * )
00020 COMPLEX A( LDA, * ), AF( LDAF, * )
00021 REAL WORK( * )
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, LSAME
00077 COMPLEX ZDUM
00078
00079
00080 EXTERNAL LSAME, CLASET
00081
00082
00083 INTRINSIC ABS, REAL, AIMAG, MAX, MIN
00084
00085
00086 REAL CABS1
00087
00088
00089 CABS1( ZDUM ) = ABS( REAL ( ZDUM ) ) + ABS( AIMAG ( ZDUM ) )
00090
00091
00092
00093 UPPER = LSAME( 'Upper', UPLO )
00094 IF ( INFO.EQ.0 ) THEN
00095 IF (UPPER) THEN
00096 NCOLS = 1
00097 ELSE
00098 NCOLS = N
00099 END IF
00100 ELSE
00101 NCOLS = INFO
00102 END IF
00103
00104 RPVGRW = 1.0
00105 DO I = 1, 2*N
00106 WORK( I ) = 0.0
00107 END DO
00108
00109
00110
00111
00112
00113 IF ( UPPER ) THEN
00114 DO J = 1, N
00115 DO I = 1, J
00116 WORK( N+I ) = MAX( CABS1( A( I,J ) ), WORK( N+I ) )
00117 WORK( N+J ) = MAX( CABS1( A( I,J ) ), WORK( N+J ) )
00118 END DO
00119 END DO
00120 ELSE
00121 DO J = 1, N
00122 DO I = J, N
00123 WORK( N+I ) = MAX( CABS1( A( I, J ) ), WORK( N+I ) )
00124 WORK( N+J ) = MAX( CABS1( A( I, J ) ), WORK( N+J ) )
00125 END DO
00126 END DO
00127 END IF
00128
00129
00130
00131
00132
00133
00134
00135
00136 IF ( UPPER ) THEN
00137 K = N
00138 DO WHILE ( K .LT. NCOLS .AND. K.GT.0 )
00139 IF ( IPIV( K ).GT.0 ) THEN
00140
00141 KP = IPIV( K )
00142 IF ( KP .NE. K ) THEN
00143 TMP = WORK( N+K )
00144 WORK( N+K ) = WORK( N+KP )
00145 WORK( N+KP ) = TMP
00146 END IF
00147 DO I = 1, K
00148 WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
00149 END DO
00150 K = K - 1
00151 ELSE
00152
00153 KP = -IPIV( K )
00154 TMP = WORK( N+K-1 )
00155 WORK( N+K-1 ) = WORK( N+KP )
00156 WORK( N+KP ) = TMP
00157 DO I = 1, K-1
00158 WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
00159 WORK( K-1 ) =
00160 $ MAX( CABS1( AF( I, K-1 ) ), WORK( K-1 ) )
00161 END DO
00162 WORK( K ) = MAX( CABS1( AF( K, K ) ), WORK( K ) )
00163 K = K - 2
00164 END IF
00165 END DO
00166 K = NCOLS
00167 DO WHILE ( K .LE. N )
00168 IF ( IPIV( K ).GT.0 ) THEN
00169 KP = IPIV( K )
00170 IF ( KP .NE. K ) THEN
00171 TMP = WORK( N+K )
00172 WORK( N+K ) = WORK( N+KP )
00173 WORK( N+KP ) = TMP
00174 END IF
00175 K = K + 1
00176 ELSE
00177 KP = -IPIV( K )
00178 TMP = WORK( N+K )
00179 WORK( N+K ) = WORK( N+KP )
00180 WORK( N+KP ) = TMP
00181 K = K + 2
00182 END IF
00183 END DO
00184 ELSE
00185 K = 1
00186 DO WHILE ( K .LE. NCOLS )
00187 IF ( IPIV( K ).GT.0 ) THEN
00188
00189 KP = IPIV( K )
00190 IF ( KP .NE. K ) THEN
00191 TMP = WORK( N+K )
00192 WORK( N+K ) = WORK( N+KP )
00193 WORK( N+KP ) = TMP
00194 END IF
00195 DO I = K, N
00196 WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
00197 END DO
00198 K = K + 1
00199 ELSE
00200
00201 KP = -IPIV( K )
00202 TMP = WORK( N+K+1 )
00203 WORK( N+K+1 ) = WORK( N+KP )
00204 WORK( N+KP ) = TMP
00205 DO I = K+1, N
00206 WORK( K ) = MAX( CABS1( AF( I, K ) ), WORK( K ) )
00207 WORK( K+1 ) =
00208 $ MAX( CABS1( AF( I, K+1 ) ) , WORK( K+1 ) )
00209 END DO
00210 WORK(K) = MAX( CABS1( AF( K, K ) ), WORK( K ) )
00211 K = K + 2
00212 END IF
00213 END DO
00214 K = NCOLS
00215 DO WHILE ( K .GE. 1 )
00216 IF ( IPIV( K ).GT.0 ) THEN
00217 KP = IPIV( K )
00218 IF ( KP .NE. K ) THEN
00219 TMP = WORK( N+K )
00220 WORK( N+K ) = WORK( N+KP )
00221 WORK( N+KP ) = TMP
00222 END IF
00223 K = K - 1
00224 ELSE
00225 KP = -IPIV( K )
00226 TMP = WORK( N+K )
00227 WORK( N+K ) = WORK( N+KP )
00228 WORK( N+KP ) = TMP
00229 K = K - 2
00230 ENDIF
00231 END DO
00232 END IF
00233
00234
00235
00236
00237
00238
00239
00240
00241 IF ( UPPER ) THEN
00242 DO I = NCOLS, N
00243 UMAX = WORK( I )
00244 AMAX = WORK( N+I )
00245 IF ( UMAX /= 0.0 ) THEN
00246 RPVGRW = MIN( AMAX / UMAX, RPVGRW )
00247 END IF
00248 END DO
00249 ELSE
00250 DO I = 1, NCOLS
00251 UMAX = WORK( I )
00252 AMAX = WORK( N+I )
00253 IF ( UMAX /= 0.0 ) THEN
00254 RPVGRW = MIN( AMAX / UMAX, RPVGRW )
00255 END IF
00256 END DO
00257 END IF
00258
00259 CLA_HERPVGRW = RPVGRW
00260 END