00001 SUBROUTINE SLA_SYAMV( UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y,
00002 $ INCY )
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 IMPLICIT NONE
00013
00014
00015 REAL ALPHA, BETA
00016 INTEGER INCX, INCY, LDA, N, UPLO
00017
00018
00019 REAL A( LDA, * ), X( * ), Y( * )
00020
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
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 REAL ONE, ZERO
00121 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
00122
00123
00124 LOGICAL SYMB_ZERO
00125 REAL TEMP, SAFE1
00126 INTEGER I, INFO, IY, J, JX, KX, KY
00127
00128
00129 EXTERNAL XERBLA, SLAMCH
00130 REAL SLAMCH
00131
00132
00133 EXTERNAL ILAUPLO
00134 INTEGER ILAUPLO
00135
00136
00137 INTRINSIC MAX, ABS, SIGN
00138
00139
00140
00141
00142
00143 INFO = 0
00144 IF ( UPLO.NE.ILAUPLO( 'U' ) .AND.
00145 $ UPLO.NE.ILAUPLO( 'L' ) ) THEN
00146 INFO = 1
00147 ELSE IF( N.LT.0 )THEN
00148 INFO = 2
00149 ELSE IF( LDA.LT.MAX( 1, N ) )THEN
00150 INFO = 5
00151 ELSE IF( INCX.EQ.0 )THEN
00152 INFO = 7
00153 ELSE IF( INCY.EQ.0 )THEN
00154 INFO = 10
00155 END IF
00156 IF( INFO.NE.0 )THEN
00157 CALL XERBLA( 'SSYMV ', INFO )
00158 RETURN
00159 END IF
00160
00161
00162
00163 IF( ( N.EQ.0 ).OR.( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )
00164 $ RETURN
00165
00166
00167
00168 IF( INCX.GT.0 )THEN
00169 KX = 1
00170 ELSE
00171 KX = 1 - ( N - 1 )*INCX
00172 END IF
00173 IF( INCY.GT.0 )THEN
00174 KY = 1
00175 ELSE
00176 KY = 1 - ( N - 1 )*INCY
00177 END IF
00178
00179
00180
00181
00182 SAFE1 = SLAMCH( 'Safe minimum' )
00183 SAFE1 = (N+1)*SAFE1
00184
00185
00186
00187
00188
00189
00190
00191 IY = KY
00192 IF ( INCX.EQ.1 ) THEN
00193 IF ( UPLO .EQ. ILAUPLO( 'U' ) ) THEN
00194 DO I = 1, N
00195 IF ( BETA .EQ. ZERO ) THEN
00196 SYMB_ZERO = .TRUE.
00197 Y( IY ) = 0.0
00198 ELSE IF ( Y( IY ) .EQ. ZERO ) THEN
00199 SYMB_ZERO = .TRUE.
00200 ELSE
00201 SYMB_ZERO = .FALSE.
00202 Y( IY ) = BETA * ABS( Y( IY ) )
00203 END IF
00204 IF ( ALPHA .NE. ZERO ) THEN
00205 DO J = 1, I
00206 TEMP = ABS( A( J, I ) )
00207 SYMB_ZERO = SYMB_ZERO .AND.
00208 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
00209
00210 Y( IY ) = Y( IY ) + ALPHA*ABS( X( J ) )*TEMP
00211 END DO
00212 DO J = I+1, N
00213 TEMP = ABS( A( I, J ) )
00214 SYMB_ZERO = SYMB_ZERO .AND.
00215 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
00216
00217 Y( IY ) = Y( IY ) + ALPHA*ABS( X( J ) )*TEMP
00218 END DO
00219 END IF
00220
00221 IF ( .NOT.SYMB_ZERO )
00222 $ Y( IY ) = Y( IY ) + SIGN( SAFE1, Y( IY ) )
00223
00224 IY = IY + INCY
00225 END DO
00226 ELSE
00227 DO I = 1, N
00228 IF ( BETA .EQ. ZERO ) THEN
00229 SYMB_ZERO = .TRUE.
00230 Y( IY ) = 0.0
00231 ELSE IF ( Y( IY ) .EQ. ZERO ) THEN
00232 SYMB_ZERO = .TRUE.
00233 ELSE
00234 SYMB_ZERO = .FALSE.
00235 Y( IY ) = BETA * ABS( Y( IY ) )
00236 END IF
00237 IF ( ALPHA .NE. ZERO ) THEN
00238 DO J = 1, I
00239 TEMP = ABS( A( I, J ) )
00240 SYMB_ZERO = SYMB_ZERO .AND.
00241 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
00242
00243 Y( IY ) = Y( IY ) + ALPHA*ABS( X( J ) )*TEMP
00244 END DO
00245 DO J = I+1, N
00246 TEMP = ABS( A( J, I ) )
00247 SYMB_ZERO = SYMB_ZERO .AND.
00248 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
00249
00250 Y( IY ) = Y( IY ) + ALPHA*ABS( X( J ) )*TEMP
00251 END DO
00252 END IF
00253
00254 IF ( .NOT.SYMB_ZERO )
00255 $ Y( IY ) = Y( IY ) + SIGN( SAFE1, Y( IY ) )
00256
00257 IY = IY + INCY
00258 END DO
00259 END IF
00260 ELSE
00261 IF ( UPLO .EQ. ILAUPLO( 'U' ) ) THEN
00262 DO I = 1, N
00263 IF ( BETA .EQ. ZERO ) THEN
00264 SYMB_ZERO = .TRUE.
00265 Y( IY ) = 0.0
00266 ELSE IF ( Y( IY ) .EQ. ZERO ) THEN
00267 SYMB_ZERO = .TRUE.
00268 ELSE
00269 SYMB_ZERO = .FALSE.
00270 Y( IY ) = BETA * ABS( Y( IY ) )
00271 END IF
00272 JX = KX
00273 IF ( ALPHA .NE. ZERO ) THEN
00274 DO J = 1, I
00275 TEMP = ABS( A( J, I ) )
00276 SYMB_ZERO = SYMB_ZERO .AND.
00277 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
00278
00279 Y( IY ) = Y( IY ) + ALPHA*ABS( X( JX ) )*TEMP
00280 JX = JX + INCX
00281 END DO
00282 DO J = I+1, N
00283 TEMP = ABS( A( I, J ) )
00284 SYMB_ZERO = SYMB_ZERO .AND.
00285 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
00286
00287 Y( IY ) = Y( IY ) + ALPHA*ABS( X( JX ) )*TEMP
00288 JX = JX + INCX
00289 END DO
00290 END IF
00291
00292 IF ( .NOT.SYMB_ZERO )
00293 $ Y( IY ) = Y( IY ) + SIGN( SAFE1, Y( IY ) )
00294
00295 IY = IY + INCY
00296 END DO
00297 ELSE
00298 DO I = 1, N
00299 IF ( BETA .EQ. ZERO ) THEN
00300 SYMB_ZERO = .TRUE.
00301 Y( IY ) = 0.0
00302 ELSE IF ( Y( IY ) .EQ. ZERO ) THEN
00303 SYMB_ZERO = .TRUE.
00304 ELSE
00305 SYMB_ZERO = .FALSE.
00306 Y( IY ) = BETA * ABS( Y( IY ) )
00307 END IF
00308 JX = KX
00309 IF ( ALPHA .NE. ZERO ) THEN
00310 DO J = 1, I
00311 TEMP = ABS( A( I, J ) )
00312 SYMB_ZERO = SYMB_ZERO .AND.
00313 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
00314
00315 Y( IY ) = Y( IY ) + ALPHA*ABS( X( JX ) )*TEMP
00316 JX = JX + INCX
00317 END DO
00318 DO J = I+1, N
00319 TEMP = ABS( A( J, I ) )
00320 SYMB_ZERO = SYMB_ZERO .AND.
00321 $ ( X( J ) .EQ. ZERO .OR. TEMP .EQ. ZERO )
00322
00323 Y( IY ) = Y( IY ) + ALPHA*ABS( X( JX ) )*TEMP
00324 JX = JX + INCX
00325 END DO
00326 END IF
00327
00328 IF ( .NOT.SYMB_ZERO )
00329 $ Y( IY ) = Y( IY ) + SIGN( SAFE1, Y( IY ) )
00330
00331 IY = IY + INCY
00332 END DO
00333 END IF
00334
00335 END IF
00336
00337 RETURN
00338
00339
00340
00341 END