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