416 SUBROUTINE cchkhs( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
417 $ NOUNIT, A, LDA, H, T1, T2, U, LDU, Z, UZ, W1,
418 $ W3, EVECTL, EVECTR, EVECTY, EVECTX, UU, TAU,
419 $ WORK, NWORK, RWORK, IWORK, SELECT, RESULT,
427 INTEGER INFO, LDA, LDU, NOUNIT, NSIZES, NTYPES, NWORK
431 LOGICAL DOTYPE( * ), SELECT( * )
432 INTEGER ISEED( 4 ), IWORK( * ), NN( * )
433 REAL RESULT( 16 ), RWORK( * )
434 COMPLEX A( LDA, * ), EVECTL( LDU, * ),
435 $ evectr( ldu, * ), evectx( ldu, * ),
436 $ evecty( ldu, * ), h( lda, * ), t1( lda, * ),
437 $ t2( lda, * ), tau( * ), u( ldu, * ),
438 $ uu( ldu, * ), uz( ldu, * ), w1( * ), w3( * ),
439 $ work( * ), z( ldu, * )
446 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0 )
448 PARAMETER ( CZERO = ( 0.0e+0, 0.0e+0 ),
449 $ cone = ( 1.0e+0, 0.0e+0 ) )
451 parameter( maxtyp = 21 )
455 INTEGER I, IHI, IINFO, ILO, IMODE, IN, ITYPE, J, JCOL,
456 $ JJ, JSIZE, JTYPE, K, MTYPES, N, N1, NERRS,
457 $ NMATS, NMAX, NTEST, NTESTT
458 REAL ANINV, ANORM, COND, CONDS, OVFL, RTOVFL, RTULP,
459 $ rtulpi, rtunfl, temp1, temp2, ulp, ulpinv, unfl
462 INTEGER IDUMMA( 1 ), IOLDSD( 4 ), KCONDS( MAXTYP ),
463 $ KMAGN( MAXTYP ), KMODE( MAXTYP ),
479 INTRINSIC abs, max, min, real, sqrt
482 DATA ktype / 1, 2, 3, 5*4, 4*6, 6*6, 3*9 /
483 DATA kmagn / 3*1, 1, 1, 1, 2, 3, 4*1, 1, 1, 1, 1, 2,
485 DATA kmode / 3*0, 4, 3, 1, 4, 4, 4, 3, 1, 5, 4, 3,
486 $ 1, 5, 5, 5, 4, 3, 1 /
487 DATA kconds / 3*0, 5*0, 4*1, 6*2, 3*0 /
499 nmax = max( nmax, nn( j ) )
506 IF( nsizes.LT.0 )
THEN
508 ELSE IF( badnn )
THEN
510 ELSE IF( ntypes.LT.0 )
THEN
512 ELSE IF( thresh.LT.zero )
THEN
514 ELSE IF( lda.LE.1 .OR. lda.LT.nmax )
THEN
516 ELSE IF( ldu.LE.1 .OR. ldu.LT.nmax )
THEN
518 ELSE IF( 4*nmax*nmax+2.GT.nwork )
THEN
523 CALL xerbla(
'CCHKHS', -info )
529 IF( nsizes.EQ.0 .OR. ntypes.EQ.0 )
534 unfl = slamch(
'Safe minimum' )
535 ovfl = slamch(
'Overflow' )
536 ulp = slamch(
'Epsilon' )*slamch(
'Base' )
538 rtunfl = sqrt( unfl )
539 rtovfl = sqrt( ovfl )
548 DO 260 jsize = 1, nsizes
553 aninv = one / real( n1 )
555 IF( nsizes.NE.1 )
THEN
556 mtypes = min( maxtyp, ntypes )
558 mtypes = min( maxtyp+1, ntypes )
561 DO 250 jtype = 1, mtypes
562 IF( .NOT.dotype( jtype ) )
570 ioldsd( j ) = iseed( j )
595 IF( mtypes.GT.maxtyp )
598 itype = ktype( jtype )
599 imode = kmode( jtype )
603 GO TO ( 40, 50, 60 )kmagn( jtype )
610 anorm = ( rtovfl*ulp )*aninv
614 anorm = rtunfl*n*ulpinv
619 CALL claset(
'Full', lda, n, czero, czero, a, lda )
625 IF( itype.EQ.1 )
THEN
630 ELSE IF( itype.EQ.2 )
THEN
635 a( jcol, jcol ) = anorm
638 ELSE IF( itype.EQ.3 )
THEN
643 a( jcol, jcol ) = anorm
645 $ a( jcol, jcol-1 ) = one
648 ELSE IF( itype.EQ.4 )
THEN
652 CALL clatmr( n, n,
'D', iseed,
'N', work, imode, cond,
653 $ cone,
'T',
'N', work( n+1 ), 1, one,
654 $ work( 2*n+1 ), 1, one,
'N', idumma, 0, 0,
655 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
657 ELSE IF( itype.EQ.5 )
THEN
661 CALL clatms( n, n,
'D', iseed,
'H', rwork, imode, cond,
662 $ anorm, n, n,
'N', a, lda, work, iinfo )
664 ELSE IF( itype.EQ.6 )
THEN
668 IF( kconds( jtype ).EQ.1 )
THEN
670 ELSE IF( kconds( jtype ).EQ.2 )
THEN
676 CALL clatme( n,
'D', iseed, work, imode, cond, cone,
677 $
'T',
'T',
'T', rwork, 4, conds, n, n, anorm,
678 $ a, lda, work( n+1 ), iinfo )
680 ELSE IF( itype.EQ.7 )
THEN
684 CALL clatmr( n, n,
'D', iseed,
'N', work, 6, one, cone,
685 $
'T',
'N', work( n+1 ), 1, one,
686 $ work( 2*n+1 ), 1, one,
'N', idumma, 0, 0,
687 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
689 ELSE IF( itype.EQ.8 )
THEN
693 CALL clatmr( n, n,
'D', iseed,
'H', work, 6, one, cone,
694 $
'T',
'N', work( n+1 ), 1, one,
695 $ work( 2*n+1 ), 1, one,
'N', idumma, n, n,
696 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
698 ELSE IF( itype.EQ.9 )
THEN
702 CALL clatmr( n, n,
'D', iseed,
'N', work, 6, one, cone,
703 $
'T',
'N', work( n+1 ), 1, one,
704 $ work( 2*n+1 ), 1, one,
'N', idumma, n, n,
705 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
707 ELSE IF( itype.EQ.10 )
THEN
711 CALL clatmr( n, n,
'D', iseed,
'N', work, 6, one, cone,
712 $
'T',
'N', work( n+1 ), 1, one,
713 $ work( 2*n+1 ), 1, one,
'N', idumma, n, 0,
714 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
721 IF( iinfo.NE.0 )
THEN
722 WRITE( nounit, fmt = 9999 )
'Generator', iinfo, n, jtype,
732 CALL clacpy(
' ', n, n, a, lda, h, lda )
738 CALL cgehrd( n, ilo, ihi, h, lda, work, work( n+1 ),
741 IF( iinfo.NE.0 )
THEN
743 WRITE( nounit, fmt = 9999 )
'CGEHRD', iinfo, n, jtype,
752 u( i, j ) = h( i, j )
753 uu( i, j ) = h( i, j )
757 CALL ccopy( n-1, work, 1, tau, 1 )
758 CALL cunghr( n, ilo, ihi, u, ldu, work, work( n+1 ),
762 CALL chst01( n, ilo, ihi, a, lda, h, lda, u, ldu, work,
763 $ nwork, rwork, result( 1 ) )
769 CALL clacpy(
' ', n, n, h, lda, t2, lda )
773 CALL chseqr(
'E',
'N', n, ilo, ihi, t2, lda, w3, uz, ldu,
774 $ work, nwork, iinfo )
775 IF( iinfo.NE.0 )
THEN
776 WRITE( nounit, fmt = 9999 )
'CHSEQR(E)', iinfo, n, jtype,
778 IF( iinfo.LE.n+2 )
THEN
786 CALL clacpy(
' ', n, n, h, lda, t2, lda )
788 CALL chseqr(
'S',
'N', n, ilo, ihi, t2, lda, w1, uz, ldu,
789 $ work, nwork, iinfo )
790 IF( iinfo.NE.0 .AND. iinfo.LE.n+2 )
THEN
791 WRITE( nounit, fmt = 9999 )
'CHSEQR(S)', iinfo, n, jtype,
799 CALL clacpy(
' ', n, n, h, lda, t1, lda )
800 CALL clacpy(
' ', n, n, u, ldu, uz, ldu )
802 CALL chseqr(
'S',
'V', n, ilo, ihi, t1, lda, w1, uz, ldu,
803 $ work, nwork, iinfo )
804 IF( iinfo.NE.0 .AND. iinfo.LE.n+2 )
THEN
805 WRITE( nounit, fmt = 9999 )
'CHSEQR(V)', iinfo, n, jtype,
813 CALL cgemm(
'C',
'N', n, n, n, cone, u, ldu, uz, ldu, czero,
820 CALL chst01( n, ilo, ihi, h, lda, t1, lda, z, ldu, work,
821 $ nwork, rwork, result( 3 ) )
826 CALL chst01( n, ilo, ihi, a, lda, t1, lda, uz, ldu, work,
827 $ nwork, rwork, result( 5 ) )
831 CALL cget10( n, n, t2, lda, t1, lda, work, rwork,
839 temp1 = max( temp1, abs( w1( j ) ), abs( w3( j ) ) )
840 temp2 = max( temp2, abs( w1( j )-w3( j ) ) )
843 result( 8 ) = temp2 / max( unfl, ulp*max( temp1, temp2 ) )
855 SELECT( j ) = .false.
860 CALL ctrevc(
'Right',
'All',
SELECT, n, t1, lda, cdumma,
861 $ ldu, evectr, ldu, n, in, work, rwork, iinfo )
862 IF( iinfo.NE.0 )
THEN
863 WRITE( nounit, fmt = 9999 )
'CTREVC(R,A)', iinfo, n,
871 CALL cget22(
'N',
'N',
'N', n, t1, lda, evectr, ldu, w1,
872 $ work, rwork, dumma( 1 ) )
873 result( 9 ) = dumma( 1 )
874 IF( dumma( 2 ).GT.thresh )
THEN
875 WRITE( nounit, fmt = 9998 )
'Right',
'CTREVC',
876 $ dumma( 2 ), n, jtype, ioldsd
882 CALL ctrevc(
'Right',
'Some',
SELECT, n, t1, lda, cdumma,
883 $ ldu, evectl, ldu, n, in, work, rwork, iinfo )
884 IF( iinfo.NE.0 )
THEN
885 WRITE( nounit, fmt = 9999 )
'CTREVC(R,S)', iinfo, n,
894 IF(
SELECT( j ) )
THEN
896 IF( evectr( jj, j ).NE.evectl( jj, k ) )
THEN
906 $
WRITE( nounit, fmt = 9997 )
'Right',
'CTREVC', n, jtype,
912 result( 10 ) = ulpinv
913 CALL ctrevc(
'Left',
'All',
SELECT, n, t1, lda, evectl, ldu,
914 $ cdumma, ldu, n, in, work, rwork, iinfo )
915 IF( iinfo.NE.0 )
THEN
916 WRITE( nounit, fmt = 9999 )
'CTREVC(L,A)', iinfo, n,
924 CALL cget22(
'C',
'N',
'C', n, t1, lda, evectl, ldu, w1,
925 $ work, rwork, dumma( 3 ) )
926 result( 10 ) = dumma( 3 )
927 IF( dumma( 4 ).GT.thresh )
THEN
928 WRITE( nounit, fmt = 9998 )
'Left',
'CTREVC', dumma( 4 ),
935 CALL ctrevc(
'Left',
'Some',
SELECT, n, t1, lda, evectr,
936 $ ldu, cdumma, ldu, n, in, work, rwork, iinfo )
937 IF( iinfo.NE.0 )
THEN
938 WRITE( nounit, fmt = 9999 )
'CTREVC(L,S)', iinfo, n,
947 IF(
SELECT( j ) )
THEN
949 IF( evectl( jj, j ).NE.evectr( jj, k ) )
THEN
959 $
WRITE( nounit, fmt = 9997 )
'Left',
'CTREVC', n, jtype,
965 result( 11 ) = ulpinv
970 CALL chsein(
'Right',
'Qr',
'Ninitv',
SELECT, n, h, lda, w3,
971 $ cdumma, ldu, evectx, ldu, n1, in, work, rwork,
972 $ iwork, iwork, iinfo )
973 IF( iinfo.NE.0 )
THEN
974 WRITE( nounit, fmt = 9999 )
'CHSEIN(R)', iinfo, n, jtype,
985 CALL cget22(
'N',
'N',
'N', n, h, lda, evectx, ldu, w3,
986 $ work, rwork, dumma( 1 ) )
987 IF( dumma( 1 ).LT.ulpinv )
988 $ result( 11 ) = dumma( 1 )*aninv
989 IF( dumma( 2 ).GT.thresh )
THEN
990 WRITE( nounit, fmt = 9998 )
'Right',
'CHSEIN',
991 $ dumma( 2 ), n, jtype, ioldsd
998 result( 12 ) = ulpinv
1000 SELECT( j ) = .true.
1003 CALL chsein(
'Left',
'Qr',
'Ninitv',
SELECT, n, h, lda, w3,
1004 $ evecty, ldu, cdumma, ldu, n1, in, work, rwork,
1005 $ iwork, iwork, iinfo )
1006 IF( iinfo.NE.0 )
THEN
1007 WRITE( nounit, fmt = 9999 )
'CHSEIN(L)', iinfo, n, jtype,
1018 CALL cget22(
'C',
'N',
'C', n, h, lda, evecty, ldu, w3,
1019 $ work, rwork, dumma( 3 ) )
1020 IF( dumma( 3 ).LT.ulpinv )
1021 $ result( 12 ) = dumma( 3 )*aninv
1022 IF( dumma( 4 ).GT.thresh )
THEN
1023 WRITE( nounit, fmt = 9998 )
'Left',
'CHSEIN',
1024 $ dumma( 4 ), n, jtype, ioldsd
1031 result( 13 ) = ulpinv
1033 CALL cunmhr(
'Left',
'No transpose', n, n, ilo, ihi, uu,
1034 $ ldu, tau, evectx, ldu, work, nwork, iinfo )
1035 IF( iinfo.NE.0 )
THEN
1036 WRITE( nounit, fmt = 9999 )
'CUNMHR(L)', iinfo, n, jtype,
1047 CALL cget22(
'N',
'N',
'N', n, a, lda, evectx, ldu, w3,
1048 $ work, rwork, dumma( 1 ) )
1049 IF( dumma( 1 ).LT.ulpinv )
1050 $ result( 13 ) = dumma( 1 )*aninv
1056 result( 14 ) = ulpinv
1058 CALL cunmhr(
'Left',
'No transpose', n, n, ilo, ihi, uu,
1059 $ ldu, tau, evecty, ldu, work, nwork, iinfo )
1060 IF( iinfo.NE.0 )
THEN
1061 WRITE( nounit, fmt = 9999 )
'CUNMHR(L)', iinfo, n, jtype,
1072 CALL cget22(
'C',
'N',
'C', n, a, lda, evecty, ldu, w3,
1073 $ work, rwork, dumma( 3 ) )
1074 IF( dumma( 3 ).LT.ulpinv )
1075 $ result( 14 ) = dumma( 3 )*aninv
1083 result( 15 ) = ulpinv
1085 CALL clacpy(
' ', n, n, uz, ldu, evectr, ldu )
1087 CALL ctrevc3(
'Right',
'Back',
SELECT, n, t1, lda, cdumma,
1088 $ ldu, evectr, ldu, n, in, work, nwork, rwork,
1090 IF( iinfo.NE.0 )
THEN
1091 WRITE( nounit, fmt = 9999 )
'CTREVC3(R,B)', iinfo, n,
1101 CALL cget22(
'N',
'N',
'N', n, a, lda, evectr, ldu, w1,
1102 $ work, rwork, dumma( 1 ) )
1103 result( 15 ) = dumma( 1 )
1104 IF( dumma( 2 ).GT.thresh )
THEN
1105 WRITE( nounit, fmt = 9998 )
'Right',
'CTREVC3',
1106 $ dumma( 2 ), n, jtype, ioldsd
1112 result( 16 ) = ulpinv
1114 CALL clacpy(
' ', n, n, uz, ldu, evectl, ldu )
1116 CALL ctrevc3(
'Left',
'Back',
SELECT, n, t1, lda, evectl,
1117 $ ldu, cdumma, ldu, n, in, work, nwork, rwork,
1119 IF( iinfo.NE.0 )
THEN
1120 WRITE( nounit, fmt = 9999 )
'CTREVC3(L,B)', iinfo, n,
1130 CALL cget22(
'Conj',
'N',
'Conj', n, a, lda, evectl, ldu,
1131 $ w1, work, rwork, dumma( 3 ) )
1132 result( 16 ) = dumma( 3 )
1133 IF( dumma( 4 ).GT.thresh )
THEN
1134 WRITE( nounit, fmt = 9998 )
'Left',
'CTREVC3', dumma( 4 ),
1142 ntestt = ntestt + ntest
1143 CALL slafts(
'CHS', n, n, jtype, ntest, result, ioldsd,
1144 $ thresh, nounit, nerrs )
1151 CALL slasum(
'CHS', nounit, nerrs, ntestt )
1155 9999
FORMAT(
' CCHKHS: ', a,
' returned INFO=', i6,
'.', / 9x,
'N=',
1156 $ i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ), i5,
')' )
1157 9998
FORMAT(
' CCHKHS: ', a,
' Eigenvectors from ', a,
' incorrectly ',
1158 $
'normalized.', /
' Bits of error=', 0p, g10.3,
',', 9x,
1159 $
'N=', i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ), i5,
1161 9997
FORMAT(
' CCHKHS: Selected ', a,
' Eigenvectors from ', a,
1162 $
' do not match other eigenvectors ', 9x,
'N=', i6,
1163 $
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ), i5,
')' )
subroutine xerbla(srname, info)
subroutine cchkhs(nsizes, nn, ntypes, dotype, iseed, thresh, nounit, a, lda, h, t1, t2, u, ldu, z, uz, w1, w3, evectl, evectr, evecty, evectx, uu, tau, work, nwork, rwork, iwork, select, result, info)
CCHKHS
subroutine cget10(m, n, a, lda, b, ldb, work, rwork, result)
CGET10
subroutine cget22(transa, transe, transw, n, a, lda, e, lde, w, work, rwork, result)
CGET22
subroutine chst01(n, ilo, ihi, a, lda, h, ldh, q, ldq, work, lwork, rwork, result)
CHST01
subroutine clatme(n, dist, iseed, d, mode, cond, dmax, rsign, upper, sim, ds, modes, conds, kl, ku, anorm, a, lda, work, info)
CLATME
subroutine clatmr(m, n, dist, iseed, sym, d, mode, cond, dmax, rsign, grade, dl, model, condl, dr, moder, condr, pivtng, ipivot, kl, ku, sparse, anorm, pack, a, lda, iwork, info)
CLATMR
subroutine clatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
CLATMS
subroutine ccopy(n, cx, incx, cy, incy)
CCOPY
subroutine cgehrd(n, ilo, ihi, a, lda, tau, work, lwork, info)
CGEHRD
subroutine cgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CGEMM
subroutine chsein(side, eigsrc, initv, select, n, h, ldh, w, vl, ldvl, vr, ldvr, mm, m, work, rwork, ifaill, ifailr, info)
CHSEIN
subroutine chseqr(job, compz, n, ilo, ihi, h, ldh, w, z, ldz, work, lwork, info)
CHSEQR
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
subroutine claset(uplo, m, n, alpha, beta, a, lda)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine ctrevc3(side, howmny, select, n, t, ldt, vl, ldvl, vr, ldvr, mm, m, work, lwork, rwork, lrwork, info)
CTREVC3
subroutine ctrevc(side, howmny, select, n, t, ldt, vl, ldvl, vr, ldvr, mm, m, work, rwork, info)
CTREVC
subroutine cunghr(n, ilo, ihi, a, lda, tau, work, lwork, info)
CUNGHR
subroutine cunmhr(side, trans, m, n, ilo, ihi, a, lda, tau, c, ldc, work, lwork, info)
CUNMHR
subroutine slafts(type, m, n, imat, ntests, result, iseed, thresh, iounit, ie)
SLAFTS
subroutine slasum(type, iounit, ie, nrun)
SLASUM