395
396
397
398
399
400
401
402
403
404
405
406
407 REAL ZERO
408 parameter( zero = 0.0 )
409
410 REAL EPS, THRESH
411 INTEGER NALF, NBET, NIDIM, NMAX, NOUT, NTRA
412 LOGICAL FATAL, REWI, TRACE
413 CHARACTER*6 SNAME
414
415 REAL A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),
416 $ AS( NMAX*NMAX ), B( NMAX, NMAX ),
417 $ BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),
418 $ C( NMAX, NMAX ), CC( NMAX*NMAX ),
419 $ CS( NMAX*NMAX ), CT( NMAX ), G( NMAX )
420 INTEGER IDIM( NIDIM )
421
422 REAL ALPHA, ALS, BETA, BLS, ERR, ERRMAX
423 INTEGER I, IA, IB, ICA, ICB, IK, IM, IN, K, KS, LAA,
424 $ LBB, LCC, LDA, LDAS, LDB, LDBS, LDC, LDCS, M,
425 $ MA, MB, MS, N, NA, NARGS, NB, NC, NS
426 LOGICAL NULL, RESET, SAME, TRANA, TRANB
427 CHARACTER*1 TRANAS, TRANBS, TRANSA, TRANSB
428 CHARACTER*3 ICH
429
430 LOGICAL ISAME( 13 )
431
432 LOGICAL LSE, LSERES
434
436
437 INTRINSIC max
438
439 INTEGER INFOT, NOUTC
440 LOGICAL LERR, OK
441
442 COMMON /infoc/infot, noutc, ok, lerr
443
444 DATA ich/'NTC'/
445
446
447 nargs = 13
448 nc = 0
449 reset = .true.
450 errmax = zero
451
452 DO 110 im = 1, nidim
453 m = idim( im )
454
455 DO 100 in = 1, nidim
456 n = idim( in )
457
458 ldc = m
459 IF( ldc.LT.nmax )
460 $ ldc = ldc + 1
461
462 IF( ldc.GT.nmax )
463 $ GO TO 100
464 lcc = ldc*n
465 null = n.LE.0.OR.m.LE.0
466
467 DO 90 ik = 1, nidim
468 k = idim( ik )
469
470 DO 80 ica = 1, 3
471 transa = ich( ica: ica )
472 trana = transa.EQ.'T'.OR.transa.EQ.'C'
473
474 IF( trana )THEN
475 ma = k
476 na = m
477 ELSE
478 ma = m
479 na = k
480 END IF
481
482 lda = ma
483 IF( lda.LT.nmax )
484 $ lda = lda + 1
485
486 IF( lda.GT.nmax )
487 $ GO TO 80
488 laa = lda*na
489
490
491
492 CALL smake(
'GE',
' ',
' ', ma, na, a, nmax, aa, lda,
493 $ reset, zero )
494
495 DO 70 icb = 1, 3
496 transb = ich( icb: icb )
497 tranb = transb.EQ.'T'.OR.transb.EQ.'C'
498
499 IF( tranb )THEN
500 mb = n
501 nb = k
502 ELSE
503 mb = k
504 nb = n
505 END IF
506
507 ldb = mb
508 IF( ldb.LT.nmax )
509 $ ldb = ldb + 1
510
511 IF( ldb.GT.nmax )
512 $ GO TO 70
513 lbb = ldb*nb
514
515
516
517 CALL smake(
'GE',
' ',
' ', mb, nb, b, nmax, bb,
518 $ ldb, reset, zero )
519
520 DO 60 ia = 1, nalf
521 alpha = alf( ia )
522
523 DO 50 ib = 1, nbet
524 beta = bet( ib )
525
526
527
528 CALL smake(
'GE',
' ',
' ', m, n, c, nmax,
529 $ cc, ldc, reset, zero )
530
531 nc = nc + 1
532
533
534
535
536 tranas = transa
537 tranbs = transb
538 ms = m
539 ns = n
540 ks = k
541 als = alpha
542 DO 10 i = 1, laa
543 as( i ) = aa( i )
544 10 CONTINUE
545 ldas = lda
546 DO 20 i = 1, lbb
547 bs( i ) = bb( i )
548 20 CONTINUE
549 ldbs = ldb
550 bls = beta
551 DO 30 i = 1, lcc
552 cs( i ) = cc( i )
553 30 CONTINUE
554 ldcs = ldc
555
556
557
558 IF( trace )
559 $ WRITE( ntra, fmt = 9995 )nc, sname,
560 $ transa, transb, m, n, k, alpha, lda, ldb,
561 $ beta, ldc
562 IF( rewi )
563 $ rewind ntra
564 CALL sgemm( transa, transb, m, n, k, alpha,
565 $ aa, lda, bb, ldb, beta, cc, ldc )
566
567
568
569 IF( .NOT.ok )THEN
570 WRITE( nout, fmt = 9994 )
571 fatal = .true.
572 GO TO 120
573 END IF
574
575
576
577 isame( 1 ) = transa.EQ.tranas
578 isame( 2 ) = transb.EQ.tranbs
579 isame( 3 ) = ms.EQ.m
580 isame( 4 ) = ns.EQ.n
581 isame( 5 ) = ks.EQ.k
582 isame( 6 ) = als.EQ.alpha
583 isame( 7 ) =
lse( as, aa, laa )
584 isame( 8 ) = ldas.EQ.lda
585 isame( 9 ) =
lse( bs, bb, lbb )
586 isame( 10 ) = ldbs.EQ.ldb
587 isame( 11 ) = bls.EQ.beta
588 IF( null )THEN
589 isame( 12 ) =
lse( cs, cc, lcc )
590 ELSE
591 isame( 12 ) =
lseres(
'GE',
' ', m, n, cs,
592 $ cc, ldc )
593 END IF
594 isame( 13 ) = ldcs.EQ.ldc
595
596
597
598
599 same = .true.
600 DO 40 i = 1, nargs
601 same = same.AND.isame( i )
602 IF( .NOT.isame( i ) )
603 $ WRITE( nout, fmt = 9998 )i
604 40 CONTINUE
605 IF( .NOT.same )THEN
606 fatal = .true.
607 GO TO 120
608 END IF
609
610 IF( .NOT.null )THEN
611
612
613
614 CALL smmch( transa, transb, m, n, k,
615 $ alpha, a, nmax, b, nmax, beta,
616 $ c, nmax, ct, g, cc, ldc, eps,
617 $ err, fatal, nout, .true. )
618 errmax = max( errmax, err )
619
620
621 IF( fatal )
622 $ GO TO 120
623 END IF
624
625 50 CONTINUE
626
627 60 CONTINUE
628
629 70 CONTINUE
630
631 80 CONTINUE
632
633 90 CONTINUE
634
635 100 CONTINUE
636
637 110 CONTINUE
638
639
640
641 IF( errmax.LT.thresh )THEN
642 WRITE( nout, fmt = 9999 )sname, nc
643 ELSE
644 WRITE( nout, fmt = 9997 )sname, nc, errmax
645 END IF
646 GO TO 130
647
648 120 CONTINUE
649 WRITE( nout, fmt = 9996 )sname
650 WRITE( nout, fmt = 9995 )nc, sname, transa, transb, m, n, k,
651 $ alpha, lda, ldb, beta, ldc
652
653 130 CONTINUE
654 RETURN
655
656 9999 FORMAT( ' ', a6, ' PASSED THE COMPUTATIONAL TESTS (', i6, ' CALL',
657 $ 'S)' )
658 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', i2, ' WAS CH',
659 $ 'ANGED INCORRECTLY *******' )
660 9997 FORMAT( ' ', a6, ' COMPLETED THE COMPUTATIONAL TESTS (', i6, ' C',
661 $ 'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', f8.2,
662 $ ' - SUSPECT *******' )
663 9996 FORMAT( ' ******* ', a6, ' FAILED ON CALL NUMBER:' )
664 9995 FORMAT( 1x, i6, ': ', a6, '(''', a1, ''',''', a1, ''',',
665 $ 3( i3, ',' ), f4.1, ', A,', i3, ', B,', i3, ',', f4.1, ', ',
666 $ 'C,', i3, ').' )
667 9994 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',
668 $ '******' )
669
670
671
subroutine sgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
SGEMM
logical function lseres(type, uplo, m, n, aa, as, lda)
subroutine smake(type, uplo, diag, m, n, a, nmax, aa, lda, kl, ku, reset, transl)
logical function lse(ri, rj, lr)
subroutine smmch(transa, transb, m, n, kk, alpha, a, lda, b, ldb, beta, c, ldc, ct, g, cc, ldcc, eps, err, fatal, nout, mv)