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