399 SUBROUTINE ddrges( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
400 $ NOUNIT, A, LDA, B, S, T, Q, LDQ, Z, ALPHAR,
401 $ ALPHAI, BETA, WORK, LWORK, RESULT, BWORK,
409 INTEGER INFO, LDA, LDQ, LWORK, NOUNIT, NSIZES, NTYPES
410 DOUBLE PRECISION THRESH
413 LOGICAL BWORK( * ), DOTYPE( * )
414 INTEGER ISEED( 4 ), NN( * )
415 DOUBLE PRECISION A( LDA, * ), ALPHAI( * ), ALPHAR( * ),
416 $ b( lda, * ), beta( * ), q( ldq, * ),
417 $ result( 13 ), s( lda, * ), t( lda, * ),
418 $ work( * ), z( ldq, * )
424 DOUBLE PRECISION ZERO, ONE
425 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0 )
427 parameter( maxtyp = 26 )
430 LOGICAL BADNN, ILABAD
432 INTEGER I, I1, IADD, IERR, IINFO, IN, ISORT, J, JC, JR,
433 $ jsize, jtype, knteig, maxwrk, minwrk, mtypes,
434 $ n, n1, nb, nerrs, nmats, nmax, ntest, ntestt,
436 DOUBLE PRECISION SAFMAX, SAFMIN, TEMP1, TEMP2, ULP, ULPINV
439 INTEGER IASIGN( MAXTYP ), IBSIGN( MAXTYP ),
440 $ IOLDSD( 4 ), KADD( 6 ), KAMAGN( MAXTYP ),
441 $ KATYPE( MAXTYP ), KAZERO( MAXTYP ),
442 $ kbmagn( maxtyp ), kbtype( maxtyp ),
443 $ kbzero( maxtyp ), kclass( maxtyp ),
444 $ ktrian( maxtyp ), kz1( 6 ), kz2( 6 )
445 DOUBLE PRECISION RMAGN( 0: 3 )
450 DOUBLE PRECISION DLAMCH, DLARND
451 EXTERNAL dlctes, ilaenv, dlamch, dlarnd
458 INTRINSIC abs, dble, max, min, sign
461 DATA kclass / 15*1, 10*2, 1*3 /
462 DATA kz1 / 0, 1, 2, 1, 3, 3 /
463 DATA kz2 / 0, 0, 1, 2, 1, 1 /
464 DATA kadd / 0, 0, 0, 0, 3, 2 /
465 DATA katype / 0, 1, 0, 1, 2, 3, 4, 1, 4, 4, 1, 1, 4,
466 $ 4, 4, 2, 4, 5, 8, 7, 9, 4*4, 0 /
467 DATA kbtype / 0, 0, 1, 1, 2, -3, 1, 4, 1, 1, 4, 4,
468 $ 1, 1, -4, 2, -4, 8*8, 0 /
469 DATA kazero / 6*1, 2, 1, 2*2, 2*1, 2*2, 3, 1, 3,
471 DATA kbzero / 6*1, 1, 2, 2*1, 2*2, 2*1, 4, 1, 4,
473 DATA kamagn / 8*1, 2, 3, 2, 3, 2, 3, 7*1, 2, 3, 3,
475 DATA kbmagn / 8*1, 3, 2, 3, 2, 2, 3, 7*1, 3, 2, 3,
477 DATA ktrian / 16*0, 10*1 /
478 DATA iasign / 6*0, 2, 0, 2*2, 2*0, 3*2, 0, 2, 3*0,
480 DATA ibsign / 7*0, 2, 2*0, 2*2, 2*0, 2, 0, 2, 9*0 /
491 nmax = max( nmax, nn( j ) )
496 IF( nsizes.LT.0 )
THEN
498 ELSE IF( badnn )
THEN
500 ELSE IF( ntypes.LT.0 )
THEN
502 ELSE IF( thresh.LT.zero )
THEN
504 ELSE IF( lda.LE.1 .OR. lda.LT.nmax )
THEN
506 ELSE IF( ldq.LE.1 .OR. ldq.LT.nmax )
THEN
518 IF( info.EQ.0 .AND. lwork.GE.1 )
THEN
519 minwrk = max( 10*( nmax+1 ), 3*nmax*nmax )
520 nb = max( 1, ilaenv( 1,
'DGEQRF',
' ', nmax, nmax, -1, -1 ),
521 $ ilaenv( 1,
'DORMQR',
'LT', nmax, nmax, nmax, -1 ),
522 $ ilaenv( 1,
'DORGQR',
' ', nmax, nmax, nmax, -1 ) )
523 maxwrk = max( 10*( nmax+1 ), 2*nmax+nmax*nb, 3*nmax*nmax )
527 IF( lwork.LT.minwrk )
531 CALL xerbla(
'DDRGES', -info )
537 IF( nsizes.EQ.0 .OR. ntypes.EQ.0 )
540 safmin = dlamch(
'Safe minimum' )
541 ulp = dlamch(
'Epsilon' )*dlamch(
'Base' )
542 safmin = safmin / ulp
543 safmax = one / safmin
557 DO 190 jsize = 1, nsizes
560 rmagn( 2 ) = safmax*ulp / dble( n1 )
561 rmagn( 3 ) = safmin*ulpinv*dble( n1 )
563 IF( nsizes.NE.1 )
THEN
564 mtypes = min( maxtyp, ntypes )
566 mtypes = min( maxtyp+1, ntypes )
571 DO 180 jtype = 1, mtypes
572 IF( .NOT.dotype( jtype ) )
580 ioldsd( j ) = iseed( j )
612 IF( mtypes.GT.maxtyp )
615 IF( kclass( jtype ).LT.3 )
THEN
619 IF( abs( katype( jtype ) ).EQ.3 )
THEN
620 in = 2*( ( n-1 ) / 2 ) + 1
622 $
CALL dlaset(
'Full', n, n, zero, zero, a, lda )
626 CALL dlatm4( katype( jtype ), in, kz1( kazero( jtype ) ),
627 $ kz2( kazero( jtype ) ), iasign( jtype ),
628 $ rmagn( kamagn( jtype ) ), ulp,
629 $ rmagn( ktrian( jtype )*kamagn( jtype ) ), 2,
631 iadd = kadd( kazero( jtype ) )
632 IF( iadd.GT.0 .AND. iadd.LE.n )
633 $ a( iadd, iadd ) = one
637 IF( abs( kbtype( jtype ) ).EQ.3 )
THEN
638 in = 2*( ( n-1 ) / 2 ) + 1
640 $
CALL dlaset(
'Full', n, n, zero, zero, b, lda )
644 CALL dlatm4( kbtype( jtype ), in, kz1( kbzero( jtype ) ),
645 $ kz2( kbzero( jtype ) ), ibsign( jtype ),
646 $ rmagn( kbmagn( jtype ) ), one,
647 $ rmagn( ktrian( jtype )*kbmagn( jtype ) ), 2,
649 iadd = kadd( kbzero( jtype ) )
650 IF( iadd.NE.0 .AND. iadd.LE.n )
651 $ b( iadd, iadd ) = one
653 IF( kclass( jtype ).EQ.2 .AND. n.GT.0 )
THEN
662 q( jr, jc ) = dlarnd( 3, iseed )
663 z( jr, jc ) = dlarnd( 3, iseed )
665 CALL dlarfg( n+1-jc, q( jc, jc ), q( jc+1, jc ), 1,
667 work( 2*n+jc ) = sign( one, q( jc, jc ) )
669 CALL dlarfg( n+1-jc, z( jc, jc ), z( jc+1, jc ), 1,
671 work( 3*n+jc ) = sign( one, z( jc, jc ) )
676 work( 3*n ) = sign( one, dlarnd( 2, iseed ) )
679 work( 4*n ) = sign( one, dlarnd( 2, iseed ) )
685 a( jr, jc ) = work( 2*n+jr )*work( 3*n+jc )*
687 b( jr, jc ) = work( 2*n+jr )*work( 3*n+jc )*
691 CALL dorm2r(
'L',
'N', n, n, n-1, q, ldq, work, a,
692 $ lda, work( 2*n+1 ), iinfo )
695 CALL dorm2r(
'R',
'T', n, n, n-1, z, ldq, work( n+1 ),
696 $ a, lda, work( 2*n+1 ), iinfo )
699 CALL dorm2r(
'L',
'N', n, n, n-1, q, ldq, work, b,
700 $ lda, work( 2*n+1 ), iinfo )
703 CALL dorm2r(
'R',
'T', n, n, n-1, z, ldq, work( n+1 ),
704 $ b, lda, work( 2*n+1 ), iinfo )
714 a( jr, jc ) = rmagn( kamagn( jtype ) )*
716 b( jr, jc ) = rmagn( kbmagn( jtype ) )*
724 IF( iinfo.NE.0 )
THEN
725 WRITE( nounit, fmt = 9999 )
'Generator', iinfo, n, jtype,
740 IF( isort.EQ.0 )
THEN
750 CALL dlacpy(
'Full', n, n, a, lda, s, lda )
751 CALL dlacpy(
'Full', n, n, b, lda, t, lda )
752 ntest = 1 + rsub + isort
753 result( 1+rsub+isort ) = ulpinv
754 CALL dgges(
'V',
'V', sort, dlctes, n, s, lda, t, lda,
755 $ sdim, alphar, alphai, beta, q, ldq, z, ldq,
756 $ work, lwork, bwork, iinfo )
757 IF( iinfo.NE.0 .AND. iinfo.NE.n+2 )
THEN
758 result( 1+rsub+isort ) = ulpinv
759 WRITE( nounit, fmt = 9999 )
'DGGES', iinfo, n, jtype,
769 IF( isort.EQ.0 )
THEN
770 CALL dget51( 1, n, a, lda, s, lda, q, ldq, z, ldq,
771 $ work, result( 1 ) )
772 CALL dget51( 1, n, b, lda, t, lda, q, ldq, z, ldq,
773 $ work, result( 2 ) )
775 CALL dget54( n, a, lda, b, lda, s, lda, t, lda, q,
776 $ ldq, z, ldq, work, result( 7 ) )
778 CALL dget51( 3, n, a, lda, t, lda, q, ldq, q, ldq, work,
780 CALL dget51( 3, n, b, lda, t, lda, z, ldq, z, ldq, work,
792 IF( alphai( j ).EQ.zero )
THEN
793 temp2 = ( abs( alphar( j )-s( j, j ) ) /
794 $ max( safmin, abs( alphar( j ) ), abs( s( j,
795 $ j ) ) )+abs( beta( j )-t( j, j ) ) /
796 $ max( safmin, abs( beta( j ) ), abs( t( j,
800 IF( s( j+1, j ).NE.zero )
THEN
802 result( 5+rsub ) = ulpinv
806 IF( s( j, j-1 ).NE.zero )
THEN
808 result( 5+rsub ) = ulpinv
813 IF( alphai( j ).GT.zero )
THEN
818 IF( i1.LE.0 .OR. i1.GE.n )
THEN
820 ELSE IF( i1.LT.n-1 )
THEN
821 IF( s( i1+2, i1+1 ).NE.zero )
THEN
823 result( 5+rsub ) = ulpinv
825 ELSE IF( i1.GT.1 )
THEN
826 IF( s( i1, i1-1 ).NE.zero )
THEN
828 result( 5+rsub ) = ulpinv
831 IF( .NOT.ilabad )
THEN
832 CALL dget53( s( i1, i1 ), lda, t( i1, i1 ), lda,
833 $ beta( j ), alphar( j ),
834 $ alphai( j ), temp2, ierr )
836 WRITE( nounit, fmt = 9998 )ierr, j, n,
845 temp1 = max( temp1, temp2 )
847 WRITE( nounit, fmt = 9997 )j, n, jtype, ioldsd
850 result( 6+rsub ) = temp1
852 IF( isort.GE.1 )
THEN
860 IF( dlctes( alphar( i ), alphai( i ),
861 $ beta( i ) ) .OR. dlctes( alphar( i ),
862 $ -alphai( i ), beta( i ) ) )
THEN
866 IF( ( dlctes( alphar( i+1 ), alphai( i+1 ),
867 $ beta( i+1 ) ) .OR. dlctes( alphar( i+1 ),
868 $ -alphai( i+1 ), beta( i+1 ) ) ) .AND.
869 $ ( .NOT.( dlctes( alphar( i ), alphai( i ),
870 $ beta( i ) ) .OR. dlctes( alphar( i ),
871 $ -alphai( i ), beta( i ) ) ) ) .AND.
872 $ iinfo.NE.n+2 )
THEN
873 result( 12 ) = ulpinv
877 IF( sdim.NE.knteig )
THEN
878 result( 12 ) = ulpinv
888 ntestt = ntestt + ntest
893 IF( result( jr ).GE.thresh )
THEN
898 IF( nerrs.EQ.0 )
THEN
899 WRITE( nounit, fmt = 9996 )
'DGS'
903 WRITE( nounit, fmt = 9995 )
904 WRITE( nounit, fmt = 9994 )
905 WRITE( nounit, fmt = 9993 )
'Orthogonal'
909 WRITE( nounit, fmt = 9992 )
'orthogonal',
'''',
910 $
'transpose', (
'''', j = 1, 8 )
914 IF( result( jr ).LT.10000.0d0 )
THEN
915 WRITE( nounit, fmt = 9991 )n, jtype, ioldsd, jr,
918 WRITE( nounit, fmt = 9990 )n, jtype, ioldsd, jr,
929 CALL alasvm(
'DGS', nounit, nerrs, ntestt, 0 )
935 9999
FORMAT(
' DDRGES: ', a,
' returned INFO=', i6,
'.', / 9x,
'N=',
936 $ i6,
', JTYPE=', i6,
', ISEED=(', 4( i4,
',' ), i5,
')' )
938 9998
FORMAT(
' DDRGES: DGET53 returned INFO=', i1,
' for eigenvalue ',
939 $ i6,
'.', / 9x,
'N=', i6,
', JTYPE=', i6,
', ISEED=(',
940 $ 4( i4,
',' ), i5,
')' )
942 9997
FORMAT(
' DDRGES: S not in Schur form at eigenvalue ', i6,
'.',
943 $ / 9x,
'N=', i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ),
946 9996
FORMAT( / 1x, a3,
' -- Real Generalized Schur form driver' )
948 9995
FORMAT(
' Matrix types (see DDRGES for details): ' )
950 9994
FORMAT(
' Special Matrices:', 23x,
951 $
'(J''=transposed Jordan block)',
952 $ /
' 1=(0,0) 2=(I,0) 3=(0,I) 4=(I,I) 5=(J'',J'') ',
953 $
'6=(diag(J'',I), diag(I,J''))', /
' Diagonal Matrices: ( ',
954 $
'D=diag(0,1,2,...) )', /
' 7=(D,I) 9=(large*D, small*I',
955 $
') 11=(large*I, small*D) 13=(large*D, large*I)', /
956 $
' 8=(I,D) 10=(small*D, large*I) 12=(small*I, large*D) ',
957 $
' 14=(small*D, small*I)', /
' 15=(D, reversed D)' )
958 9993
FORMAT(
' Matrices Rotated by Random ', a,
' Matrices U, V:',
959 $ /
' 16=Transposed Jordan Blocks 19=geometric ',
960 $
'alpha, beta=0,1', /
' 17=arithm. alpha&beta ',
961 $
' 20=arithmetic alpha, beta=0,1', /
' 18=clustered ',
962 $
'alpha, beta=0,1 21=random alpha, beta=0,1',
963 $ /
' Large & Small Matrices:', /
' 22=(large, small) ',
964 $
'23=(small,large) 24=(small,small) 25=(large,large)',
965 $ /
' 26=random O(1) matrices.' )
967 9992
FORMAT( /
' Tests performed: (S is Schur, T is triangular, ',
968 $
'Q and Z are ', a,
',', / 19x,
969 $
'l and r are the appropriate left and right', / 19x,
970 $
'eigenvectors, resp., a is alpha, b is beta, and', / 19x, a,
971 $
' means ', a,
'.)', /
' Without ordering: ',
972 $ /
' 1 = | A - Q S Z', a,
973 $
' | / ( |A| n ulp ) 2 = | B - Q T Z', a,
974 $
' | / ( |B| n ulp )', /
' 3 = | I - QQ', a,
975 $
' | / ( n ulp ) 4 = | I - ZZ', a,
976 $
' | / ( n ulp )', /
' 5 = A is in Schur form S',
977 $ /
' 6 = difference between (alpha,beta)',
978 $
' and diagonals of (S,T)', /
' With ordering: ',
979 $ /
' 7 = | (A,B) - Q (S,T) Z', a,
980 $
' | / ( |(A,B)| n ulp ) ', /
' 8 = | I - QQ', a,
981 $
' | / ( n ulp ) 9 = | I - ZZ', a,
982 $
' | / ( n ulp )', /
' 10 = A is in Schur form S',
983 $ /
' 11 = difference between (alpha,beta) and diagonals',
984 $
' of (S,T)', /
' 12 = SDIM is the correct number of ',
985 $
'selected eigenvalues', / )
986 9991
FORMAT(
' Matrix order=', i5,
', type=', i2,
', seed=',
987 $ 4( i4,
',' ),
' result ', i2,
' is', 0p, f8.2 )
988 9990
FORMAT(
' Matrix order=', i5,
', type=', i2,
', seed=',
989 $ 4( i4,
',' ),
' result ', i2,
' is', 1p, d10.3 )
subroutine alasvm(type, nout, nfail, nrun, nerrs)
ALASVM
subroutine xerbla(srname, info)
subroutine ddrges(nsizes, nn, ntypes, dotype, iseed, thresh, nounit, a, lda, b, s, t, q, ldq, z, alphar, alphai, beta, work, lwork, result, bwork, info)
DDRGES
subroutine dget51(itype, n, a, lda, b, ldb, u, ldu, v, ldv, work, result)
DGET51
subroutine dget53(a, lda, b, ldb, scale, wr, wi, result, info)
DGET53
subroutine dget54(n, a, lda, b, ldb, s, lds, t, ldt, u, ldu, v, ldv, work, result)
DGET54
subroutine dlatm4(itype, n, nz1, nz2, isign, amagn, rcond, triang, idist, iseed, a, lda)
DLATM4
subroutine dgges(jobvsl, jobvsr, sort, selctg, n, a, lda, b, ldb, sdim, alphar, alphai, beta, vsl, ldvsl, vsr, ldvsr, work, lwork, bwork, info)
DGGES computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE m...
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
subroutine dlarfg(n, alpha, x, incx, tau)
DLARFG generates an elementary reflector (Householder matrix).
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 dorm2r(side, trans, m, n, k, a, lda, tau, c, ldc, work, info)
DORM2R multiplies a general matrix by the orthogonal matrix from a QR factorization determined by sge...