2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469 COMPLEX*16 ZERO
2470 parameter( zero = ( 0.0d0, 0.0d0 ) )
2471 DOUBLE PRECISION RZERO, RONE
2472 parameter( rzero = 0.0d0, rone = 1.0d0 )
2473
2474 COMPLEX*16 ALPHA, BETA
2475 DOUBLE PRECISION EPS, ERR
2476 INTEGER INCX, INCY, M, N, NMAX, NOUT
2477 LOGICAL FATAL, MV
2478 CHARACTER*1 TRANS
2479
2480 COMPLEX*16 A( NMAX, * ), X( * ), Y( * ), YT( * ), YY( * )
2481 DOUBLE PRECISION G( * )
2482
2483 COMPLEX*16 C
2484 DOUBLE PRECISION ERRI
2485 INTEGER I, INCXL, INCYL, IY, J, JX, KX, KY, ML, NL
2486 LOGICAL CTRAN, TRAN
2487
2488 INTRINSIC abs, dimag, dconjg, max, dble, sqrt
2489
2490 DOUBLE PRECISION ABS1
2491
2492 abs1( c ) = abs( dble( c ) ) + abs( dimag( c ) )
2493
2494 tran = trans.EQ.'T'
2495 ctran = trans.EQ.'C'
2496 IF( tran.OR.ctran )THEN
2497 ml = n
2498 nl = m
2499 ELSE
2500 ml = m
2501 nl = n
2502 END IF
2503 IF( incx.LT.0 )THEN
2504 kx = nl
2505 incxl = -1
2506 ELSE
2507 kx = 1
2508 incxl = 1
2509 END IF
2510 IF( incy.LT.0 )THEN
2511 ky = ml
2512 incyl = -1
2513 ELSE
2514 ky = 1
2515 incyl = 1
2516 END IF
2517
2518
2519
2520
2521 iy = ky
2522 DO 40 i = 1, ml
2523 yt( iy ) = zero
2524 g( iy ) = rzero
2525 jx = kx
2526 IF( tran )THEN
2527 DO 10 j = 1, nl
2528 yt( iy ) = yt( iy ) + a( j, i )*x( jx )
2529 g( iy ) = g( iy ) + abs1( a( j, i ) )*abs1( x( jx ) )
2530 jx = jx + incxl
2531 10 CONTINUE
2532 ELSE IF( ctran )THEN
2533 DO 20 j = 1, nl
2534 yt( iy ) = yt( iy ) + dconjg( a( j, i ) )*x( jx )
2535 g( iy ) = g( iy ) + abs1( a( j, i ) )*abs1( x( jx ) )
2536 jx = jx + incxl
2537 20 CONTINUE
2538 ELSE
2539 DO 30 j = 1, nl
2540 yt( iy ) = yt( iy ) + a( i, j )*x( jx )
2541 g( iy ) = g( iy ) + abs1( a( i, j ) )*abs1( x( jx ) )
2542 jx = jx + incxl
2543 30 CONTINUE
2544 END IF
2545 yt( iy ) = alpha*yt( iy ) + beta*y( iy )
2546 g( iy ) = abs1( alpha )*g( iy ) + abs1( beta )*abs1( y( iy ) )
2547 iy = iy + incyl
2548 40 CONTINUE
2549
2550
2551
2552 err = zero
2553 DO 50 i = 1, ml
2554 erri = abs( yt( i ) - yy( 1 + ( i - 1 )*abs( incy ) ) )/eps
2555 IF( g( i ).NE.rzero )
2556 $ erri = erri/g( i )
2557 err = max( err, erri )
2558 IF( err*sqrt( eps ).GE.rone )
2559 $ GO TO 60
2560 50 CONTINUE
2561
2562 GO TO 80
2563
2564
2565
2566 60 fatal = .true.
2567 WRITE( nout, fmt = 9999 )
2568 DO 70 i = 1, ml
2569 IF( mv )THEN
2570 WRITE( nout, fmt = 9998 )i, yt( i ),
2571 $ yy( 1 + ( i - 1 )*abs( incy ) )
2572 ELSE
2573 WRITE( nout, fmt = 9998 )i,
2574 $ yy( 1 + ( i - 1 )*abs( incy ) ), yt( i )
2575 END IF
2576 70 CONTINUE
2577
2578 80 CONTINUE
2579 RETURN
2580
2581 9999 FORMAT(' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',
2582 $ 'F ACCURATE *******', /' EXPECTED RE',
2583 $ 'SULT COMPUTED RESULT' )
2584 9998 FORMAT( 1x, i7, 2( ' (', g15.6, ',', g15.6, ')' ) )
2585
2586
2587