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