378 SUBROUTINE cdrges( 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
391 LOGICAL BWORK( * ), DOTYPE( * )
392 INTEGER ISEED( 4 ), NN( * )
393 REAL RESULT( 13 ), RWORK( * )
394 COMPLEX A( LDA, * ), ALPHA( * ), B( LDA, * ),
395 $ beta( * ), q( ldq, * ), s( lda, * ),
396 $ t( lda, * ), work( * ), z( ldq, * )
403 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0 )
405 parameter( czero = ( 0.0e+0, 0.0e+0 ),
406 $ cone = ( 1.0e+0, 0.0e+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 REAL 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 )
434 EXTERNAL clctes, ilaenv, slamch, clarnd
441 INTRINSIC abs, aimag, conjg, max, min, real, sign
447 abs1( x ) = abs( real( x ) ) + abs( aimag( 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,
'CGEQRF',
' ', nmax, nmax, -1, -1 ),
513 $ ilaenv( 1,
'CUNMQR',
'LC', nmax, nmax, nmax, -1 ),
514 $ ilaenv( 1,
'CUNGQR',
' ', nmax, nmax, nmax, -1 ) )
515 maxwrk = max( nmax+nmax*nb, 3*nmax*nmax )
519 IF( lwork.LT.minwrk )
523 CALL xerbla(
'CDRGES', -info )
529 IF( nsizes.EQ.0 .OR. ntypes.EQ.0 )
532 ulp = slamch(
'Precision' )
533 safmin = slamch(
'Safe minimum' )
534 safmin = safmin / ulp
535 safmax = one / safmin
549 DO 190 jsize = 1, nsizes
552 rmagn( 2 ) = safmax*ulp / real( n1 )
553 rmagn( 3 ) = safmin*ulpinv*real( 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 claset(
'Full', n, n, czero, czero, a, lda )
616 CALL clatm4( 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 claset(
'Full', n, n, czero, czero, b, lda )
634 CALL clatm4( 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 ) = clarnd( 3, iseed )
653 z( jr, jc ) = clarnd( 3, iseed )
655 CALL clarfg( n+1-jc, q( jc, jc ), q( jc+1, jc ), 1,
657 work( 2*n+jc ) = sign( one, real( q( jc, jc ) ) )
659 CALL clarfg( n+1-jc, z( jc, jc ), z( jc+1, jc ), 1,
661 work( 3*n+jc ) = sign( one, real( z( jc, jc ) ) )
664 ctemp = clarnd( 3, iseed )
667 work( 3*n ) = ctemp / abs( ctemp )
668 ctemp = clarnd( 3, iseed )
671 work( 4*n ) = ctemp / abs( ctemp )
677 a( jr, jc ) = work( 2*n+jr )*
678 $ conjg( work( 3*n+jc ) )*
680 b( jr, jc ) = work( 2*n+jr )*
681 $ conjg( work( 3*n+jc ) )*
685 CALL cunm2r(
'L',
'N', n, n, n-1, q, ldq, work, a,
686 $ lda, work( 2*n+1 ), iinfo )
689 CALL cunm2r(
'R',
'C', n, n, n-1, z, ldq, work( n+1 ),
690 $ a, lda, work( 2*n+1 ), iinfo )
693 CALL cunm2r(
'L',
'N', n, n, n-1, q, ldq, work, b,
694 $ lda, work( 2*n+1 ), iinfo )
697 CALL cunm2r(
'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 clacpy(
'Full', n, n, a, lda, s, lda )
745 CALL clacpy(
'Full', n, n, b, lda, t, lda )
746 ntest = 1 + rsub + isort
747 result( 1+rsub+isort ) = ulpinv
748 CALL cgges(
'V',
'V', sort, clctes, 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 )
'CGGES', iinfo, n, jtype,
763 IF( isort.EQ.0 )
THEN
764 CALL cget51( 1, n, a, lda, s, lda, q, ldq, z, ldq,
765 $ work, rwork, result( 1 ) )
766 CALL cget51( 1, n, b, lda, t, lda, q, ldq, z, ldq,
767 $ work, rwork, result( 2 ) )
769 CALL cget54( n, a, lda, b, lda, s, lda, t, lda, q,
770 $ ldq, z, ldq, work, result( 2+rsub ) )
773 CALL cget51( 3, n, b, lda, t, lda, q, ldq, q, ldq, work,
774 $ rwork, result( 3+rsub ) )
775 CALL cget51( 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( clctes( 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 )
'CGS'
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.0 )
THEN
860 WRITE( nounit, fmt = 9992 )n, jtype, ioldsd, jr,
863 WRITE( nounit, fmt = 9991 )n, jtype, ioldsd, jr,
874 CALL alasvm(
'CGS', nounit, nerrs, ntestt, 0 )
880 9999
FORMAT(
' CDRGES: ', a,
' returned INFO=', i6,
'.', / 9x,
'N=',
881 $ i6,
', JTYPE=', i6,
', ISEED=(', 4( i4,
',' ), i5,
')' )
883 9998
FORMAT(
' CDRGES: 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 CDRGES 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, e10.3 )
subroutine alasvm(type, nout, nfail, nrun, nerrs)
ALASVM
subroutine xerbla(srname, info)
subroutine cdrges(nsizes, nn, ntypes, dotype, iseed, thresh, nounit, a, lda, b, s, t, q, ldq, z, alpha, beta, work, lwork, rwork, result, bwork, info)
CDRGES
subroutine cget51(itype, n, a, lda, b, ldb, u, ldu, v, ldv, work, rwork, result)
CGET51
subroutine cget54(n, a, lda, b, ldb, s, lds, t, ldt, u, ldu, v, ldv, work, result)
CGET54
subroutine clatm4(itype, n, nz1, nz2, rsign, amagn, rcond, triang, idist, iseed, a, lda)
CLATM4
subroutine cgges(jobvsl, jobvsr, sort, selctg, n, a, lda, b, ldb, sdim, alpha, beta, vsl, ldvsl, vsr, ldvsr, work, lwork, rwork, bwork, info)
CGGES computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE m...
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
subroutine clarfg(n, alpha, x, incx, tau)
CLARFG generates an elementary reflector (Householder matrix).
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 cunm2r(side, trans, m, n, k, a, lda, tau, c, ldc, work, info)
CUNM2R multiplies a general matrix by the unitary matrix from a QR factorization determined by cgeqrf...