399 SUBROUTINE ddrges3( 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(
'DDRGES3', -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
758 CALL dlacpy(
'Full', n, n, a, lda, s, lda )
759 CALL dlacpy(
'Full', n, n, b, lda, t, lda )
760 ntest = 1 + rsub + isort
761 result( 1+rsub+isort ) = ulpinv
762 CALL dgges3(
'V',
'V', sort, dlctes, n, s, lda, t, lda,
763 $ sdim, alphar, alphai, beta, q, ldq, z, ldq,
764 $ work, lwork, bwork, iinfo )
765 IF( iinfo.NE.0 .AND. iinfo.NE.n+2 )
THEN
766 result( 1+rsub+isort ) = ulpinv
767 WRITE( nounit, fmt = 9999 )
'DGGES3', iinfo, n, jtype,
777 IF( isort.EQ.0 )
THEN
778 CALL dget51( 1, n, a, lda, s, lda, q, ldq, z, ldq,
779 $ work, result( 1 ) )
780 CALL dget51( 1, n, b, lda, t, lda, q, ldq, z, ldq,
781 $ work, result( 2 ) )
783 CALL dget54( n, a, lda, b, lda, s, lda, t, lda, q,
784 $ ldq, z, ldq, work, result( 7 ) )
786 CALL dget51( 3, n, a, lda, t, lda, q, ldq, q, ldq, work,
788 CALL dget51( 3, n, b, lda, t, lda, z, ldq, z, ldq, work,
800 IF( alphai( j ).EQ.zero )
THEN
801 temp2 = ( abs( alphar( j )-s( j, j ) ) /
802 $ max( safmin, abs( alphar( j ) ), abs( s( j,
803 $ j ) ) )+abs( beta( j )-t( j, j ) ) /
804 $ max( safmin, abs( beta( j ) ), abs( t( j,
808 IF( s( j+1, j ).NE.zero )
THEN
810 result( 5+rsub ) = ulpinv
814 IF( s( j, j-1 ).NE.zero )
THEN
816 result( 5+rsub ) = ulpinv
821 IF( alphai( j ).GT.zero )
THEN
826 IF( i1.LE.0 .OR. i1.GE.n )
THEN
828 ELSE IF( i1.LT.n-1 )
THEN
829 IF( s( i1+2, i1+1 ).NE.zero )
THEN
831 result( 5+rsub ) = ulpinv
833 ELSE IF( i1.GT.1 )
THEN
834 IF( s( i1, i1-1 ).NE.zero )
THEN
836 result( 5+rsub ) = ulpinv
839 IF( .NOT.ilabad )
THEN
840 CALL dget53( s( i1, i1 ), lda, t( i1, i1 ), lda,
841 $ beta( j ), alphar( j ),
842 $ alphai( j ), temp2, ierr )
844 WRITE( nounit, fmt = 9998 )ierr, j, n,
853 temp1 = max( temp1, temp2 )
855 WRITE( nounit, fmt = 9997 )j, n, jtype, ioldsd
858 result( 6+rsub ) = temp1
860 IF( isort.GE.1 )
THEN
868 IF( dlctes( alphar( i ), alphai( i ),
869 $ beta( i ) ) .OR. dlctes( alphar( i ),
870 $ -alphai( i ), beta( i ) ) )
THEN
874 IF( ( dlctes( alphar( i+1 ), alphai( i+1 ),
875 $ beta( i+1 ) ) .OR. dlctes( alphar( i+1 ),
876 $ -alphai( i+1 ), beta( i+1 ) ) ) .AND.
877 $ ( .NOT.( dlctes( alphar( i ), alphai( i ),
878 $ beta( i ) ) .OR. dlctes( alphar( i ),
879 $ -alphai( i ), beta( i ) ) ) ) .AND.
880 $ iinfo.NE.n+2 )
THEN
881 result( 12 ) = ulpinv
885 IF( sdim.NE.knteig )
THEN
886 result( 12 ) = ulpinv
896 ntestt = ntestt + ntest
901 IF( result( jr ).GE.thresh )
THEN
906 IF( nerrs.EQ.0 )
THEN
907 WRITE( nounit, fmt = 9996 )
'DGS'
911 WRITE( nounit, fmt = 9995 )
912 WRITE( nounit, fmt = 9994 )
913 WRITE( nounit, fmt = 9993 )
'Orthogonal'
917 WRITE( nounit, fmt = 9992 )
'orthogonal',
'''',
918 $
'transpose', (
'''', j = 1, 8 )
922 IF( result( jr ).LT.10000.0d0 )
THEN
923 WRITE( nounit, fmt = 9991 )n, jtype, ioldsd, jr,
926 WRITE( nounit, fmt = 9990 )n, jtype, ioldsd, jr,
937 CALL alasvm(
'DGS', nounit, nerrs, ntestt, 0 )
943 9999
FORMAT(
' DDRGES3: ', a,
' returned INFO=', i6,
'.', / 9x,
'N=',
944 $ i6,
', JTYPE=', i6,
', ISEED=(', 4( i4,
',' ), i5,
')' )
946 9998
FORMAT(
' DDRGES3: DGET53 returned INFO=', i1,
' for eigenvalue ',
947 $ i6,
'.', / 9x,
'N=', i6,
', JTYPE=', i6,
', ISEED=(',
948 $ 4( i4,
',' ), i5,
')' )
950 9997
FORMAT(
' DDRGES3: S not in Schur form at eigenvalue ', i6,
'.',
951 $ / 9x,
'N=', i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ),
954 9996
FORMAT( / 1x, a3,
' -- Real Generalized Schur form driver' )
956 9995
FORMAT(
' Matrix types (see DDRGES3 for details): ' )
958 9994
FORMAT(
' Special Matrices:', 23x,
959 $
'(J''=transposed Jordan block)',
960 $ /
' 1=(0,0) 2=(I,0) 3=(0,I) 4=(I,I) 5=(J'',J'') ',
961 $
'6=(diag(J'',I), diag(I,J''))', /
' Diagonal Matrices: ( ',
962 $
'D=diag(0,1,2,...) )', /
' 7=(D,I) 9=(large*D, small*I',
963 $
') 11=(large*I, small*D) 13=(large*D, large*I)', /
964 $
' 8=(I,D) 10=(small*D, large*I) 12=(small*I, large*D) ',
965 $
' 14=(small*D, small*I)', /
' 15=(D, reversed D)' )
966 9993
FORMAT(
' Matrices Rotated by Random ', a,
' Matrices U, V:',
967 $ /
' 16=Transposed Jordan Blocks 19=geometric ',
968 $
'alpha, beta=0,1', /
' 17=arithm. alpha&beta ',
969 $
' 20=arithmetic alpha, beta=0,1', /
' 18=clustered ',
970 $
'alpha, beta=0,1 21=random alpha, beta=0,1',
971 $ /
' Large & Small Matrices:', /
' 22=(large, small) ',
972 $
'23=(small,large) 24=(small,small) 25=(large,large)',
973 $ /
' 26=random O(1) matrices.' )
975 9992
FORMAT( /
' Tests performed: (S is Schur, T is triangular, ',
976 $
'Q and Z are ', a,
',', / 19x,
977 $
'l and r are the appropriate left and right', / 19x,
978 $
'eigenvectors, resp., a is alpha, b is beta, and', / 19x, a,
979 $
' means ', a,
'.)', /
' Without ordering: ',
980 $ /
' 1 = | A - Q S Z', a,
981 $
' | / ( |A| n ulp ) 2 = | B - Q T Z', a,
982 $
' | / ( |B| n ulp )', /
' 3 = | I - QQ', a,
983 $
' | / ( n ulp ) 4 = | I - ZZ', a,
984 $
' | / ( n ulp )', /
' 5 = A is in Schur form S',
985 $ /
' 6 = difference between (alpha,beta)',
986 $
' and diagonals of (S,T)', /
' With ordering: ',
987 $ /
' 7 = | (A,B) - Q (S,T) Z', a,
988 $
' | / ( |(A,B)| n ulp ) ', /
' 8 = | I - QQ', a,
989 $
' | / ( n ulp ) 9 = | I - ZZ', a,
990 $
' | / ( n ulp )', /
' 10 = A is in Schur form S',
991 $ /
' 11 = difference between (alpha,beta) and diagonals',
992 $
' of (S,T)', /
' 12 = SDIM is the correct number of ',
993 $
'selected eigenvalues', / )
994 9991
FORMAT(
' Matrix order=', i5,
', type=', i2,
', seed=',
995 $ 4( i4,
',' ),
' result ', i2,
' is', 0p, f8.2 )
996 9990
FORMAT(
' Matrix order=', i5,
', type=', i2,
', seed=',
997 $ 4( i4,
',' ),
' result ', i2,
' is', 1p, d10.3 )
subroutine alasvm(type, nout, nfail, nrun, nerrs)
ALASVM
subroutine xlaenv(ispec, nvalue)
XLAENV
subroutine xerbla(srname, info)
subroutine ddrges3(nsizes, nn, ntypes, dotype, iseed, thresh, nounit, a, lda, b, s, t, q, ldq, z, alphar, alphai, beta, work, lwork, result, bwork, info)
DDRGES3
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 dgges3(jobvsl, jobvsr, sort, selctg, n, a, lda, b, ldb, sdim, alphar, alphai, beta, vsl, ldvsl, vsr, ldvsr, work, lwork, bwork, info)
DGGES3 computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE ...
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...