395 SUBROUTINE cdrgev3( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
396 $ NOUNIT, A, LDA, B, S, T, Q, LDQ, Z, QE, LDQE,
397 $ ALPHA, BETA, ALPHA1, BETA1, WORK, LWORK,
398 $ RWORK, RESULT, INFO )
405 INTEGER INFO, LDA, LDQ, LDQE, LWORK, NOUNIT, NSIZES,
411 INTEGER ISEED( 4 ), NN( * )
412 REAL RESULT( * ), RWORK( * )
413 COMPLEX A( LDA, * ), ALPHA( * ), ALPHA1( * ),
414 $ b( lda, * ), beta( * ), beta1( * ),
415 $ q( ldq, * ), qe( ldqe, * ), s( lda, * ),
416 $ t( lda, * ), work( * ), z( ldq, * )
423 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0 )
425 parameter( czero = ( 0.0e+0, 0.0e+0 ),
426 $ cone = ( 1.0e+0, 0.0e+0 ) )
428 parameter( maxtyp = 26 )
432 INTEGER I, IADD, IERR, IN, J, JC, JR, JSIZE, JTYPE,
433 $ MAXWRK, MINWRK, MTYPES, N, N1, NB, NERRS,
434 $ nmats, nmax, ntestt
435 REAL SAFMAX, SAFMIN, ULP, ULPINV
439 LOGICAL LASIGN( MAXTYP ), LBSIGN( MAXTYP )
440 INTEGER 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 )
451 EXTERNAL ilaenv, slamch, clarnd
458 INTRINSIC abs, conjg, max, min, real, 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 lasign / 6*.false., .true., .false., 2*.true.,
479 $ 2*.false., 3*.true., .false., .true.,
480 $ 3*.false., 5*.true., .false. /
481 DATA lbsign / 7*.false., .true., 2*.false.,
482 $ 2*.true., 2*.false., .true., .false., .true.,
494 nmax = max( nmax, nn( j ) )
499 IF( nsizes.LT.0 )
THEN
501 ELSE IF( badnn )
THEN
503 ELSE IF( ntypes.LT.0 )
THEN
505 ELSE IF( thresh.LT.zero )
THEN
507 ELSE IF( lda.LE.1 .OR. lda.LT.nmax )
THEN
509 ELSE IF( ldq.LE.1 .OR. ldq.LT.nmax )
THEN
511 ELSE IF( ldqe.LE.1 .OR. ldqe.LT.nmax )
THEN
523 IF( info.EQ.0 .AND. lwork.GE.1 )
THEN
524 minwrk = nmax*( nmax+1 )
525 nb = max( 1, ilaenv( 1,
'CGEQRF',
' ', nmax, nmax, -1, -1 ),
526 $ ilaenv( 1,
'CUNMQR',
'LC', nmax, nmax, nmax, -1 ),
527 $ ilaenv( 1,
'CUNGQR',
' ', nmax, nmax, nmax, -1 ) )
528 maxwrk = max( 2*nmax, nmax*( nb+1 ), nmax*( nmax+1 ) )
532 IF( lwork.LT.minwrk )
536 CALL xerbla(
'CDRGEV3', -info )
542 IF( nsizes.EQ.0 .OR. ntypes.EQ.0 )
545 ulp = slamch(
'Precision' )
546 safmin = slamch(
'Safe minimum' )
547 safmin = safmin / ulp
548 safmax = one / safmin
562 DO 220 jsize = 1, nsizes
565 rmagn( 2 ) = safmax*ulp / real( n1 )
566 rmagn( 3 ) = safmin*ulpinv*n1
568 IF( nsizes.NE.1 )
THEN
569 mtypes = min( maxtyp, ntypes )
571 mtypes = min( maxtyp+1, ntypes )
574 DO 210 jtype = 1, mtypes
575 IF( .NOT.dotype( jtype ) )
582 ioldsd( j ) = iseed( j )
606 IF( mtypes.GT.maxtyp )
609 IF( kclass( jtype ).LT.3 )
THEN
613 IF( abs( katype( jtype ) ).EQ.3 )
THEN
614 in = 2*( ( n-1 ) / 2 ) + 1
616 $
CALL claset(
'Full', n, n, czero, czero, a, lda )
620 CALL clatm4( katype( jtype ), in, kz1( kazero( jtype ) ),
621 $ kz2( kazero( jtype ) ), lasign( jtype ),
622 $ rmagn( kamagn( jtype ) ), ulp,
623 $ rmagn( ktrian( jtype )*kamagn( jtype ) ), 2,
625 iadd = kadd( kazero( jtype ) )
626 IF( iadd.GT.0 .AND. iadd.LE.n )
627 $ a( iadd, iadd ) = rmagn( kamagn( jtype ) )
631 IF( abs( kbtype( jtype ) ).EQ.3 )
THEN
632 in = 2*( ( n-1 ) / 2 ) + 1
634 $
CALL claset(
'Full', n, n, czero, czero, b, lda )
638 CALL clatm4( kbtype( jtype ), in, kz1( kbzero( jtype ) ),
639 $ kz2( kbzero( jtype ) ), lbsign( jtype ),
640 $ rmagn( kbmagn( jtype ) ), one,
641 $ rmagn( ktrian( jtype )*kbmagn( jtype ) ), 2,
643 iadd = kadd( kbzero( jtype ) )
644 IF( iadd.NE.0 .AND. iadd.LE.n )
645 $ b( iadd, iadd ) = rmagn( kbmagn( jtype ) )
647 IF( kclass( jtype ).EQ.2 .AND. n.GT.0 )
THEN
656 q( jr, jc ) = clarnd( 3, iseed )
657 z( jr, jc ) = clarnd( 3, iseed )
659 CALL clarfg( n+1-jc, q( jc, jc ), q( jc+1, jc ), 1,
661 work( 2*n+jc ) = sign( one, real( q( jc, jc ) ) )
663 CALL clarfg( n+1-jc, z( jc, jc ), z( jc+1, jc ), 1,
665 work( 3*n+jc ) = sign( one, real( z( jc, jc ) ) )
668 ctemp = clarnd( 3, iseed )
671 work( 3*n ) = ctemp / abs( ctemp )
672 ctemp = clarnd( 3, iseed )
675 work( 4*n ) = ctemp / abs( ctemp )
681 a( jr, jc ) = work( 2*n+jr )*
682 $ conjg( work( 3*n+jc ) )*
684 b( jr, jc ) = work( 2*n+jr )*
685 $ conjg( work( 3*n+jc ) )*
689 CALL cunm2r(
'L',
'N', n, n, n-1, q, ldq, work, a,
690 $ lda, work( 2*n+1 ), ierr )
693 CALL cunm2r(
'R',
'C', n, n, n-1, z, ldq, work( n+1 ),
694 $ a, lda, work( 2*n+1 ), ierr )
697 CALL cunm2r(
'L',
'N', n, n, n-1, q, ldq, work, b,
698 $ lda, work( 2*n+1 ), ierr )
701 CALL cunm2r(
'R',
'C', n, n, n-1, z, ldq, work( n+1 ),
702 $ b, lda, work( 2*n+1 ), ierr )
712 a( jr, jc ) = rmagn( kamagn( jtype ) )*
714 b( jr, jc ) = rmagn( kbmagn( jtype ) )*
723 WRITE( nounit, fmt = 9999 )
'Generator', ierr, n, jtype,
745 CALL clacpy(
' ', n, n, a, lda, s, lda )
746 CALL clacpy(
' ', n, n, b, lda, t, lda )
747 CALL cggev3(
'V',
'V', n, s, lda, t, lda, alpha, beta, q,
748 $ ldq, z, ldq, work, lwork, rwork, ierr )
749 IF( ierr.NE.0 .AND. ierr.NE.n+1 )
THEN
751 WRITE( nounit, fmt = 9999 )
'CGGEV31', ierr, n, jtype,
759 CALL cget52( .true., n, a, lda, b, lda, q, ldq, alpha, beta,
760 $ work, rwork, result( 1 ) )
761 IF( result( 2 ).GT.thresh )
THEN
762 WRITE( nounit, fmt = 9998 )
'Left',
'CGGEV31',
763 $ result( 2 ), n, jtype, ioldsd
768 CALL cget52( .false., n, a, lda, b, lda, z, ldq, alpha,
769 $ beta, work, rwork, result( 3 ) )
770 IF( result( 4 ).GT.thresh )
THEN
771 WRITE( nounit, fmt = 9998 )
'Right',
'CGGEV31',
772 $ result( 4 ), n, jtype, ioldsd
777 CALL clacpy(
' ', n, n, a, lda, s, lda )
778 CALL clacpy(
' ', n, n, b, lda, t, lda )
779 CALL cggev3(
'N',
'N', n, s, lda, t, lda, alpha1, beta1, q,
780 $ ldq, z, ldq, work, lwork, rwork, ierr )
781 IF( ierr.NE.0 .AND. ierr.NE.n+1 )
THEN
783 WRITE( nounit, fmt = 9999 )
'CGGEV32', ierr, n, jtype,
790 IF( alpha( j ).NE.alpha1( j ) .OR. beta( j ).NE.
791 $ beta1( j ) ) result( 5 ) = ulpinv
797 CALL clacpy(
' ', n, n, a, lda, s, lda )
798 CALL clacpy(
' ', n, n, b, lda, t, lda )
799 CALL cggev3(
'V',
'N', n, s, lda, t, lda, alpha1, beta1, qe,
800 $ ldqe, z, ldq, work, lwork, rwork, ierr )
801 IF( ierr.NE.0 .AND. ierr.NE.n+1 )
THEN
803 WRITE( nounit, fmt = 9999 )
'CGGEV33', ierr, n, jtype,
811 IF( alpha( j ).NE.alpha1( j ) .OR.
812 $ beta( j ).NE.beta1( j ) )
THEN
819 IF( q( j, jc ).NE.qe( j, jc ) )
THEN
828 CALL clacpy(
' ', n, n, a, lda, s, lda )
829 CALL clacpy(
' ', n, n, b, lda, t, lda )
830 CALL cggev3(
'N',
'V', n, s, lda, t, lda, alpha1, beta1, q,
831 $ ldq, qe, ldqe, work, lwork, rwork, ierr )
832 IF( ierr.NE.0 .AND. ierr.NE.n+1 )
THEN
834 WRITE( nounit, fmt = 9999 )
'CGGEV34', ierr, n, jtype,
841 IF( alpha( j ).NE.alpha1( j ) .OR. beta( j ).NE.
842 $ beta1( j ) )result( 7 ) = ulpinv
847 IF( z( j, jc ).NE.qe( j, jc ) )
848 $ result( 7 ) = ulpinv
861 IF( result( jr ).GE.thresh )
THEN
866 IF( nerrs.EQ.0 )
THEN
867 WRITE( nounit, fmt = 9997 )
'CGV'
871 WRITE( nounit, fmt = 9996 )
872 WRITE( nounit, fmt = 9995 )
873 WRITE( nounit, fmt = 9994 )
'Orthogonal'
877 WRITE( nounit, fmt = 9993 )
881 IF( result( jr ).LT.10000.0 )
THEN
882 WRITE( nounit, fmt = 9992 )n, jtype, ioldsd, jr,
885 WRITE( nounit, fmt = 9991 )n, jtype, ioldsd, jr,
896 CALL alasvm(
'CGV3', nounit, nerrs, ntestt, 0 )
902 9999
FORMAT(
' CDRGEV3: ', a,
' returned INFO=', i6,
'.', / 3x,
'N=',
903 $ i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ), i5,
')' )
905 9998
FORMAT(
' CDRGEV3: ', a,
' Eigenvectors from ', a,
906 $
' incorrectly normalized.', /
' Bits of error=', 0p, g10.3,
907 $
',', 3x,
'N=', i4,
', JTYPE=', i3,
', ISEED=(',
908 $ 3( i4,
',' ), i5,
')' )
910 9997
FORMAT( / 1x, a3,
' -- Complex Generalized eigenvalue problem ',
913 9996
FORMAT(
' Matrix types (see CDRGEV3 for details): ' )
915 9995
FORMAT(
' Special Matrices:', 23x,
916 $
'(J''=transposed Jordan block)',
917 $ /
' 1=(0,0) 2=(I,0) 3=(0,I) 4=(I,I) 5=(J'',J'') ',
918 $
'6=(diag(J'',I), diag(I,J''))', /
' Diagonal Matrices: ( ',
919 $
'D=diag(0,1,2,...) )', /
' 7=(D,I) 9=(large*D, small*I',
920 $
') 11=(large*I, small*D) 13=(large*D, large*I)', /
921 $
' 8=(I,D) 10=(small*D, large*I) 12=(small*I, large*D) ',
922 $
' 14=(small*D, small*I)', /
' 15=(D, reversed D)' )
923 9994
FORMAT(
' Matrices Rotated by Random ', a,
' Matrices U, V:',
924 $ /
' 16=Transposed Jordan Blocks 19=geometric ',
925 $
'alpha, beta=0,1', /
' 17=arithm. alpha&beta ',
926 $
' 20=arithmetic alpha, beta=0,1', /
' 18=clustered ',
927 $
'alpha, beta=0,1 21=random alpha, beta=0,1',
928 $ /
' Large & Small Matrices:', /
' 22=(large, small) ',
929 $
'23=(small,large) 24=(small,small) 25=(large,large)',
930 $ /
' 26=random O(1) matrices.' )
932 9993
FORMAT( /
' Tests performed: ',
933 $ /
' 1 = max | ( b A - a B )''*l | / const.,',
934 $ /
' 2 = | |VR(i)| - 1 | / ulp,',
935 $ /
' 3 = max | ( b A - a B )*r | / const.',
936 $ /
' 4 = | |VL(i)| - 1 | / ulp,',
937 $ /
' 5 = 0 if W same no matter if r or l computed,',
938 $ /
' 6 = 0 if l same no matter if l computed,',
939 $ /
' 7 = 0 if r same no matter if r computed,', / 1x )
940 9992
FORMAT(
' Matrix order=', i5,
', type=', i2,
', seed=',
941 $ 4( i4,
',' ),
' result ', i2,
' is', 0p, f8.2 )
942 9991
FORMAT(
' Matrix order=', i5,
', type=', i2,
', seed=',
943 $ 4( i4,
',' ),
' result ', i2,
' is', 1p, e10.3 )
subroutine alasvm(type, nout, nfail, nrun, nerrs)
ALASVM
subroutine xlaenv(ispec, nvalue)
XLAENV
subroutine xerbla(srname, info)
subroutine cdrgev3(nsizes, nn, ntypes, dotype, iseed, thresh, nounit, a, lda, b, s, t, q, ldq, z, qe, ldqe, alpha, beta, alpha1, beta1, work, lwork, rwork, result, info)
CDRGEV3
subroutine cget52(left, n, a, lda, b, ldb, e, lde, alpha, beta, work, rwork, result)
CGET52
subroutine clatm4(itype, n, nz1, nz2, rsign, amagn, rcond, triang, idist, iseed, a, lda)
CLATM4
subroutine cggev3(jobvl, jobvr, n, a, lda, b, ldb, alpha, beta, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
CGGEV3 computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices (...
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...