224 SUBROUTINE dggev( JOBVL, JOBVR, N, A, LDA, B, LDB, ALPHAR, ALPHAI,
225 $ BETA, VL, LDVL, VR, LDVR, WORK, LWORK, INFO )
232 CHARACTER JOBVL, JOBVR
233 INTEGER INFO, LDA, LDB, LDVL, LDVR, LWORK, N
236 DOUBLE PRECISION A( LDA, * ), ALPHAI( * ), ALPHAR( * ),
237 $ b( ldb, * ), beta( * ), vl( ldvl, * ),
238 $ vr( ldvr, * ), work( * )
244 DOUBLE PRECISION ZERO, ONE
245 parameter( zero = 0.0d+0, one = 1.0d+0 )
248 LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR, LQUERY
250 INTEGER ICOLS, IERR, IHI, IJOBVL, IJOBVR, ILEFT, ILO,
251 $ in, iright, irows, itau, iwrk, jc, jr, maxwrk,
253 DOUBLE PRECISION ANRM, ANRMTO, BIGNUM, BNRM, BNRMTO, EPS,
266 DOUBLE PRECISION DLAMCH, DLANGE
267 EXTERNAL lsame, ilaenv, dlamch, dlange
270 INTRINSIC abs, max, sqrt
276 IF( lsame( jobvl,
'N' ) )
THEN
279 ELSE IF( lsame( jobvl,
'V' ) )
THEN
287 IF( lsame( jobvr,
'N' ) )
THEN
290 ELSE IF( lsame( jobvr,
'V' ) )
THEN
302 lquery = ( lwork.EQ.-1 )
303 IF( ijobvl.LE.0 )
THEN
305 ELSE IF( ijobvr.LE.0 )
THEN
307 ELSE IF( n.LT.0 )
THEN
309 ELSE IF( lda.LT.max( 1, n ) )
THEN
311 ELSE IF( ldb.LT.max( 1, n ) )
THEN
313 ELSE IF( ldvl.LT.1 .OR. ( ilvl .AND. ldvl.LT.n ) )
THEN
315 ELSE IF( ldvr.LT.1 .OR. ( ilvr .AND. ldvr.LT.n ) )
THEN
328 minwrk = max( 1, 8*n )
329 maxwrk = max( 1, n*( 7 +
330 $ ilaenv( 1,
'DGEQRF',
' ', n, 1, n, 0 ) ) )
331 maxwrk = max( maxwrk, n*( 7 +
332 $ ilaenv( 1,
'DORMQR',
' ', n, 1, n, 0 ) ) )
334 maxwrk = max( maxwrk, n*( 7 +
335 $ ilaenv( 1,
'DORGQR',
' ', n, 1, n, -1 ) ) )
339 IF( lwork.LT.minwrk .AND. .NOT.lquery )
344 CALL xerbla(
'DGGEV ', -info )
346 ELSE IF( lquery )
THEN
358 smlnum = dlamch(
'S' )
359 bignum = one / smlnum
360 smlnum = sqrt( smlnum ) / eps
361 bignum = one / smlnum
365 anrm = dlange(
'M', n, n, a, lda, work )
367 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
370 ELSE IF( anrm.GT.bignum )
THEN
375 $
CALL dlascl(
'G', 0, 0, anrm, anrmto, n, n, a, lda, ierr )
379 bnrm = dlange(
'M', n, n, b, ldb, work )
381 IF( bnrm.GT.zero .AND. bnrm.LT.smlnum )
THEN
384 ELSE IF( bnrm.GT.bignum )
THEN
389 $
CALL dlascl(
'G', 0, 0, bnrm, bnrmto, n, n, b, ldb, ierr )
397 CALL dggbal(
'P', n, a, lda, b, ldb, ilo, ihi, work( ileft ),
398 $ work( iright ), work( iwrk ), ierr )
403 irows = ihi + 1 - ilo
411 CALL dgeqrf( irows, icols, b( ilo, ilo ), ldb, work( itau ),
412 $ work( iwrk ), lwork+1-iwrk, ierr )
417 CALL dormqr(
'L',
'T', irows, icols, irows, b( ilo, ilo ), ldb,
418 $ work( itau ), a( ilo, ilo ), lda, work( iwrk ),
419 $ lwork+1-iwrk, ierr )
425 CALL dlaset(
'Full', n, n, zero, one, vl, ldvl )
426 IF( irows.GT.1 )
THEN
427 CALL dlacpy(
'L', irows-1, irows-1, b( ilo+1, ilo ), ldb,
428 $ vl( ilo+1, ilo ), ldvl )
430 CALL dorgqr( irows, irows, irows, vl( ilo, ilo ), ldvl,
431 $ work( itau ), work( iwrk ), lwork+1-iwrk, ierr )
437 $
CALL dlaset(
'Full', n, n, zero, one, vr, ldvr )
446 CALL dgghrd( jobvl, jobvr, n, ilo, ihi, a, lda, b, ldb, vl,
447 $ ldvl, vr, ldvr, ierr )
449 CALL dgghrd(
'N',
'N', irows, 1, irows, a( ilo, ilo ), lda,
450 $ b( ilo, ilo ), ldb, vl, ldvl, vr, ldvr, ierr )
463 CALL dhgeqz( chtemp, jobvl, jobvr, n, ilo, ihi, a, lda, b, ldb,
464 $ alphar, alphai, beta, vl, ldvl, vr, ldvr,
465 $ work( iwrk ), lwork+1-iwrk, ierr )
467 IF( ierr.GT.0 .AND. ierr.LE.n )
THEN
469 ELSE IF( ierr.GT.n .AND. ierr.LE.2*n )
THEN
490 CALL dtgevc( chtemp,
'B', ldumma, n, a, lda, b, ldb, vl, ldvl,
491 $ vr, ldvr, n, in, work( iwrk ), ierr )
501 CALL dggbak(
'P',
'L', n, ilo, ihi, work( ileft ),
502 $ work( iright ), n, vl, ldvl, ierr )
504 IF( alphai( jc ).LT.zero )
507 IF( alphai( jc ).EQ.zero )
THEN
509 temp = max( temp, abs( vl( jr, jc ) ) )
513 temp = max( temp, abs( vl( jr, jc ) )+
514 $ abs( vl( jr, jc+1 ) ) )
520 IF( alphai( jc ).EQ.zero )
THEN
522 vl( jr, jc ) = vl( jr, jc )*temp
526 vl( jr, jc ) = vl( jr, jc )*temp
527 vl( jr, jc+1 ) = vl( jr, jc+1 )*temp
533 CALL dggbak(
'P',
'R', n, ilo, ihi, work( ileft ),
534 $ work( iright ), n, vr, ldvr, ierr )
536 IF( alphai( jc ).LT.zero )
539 IF( alphai( jc ).EQ.zero )
THEN
541 temp = max( temp, abs( vr( jr, jc ) ) )
545 temp = max( temp, abs( vr( jr, jc ) )+
546 $ abs( vr( jr, jc+1 ) ) )
552 IF( alphai( jc ).EQ.zero )
THEN
554 vr( jr, jc ) = vr( jr, jc )*temp
558 vr( jr, jc ) = vr( jr, jc )*temp
559 vr( jr, jc+1 ) = vr( jr, jc+1 )*temp
574 CALL dlascl(
'G', 0, 0, anrmto, anrm, n, 1, alphar, n, ierr )
575 CALL dlascl(
'G', 0, 0, anrmto, anrm, n, 1, alphai, n, ierr )
579 CALL dlascl(
'G', 0, 0, bnrmto, bnrm, n, 1, beta, n, ierr )
subroutine xerbla(srname, info)
subroutine dgeqrf(m, n, a, lda, tau, work, lwork, info)
DGEQRF
subroutine dggbak(job, side, n, ilo, ihi, lscale, rscale, m, v, ldv, info)
DGGBAK
subroutine dggbal(job, n, a, lda, b, ldb, ilo, ihi, lscale, rscale, work, info)
DGGBAL
subroutine dggev(jobvl, jobvr, n, a, lda, b, ldb, alphar, alphai, beta, vl, ldvl, vr, ldvr, work, lwork, info)
DGGEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices
subroutine dgghrd(compq, compz, n, ilo, ihi, a, lda, b, ldb, q, ldq, z, ldz, info)
DGGHRD
subroutine dhgeqz(job, compq, compz, n, ilo, ihi, h, ldh, t, ldt, alphar, alphai, beta, q, ldq, z, ldz, work, lwork, info)
DHGEQZ
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
subroutine dlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
DLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
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 dtgevc(side, howmny, select, n, s, lds, p, ldp, vl, ldvl, vr, ldvr, mm, m, work, info)
DTGEVC
subroutine dorgqr(m, n, k, a, lda, tau, work, lwork, info)
DORGQR
subroutine dormqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
DORMQR