2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946 COMPLEX ZERO
2947 parameter( zero = ( 0.0, 0.0 ) )
2948 REAL RZERO, RONE
2949 parameter( rzero = 0.0, rone = 1.0 )
2950
2951 COMPLEX ALPHA, BETA
2952 REAL EPS, ERR
2953 INTEGER INCX, INCY, M, N, NMAX, NOUT
2954 LOGICAL FATAL, MV
2955 CHARACTER*1 TRANS
2956
2957 COMPLEX A( NMAX, * ), X( * ), Y( * ), YT( * ), YY( * )
2958 REAL G( * )
2959
2960 COMPLEX C
2961 REAL ERRI
2962 INTEGER I, INCXL, INCYL, IY, J, JX, KX, KY, ML, NL
2963 LOGICAL CTRAN, TRAN
2964
2965 INTRINSIC abs, aimag, conjg, max, real, sqrt
2966
2967 REAL ABS1
2968
2969 abs1( c ) = abs( real( c ) ) + abs( aimag( c ) )
2970
2971 tran = trans.EQ.'T'
2972 ctran = trans.EQ.'C'
2973 IF( tran.OR.ctran )THEN
2974 ml = n
2975 nl = m
2976 ELSE
2977 ml = m
2978 nl = n
2979 END IF
2980 IF( incx.LT.0 )THEN
2981 kx = nl
2982 incxl = -1
2983 ELSE
2984 kx = 1
2985 incxl = 1
2986 END IF
2987 IF( incy.LT.0 )THEN
2988 ky = ml
2989 incyl = -1
2990 ELSE
2991 ky = 1
2992 incyl = 1
2993 END IF
2994
2995
2996
2997
2998 iy = ky
2999 DO 40 i = 1, ml
3000 yt( iy ) = zero
3001 g( iy ) = rzero
3002 jx = kx
3003 IF( tran )THEN
3004 DO 10 j = 1, nl
3005 yt( iy ) = yt( iy ) + a( j, i )*x( jx )
3006 g( iy ) = g( iy ) + abs1( a( j, i ) )*abs1( x( jx ) )
3007 jx = jx + incxl
3008 10 CONTINUE
3009 ELSE IF( ctran )THEN
3010 DO 20 j = 1, nl
3011 yt( iy ) = yt( iy ) + conjg( a( j, i ) )*x( jx )
3012 g( iy ) = g( iy ) + abs1( a( j, i ) )*abs1( x( jx ) )
3013 jx = jx + incxl
3014 20 CONTINUE
3015 ELSE
3016 DO 30 j = 1, nl
3017 yt( iy ) = yt( iy ) + a( i, j )*x( jx )
3018 g( iy ) = g( iy ) + abs1( a( i, j ) )*abs1( x( jx ) )
3019 jx = jx + incxl
3020 30 CONTINUE
3021 END IF
3022 yt( iy ) = alpha*yt( iy ) + beta*y( iy )
3023 g( iy ) = abs1( alpha )*g( iy ) + abs1( beta )*abs1( y( iy ) )
3024 iy = iy + incyl
3025 40 CONTINUE
3026
3027
3028
3029 err = zero
3030 DO 50 i = 1, ml
3031 erri = abs( yt( i ) - yy( 1 + ( i - 1 )*abs( incy ) ) )/eps
3032 IF( g( i ).NE.rzero )
3033 $ erri = erri/g( i )
3034 err = max( err, erri )
3035 IF( err*sqrt( eps ).GE.rone )
3036 $ GO TO 60
3037 50 CONTINUE
3038
3039 GO TO 80
3040
3041
3042
3043 60 fatal = .true.
3044 WRITE( nout, fmt = 9999 )
3045 DO 70 i = 1, ml
3046 IF( mv )THEN
3047 WRITE( nout, fmt = 9998 )i, yt( i ),
3048 $ yy( 1 + ( i - 1 )*abs( incy ) )
3049 ELSE
3050 WRITE( nout, fmt = 9998 )i,
3051 $ yy( 1 + ( i - 1 )*abs( incy ) ), yt( i )
3052 END IF
3053 70 CONTINUE
3054
3055 80 CONTINUE
3056 RETURN
3057
3058 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',
3059 $ 'F ACCURATE *******', /' EXPECTED RE',
3060 $ 'SULT COMPUTED RESULT' )
3061 9998 FORMAT( 1x, i7, 2( ' (', g15.6, ',', g15.6, ')' ) )
3062
3063
3064