LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ cmmch()

subroutine cmmch ( character*1 transa,
character*1 transb,
integer m,
integer n,
integer kk,
complex alpha,
complex, dimension( lda, * ) a,
integer lda,
complex, dimension( ldb, * ) b,
integer ldb,
complex beta,
complex, dimension( ldc, * ) c,
integer ldc,
complex, dimension( * ) ct,
real, dimension( * ) g,
complex, dimension( ldcc, * ) cc,
integer ldcc,
real eps,
real err,
logical fatal,
integer nout,
logical mv )

Definition at line 2449 of file c_cblat3.f.

2452*
2453* Checks the results of the computational tests.
2454*
2455* Auxiliary routine for test program for Level 3 Blas.
2456*
2457* -- Written on 8-February-1989.
2458* Jack Dongarra, Argonne National Laboratory.
2459* Iain Duff, AERE Harwell.
2460* Jeremy Du Croz, Numerical Algorithms Group Ltd.
2461* Sven Hammarling, Numerical Algorithms Group Ltd.
2462*
2463* .. Parameters ..
2464 COMPLEX ZERO
2465 parameter( zero = ( 0.0, 0.0 ) )
2466 REAL RZERO, RONE
2467 parameter( rzero = 0.0, rone = 1.0 )
2468* .. Scalar Arguments ..
2469 COMPLEX ALPHA, BETA
2470 REAL EPS, ERR
2471 INTEGER KK, LDA, LDB, LDC, LDCC, M, N, NOUT
2472 LOGICAL FATAL, MV
2473 CHARACTER*1 TRANSA, TRANSB
2474* .. Array Arguments ..
2475 COMPLEX A( LDA, * ), B( LDB, * ), C( LDC, * ),
2476 $ CC( LDCC, * ), CT( * )
2477 REAL G( * )
2478* .. Local Scalars ..
2479 COMPLEX CL
2480 REAL ERRI
2481 INTEGER I, J, K
2482 LOGICAL CTRANA, CTRANB, TRANA, TRANB
2483* .. Intrinsic Functions ..
2484 INTRINSIC abs, aimag, conjg, max, real, sqrt
2485* .. Statement Functions ..
2486 REAL ABS1
2487* .. Statement Function definitions ..
2488 abs1( cl ) = abs( real( cl ) ) + abs( aimag( cl ) )
2489* .. Executable Statements ..
2490 trana = transa.EQ.'T'.OR.transa.EQ.'C'
2491 tranb = transb.EQ.'T'.OR.transb.EQ.'C'
2492 ctrana = transa.EQ.'C'
2493 ctranb = transb.EQ.'C'
2494*
2495* Compute expected result, one column at a time, in CT using data
2496* in A, B and C.
2497* Compute gauges in G.
2498*
2499 DO 220 j = 1, n
2500*
2501 DO 10 i = 1, m
2502 ct( i ) = zero
2503 g( i ) = rzero
2504 10 CONTINUE
2505 IF( .NOT.trana.AND..NOT.tranb )THEN
2506 DO 30 k = 1, kk
2507 DO 20 i = 1, m
2508 ct( i ) = ct( i ) + a( i, k )*b( k, j )
2509 g( i ) = g( i ) + abs1( a( i, k ) )*abs1( b( k, j ) )
2510 20 CONTINUE
2511 30 CONTINUE
2512 ELSE IF( trana.AND..NOT.tranb )THEN
2513 IF( ctrana )THEN
2514 DO 50 k = 1, kk
2515 DO 40 i = 1, m
2516 ct( i ) = ct( i ) + conjg( a( k, i ) )*b( k, j )
2517 g( i ) = g( i ) + abs1( a( k, i ) )*
2518 $ abs1( b( k, j ) )
2519 40 CONTINUE
2520 50 CONTINUE
2521 ELSE
2522 DO 70 k = 1, kk
2523 DO 60 i = 1, m
2524 ct( i ) = ct( i ) + a( k, i )*b( k, j )
2525 g( i ) = g( i ) + abs1( a( k, i ) )*
2526 $ abs1( b( k, j ) )
2527 60 CONTINUE
2528 70 CONTINUE
2529 END IF
2530 ELSE IF( .NOT.trana.AND.tranb )THEN
2531 IF( ctranb )THEN
2532 DO 90 k = 1, kk
2533 DO 80 i = 1, m
2534 ct( i ) = ct( i ) + a( i, k )*conjg( b( j, k ) )
2535 g( i ) = g( i ) + abs1( a( i, k ) )*
2536 $ abs1( b( j, k ) )
2537 80 CONTINUE
2538 90 CONTINUE
2539 ELSE
2540 DO 110 k = 1, kk
2541 DO 100 i = 1, m
2542 ct( i ) = ct( i ) + a( i, k )*b( j, k )
2543 g( i ) = g( i ) + abs1( a( i, k ) )*
2544 $ abs1( b( j, k ) )
2545 100 CONTINUE
2546 110 CONTINUE
2547 END IF
2548 ELSE IF( trana.AND.tranb )THEN
2549 IF( ctrana )THEN
2550 IF( ctranb )THEN
2551 DO 130 k = 1, kk
2552 DO 120 i = 1, m
2553 ct( i ) = ct( i ) + conjg( a( k, i ) )*
2554 $ conjg( b( j, k ) )
2555 g( i ) = g( i ) + abs1( a( k, i ) )*
2556 $ abs1( b( j, k ) )
2557 120 CONTINUE
2558 130 CONTINUE
2559 ELSE
2560 DO 150 k = 1, kk
2561 DO 140 i = 1, m
2562 ct( i ) = ct( i ) + conjg( a( k, i ) )*b( j, k )
2563 g( i ) = g( i ) + abs1( a( k, i ) )*
2564 $ abs1( b( j, k ) )
2565 140 CONTINUE
2566 150 CONTINUE
2567 END IF
2568 ELSE
2569 IF( ctranb )THEN
2570 DO 170 k = 1, kk
2571 DO 160 i = 1, m
2572 ct( i ) = ct( i ) + a( k, i )*conjg( b( j, k ) )
2573 g( i ) = g( i ) + abs1( a( k, i ) )*
2574 $ abs1( b( j, k ) )
2575 160 CONTINUE
2576 170 CONTINUE
2577 ELSE
2578 DO 190 k = 1, kk
2579 DO 180 i = 1, m
2580 ct( i ) = ct( i ) + a( k, i )*b( j, k )
2581 g( i ) = g( i ) + abs1( a( k, i ) )*
2582 $ abs1( b( j, k ) )
2583 180 CONTINUE
2584 190 CONTINUE
2585 END IF
2586 END IF
2587 END IF
2588 DO 200 i = 1, m
2589 ct( i ) = alpha*ct( i ) + beta*c( i, j )
2590 g( i ) = abs1( alpha )*g( i ) +
2591 $ abs1( beta )*abs1( c( i, j ) )
2592 200 CONTINUE
2593*
2594* Compute the error ratio for this result.
2595*
2596 err = zero
2597 DO 210 i = 1, m
2598 erri = abs1( ct( i ) - cc( i, j ) )/eps
2599 IF( g( i ).NE.rzero )
2600 $ erri = erri/g( i )
2601 err = max( err, erri )
2602 IF( err*sqrt( eps ).GE.rone )
2603 $ GO TO 230
2604 210 CONTINUE
2605*
2606 220 CONTINUE
2607*
2608* If the loop completes, all results are at least half accurate.
2609 GO TO 250
2610*
2611* Report fatal error.
2612*
2613 230 fatal = .true.
2614 WRITE( nout, fmt = 9999 )
2615 DO 240 i = 1, m
2616 IF( mv )THEN
2617 WRITE( nout, fmt = 9998 )i, ct( i ), cc( i, j )
2618 ELSE
2619 WRITE( nout, fmt = 9998 )i, cc( i, j ), ct( i )
2620 END IF
2621 240 CONTINUE
2622 IF( n.GT.1 )
2623 $ WRITE( nout, fmt = 9997 )j
2624*
2625 250 CONTINUE
2626 RETURN
2627*
2628 9999 FORMAT(' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',
2629 $ 'F ACCURATE *******', /' EXPECTED RE',
2630 $ 'SULT COMPUTED RESULT' )
2631 9998 FORMAT( 1x, i7, 2( ' (', g15.6, ',', g15.6, ')' ) )
2632 9997 FORMAT( ' THESE ARE THE RESULTS FOR COLUMN ', i3 )
2633*
2634* End of CMMCH.
2635*