417 SUBROUTINE dchkhs( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
418 $ NOUNIT, A, LDA, H, T1, T2, U, LDU, Z, UZ, WR1,
419 $ WI1, WR2, WI2, WR3, WI3, EVECTL, EVECTR,
420 $ EVECTY, EVECTX, UU, TAU, WORK, NWORK, IWORK,
421 $ SELECT, RESULT, INFO )
428 INTEGER INFO, LDA, LDU, NOUNIT, NSIZES, NTYPES, NWORK
429 DOUBLE PRECISION THRESH
432 LOGICAL DOTYPE( * ), SELECT( * )
433 INTEGER ISEED( 4 ), IWORK( * ), NN( * )
434 DOUBLE PRECISION A( LDA, * ), EVECTL( LDU, * ),
435 $ EVECTR( LDU, * ), EVECTX( LDU, * ),
436 $ evecty( ldu, * ), h( lda, * ), result( 16 ),
437 $ t1( lda, * ), t2( lda, * ), tau( * ),
438 $ u( ldu, * ), uu( ldu, * ), uz( ldu, * ),
439 $ wi1( * ), wi2( * ), wi3( * ), work( * ),
440 $ wr1( * ), wr2( * ), wr3( * ), z( ldu, * )
446 DOUBLE PRECISION ZERO, ONE
447 PARAMETER ( ZERO = 0.0d0, one = 1.0d0 )
449 PARAMETER ( MAXTYP = 21 )
453 INTEGER I, IHI, IINFO, ILO, IMODE, IN, ITYPE, J, JCOL,
454 $ JJ, JSIZE, JTYPE, K, MTYPES, N, N1, NERRS,
455 $ NMATS, NMAX, NSELC, NSELR, NTEST, NTESTT
456 DOUBLE PRECISION ANINV, ANORM, COND, CONDS, OVFL, RTOVFL, RTULP,
457 $ rtulpi, rtunfl, temp1, temp2, ulp, ulpinv, unfl
460 CHARACTER ADUMMA( 1 )
461 INTEGER IDUMMA( 1 ), IOLDSD( 4 ), KCONDS( MAXTYP ),
462 $ KMAGN( MAXTYP ), KMODE( MAXTYP ),
464 DOUBLE PRECISION DUMMA( 6 )
467 DOUBLE PRECISION DLAMCH
477 INTRINSIC abs, dble, max, min, sqrt
480 DATA ktype / 1, 2, 3, 5*4, 4*6, 6*6, 3*9 /
481 DATA kmagn / 3*1, 1, 1, 1, 2, 3, 4*1, 1, 1, 1, 1, 2,
483 DATA kmode / 3*0, 4, 3, 1, 4, 4, 4, 3, 1, 5, 4, 3,
484 $ 1, 5, 5, 5, 4, 3, 1 /
485 DATA kconds / 3*0, 5*0, 4*1, 6*2, 3*0 /
497 nmax = max( nmax, nn( j ) )
504 IF( nsizes.LT.0 )
THEN
506 ELSE IF( badnn )
THEN
508 ELSE IF( ntypes.LT.0 )
THEN
510 ELSE IF( thresh.LT.zero )
THEN
512 ELSE IF( lda.LE.1 .OR. lda.LT.nmax )
THEN
514 ELSE IF( ldu.LE.1 .OR. ldu.LT.nmax )
THEN
516 ELSE IF( 4*nmax*nmax+2.GT.nwork )
THEN
521 CALL xerbla(
'DCHKHS', -info )
527 IF( nsizes.EQ.0 .OR. ntypes.EQ.0 )
532 unfl = dlamch(
'Safe minimum' )
533 ovfl = dlamch(
'Overflow' )
534 ulp = dlamch(
'Epsilon' )*dlamch(
'Base' )
536 rtunfl = sqrt( unfl )
537 rtovfl = sqrt( ovfl )
546 DO 270 jsize = 1, nsizes
551 aninv = one / dble( n1 )
553 IF( nsizes.NE.1 )
THEN
554 mtypes = min( maxtyp, ntypes )
556 mtypes = min( maxtyp+1, ntypes )
559 DO 260 jtype = 1, mtypes
560 IF( .NOT.dotype( jtype ) )
568 ioldsd( j ) = iseed( j )
593 IF( mtypes.GT.maxtyp )
596 itype = ktype( jtype )
597 imode = kmode( jtype )
601 GO TO ( 40, 50, 60 )kmagn( jtype )
608 anorm = ( rtovfl*ulp )*aninv
612 anorm = rtunfl*n*ulpinv
617 CALL dlaset(
'Full', lda, n, zero, zero, a, lda )
623 IF( itype.EQ.1 )
THEN
629 ELSE IF( itype.EQ.2 )
THEN
634 a( jcol, jcol ) = anorm
637 ELSE IF( itype.EQ.3 )
THEN
642 a( jcol, jcol ) = anorm
644 $ a( jcol, jcol-1 ) = one
647 ELSE IF( itype.EQ.4 )
THEN
651 CALL dlatms( n, n,
'S', iseed,
'S', work, imode, cond,
652 $ anorm, 0, 0,
'N', a, lda, work( n+1 ),
655 ELSE IF( itype.EQ.5 )
THEN
659 CALL dlatms( n, n,
'S', iseed,
'S', work, imode, cond,
660 $ anorm, n, n,
'N', a, lda, work( n+1 ),
663 ELSE IF( itype.EQ.6 )
THEN
667 IF( kconds( jtype ).EQ.1 )
THEN
669 ELSE IF( kconds( jtype ).EQ.2 )
THEN
676 CALL dlatme( n,
'S', iseed, work, imode, cond, one,
677 $ adumma,
'T',
'T',
'T', work( n+1 ), 4,
678 $ conds, n, n, anorm, a, lda, work( 2*n+1 ),
681 ELSE IF( itype.EQ.7 )
THEN
685 CALL dlatmr( n, n,
'S', iseed,
'S', work, 6, one, one,
686 $
'T',
'N', work( n+1 ), 1, one,
687 $ work( 2*n+1 ), 1, one,
'N', idumma, 0, 0,
688 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
690 ELSE IF( itype.EQ.8 )
THEN
694 CALL dlatmr( n, n,
'S', iseed,
'S', work, 6, one, one,
695 $
'T',
'N', work( n+1 ), 1, one,
696 $ work( 2*n+1 ), 1, one,
'N', idumma, n, n,
697 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
699 ELSE IF( itype.EQ.9 )
THEN
703 CALL dlatmr( n, n,
'S', iseed,
'N', work, 6, one, one,
704 $
'T',
'N', work( n+1 ), 1, one,
705 $ work( 2*n+1 ), 1, one,
'N', idumma, n, n,
706 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
708 ELSE IF( itype.EQ.10 )
THEN
712 CALL dlatmr( n, n,
'S', iseed,
'N', work, 6, one, one,
713 $
'T',
'N', work( n+1 ), 1, one,
714 $ work( 2*n+1 ), 1, one,
'N', idumma, n, 0,
715 $ zero, anorm,
'NO', a, lda, iwork, iinfo )
722 IF( iinfo.NE.0 )
THEN
723 WRITE( nounit, fmt = 9999 )
'Generator', iinfo, n, jtype,
733 CALL dlacpy(
' ', n, n, a, lda, h, lda )
740 CALL dgehrd( n, ilo, ihi, h, lda, work, work( n+1 ),
743 IF( iinfo.NE.0 )
THEN
745 WRITE( nounit, fmt = 9999 )
'DGEHRD', iinfo, n, jtype,
754 u( i, j ) = h( i, j )
755 uu( i, j ) = h( i, j )
759 CALL dcopy( n-1, work, 1, tau, 1 )
760 CALL dorghr( n, ilo, ihi, u, ldu, work, work( n+1 ),
764 CALL dhst01( n, ilo, ihi, a, lda, h, lda, u, ldu, work,
765 $ nwork, result( 1 ) )
771 CALL dlacpy(
' ', n, n, h, lda, t2, lda )
775 CALL dhseqr(
'E',
'N', n, ilo, ihi, t2, lda, wr3, wi3, uz,
776 $ ldu, work, nwork, iinfo )
777 IF( iinfo.NE.0 )
THEN
778 WRITE( nounit, fmt = 9999 )
'DHSEQR(E)', iinfo, n, jtype,
780 IF( iinfo.LE.n+2 )
THEN
788 CALL dlacpy(
' ', n, n, h, lda, t2, lda )
790 CALL dhseqr(
'S',
'N', n, ilo, ihi, t2, lda, wr2, wi2, uz,
791 $ ldu, work, nwork, iinfo )
792 IF( iinfo.NE.0 .AND. iinfo.LE.n+2 )
THEN
793 WRITE( nounit, fmt = 9999 )
'DHSEQR(S)', iinfo, n, jtype,
802 CALL dlacpy(
' ', n, n, h, lda, t1, lda )
803 CALL dlacpy(
' ', n, n, u, ldu, uz, ldu )
805 CALL dhseqr(
'S',
'V', n, ilo, ihi, t1, lda, wr1, wi1, uz,
806 $ ldu, work, nwork, iinfo )
807 IF( iinfo.NE.0 .AND. iinfo.LE.n+2 )
THEN
808 WRITE( nounit, fmt = 9999 )
'DHSEQR(V)', iinfo, n, jtype,
816 CALL dgemm(
'T',
'N', n, n, n, one, u, ldu, uz, ldu, zero,
823 CALL dhst01( n, ilo, ihi, h, lda, t1, lda, z, ldu, work,
824 $ nwork, result( 3 ) )
829 CALL dhst01( n, ilo, ihi, a, lda, t1, lda, uz, ldu, work,
830 $ nwork, result( 5 ) )
834 CALL dget10( n, n, t2, lda, t1, lda, work, result( 7 ) )
841 temp1 = max( temp1, abs( wr1( j ) )+abs( wi1( j ) ),
842 $ abs( wr2( j ) )+abs( wi2( j ) ) )
843 temp2 = max( temp2, abs( wr1( j )-wr2( j ) )+
844 & abs( wi1( j )-wi2( j ) ) )
847 result( 8 ) = temp2 / max( unfl, ulp*max( temp1, temp2 ) )
862 IF( wi1( j ).EQ.zero )
THEN
863 IF( nselr.LT.max( n / 4, 1 ) )
THEN
867 SELECT( j ) = .false.
871 IF( nselc.LT.max( n / 4, 1 ) )
THEN
874 SELECT( j-1 ) = .false.
876 SELECT( j ) = .false.
877 SELECT( j-1 ) = .false.
884 CALL dtrevc(
'Right',
'All',
SELECT, n, t1, lda, dumma, ldu,
885 $ evectr, ldu, n, in, work, iinfo )
886 IF( iinfo.NE.0 )
THEN
887 WRITE( nounit, fmt = 9999 )
'DTREVC(R,A)', iinfo, n,
895 CALL dget22(
'N',
'N',
'N', n, t1, lda, evectr, ldu, wr1,
896 $ wi1, work, dumma( 1 ) )
897 result( 9 ) = dumma( 1 )
898 IF( dumma( 2 ).GT.thresh )
THEN
899 WRITE( nounit, fmt = 9998 )
'Right',
'DTREVC',
900 $ dumma( 2 ), n, jtype, ioldsd
906 CALL dtrevc(
'Right',
'Some',
SELECT, n, t1, lda, dumma,
907 $ ldu, evectl, ldu, n, in, work, iinfo )
908 IF( iinfo.NE.0 )
THEN
909 WRITE( nounit, fmt = 9999 )
'DTREVC(R,S)', iinfo, n,
918 IF(
SELECT( j ) .AND. wi1( j ).EQ.zero )
THEN
920 IF( evectr( jj, j ).NE.evectl( jj, k ) )
THEN
926 ELSE IF(
SELECT( j ) .AND. wi1( j ).NE.zero )
THEN
928 IF( evectr( jj, j ).NE.evectl( jj, k ) .OR.
929 $ evectr( jj, j+1 ).NE.evectl( jj, k+1 ) )
THEN
939 $
WRITE( nounit, fmt = 9997 )
'Right',
'DTREVC', n, jtype,
945 result( 10 ) = ulpinv
946 CALL dtrevc(
'Left',
'All',
SELECT, n, t1, lda, evectl, ldu,
947 $ dumma, ldu, n, in, work, iinfo )
948 IF( iinfo.NE.0 )
THEN
949 WRITE( nounit, fmt = 9999 )
'DTREVC(L,A)', iinfo, n,
957 CALL dget22(
'Trans',
'N',
'Conj', n, t1, lda, evectl, ldu,
958 $ wr1, wi1, work, dumma( 3 ) )
959 result( 10 ) = dumma( 3 )
960 IF( dumma( 4 ).GT.thresh )
THEN
961 WRITE( nounit, fmt = 9998 )
'Left',
'DTREVC', dumma( 4 ),
968 CALL dtrevc(
'Left',
'Some',
SELECT, n, t1, lda, evectr,
969 $ ldu, dumma, ldu, n, in, work, iinfo )
970 IF( iinfo.NE.0 )
THEN
971 WRITE( nounit, fmt = 9999 )
'DTREVC(L,S)', iinfo, n,
980 IF(
SELECT( j ) .AND. wi1( j ).EQ.zero )
THEN
982 IF( evectl( jj, j ).NE.evectr( jj, k ) )
THEN
988 ELSE IF(
SELECT( j ) .AND. wi1( j ).NE.zero )
THEN
990 IF( evectl( jj, j ).NE.evectr( jj, k ) .OR.
991 $ evectl( jj, j+1 ).NE.evectr( jj, k+1 ) )
THEN
1001 $
WRITE( nounit, fmt = 9997 )
'Left',
'DTREVC', n, jtype,
1007 result( 11 ) = ulpinv
1009 SELECT( j ) = .true.
1012 CALL dhsein(
'Right',
'Qr',
'Ninitv',
SELECT, n, h, lda,
1013 $ wr3, wi3, dumma, ldu, evectx, ldu, n1, in,
1014 $ work, iwork, iwork, iinfo )
1015 IF( iinfo.NE.0 )
THEN
1016 WRITE( nounit, fmt = 9999 )
'DHSEIN(R)', iinfo, n, jtype,
1027 CALL dget22(
'N',
'N',
'N', n, h, lda, evectx, ldu, wr3,
1028 $ wi3, work, dumma( 1 ) )
1029 IF( dumma( 1 ).LT.ulpinv )
1030 $ result( 11 ) = dumma( 1 )*aninv
1031 IF( dumma( 2 ).GT.thresh )
THEN
1032 WRITE( nounit, fmt = 9998 )
'Right',
'DHSEIN',
1033 $ dumma( 2 ), n, jtype, ioldsd
1040 result( 12 ) = ulpinv
1042 SELECT( j ) = .true.
1045 CALL dhsein(
'Left',
'Qr',
'Ninitv',
SELECT, n, h, lda, wr3,
1046 $ wi3, evecty, ldu, dumma, ldu, n1, in, work,
1047 $ iwork, iwork, iinfo )
1048 IF( iinfo.NE.0 )
THEN
1049 WRITE( nounit, fmt = 9999 )
'DHSEIN(L)', iinfo, n, jtype,
1060 CALL dget22(
'C',
'N',
'C', n, h, lda, evecty, ldu, wr3,
1061 $ wi3, work, dumma( 3 ) )
1062 IF( dumma( 3 ).LT.ulpinv )
1063 $ result( 12 ) = dumma( 3 )*aninv
1064 IF( dumma( 4 ).GT.thresh )
THEN
1065 WRITE( nounit, fmt = 9998 )
'Left',
'DHSEIN',
1066 $ dumma( 4 ), n, jtype, ioldsd
1073 result( 13 ) = ulpinv
1075 CALL dormhr(
'Left',
'No transpose', n, n, ilo, ihi, uu,
1076 $ ldu, tau, evectx, ldu, work, nwork, iinfo )
1077 IF( iinfo.NE.0 )
THEN
1078 WRITE( nounit, fmt = 9999 )
'DORMHR(R)', iinfo, n, jtype,
1089 CALL dget22(
'N',
'N',
'N', n, a, lda, evectx, ldu, wr3,
1090 $ wi3, work, dumma( 1 ) )
1091 IF( dumma( 1 ).LT.ulpinv )
1092 $ result( 13 ) = dumma( 1 )*aninv
1098 result( 14 ) = ulpinv
1100 CALL dormhr(
'Left',
'No transpose', n, n, ilo, ihi, uu,
1101 $ ldu, tau, evecty, ldu, work, nwork, iinfo )
1102 IF( iinfo.NE.0 )
THEN
1103 WRITE( nounit, fmt = 9999 )
'DORMHR(L)', iinfo, n, jtype,
1114 CALL dget22(
'C',
'N',
'C', n, a, lda, evecty, ldu, wr3,
1115 $ wi3, work, dumma( 3 ) )
1116 IF( dumma( 3 ).LT.ulpinv )
1117 $ result( 14 ) = dumma( 3 )*aninv
1125 result( 15 ) = ulpinv
1127 CALL dlacpy(
' ', n, n, uz, ldu, evectr, ldu )
1129 CALL dtrevc3(
'Right',
'Back',
SELECT, n, t1, lda, dumma,
1130 $ ldu, evectr, ldu, n, in, work, nwork, iinfo )
1131 IF( iinfo.NE.0 )
THEN
1132 WRITE( nounit, fmt = 9999 )
'DTREVC3(R,B)', iinfo, n,
1142 CALL dget22(
'N',
'N',
'N', n, a, lda, evectr, ldu, wr1,
1143 $ wi1, work, dumma( 1 ) )
1144 result( 15 ) = dumma( 1 )
1145 IF( dumma( 2 ).GT.thresh )
THEN
1146 WRITE( nounit, fmt = 9998 )
'Right',
'DTREVC3',
1147 $ dumma( 2 ), n, jtype, ioldsd
1153 result( 16 ) = ulpinv
1155 CALL dlacpy(
' ', n, n, uz, ldu, evectl, ldu )
1157 CALL dtrevc3(
'Left',
'Back',
SELECT, n, t1, lda, evectl,
1158 $ ldu, dumma, ldu, n, in, work, nwork, iinfo )
1159 IF( iinfo.NE.0 )
THEN
1160 WRITE( nounit, fmt = 9999 )
'DTREVC3(L,B)', iinfo, n,
1170 CALL dget22(
'Trans',
'N',
'Conj', n, a, lda, evectl, ldu,
1171 $ wr1, wi1, work, dumma( 3 ) )
1172 result( 16 ) = dumma( 3 )
1173 IF( dumma( 4 ).GT.thresh )
THEN
1174 WRITE( nounit, fmt = 9998 )
'Left',
'DTREVC3', dumma( 4 ),
1182 ntestt = ntestt + ntest
1183 CALL dlafts(
'DHS', n, n, jtype, ntest, result, ioldsd,
1184 $ thresh, nounit, nerrs )
1191 CALL dlasum(
'DHS', nounit, nerrs, ntestt )
1195 9999
FORMAT(
' DCHKHS: ', a,
' returned INFO=', i6,
'.', / 9x,
'N=',
1196 $ i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ), i5,
')' )
1197 9998
FORMAT(
' DCHKHS: ', a,
' Eigenvectors from ', a,
' incorrectly ',
1198 $
'normalized.', /
' Bits of error=', 0p, g10.3,
',', 9x,
1199 $
'N=', i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ), i5,
1201 9997
FORMAT(
' DCHKHS: Selected ', a,
' Eigenvectors from ', a,
1202 $
' do not match other eigenvectors ', 9x,
'N=', i6,
1203 $
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ), i5,
')' )
subroutine xerbla(srname, info)
subroutine dchkhs(nsizes, nn, ntypes, dotype, iseed, thresh, nounit, a, lda, h, t1, t2, u, ldu, z, uz, wr1, wi1, wr2, wi2, wr3, wi3, evectl, evectr, evecty, evectx, uu, tau, work, nwork, iwork, select, result, info)
DCHKHS
subroutine dget10(m, n, a, lda, b, ldb, work, result)
DGET10
subroutine dget22(transa, transe, transw, n, a, lda, e, lde, wr, wi, work, result)
DGET22
subroutine dhst01(n, ilo, ihi, a, lda, h, ldh, q, ldq, work, lwork, result)
DHST01
subroutine dlafts(type, m, n, imat, ntests, result, iseed, thresh, iounit, ie)
DLAFTS
subroutine dlasum(type, iounit, ie, nrun)
DLASUM
subroutine dlatme(n, dist, iseed, d, mode, cond, dmax, ei, rsign, upper, sim, ds, modes, conds, kl, ku, anorm, a, lda, work, info)
DLATME
subroutine dlatmr(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)
DLATMR
subroutine dlatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
DLATMS
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
subroutine dgehrd(n, ilo, ihi, a, lda, tau, work, lwork, info)
DGEHRD
subroutine dgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
DGEMM
subroutine dhsein(side, eigsrc, initv, select, n, h, ldh, wr, wi, vl, ldvl, vr, ldvr, mm, m, work, ifaill, ifailr, info)
DHSEIN
subroutine dhseqr(job, compz, n, ilo, ihi, h, ldh, wr, wi, z, ldz, work, lwork, info)
DHSEQR
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
subroutine dlaset(uplo, m, n, alpha, beta, a, lda)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine dtrevc3(side, howmny, select, n, t, ldt, vl, ldvl, vr, ldvr, mm, m, work, lwork, info)
DTREVC3
subroutine dtrevc(side, howmny, select, n, t, ldt, vl, ldvl, vr, ldvr, mm, m, work, info)
DTREVC
subroutine dorghr(n, ilo, ihi, a, lda, tau, work, lwork, info)
DORGHR
subroutine dormhr(side, trans, m, n, ilo, ihi, a, lda, tau, c, ldc, work, lwork, info)
DORMHR