2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233 REAL ZERO, ONE
2234 parameter( zero = 0.0, one = 1.0 )
2235
2236 REAL ALPHA, BETA, EPS, ERR
2237 INTEGER KK, LDA, LDB, LDC, LDCC, M, N, NOUT
2238 LOGICAL FATAL, MV
2239 CHARACTER*1 TRANSA, TRANSB
2240
2241 REAL A( LDA, * ), B( LDB, * ), C( LDC, * ),
2242 $ CC( LDCC, * ), CT( * ), G( * )
2243
2244 REAL ERRI
2245 INTEGER I, J, K
2246 LOGICAL TRANA, TRANB
2247
2248 INTRINSIC abs, max, sqrt
2249
2250 trana = transa.EQ.'T'.OR.transa.EQ.'C'
2251 tranb = transb.EQ.'T'.OR.transb.EQ.'C'
2252
2253
2254
2255
2256
2257 DO 120 j = 1, n
2258
2259 DO 10 i = 1, m
2260 ct( i ) = zero
2261 g( i ) = zero
2262 10 CONTINUE
2263 IF( .NOT.trana.AND..NOT.tranb )THEN
2264 DO 30 k = 1, kk
2265 DO 20 i = 1, m
2266 ct( i ) = ct( i ) + a( i, k )*b( k, j )
2267 g( i ) = g( i ) + abs( a( i, k ) )*abs( b( k, j ) )
2268 20 CONTINUE
2269 30 CONTINUE
2270 ELSE IF( trana.AND..NOT.tranb )THEN
2271 DO 50 k = 1, kk
2272 DO 40 i = 1, m
2273 ct( i ) = ct( i ) + a( k, i )*b( k, j )
2274 g( i ) = g( i ) + abs( a( k, i ) )*abs( b( k, j ) )
2275 40 CONTINUE
2276 50 CONTINUE
2277 ELSE IF( .NOT.trana.AND.tranb )THEN
2278 DO 70 k = 1, kk
2279 DO 60 i = 1, m
2280 ct( i ) = ct( i ) + a( i, k )*b( j, k )
2281 g( i ) = g( i ) + abs( a( i, k ) )*abs( b( j, k ) )
2282 60 CONTINUE
2283 70 CONTINUE
2284 ELSE IF( trana.AND.tranb )THEN
2285 DO 90 k = 1, kk
2286 DO 80 i = 1, m
2287 ct( i ) = ct( i ) + a( k, i )*b( j, k )
2288 g( i ) = g( i ) + abs( a( k, i ) )*abs( b( j, k ) )
2289 80 CONTINUE
2290 90 CONTINUE
2291 END IF
2292 DO 100 i = 1, m
2293 ct( i ) = alpha*ct( i ) + beta*c( i, j )
2294 g( i ) = abs( alpha )*g( i ) + abs( beta )*abs( c( i, j ) )
2295 100 CONTINUE
2296
2297
2298
2299 err = zero
2300 DO 110 i = 1, m
2301 erri = abs( ct( i ) - cc( i, j ) )/eps
2302 IF( g( i ).NE.zero )
2303 $ erri = erri/g( i )
2304 err = max( err, erri )
2305 IF( err*sqrt( eps ).GE.one )
2306 $ GO TO 130
2307 110 CONTINUE
2308
2309 120 CONTINUE
2310
2311
2312 GO TO 150
2313
2314
2315
2316 130 fatal = .true.
2317 WRITE( nout, fmt = 9999 )
2318 DO 140 i = 1, m
2319 IF( mv )THEN
2320 WRITE( nout, fmt = 9998 )i, ct( i ), cc( i, j )
2321 ELSE
2322 WRITE( nout, fmt = 9998 )i, cc( i, j ), ct( i )
2323 END IF
2324 140 CONTINUE
2325 IF( n.GT.1 )
2326 $ WRITE( nout, fmt = 9997 )j
2327
2328 150 CONTINUE
2329 RETURN
2330
2331 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',
2332 $ 'F ACCURATE *******', /' EXPECTED RESULT COMPU',
2333 $ 'TED RESULT' )
2334 9998 FORMAT( 1x, i7, 2g18.6 )
2335 9997 FORMAT( ' THESE ARE THE RESULTS FOR COLUMN ', i3 )
2336
2337
2338