395 SUBROUTINE zdrgev3( 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,
407 DOUBLE PRECISION THRESH
411 INTEGER ISEED( 4 ), NN( * )
412 DOUBLE PRECISION RESULT( * ), RWORK( * )
413 COMPLEX*16 A( LDA, * ), ALPHA( * ), ALPHA1( * ),
414 $ b( lda, * ), beta( * ), beta1( * ),
415 $ q( ldq, * ), qe( ldqe, * ), s( lda, * ),
416 $ t( lda, * ), work( * ), z( ldq, * )
422 DOUBLE PRECISION ZERO, ONE
423 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0 )
424 COMPLEX*16 CZERO, CONE
425 parameter( czero = ( 0.0d+0, 0.0d+0 ),
426 $ cone = ( 1.0d+0, 0.0d+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 DOUBLE PRECISION 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 )
445 DOUBLE PRECISION RMAGN( 0: 3 )
449 DOUBLE PRECISION DLAMCH
451 EXTERNAL ilaenv, dlamch, zlarnd
458 INTRINSIC abs, dble, dconjg, 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 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,
'ZGEQRF',
' ', nmax, nmax, -1, -1 ),
526 $ ilaenv( 1,
'ZUNMQR',
'LC', nmax, nmax, nmax, -1 ),
527 $ ilaenv( 1,
'ZUNGQR',
' ', nmax, nmax, nmax, -1 ) )
528 maxwrk = max( 2*nmax, nmax*( nb+1 ), nmax*( nmax+1 ) )
532 IF( lwork.LT.minwrk )
536 CALL xerbla(
'ZDRGEV3', -info )
542 IF( nsizes.EQ.0 .OR. ntypes.EQ.0 )
545 ulp = dlamch(
'Precision' )
546 safmin = dlamch(
'Safe minimum' )
547 safmin = safmin / ulp
548 safmax = one / safmin
562 DO 220 jsize = 1, nsizes
565 rmagn( 2 ) = safmax*ulp / dble( 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 zlaset(
'Full', n, n, czero, czero, a, lda )
620 CALL zlatm4( 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 zlaset(
'Full', n, n, czero, czero, b, lda )
638 CALL zlatm4( 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 ) = zlarnd( 3, iseed )
657 z( jr, jc ) = zlarnd( 3, iseed )
659 CALL zlarfg( n+1-jc, q( jc, jc ), q( jc+1, jc ), 1,
661 work( 2*n+jc ) = sign( one, dble( q( jc, jc ) ) )
663 CALL zlarfg( n+1-jc, z( jc, jc ), z( jc+1, jc ), 1,
665 work( 3*n+jc ) = sign( one, dble( z( jc, jc ) ) )
668 ctemp = zlarnd( 3, iseed )
671 work( 3*n ) = ctemp / abs( ctemp )
672 ctemp = zlarnd( 3, iseed )
675 work( 4*n ) = ctemp / abs( ctemp )
681 a( jr, jc ) = work( 2*n+jr )*
682 $ dconjg( work( 3*n+jc ) )*
684 b( jr, jc ) = work( 2*n+jr )*
685 $ dconjg( work( 3*n+jc ) )*
689 CALL zunm2r(
'L',
'N', n, n, n-1, q, ldq, work, a,
690 $ lda, work( 2*n+1 ), ierr )
693 CALL zunm2r(
'R',
'C', n, n, n-1, z, ldq, work( n+1 ),
694 $ a, lda, work( 2*n+1 ), ierr )
697 CALL zunm2r(
'L',
'N', n, n, n-1, q, ldq, work, b,
698 $ lda, work( 2*n+1 ), ierr )
701 CALL zunm2r(
'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 zlacpy(
' ', n, n, a, lda, s, lda )
746 CALL zlacpy(
' ', n, n, b, lda, t, lda )
747 CALL zggev3(
'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 )
'ZGGEV31', ierr, n, jtype,
759 CALL zget52( .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',
'ZGGEV31',
763 $ result( 2 ), n, jtype, ioldsd
768 CALL zget52( .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',
'ZGGEV31',
772 $ result( 4 ), n, jtype, ioldsd
777 CALL zlacpy(
' ', n, n, a, lda, s, lda )
778 CALL zlacpy(
' ', n, n, b, lda, t, lda )
779 CALL zggev3(
'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 )
'ZGGEV32', ierr, n, jtype,
790 IF( alpha( j ).NE.alpha1( j ) .OR. beta( j ).NE.
791 $ beta1( j ) )result( 5 ) = ulpinv
797 CALL zlacpy(
' ', n, n, a, lda, s, lda )
798 CALL zlacpy(
' ', n, n, b, lda, t, lda )
799 CALL zggev3(
'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 )
'ZGGEV33', ierr, n, jtype,
810 IF( alpha( j ).NE.alpha1( j ) .OR. beta( j ).NE.
811 $ beta1( j ) )result( 6 ) = ulpinv
816 IF( q( j, jc ).NE.qe( j, jc ) )
817 $ result( 6 ) = ulpinv
824 CALL zlacpy(
' ', n, n, a, lda, s, lda )
825 CALL zlacpy(
' ', n, n, b, lda, t, lda )
826 CALL zggev3(
'N',
'V', n, s, lda, t, lda, alpha1, beta1, q,
827 $ ldq, qe, ldqe, work, lwork, rwork, ierr )
828 IF( ierr.NE.0 .AND. ierr.NE.n+1 )
THEN
830 WRITE( nounit, fmt = 9999 )
'ZGGEV34', ierr, n, jtype,
837 IF( alpha( j ).NE.alpha1( j ) .OR. beta( j ).NE.
838 $ beta1( j ) )result( 7 ) = ulpinv
843 IF( z( j, jc ).NE.qe( j, jc ) )
844 $ result( 7 ) = ulpinv
857 IF( result( jr ).GE.thresh )
THEN
862 IF( nerrs.EQ.0 )
THEN
863 WRITE( nounit, fmt = 9997 )
'ZGV'
867 WRITE( nounit, fmt = 9996 )
868 WRITE( nounit, fmt = 9995 )
869 WRITE( nounit, fmt = 9994 )
'Orthogonal'
873 WRITE( nounit, fmt = 9993 )
877 IF( result( jr ).LT.10000.0d0 )
THEN
878 WRITE( nounit, fmt = 9992 )n, jtype, ioldsd, jr,
881 WRITE( nounit, fmt = 9991 )n, jtype, ioldsd, jr,
892 CALL alasvm(
'ZGV3', nounit, nerrs, ntestt, 0 )
898 9999
FORMAT(
' ZDRGEV3: ', a,
' returned INFO=', i6,
'.', / 3x,
'N=',
899 $ i6,
', JTYPE=', i6,
', ISEED=(', 3( i5,
',' ), i5,
')' )
901 9998
FORMAT(
' ZDRGEV3: ', a,
' Eigenvectors from ', a,
902 $
' incorrectly normalized.', /
' Bits of error=', 0p, g10.3,
903 $
',', 3x,
'N=', i4,
', JTYPE=', i3,
', ISEED=(',
904 $ 3( i4,
',' ), i5,
')' )
906 9997
FORMAT( / 1x, a3,
' -- Complex Generalized eigenvalue problem ',
909 9996
FORMAT(
' Matrix types (see ZDRGEV3 for details): ' )
911 9995
FORMAT(
' Special Matrices:', 23x,
912 $
'(J''=transposed Jordan block)',
913 $ /
' 1=(0,0) 2=(I,0) 3=(0,I) 4=(I,I) 5=(J'',J'') ',
914 $
'6=(diag(J'',I), diag(I,J''))', /
' Diagonal Matrices: ( ',
915 $
'D=diag(0,1,2,...) )', /
' 7=(D,I) 9=(large*D, small*I',
916 $
') 11=(large*I, small*D) 13=(large*D, large*I)', /
917 $
' 8=(I,D) 10=(small*D, large*I) 12=(small*I, large*D) ',
918 $
' 14=(small*D, small*I)', /
' 15=(D, reversed D)' )
919 9994
FORMAT(
' Matrices Rotated by Random ', a,
' Matrices U, V:',
920 $ /
' 16=Transposed Jordan Blocks 19=geometric ',
921 $
'alpha, beta=0,1', /
' 17=arithm. alpha&beta ',
922 $
' 20=arithmetic alpha, beta=0,1', /
' 18=clustered ',
923 $
'alpha, beta=0,1 21=random alpha, beta=0,1',
924 $ /
' Large & Small Matrices:', /
' 22=(large, small) ',
925 $
'23=(small,large) 24=(small,small) 25=(large,large)',
926 $ /
' 26=random O(1) matrices.' )
928 9993
FORMAT( /
' Tests performed: ',
929 $ /
' 1 = max | ( b A - a B )''*l | / const.,',
930 $ /
' 2 = | |VR(i)| - 1 | / ulp,',
931 $ /
' 3 = max | ( b A - a B )*r | / const.',
932 $ /
' 4 = | |VL(i)| - 1 | / ulp,',
933 $ /
' 5 = 0 if W same no matter if r or l computed,',
934 $ /
' 6 = 0 if l same no matter if l computed,',
935 $ /
' 7 = 0 if r same no matter if r computed,', / 1x )
936 9992
FORMAT(
' Matrix order=', i5,
', type=', i2,
', seed=',
937 $ 4( i4,
',' ),
' result ', i2,
' is', 0p, f8.2 )
938 9991
FORMAT(
' Matrix order=', i5,
', type=', i2,
', seed=',
939 $ 4( i4,
',' ),
' result ', i2,
' is', 1p, d10.3 )