2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606 REAL ZERO, ONE
2607 parameter( zero = 0.0, one = 1.0 )
2608
2609 REAL ALPHA, BETA, EPS, ERR
2610 INTEGER KK, LDA, LDB, LDC, LDCC, M, N, NOUT
2611 LOGICAL FATAL, MV
2612 CHARACTER*1 TRANSA, TRANSB
2613
2614 REAL A( LDA, * ), B( LDB, * ), C( LDC, * ),
2615 $ CC( LDCC, * ), CT( * ), G( * )
2616
2617 REAL ERRI
2618 INTEGER I, J, K
2619 LOGICAL TRANA, TRANB
2620
2621 INTRINSIC abs, max, sqrt
2622
2623 trana = transa.EQ.'T'.OR.transa.EQ.'C'
2624 tranb = transb.EQ.'T'.OR.transb.EQ.'C'
2625
2626
2627
2628
2629
2630 DO 120 j = 1, n
2631
2632 DO 10 i = 1, m
2633 ct( i ) = zero
2634 g( i ) = zero
2635 10 CONTINUE
2636 IF( .NOT.trana.AND..NOT.tranb )THEN
2637 DO 30 k = 1, kk
2638 DO 20 i = 1, m
2639 ct( i ) = ct( i ) + a( i, k )*b( k, j )
2640 g( i ) = g( i ) + abs( a( i, k ) )*abs( b( k, j ) )
2641 20 CONTINUE
2642 30 CONTINUE
2643 ELSE IF( trana.AND..NOT.tranb )THEN
2644 DO 50 k = 1, kk
2645 DO 40 i = 1, m
2646 ct( i ) = ct( i ) + a( k, i )*b( k, j )
2647 g( i ) = g( i ) + abs( a( k, i ) )*abs( b( k, j ) )
2648 40 CONTINUE
2649 50 CONTINUE
2650 ELSE IF( .NOT.trana.AND.tranb )THEN
2651 DO 70 k = 1, kk
2652 DO 60 i = 1, m
2653 ct( i ) = ct( i ) + a( i, k )*b( j, k )
2654 g( i ) = g( i ) + abs( a( i, k ) )*abs( b( j, k ) )
2655 60 CONTINUE
2656 70 CONTINUE
2657 ELSE IF( trana.AND.tranb )THEN
2658 DO 90 k = 1, kk
2659 DO 80 i = 1, m
2660 ct( i ) = ct( i ) + a( k, i )*b( j, k )
2661 g( i ) = g( i ) + abs( a( k, i ) )*abs( b( j, k ) )
2662 80 CONTINUE
2663 90 CONTINUE
2664 END IF
2665 DO 100 i = 1, m
2666 ct( i ) = alpha*ct( i ) + beta*c( i, j )
2667 g( i ) = abs( alpha )*g( i ) + abs( beta )*abs( c( i, j ) )
2668 100 CONTINUE
2669
2670
2671
2672 err = zero
2673 DO 110 i = 1, m
2674 erri = abs( ct( i ) - cc( i, j ) )/eps
2675 IF( g( i ).NE.zero )
2676 $ erri = erri/g( i )
2677 err = max( err, erri )
2678 IF( err*sqrt( eps ).GE.one )
2679 $ GO TO 130
2680 110 CONTINUE
2681
2682 120 CONTINUE
2683
2684
2685 GO TO 150
2686
2687
2688
2689 130 fatal = .true.
2690 WRITE( nout, fmt = 9999 )
2691 DO 140 i = 1, m
2692 IF( mv )THEN
2693 WRITE( nout, fmt = 9998 )i, ct( i ), cc( i, j )
2694 ELSE
2695 WRITE( nout, fmt = 9998 )i, cc( i, j ), ct( i )
2696 END IF
2697 140 CONTINUE
2698 IF( n.GT.1 )
2699 $ WRITE( nout, fmt = 9997 )j
2700
2701 150 CONTINUE
2702 RETURN
2703
2704 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',
2705 $ 'F ACCURATE *******', /' EXPECTED RESULT COMPU',
2706 $ 'TED RESULT' )
2707 9998 FORMAT( 1x, i7, 2g18.6 )
2708 9997 FORMAT( ' THESE ARE THE RESULTS FOR COLUMN ', i3 )
2709
2710
2711