378 SUBROUTINE zdrges( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
379 $ NOUNIT, A, LDA, B, S, T, Q, LDQ, Z, ALPHA,
380 $ BETA, WORK, LWORK, RWORK, RESULT, BWORK, INFO )
387 INTEGER INFO, LDA, LDQ, LWORK, NOUNIT, NSIZES, NTYPES
388 DOUBLE PRECISION THRESH
391 LOGICAL BWORK( * ), DOTYPE( * )
392 INTEGER ISEED( 4 ), NN( * )
393 DOUBLE PRECISION RESULT( 13 ), RWORK( * )
394 COMPLEX*16 A( LDA, * ), ALPHA( * ), B( LDA, * ),
395 $ beta( * ), q( ldq, * ), s( lda, * ),
396 $ t( lda, * ), work( * ), z( ldq, * )
402 DOUBLE PRECISION ZERO, ONE
403 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0 )
404 COMPLEX*16 CZERO, CONE
405 parameter( czero = ( 0.0d+0, 0.0d+0 ),
406 $ cone = ( 1.0d+0, 0.0d+0 ) )
408 PARAMETER ( MAXTYP = 26 )
411 LOGICAL BADNN, ILABAD
413 INTEGER I, IADD, IINFO, IN, ISORT, J, JC, JR, JSIZE,
414 $ jtype, knteig, maxwrk, minwrk, mtypes, n, n1,
415 $ nb, nerrs, nmats, nmax, ntest, ntestt, rsub,
417 DOUBLE PRECISION SAFMAX, SAFMIN, TEMP1, TEMP2, ULP, ULPINV
421 LOGICAL LASIGN( MAXTYP ), LBSIGN( MAXTYP )
422 INTEGER IOLDSD( 4 ), KADD( 6 ), KAMAGN( MAXTYP ),
423 $ katype( maxtyp ), kazero( maxtyp ),
424 $ kbmagn( maxtyp ), kbtype( maxtyp ),
425 $ kbzero( maxtyp ), kclass( maxtyp ),
426 $ ktrian( maxtyp ), kz1( 6 ), kz2( 6 )
427 DOUBLE PRECISION RMAGN( 0: 3 )
432 DOUBLE PRECISION DLAMCH
434 EXTERNAL zlctes, ilaenv, dlamch, zlarnd
441 INTRINSIC abs, dble, dconjg, dimag, max, min, sign
444 DOUBLE PRECISION ABS1
447 abs1( x ) = abs( dble( x ) ) + abs( dimag( x ) )
450 DATA kclass / 15*1, 10*2, 1*3 /
451 DATA kz1 / 0, 1, 2, 1, 3, 3 /
452 DATA kz2 / 0, 0, 1, 2, 1, 1 /
453 DATA kadd / 0, 0, 0, 0, 3, 2 /
454 DATA katype / 0, 1, 0, 1, 2, 3, 4, 1, 4, 4, 1, 1, 4,
455 $ 4, 4, 2, 4, 5, 8, 7, 9, 4*4, 0 /
456 DATA kbtype / 0, 0, 1, 1, 2, -3, 1, 4, 1, 1, 4, 4,
457 $ 1, 1, -4, 2, -4, 8*8, 0 /
458 DATA kazero / 6*1, 2, 1, 2*2, 2*1, 2*2, 3, 1, 3,
460 DATA kbzero / 6*1, 1, 2, 2*1, 2*2, 2*1, 4, 1, 4,
462 DATA kamagn / 8*1, 2, 3, 2, 3, 2, 3, 7*1, 2, 3, 3,
464 DATA kbmagn / 8*1, 3, 2, 3, 2, 2, 3, 7*1, 3, 2, 3,
466 DATA ktrian / 16*0, 10*1 /
467 DATA lasign / 6*.false., .true., .false., 2*.true.,
468 $ 2*.false., 3*.true., .false., .true.,
469 $ 3*.false., 5*.true., .false. /
470 DATA lbsign / 7*.false., .true., 2*.false.,
471 $ 2*.true., 2*.false., .true., .false., .true.,
483 nmax = max( nmax, nn( j ) )
488 IF( nsizes.LT.0 )
THEN
490 ELSE IF( badnn )
THEN
492 ELSE IF( ntypes.LT.0 )
THEN
494 ELSE IF( thresh.LT.zero )
THEN
496 ELSE IF( lda.LE.1 .OR. lda.LT.nmax )
THEN
498 ELSE IF( ldq.LE.1 .OR. ldq.LT.nmax )
THEN
510 IF( info.EQ.0 .AND. lwork.GE.1 )
THEN
512 nb = max( 1, ilaenv( 1,
'ZGEQRF',
' ', nmax, nmax, -1, -1 ),
513 $ ilaenv( 1,
'ZUNMQR',
'LC', nmax, nmax, nmax, -1 ),
514 $ ilaenv( 1,
'ZUNGQR',
' ', nmax, nmax, nmax, -1 ) )
515 maxwrk = max( nmax+nmax*nb, 3*nmax*nmax )
519 IF( lwork.LT.minwrk )
523 CALL xerbla(
'ZDRGES', -info )
529 IF( nsizes.EQ.0 .OR. ntypes.EQ.0 )
532 ulp = dlamch(
'Precision' )
533 safmin = dlamch(
'Safe minimum' )
534 safmin = safmin / ulp
535 safmax = one / safmin
549 DO 190 jsize = 1, nsizes
552 rmagn( 2 ) = safmax*ulp / dble( n1 )
553 rmagn( 3 ) = safmin*ulpinv*dble( n1 )
555 IF( nsizes.NE.1 )
THEN
556 mtypes = min( maxtyp, ntypes )
558 mtypes = min( maxtyp+1, ntypes )
563 DO 180 jtype = 1, mtypes
564 IF( .NOT.dotype( jtype ) )
572 ioldsd( j ) = iseed( j )
602 IF( mtypes.GT.maxtyp )
605 IF( kclass( jtype ).LT.3 )
THEN
609 IF( abs( katype( jtype ) ).EQ.3 )
THEN
610 in = 2*( ( n-1 ) / 2 ) + 1
612 $
CALL zlaset(
'Full', n, n, czero, czero, a, lda )
616 CALL zlatm4( katype( jtype ), in, kz1( kazero( jtype ) ),
617 $ kz2( kazero( jtype ) ), lasign( jtype ),
618 $ rmagn( kamagn( jtype ) ), ulp,
619 $ rmagn( ktrian( jtype )*kamagn( jtype ) ), 2,
621 iadd = kadd( kazero( jtype ) )
622 IF( iadd.GT.0 .AND. iadd.LE.n )
623 $ a( iadd, iadd ) = rmagn( kamagn( jtype ) )
627 IF( abs( kbtype( jtype ) ).EQ.3 )
THEN
628 in = 2*( ( n-1 ) / 2 ) + 1
630 $
CALL zlaset(
'Full', n, n, czero, czero, b, lda )
634 CALL zlatm4( kbtype( jtype ), in, kz1( kbzero( jtype ) ),
635 $ kz2( kbzero( jtype ) ), lbsign( jtype ),
636 $ rmagn( kbmagn( jtype ) ), one,
637 $ rmagn( ktrian( jtype )*kbmagn( jtype ) ), 2,
639 iadd = kadd( kbzero( jtype ) )
640 IF( iadd.NE.0 .AND. iadd.LE.n )
641 $ b( iadd, iadd ) = rmagn( kbmagn( jtype ) )
643 IF( kclass( jtype ).EQ.2 .AND. n.GT.0 )
THEN
652 q( jr, jc ) = zlarnd( 3, iseed )
653 z( jr, jc ) = zlarnd( 3, iseed )
655 CALL zlarfg( n+1-jc, q( jc, jc ), q( jc+1, jc ), 1,
657 work( 2*n+jc ) = sign( one, dble( q( jc, jc ) ) )
659 CALL zlarfg( n+1-jc, z( jc, jc ), z( jc+1, jc ), 1,
661 work( 3*n+jc ) = sign( one, dble( z( jc, jc ) ) )
664 ctemp = zlarnd( 3, iseed )
667 work( 3*n ) = ctemp / abs( ctemp )
668 ctemp = zlarnd( 3, iseed )
671 work( 4*n ) = ctemp / abs( ctemp )
677 a( jr, jc ) = work( 2*n+jr )*
678 $ dconjg( work( 3*n+jc ) )*
680 b( jr, jc ) = work( 2*n+jr )*
681 $ dconjg( work( 3*n+jc ) )*
685 CALL zunm2r(
'L',
'N', n, n, n-1, q, ldq, work, a,
686 $ lda, work( 2*n+1 ), iinfo )
689 CALL zunm2r(
'R',
'C', n, n, n-1, z, ldq, work( n+1 ),
690 $ a, lda, work( 2*n+1 ), iinfo )
693 CALL zunm2r(
'L',
'N', n, n, n-1, q, ldq, work, b,
694 $ lda, work( 2*n+1 ), iinfo )
697 CALL zunm2r(
'R',
'C', n, n, n-1, z, ldq, work( n+1 ),
698 $ b, lda, work( 2*n+1 ), iinfo )
708 a( jr, jc ) = rmagn( kamagn( jtype ) )*
710 b( jr, jc ) = rmagn( kbmagn( jtype ) )*
718 IF( iinfo.NE.0 )
THEN
719 WRITE( nounit, fmt = 9999 )
'Generator', iinfo, n, jtype,
734 IF( isort.EQ.0 )
THEN
744 CALL zlacpy(
'Full', n, n, a, lda, s, lda )
745 CALL zlacpy(
'Full', n, n, b, lda, t, lda )
746 ntest = 1 + rsub + isort
747 result( 1+rsub+isort ) = ulpinv
748 CALL zgges(
'V',
'V', sort, zlctes, n, s, lda, t, lda,
749 $ sdim, alpha, beta, q, ldq, z, ldq, work,
750 $ lwork, rwork, bwork, iinfo )
751 IF( iinfo.NE.0 .AND. iinfo.NE.n+2 )
THEN
752 result( 1+rsub+isort ) = ulpinv
753 WRITE( nounit, fmt = 9999 )
'ZGGES', iinfo, n, jtype,
763 IF( isort.EQ.0 )
THEN
764 CALL zget51( 1, n, a, lda, s, lda, q, ldq, z, ldq,
765 $ work, rwork, result( 1 ) )
766 CALL zget51( 1, n, b, lda, t, lda, q, ldq, z, ldq,
767 $ work, rwork, result( 2 ) )
769 CALL zget54( n, a, lda, b, lda, s, lda, t, lda, q,
770 $ ldq, z, ldq, work, result( 2+rsub ) )
773 CALL zget51( 3, n, b, lda, t, lda, q, ldq, q, ldq, work,
774 $ rwork, result( 3+rsub ) )
775 CALL zget51( 3, n, b, lda, t, lda, z, ldq, z, ldq, work,
776 $ rwork, result( 4+rsub ) )
787 temp2 = ( abs1( alpha( j )-s( j, j ) ) /
788 $ max( safmin, abs1( alpha( j ) ), abs1( s( j,
789 $ j ) ) )+abs1( beta( j )-t( j, j ) ) /
790 $ max( safmin, abs1( beta( j ) ), abs1( t( j,
794 IF( s( j+1, j ).NE.zero )
THEN
796 result( 5+rsub ) = ulpinv
800 IF( s( j, j-1 ).NE.zero )
THEN
802 result( 5+rsub ) = ulpinv
805 temp1 = max( temp1, temp2 )
807 WRITE( nounit, fmt = 9998 )j, n, jtype, ioldsd
810 result( 6+rsub ) = temp1
812 IF( isort.GE.1 )
THEN
820 IF( zlctes( alpha( i ), beta( i ) ) )
821 $ knteig = knteig + 1
824 $ result( 13 ) = ulpinv
833 ntestt = ntestt + ntest
838 IF( result( jr ).GE.thresh )
THEN
843 IF( nerrs.EQ.0 )
THEN
844 WRITE( nounit, fmt = 9997 )
'ZGS'
848 WRITE( nounit, fmt = 9996 )
849 WRITE( nounit, fmt = 9995 )
850 WRITE( nounit, fmt = 9994 )
'Unitary'
854 WRITE( nounit, fmt = 9993 )
'unitary',
'''',
855 $
'transpose', (
'''', j = 1, 8 )
859 IF( result( jr ).LT.10000.0d0 )
THEN
860 WRITE( nounit, fmt = 9992 )n, jtype, ioldsd, jr,
863 WRITE( nounit, fmt = 9991 )n, jtype, ioldsd, jr,
874 CALL alasvm(
'ZGS', nounit, nerrs, ntestt, 0 )
880 9999
FORMAT(
' ZDRGES: ', a,
' returned INFO=', i6,
'.', / 9x,
'N=',
881 $ i6,
', JTYPE=', i6,
', ISEED=(', 4( i4,
',' ), i5,
')' )
883 9998
FORMAT(
' ZDRGES: S not in Schur form at eigenvalue ', i6,
'.',
884 $ / 9x,
'N=', i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ),
887 9997
FORMAT( / 1x, a3,
' -- Complex Generalized Schur from problem ',
890 9996
FORMAT(
' Matrix types (see ZDRGES for details): ' )
892 9995
FORMAT(
' Special Matrices:', 23x,
893 $
'(J''=transposed Jordan block)',
894 $ /
' 1=(0,0) 2=(I,0) 3=(0,I) 4=(I,I) 5=(J'',J'') ',
895 $
'6=(diag(J'',I), diag(I,J''))', /
' Diagonal Matrices: ( ',
896 $
'D=diag(0,1,2,...) )', /
' 7=(D,I) 9=(large*D, small*I',
897 $
') 11=(large*I, small*D) 13=(large*D, large*I)', /
898 $
' 8=(I,D) 10=(small*D, large*I) 12=(small*I, large*D) ',
899 $
' 14=(small*D, small*I)', /
' 15=(D, reversed D)' )
900 9994
FORMAT(
' Matrices Rotated by Random ', a,
' Matrices U, V:',
901 $ /
' 16=Transposed Jordan Blocks 19=geometric ',
902 $
'alpha, beta=0,1', /
' 17=arithm. alpha&beta ',
903 $
' 20=arithmetic alpha, beta=0,1', /
' 18=clustered ',
904 $
'alpha, beta=0,1 21=random alpha, beta=0,1',
905 $ /
' Large & Small Matrices:', /
' 22=(large, small) ',
906 $
'23=(small,large) 24=(small,small) 25=(large,large)',
907 $ /
' 26=random O(1) matrices.' )
909 9993
FORMAT( /
' Tests performed: (S is Schur, T is triangular, ',
910 $
'Q and Z are ', a,
',', / 19x,
911 $
'l and r are the appropriate left and right', / 19x,
912 $
'eigenvectors, resp., a is alpha, b is beta, and', / 19x, a,
913 $
' means ', a,
'.)', /
' Without ordering: ',
914 $ /
' 1 = | A - Q S Z', a,
915 $
' | / ( |A| n ulp ) 2 = | B - Q T Z', a,
916 $
' | / ( |B| n ulp )', /
' 3 = | I - QQ', a,
917 $
' | / ( n ulp ) 4 = | I - ZZ', a,
918 $
' | / ( n ulp )', /
' 5 = A is in Schur form S',
919 $ /
' 6 = difference between (alpha,beta)',
920 $
' and diagonals of (S,T)', /
' With ordering: ',
921 $ /
' 7 = | (A,B) - Q (S,T) Z', a,
' | / ( |(A,B)| n ulp )',
922 $ /
' 8 = | I - QQ', a,
923 $
' | / ( n ulp ) 9 = | I - ZZ', a,
924 $
' | / ( n ulp )', /
' 10 = A is in Schur form S',
925 $ /
' 11 = difference between (alpha,beta) and diagonals',
926 $
' of (S,T)', /
' 12 = SDIM is the correct number of ',
927 $
'selected eigenvalues', / )
928 9992
FORMAT(
' Matrix order=', i5,
', type=', i2,
', seed=',
929 $ 4( i4,
',' ),
' result ', i2,
' is', 0p, f8.2 )
930 9991
FORMAT(
' Matrix order=', i5,
', type=', i2,
', seed=',
931 $ 4( i4,
',' ),
' result ', i2,
' is', 1p, d10.3 )
subroutine alasvm(type, nout, nfail, nrun, nerrs)
ALASVM
subroutine xerbla(srname, info)
subroutine zgges(jobvsl, jobvsr, sort, selctg, n, a, lda, b, ldb, sdim, alpha, beta, vsl, ldvsl, vsr, ldvsr, work, lwork, rwork, bwork, info)
ZGGES computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE m...
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine zlarfg(n, alpha, x, incx, tau)
ZLARFG generates an elementary reflector (Householder matrix).
subroutine zlaset(uplo, m, n, alpha, beta, a, lda)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine zunm2r(side, trans, m, n, k, a, lda, tau, c, ldc, work, info)
ZUNM2R multiplies a general matrix by the unitary matrix from a QR factorization determined by cgeqrf...
subroutine zdrges(nsizes, nn, ntypes, dotype, iseed, thresh, nounit, a, lda, b, s, t, q, ldq, z, alpha, beta, work, lwork, rwork, result, bwork, info)
ZDRGES
subroutine zget51(itype, n, a, lda, b, ldb, u, ldu, v, ldv, work, rwork, result)
ZGET51
subroutine zget54(n, a, lda, b, ldb, s, lds, t, ldt, u, ldu, v, ldv, work, result)
ZGET54
subroutine zlatm4(itype, n, nz1, nz2, rsign, amagn, rcond, triang, idist, iseed, a, lda)
ZLATM4