2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864 DOUBLE PRECISION ZERO, ONE
2865 parameter( zero = 0.0d0, one = 1.0d0 )
2866
2867 DOUBLE PRECISION ALPHA, BETA, EPS, ERR
2868 INTEGER INCX, INCY, M, N, NMAX, NOUT
2869 LOGICAL FATAL, MV
2870 CHARACTER*1 TRANS
2871
2872 DOUBLE PRECISION A( NMAX, * ), G( * ), X( * ), Y( * ), YT( * ),
2873 $ YY( * )
2874
2875 DOUBLE PRECISION ERRI
2876 INTEGER I, INCXL, INCYL, IY, J, JX, KX, KY, ML, NL
2877 LOGICAL TRAN
2878
2879 INTRINSIC abs, max, sqrt
2880
2881 tran = trans.EQ.'T'.OR.trans.EQ.'C'
2882 IF( tran )THEN
2883 ml = n
2884 nl = m
2885 ELSE
2886 ml = m
2887 nl = n
2888 END IF
2889 IF( incx.LT.0 )THEN
2890 kx = nl
2891 incxl = -1
2892 ELSE
2893 kx = 1
2894 incxl = 1
2895 END IF
2896 IF( incy.LT.0 )THEN
2897 ky = ml
2898 incyl = -1
2899 ELSE
2900 ky = 1
2901 incyl = 1
2902 END IF
2903
2904
2905
2906
2907 iy = ky
2908 DO 30 i = 1, ml
2909 yt( iy ) = zero
2910 g( iy ) = zero
2911 jx = kx
2912 IF( tran )THEN
2913 DO 10 j = 1, nl
2914 yt( iy ) = yt( iy ) + a( j, i )*x( jx )
2915 g( iy ) = g( iy ) + abs( a( j, i )*x( jx ) )
2916 jx = jx + incxl
2917 10 CONTINUE
2918 ELSE
2919 DO 20 j = 1, nl
2920 yt( iy ) = yt( iy ) + a( i, j )*x( jx )
2921 g( iy ) = g( iy ) + abs( a( i, j )*x( jx ) )
2922 jx = jx + incxl
2923 20 CONTINUE
2924 END IF
2925 yt( iy ) = alpha*yt( iy ) + beta*y( iy )
2926 g( iy ) = abs( alpha )*g( iy ) + abs( beta*y( iy ) )
2927 iy = iy + incyl
2928 30 CONTINUE
2929
2930
2931
2932 err = zero
2933 DO 40 i = 1, ml
2934 erri = abs( yt( i ) - yy( 1 + ( i - 1 )*abs( incy ) ) )/eps
2935 IF( g( i ).NE.zero )
2936 $ erri = erri/g( i )
2937 err = max( err, erri )
2938 IF( err*sqrt( eps ).GE.one )
2939 $ GO TO 50
2940 40 CONTINUE
2941
2942 GO TO 70
2943
2944
2945
2946 50 fatal = .true.
2947 WRITE( nout, fmt = 9999 )
2948 DO 60 i = 1, ml
2949 IF( mv )THEN
2950 WRITE( nout, fmt = 9998 )i, yt( i ),
2951 $ yy( 1 + ( i - 1 )*abs( incy ) )
2952 ELSE
2953 WRITE( nout, fmt = 9998 )i,
2954 $ yy( 1 + ( i - 1 )*abs( incy ) ), yt( i )
2955 END IF
2956 60 CONTINUE
2957
2958 70 CONTINUE
2959 RETURN
2960
2961 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',
2962 $ 'F ACCURATE *******', /' EXPECTED RESULT COMPU',
2963 $ 'TED RESULT' )
2964 9998 FORMAT( 1x, i7, 2g18.6 )
2965
2966
2967