404 SUBROUTINE ddrgev3( NSIZES, NN, NTYPES, DOTYPE, ISEED, THRESH,
405 $ NOUNIT, A, LDA, B, S, T, Q, LDQ, Z, QE, LDQE,
406 $ ALPHAR, ALPHAI, BETA, ALPHR1, ALPHI1, BETA1,
407 $ WORK, LWORK, RESULT, INFO )
414 INTEGER INFO, LDA, LDQ, LDQE, LWORK, NOUNIT, NSIZES,
416 DOUBLE PRECISION THRESH
420 INTEGER ISEED( 4 ), NN( * )
421 DOUBLE PRECISION A( LDA, * ), ALPHAI( * ), ALPHAR( * ),
422 $ alphi1( * ), alphr1( * ), b( lda, * ),
423 $ beta( * ), beta1( * ), q( ldq, * ),
424 $ qe( ldqe, * ), result( * ), s( lda, * ),
425 $ t( lda, * ), work( * ), z( ldq, * )
431 DOUBLE PRECISION ZERO, ONE
432 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0 )
434 parameter( maxtyp = 27 )
438 INTEGER I, IADD, IERR, IN, J, JC, JR, JSIZE, JTYPE,
439 $ MAXWRK, MINWRK, MTYPES, N, N1, NERRS, NMATS,
441 DOUBLE PRECISION SAFMAX, SAFMIN, ULP, ULPINV
444 INTEGER IASIGN( MAXTYP ), IBSIGN( MAXTYP ),
445 $ IOLDSD( 4 ), KADD( 6 ), KAMAGN( MAXTYP ),
446 $ KATYPE( MAXTYP ), KAZERO( MAXTYP ),
447 $ kbmagn( maxtyp ), kbtype( maxtyp ),
448 $ kbzero( maxtyp ), kclass( maxtyp ),
449 $ ktrian( maxtyp ), kz1( 6 ), kz2( 6 )
450 DOUBLE PRECISION RMAGN( 0: 3 )
454 DOUBLE PRECISION DLAMCH, DLARND
455 EXTERNAL ILAENV, DLAMCH, DLARND
462 INTRINSIC abs, dble, max, min, sign
465 DATA kclass / 15*1, 10*2, 1*3, 1*4 /
466 DATA kz1 / 0, 1, 2, 1, 3, 3 /
467 DATA kz2 / 0, 0, 1, 2, 1, 1 /
468 DATA kadd / 0, 0, 0, 0, 3, 2 /
469 DATA katype / 0, 1, 0, 1, 2, 3, 4, 1, 4, 4, 1, 1, 4,
470 $ 4, 4, 2, 4, 5, 8, 7, 9, 4*4, 0, 0 /
471 DATA kbtype / 0, 0, 1, 1, 2, -3, 1, 4, 1, 1, 4, 4,
472 $ 1, 1, -4, 2, -4, 8*8, 0, 0 /
473 DATA kazero / 6*1, 2, 1, 2*2, 2*1, 2*2, 3, 1, 3,
475 DATA kbzero / 6*1, 1, 2, 2*1, 2*2, 2*1, 4, 1, 4,
477 DATA kamagn / 8*1, 2, 3, 2, 3, 2, 3, 7*1, 2, 3, 3,
479 DATA kbmagn / 8*1, 3, 2, 3, 2, 2, 3, 7*1, 3, 2, 3,
481 DATA ktrian / 16*0, 11*1 /
482 DATA iasign / 6*0, 2, 0, 2*2, 2*0, 3*2, 0, 2, 3*0,
484 DATA ibsign / 7*0, 2, 2*0, 2*2, 2*0, 2, 0, 2, 10*0 /
495 nmax = max( nmax, nn( j ) )
500 IF( nsizes.LT.0 )
THEN
502 ELSE IF( badnn )
THEN
504 ELSE IF( ntypes.LT.0 )
THEN
506 ELSE IF( thresh.LT.zero )
THEN
508 ELSE IF( lda.LE.1 .OR. lda.LT.nmax )
THEN
510 ELSE IF( ldq.LE.1 .OR. ldq.LT.nmax )
THEN
512 ELSE IF( ldqe.LE.1 .OR. ldqe.LT.nmax )
THEN
524 IF( info.EQ.0 .AND. lwork.GE.1 )
THEN
525 minwrk = max( 1, 8*nmax, nmax*( nmax+1 ) )
526 maxwrk = 7*nmax + nmax*ilaenv( 1,
'DGEQRF',
' ', nmax, 1, nmax,
528 maxwrk = max( maxwrk, nmax*( nmax+1 ) )
532 IF( lwork.LT.minwrk )
536 CALL xerbla(
'DDRGEV3', -info )
542 IF( nsizes.EQ.0 .OR. ntypes.EQ.0 )
545 safmin = dlamch(
'Safe minimum' )
546 ulp = dlamch(
'Epsilon' )*dlamch(
'Base' )
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 )
609 IF( mtypes.GT.maxtyp )
612 IF( kclass( jtype ).LT.3 )
THEN
616 IF( abs( katype( jtype ) ).EQ.3 )
THEN
617 in = 2*( ( n-1 ) / 2 ) + 1
619 $
CALL dlaset(
'Full', n, n, zero, zero, a, lda )
623 CALL dlatm4( katype( jtype ), in, kz1( kazero( jtype ) ),
624 $ kz2( kazero( jtype ) ), iasign( jtype ),
625 $ rmagn( kamagn( jtype ) ), ulp,
626 $ rmagn( ktrian( jtype )*kamagn( jtype ) ), 2,
628 iadd = kadd( kazero( jtype ) )
629 IF( iadd.GT.0 .AND. iadd.LE.n )
630 $ a( iadd, iadd ) = one
634 IF( abs( kbtype( jtype ) ).EQ.3 )
THEN
635 in = 2*( ( n-1 ) / 2 ) + 1
637 $
CALL dlaset(
'Full', n, n, zero, zero, b, lda )
641 CALL dlatm4( kbtype( jtype ), in, kz1( kbzero( jtype ) ),
642 $ kz2( kbzero( jtype ) ), ibsign( jtype ),
643 $ rmagn( kbmagn( jtype ) ), one,
644 $ rmagn( ktrian( jtype )*kbmagn( jtype ) ), 2,
646 iadd = kadd( kbzero( jtype ) )
647 IF( iadd.NE.0 .AND. iadd.LE.n )
648 $ b( iadd, iadd ) = one
650 IF( kclass( jtype ).EQ.2 .AND. n.GT.0 )
THEN
659 q( jr, jc ) = dlarnd( 3, iseed )
660 z( jr, jc ) = dlarnd( 3, iseed )
662 CALL dlarfg( n+1-jc, q( jc, jc ), q( jc+1, jc ), 1,
664 work( 2*n+jc ) = sign( one, q( jc, jc ) )
666 CALL dlarfg( n+1-jc, z( jc, jc ), z( jc+1, jc ), 1,
668 work( 3*n+jc ) = sign( one, z( jc, jc ) )
673 work( 3*n ) = sign( one, dlarnd( 2, iseed ) )
676 work( 4*n ) = sign( one, dlarnd( 2, iseed ) )
682 a( jr, jc ) = work( 2*n+jr )*work( 3*n+jc )*
684 b( jr, jc ) = work( 2*n+jr )*work( 3*n+jc )*
688 CALL dorm2r(
'L',
'N', n, n, n-1, q, ldq, work, a,
689 $ lda, work( 2*n+1 ), ierr )
692 CALL dorm2r(
'R',
'T', n, n, n-1, z, ldq, work( n+1 ),
693 $ a, lda, work( 2*n+1 ), ierr )
696 CALL dorm2r(
'L',
'N', n, n, n-1, q, ldq, work, b,
697 $ lda, work( 2*n+1 ), ierr )
700 CALL dorm2r(
'R',
'T', n, n, n-1, z, ldq, work( n+1 ),
701 $ b, lda, work( 2*n+1 ), ierr )
705 ELSE IF (kclass( jtype ).EQ.3)
THEN
711 a( jr, jc ) = rmagn( kamagn( jtype ) )*
713 b( jr, jc ) = rmagn( kbmagn( jtype ) )*
722 DO 71 jr = 1, min( jc + 1, n)
723 a( jr, jc ) = rmagn( kamagn( jtype ) )*
732 b( jr, jc ) = rmagn( kamagn( jtype ) )*
748 WRITE( nounit, fmt = 9999 )
'Generator', ierr, n, jtype,
770 CALL dlacpy(
' ', n, n, a, lda, s, lda )
771 CALL dlacpy(
' ', n, n, b, lda, t, lda )
772 CALL dggev3(
'V',
'V', n, s, lda, t, lda, alphar, alphai,
773 $ beta, q, ldq, z, ldq, work, lwork, ierr )
774 IF( ierr.NE.0 .AND. ierr.NE.n+1 )
THEN
776 WRITE( nounit, fmt = 9999 )
'DGGEV31', ierr, n, jtype,
784 CALL dget52( .true., n, a, lda, b, lda, q, ldq, alphar,
785 $ alphai, beta, work, result( 1 ) )
786 IF( result( 2 ).GT.thresh )
THEN
787 WRITE( nounit, fmt = 9998 )
'Left',
'DGGEV31',
788 $ result( 2 ), n, jtype, ioldsd
793 CALL dget52( .false., n, a, lda, b, lda, z, ldq, alphar,
794 $ alphai, beta, work, result( 3 ) )
795 IF( result( 4 ).GT.thresh )
THEN
796 WRITE( nounit, fmt = 9998 )
'Right',
'DGGEV31',
797 $ result( 4 ), n, jtype, ioldsd
802 CALL dlacpy(
' ', n, n, a, lda, s, lda )
803 CALL dlacpy(
' ', n, n, b, lda, t, lda )
804 CALL dggev3(
'N',
'N', n, s, lda, t, lda, alphr1, alphi1,
805 $ beta1, q, ldq, z, ldq, work, lwork, ierr )
806 IF( ierr.NE.0 .AND. ierr.NE.n+1 )
THEN
808 WRITE( nounit, fmt = 9999 )
'DGGEV32', ierr, n, jtype,
815 IF( alphar( j ).NE.alphr1( j ) .OR. alphai( j ).NE.
816 $ alphi1( j ) .OR. beta( j ).NE.beta1( j ) )result( 5 )
823 CALL dlacpy(
' ', n, n, a, lda, s, lda )
824 CALL dlacpy(
' ', n, n, b, lda, t, lda )
825 CALL dggev3(
'V',
'N', n, s, lda, t, lda, alphr1, alphi1,
826 $ beta1, qe, ldqe, z, ldq, work, lwork, ierr )
827 IF( ierr.NE.0 .AND. ierr.NE.n+1 )
THEN
829 WRITE( nounit, fmt = 9999 )
'DGGEV33', ierr, n, jtype,
836 IF( alphar( j ).NE.alphr1( j ) .OR. alphai( j ).NE.
837 $ alphi1( j ) .OR. beta( j ).NE.beta1( j ) )result( 6 )
843 IF( q( j, jc ).NE.qe( j, jc ) )
844 $ result( 6 ) = ulpinv
851 CALL dlacpy(
' ', n, n, a, lda, s, lda )
852 CALL dlacpy(
' ', n, n, b, lda, t, lda )
853 CALL dggev3(
'N',
'V', n, s, lda, t, lda, alphr1, alphi1,
854 $ beta1, q, ldq, qe, ldqe, work, lwork, ierr )
855 IF( ierr.NE.0 .AND. ierr.NE.n+1 )
THEN
857 WRITE( nounit, fmt = 9999 )
'DGGEV34', ierr, n, jtype,
864 IF( alphar( j ).NE.alphr1( j ) .OR. alphai( j ).NE.
865 $ alphi1( j ) .OR. beta( j ).NE.beta1( j ) )result( 7 )
871 IF( z( j, jc ).NE.qe( j, jc ) )
872 $ result( 7 ) = ulpinv
885 IF( result( jr ).GE.thresh )
THEN
890 IF( nerrs.EQ.0 )
THEN
891 WRITE( nounit, fmt = 9997 )
'DGV'
895 WRITE( nounit, fmt = 9996 )
896 WRITE( nounit, fmt = 9995 )
897 WRITE( nounit, fmt = 9994 )
'Orthogonal'
901 WRITE( nounit, fmt = 9993 )
905 IF( result( jr ).LT.10000.0d0 )
THEN
906 WRITE( nounit, fmt = 9992 )n, jtype, ioldsd, jr,
909 WRITE( nounit, fmt = 9991 )n, jtype, ioldsd, jr,
920 CALL alasvm(
'DGV', nounit, nerrs, ntestt, 0 )
926 9999
FORMAT(
' DDRGEV3: ', a,
' returned INFO=', i6,
'.', / 3x,
'N=',
927 $ i6,
', JTYPE=', i6,
', ISEED=(', 4( i4,
',' ), i5,
')' )
929 9998
FORMAT(
' DDRGEV3: ', a,
' Eigenvectors from ', a,
930 $
' incorrectly normalized.', /
' Bits of error=', 0p, g10.3,
931 $
',', 3x,
'N=', i4,
', JTYPE=', i3,
', ISEED=(',
932 $ 4( i4,
',' ), i5,
')' )
934 9997
FORMAT( / 1x, a3,
' -- Real Generalized eigenvalue problem driver'
937 9996
FORMAT(
' Matrix types (see DDRGEV3 for details): ' )
939 9995
FORMAT(
' Special Matrices:', 23x,
940 $
'(J''=transposed Jordan block)',
941 $ /
' 1=(0,0) 2=(I,0) 3=(0,I) 4=(I,I) 5=(J'',J'') ',
942 $
'6=(diag(J'',I), diag(I,J''))', /
' Diagonal Matrices: ( ',
943 $
'D=diag(0,1,2,...) )', /
' 7=(D,I) 9=(large*D, small*I',
944 $
') 11=(large*I, small*D) 13=(large*D, large*I)', /
945 $
' 8=(I,D) 10=(small*D, large*I) 12=(small*I, large*D) ',
946 $
' 14=(small*D, small*I)', /
' 15=(D, reversed D)' )
947 9994
FORMAT(
' Matrices Rotated by Random ', a,
' Matrices U, V:',
948 $ /
' 16=Transposed Jordan Blocks 19=geometric ',
949 $
'alpha, beta=0,1', /
' 17=arithm. alpha&beta ',
950 $
' 20=arithmetic alpha, beta=0,1', /
' 18=clustered ',
951 $
'alpha, beta=0,1 21=random alpha, beta=0,1',
952 $ /
' Large & Small Matrices:', /
' 22=(large, small) ',
953 $
'23=(small,large) 24=(small,small) 25=(large,large)',
954 $ /
' 26=random O(1) matrices.' )
956 9993
FORMAT( /
' Tests performed: ',
957 $ /
' 1 = max | ( b A - a B )''*l | / const.,',
958 $ /
' 2 = | |VR(i)| - 1 | / ulp,',
959 $ /
' 3 = max | ( b A - a B )*r | / const.',
960 $ /
' 4 = | |VL(i)| - 1 | / ulp,',
961 $ /
' 5 = 0 if W same no matter if r or l computed,',
962 $ /
' 6 = 0 if l same no matter if l computed,',
963 $ /
' 7 = 0 if r same no matter if r computed,', / 1x )
964 9992
FORMAT(
' Matrix order=', i5,
', type=', i2,
', seed=',
965 $ 4( i4,
',' ),
' result ', i2,
' is', 0p, f8.2 )
966 9991
FORMAT(
' Matrix order=', i5,
', type=', i2,
', seed=',
967 $ 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 ddrgev3(nsizes, nn, ntypes, dotype, iseed, thresh, nounit, a, lda, b, s, t, q, ldq, z, qe, ldqe, alphar, alphai, beta, alphr1, alphi1, beta1, work, lwork, result, info)
DDRGEV3
subroutine dget52(left, n, a, lda, b, ldb, e, lde, alphar, alphai, beta, work, result)
DGET52
subroutine dlatm4(itype, n, nz1, nz2, isign, amagn, rcond, triang, idist, iseed, a, lda)
DLATM4
subroutine dggev3(jobvl, jobvr, n, a, lda, b, ldb, alphar, alphai, beta, vl, ldvl, vr, ldvr, work, lwork, info)
DGGEV3 computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices (...
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...