3245
3246
3247
3248
3249
3250
3251
3252
3253
3254 DOUBLE PRECISION ZERO, ONE
3255 parameter( zero = 0.0d0, one = 1.0d0 )
3256
3257 DOUBLE PRECISION ALPHA, BETA, EPS, ERR
3258 INTEGER KK, LDA, LDB, LDC, LDCC, N, NOUT
3259 LOGICAL FATAL, MV
3260 CHARACTER*1 UPLO, TRANSA, TRANSB
3261
3262 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), C( LDC, * ),
3263 $ CC( LDCC, * ), CT( * ), G( * )
3264
3265 DOUBLE PRECISION ERRI
3266 INTEGER I, J, K, ISTART, ISTOP
3267 LOGICAL TRANA, TRANB, UPPER
3268
3269 INTRINSIC abs, max, sqrt
3270
3271 upper = uplo.EQ.'U'
3272 trana = transa.EQ.'T'.OR.transa.EQ.'C'
3273 tranb = transb.EQ.'T'.OR.transb.EQ.'C'
3274
3275
3276
3277
3278
3279 istart = 1
3280 istop = n
3281
3282 DO 120 j = 1, n
3283
3284 IF ( upper ) THEN
3285 istart = 1
3286 istop = j
3287 ELSE
3288 istart = j
3289 istop = n
3290 END IF
3291 DO 10 i = istart, istop
3292 ct( i ) = zero
3293 g( i ) = zero
3294 10 CONTINUE
3295 IF( .NOT.trana.AND..NOT.tranb )THEN
3296 DO 30 k = 1, kk
3297 DO 20 i = istart, istop
3298 ct( i ) = ct( i ) + a( i, k )*b( k, j )
3299 g( i ) = g( i ) + abs( a( i, k ) )*abs( b( k, j ) )
3300 20 CONTINUE
3301 30 CONTINUE
3302 ELSE IF( trana.AND..NOT.tranb )THEN
3303 DO 50 k = 1, kk
3304 DO 40 i = istart, istop
3305 ct( i ) = ct( i ) + a( k, i )*b( k, j )
3306 g( i ) = g( i ) + abs( a( k, i ) )*abs( b( k, j ) )
3307 40 CONTINUE
3308 50 CONTINUE
3309 ELSE IF( .NOT.trana.AND.tranb )THEN
3310 DO 70 k = 1, kk
3311 DO 60 i = istart, istop
3312 ct( i ) = ct( i ) + a( i, k )*b( j, k )
3313 g( i ) = g( i ) + abs( a( i, k ) )*abs( b( j, k ) )
3314 60 CONTINUE
3315 70 CONTINUE
3316 ELSE IF( trana.AND.tranb )THEN
3317 DO 90 k = 1, kk
3318 DO 80 i = istart, istop
3319 ct( i ) = ct( i ) + a( k, i )*b( j, k )
3320 g( i ) = g( i ) + abs( a( k, i ) )*abs( b( j, k ) )
3321 80 CONTINUE
3322 90 CONTINUE
3323 END IF
3324 DO 100 i = istart, istop
3325 ct( i ) = alpha*ct( i ) + beta*c( i, j )
3326 g( i ) = abs( alpha )*g( i ) + abs( beta )*abs( c( i, j ) )
3327 100 CONTINUE
3328
3329
3330
3331 err = zero
3332 DO 110 i = istart, istop
3333 erri = abs( ct( i ) - cc( i, j ) )/eps
3334 IF( g( i ).NE.zero )
3335 $ erri = erri/g( i )
3336 err = max( err, erri )
3337 IF( err*sqrt( eps ).GE.one )
3338 $ GO TO 130
3339 110 CONTINUE
3340
3341 120 CONTINUE
3342
3343
3344 GO TO 150
3345
3346
3347
3348 130 fatal = .true.
3349 WRITE( nout, fmt = 9999 )
3350 DO 140 i = istart, istop
3351 IF( mv )THEN
3352 WRITE( nout, fmt = 9998 )i, ct( i ), cc( i, j )
3353 ELSE
3354 WRITE( nout, fmt = 9998 )i, cc( i, j ), ct( i )
3355 END IF
3356 140 CONTINUE
3357 IF( n.GT.1 )
3358 $ WRITE( nout, fmt = 9997 )j
3359
3360 150 CONTINUE
3361 RETURN
3362
3363 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',
3364 $ 'F ACCURATE *******', /' EXPECTED RESULT COMPU',
3365 $ 'TED RESULT' )
3366 9998 FORMAT( 1x, i7, 2g18.6 )
3367 9997 FORMAT( ' THESE ARE THE RESULTS FOR COLUMN ', i3 )
3368
3369
3370