2842
2843
2844
2845
2846
2847
2848
2849
2850
2851 REAL ZERO, ONE
2852 parameter( zero = 0.0, one = 1.0 )
2853
2854 REAL ALPHA, BETA, EPS, ERR
2855 INTEGER KK, LDA, LDB, LDC, LDCC, N, NOUT
2856 LOGICAL FATAL, MV
2857 CHARACTER*1 UPLO, TRANSA, TRANSB
2858
2859 REAL A( LDA, * ), B( LDB, * ), C( LDC, * ),
2860 $ CC( LDCC, * ), CT( * ), G( * )
2861
2862 REAL ERRI
2863 INTEGER I, J, K, ISTART, ISTOP
2864 LOGICAL TRANA, TRANB, UPPER
2865
2866 INTRINSIC abs, max, sqrt
2867
2868 upper = uplo.EQ.'U'
2869 trana = transa.EQ.'T'.OR.transa.EQ.'C'
2870 tranb = transb.EQ.'T'.OR.transb.EQ.'C'
2871
2872
2873
2874
2875
2876 istart = 1
2877 istop = n
2878
2879 DO 120 j = 1, n
2880
2881 IF ( upper ) THEN
2882 istart = 1
2883 istop = j
2884 ELSE
2885 istart = j
2886 istop = n
2887 END IF
2888 DO 10 i = istart, istop
2889 ct( i ) = zero
2890 g( i ) = zero
2891 10 CONTINUE
2892 IF( .NOT.trana.AND..NOT.tranb )THEN
2893 DO 30 k = 1, kk
2894 DO 20 i = istart, istop
2895 ct( i ) = ct( i ) + a( i, k )*b( k, j )
2896 g( i ) = g( i ) + abs( a( i, k ) )*abs( b( k, j ) )
2897 20 CONTINUE
2898 30 CONTINUE
2899 ELSE IF( trana.AND..NOT.tranb )THEN
2900 DO 50 k = 1, kk
2901 DO 40 i = istart, istop
2902 ct( i ) = ct( i ) + a( k, i )*b( k, j )
2903 g( i ) = g( i ) + abs( a( k, i ) )*abs( b( k, j ) )
2904 40 CONTINUE
2905 50 CONTINUE
2906 ELSE IF( .NOT.trana.AND.tranb )THEN
2907 DO 70 k = 1, kk
2908 DO 60 i = istart, istop
2909 ct( i ) = ct( i ) + a( i, k )*b( j, k )
2910 g( i ) = g( i ) + abs( a( i, k ) )*abs( b( j, k ) )
2911 60 CONTINUE
2912 70 CONTINUE
2913 ELSE IF( trana.AND.tranb )THEN
2914 DO 90 k = 1, kk
2915 DO 80 i = istart, istop
2916 ct( i ) = ct( i ) + a( k, i )*b( j, k )
2917 g( i ) = g( i ) + abs( a( k, i ) )*abs( b( j, k ) )
2918 80 CONTINUE
2919 90 CONTINUE
2920 END IF
2921 DO 100 i = istart, istop
2922 ct( i ) = alpha*ct( i ) + beta*c( i, j )
2923 g( i ) = abs( alpha )*g( i ) + abs( beta )*abs( c( i, j ) )
2924 100 CONTINUE
2925
2926
2927
2928 err = zero
2929 DO 110 i = istart, istop
2930 erri = abs( ct( i ) - cc( i, j ) )/eps
2931 IF( g( i ).NE.zero )
2932 $ erri = erri/g( i )
2933 err = max( err, erri )
2934 IF( err*sqrt( eps ).GE.one )
2935 $ GO TO 130
2936 110 CONTINUE
2937
2938 120 CONTINUE
2939
2940
2941 GO TO 150
2942
2943
2944
2945 130 fatal = .true.
2946 WRITE( nout, fmt = 9999 )
2947 DO 140 i = istart, istop
2948 IF( mv )THEN
2949 WRITE( nout, fmt = 9998 )i, ct( i ), cc( i, j )
2950 ELSE
2951 WRITE( nout, fmt = 9998 )i, cc( i, j ), ct( i )
2952 END IF
2953 140 CONTINUE
2954 IF( n.GT.1 )
2955 $ WRITE( nout, fmt = 9997 )j
2956
2957 150 CONTINUE
2958 RETURN
2959
2960 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',
2961 $ 'F ACCURATE *******', /' EXPECTED RESULT COMPU',
2962 $ 'TED RESULT' )
2963 9998 FORMAT( 1x, i7, 2g18.6 )
2964 9997 FORMAT( ' THESE ARE THE RESULTS FOR COLUMN ', i3 )
2965
2966
2967