225 SUBROUTINE dggev3( JOBVL, JOBVR, N, A, LDA, B, LDB, ALPHAR,
226 $ alphai, beta, vl, ldvl, vr, ldvr, work, lwork,
235 CHARACTER JOBVL, JOBVR
236 INTEGER INFO, LDA, LDB, LDVL, LDVR, LWORK, N
239 DOUBLE PRECISION A( lda, * ), ALPHAI( * ), ALPHAR( * ),
240 $ b( ldb, * ), beta( * ), vl( ldvl, * ),
241 $ vr( ldvr, * ), work( * )
247 DOUBLE PRECISION ZERO, ONE
248 parameter ( zero = 0.0d+0, one = 1.0d+0 )
251 LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR, LQUERY
253 INTEGER ICOLS, IERR, IHI, IJOBVL, IJOBVR, ILEFT, ILO,
254 $ in, iright, irows, itau, iwrk, jc, jr, lwkopt
255 DOUBLE PRECISION ANRM, ANRMTO, BIGNUM, BNRM, BNRMTO, EPS,
268 DOUBLE PRECISION DLAMCH, DLANGE
269 EXTERNAL lsame, dlamch, dlange
272 INTRINSIC abs, max, sqrt
278 IF( lsame( jobvl,
'N' ) )
THEN
281 ELSE IF( lsame( jobvl,
'V' ) )
THEN
289 IF( lsame( jobvr,
'N' ) )
THEN
292 ELSE IF( lsame( jobvr,
'V' ) )
THEN
304 lquery = ( lwork.EQ.-1 )
305 IF( ijobvl.LE.0 )
THEN
307 ELSE IF( ijobvr.LE.0 )
THEN
309 ELSE IF( n.LT.0 )
THEN
311 ELSE IF( lda.LT.max( 1, n ) )
THEN
313 ELSE IF( ldb.LT.max( 1, n ) )
THEN
315 ELSE IF( ldvl.LT.1 .OR. ( ilvl .AND. ldvl.LT.n ) )
THEN
317 ELSE IF( ldvr.LT.1 .OR. ( ilvr .AND. ldvr.LT.n ) )
THEN
319 ELSE IF( lwork.LT.max( 1, 8*n ) .AND. .NOT.lquery )
THEN
326 CALL dgeqrf( n, n, b, ldb, work, work, -1, ierr )
327 lwkopt = max(1, 8*n, 3*n+int( work( 1 ) ) )
328 CALL dormqr(
'L',
'T', n, n, n, b, ldb, work, a, lda, work, -1,
330 lwkopt = max( lwkopt, 3*n+int( work( 1 ) ) )
332 CALL dorgqr( n, n, n, vl, ldvl, work, work, -1, ierr )
333 lwkopt = max( lwkopt, 3*n+int( work( 1 ) ) )
336 CALL dgghd3( jobvl, jobvr, n, 1, n, a, lda, b, ldb, vl,
337 $ ldvl, vr, ldvr, work, -1, ierr )
338 lwkopt = max( lwkopt, 3*n+int( work( 1 ) ) )
339 CALL dhgeqz(
'S', jobvl, jobvr, n, 1, n, a, lda, b, ldb,
340 $ alphar, alphai, beta, vl, ldvl, vr, ldvr,
342 lwkopt = max( lwkopt, 2*n+int( work( 1 ) ) )
344 CALL dgghd3(
'N',
'N', n, 1, n, a, lda, b, ldb, vl, ldvl,
345 $ vr, ldvr, work, -1, ierr )
346 lwkopt = max( lwkopt, 3*n+int( work( 1 ) ) )
347 CALL dhgeqz(
'E', jobvl, jobvr, n, 1, n, a, lda, b, ldb,
348 $ alphar, alphai, beta, vl, ldvl, vr, ldvr,
350 lwkopt = max( lwkopt, 2*n+int( work( 1 ) ) )
357 CALL xerbla(
'DGGEV3 ', -info )
359 ELSE IF( lquery )
THEN
371 smlnum = dlamch(
'S' )
372 bignum = one / smlnum
373 CALL dlabad( smlnum, bignum )
374 smlnum = sqrt( smlnum ) / eps
375 bignum = one / smlnum
379 anrm = dlange(
'M', n, n, a, lda, work )
381 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
384 ELSE IF( anrm.GT.bignum )
THEN
389 $
CALL dlascl(
'G', 0, 0, anrm, anrmto, n, n, a, lda, ierr )
393 bnrm = dlange(
'M', n, n, b, ldb, work )
395 IF( bnrm.GT.zero .AND. bnrm.LT.smlnum )
THEN
398 ELSE IF( bnrm.GT.bignum )
THEN
403 $
CALL dlascl(
'G', 0, 0, bnrm, bnrmto, n, n, b, ldb, ierr )
410 CALL dggbal(
'P', n, a, lda, b, ldb, ilo, ihi, work( ileft ),
411 $ work( iright ), work( iwrk ), ierr )
415 irows = ihi + 1 - ilo
423 CALL dgeqrf( irows, icols, b( ilo, ilo ), ldb, work( itau ),
424 $ work( iwrk ), lwork+1-iwrk, ierr )
428 CALL dormqr(
'L',
'T', irows, icols, irows, b( ilo, ilo ), ldb,
429 $ work( itau ), a( ilo, ilo ), lda, work( iwrk ),
430 $ lwork+1-iwrk, ierr )
435 CALL dlaset(
'Full', n, n, zero, one, vl, ldvl )
436 IF( irows.GT.1 )
THEN
437 CALL dlacpy(
'L', irows-1, irows-1, b( ilo+1, ilo ), ldb,
438 $ vl( ilo+1, ilo ), ldvl )
440 CALL dorgqr( irows, irows, irows, vl( ilo, ilo ), ldvl,
441 $ work( itau ), work( iwrk ), lwork+1-iwrk, ierr )
447 $
CALL dlaset(
'Full', n, n, zero, one, vr, ldvr )
455 CALL dgghd3( jobvl, jobvr, n, ilo, ihi, a, lda, b, ldb, vl,
456 $ ldvl, vr, ldvr, work( iwrk ), lwork+1-iwrk, ierr )
458 CALL dgghd3(
'N',
'N', irows, 1, irows, a( ilo, ilo ), lda,
459 $ b( ilo, ilo ), ldb, vl, ldvl, vr, ldvr,
460 $ work( iwrk ), lwork+1-iwrk, ierr )
472 CALL dhgeqz( chtemp, jobvl, jobvr, n, ilo, ihi, a, lda, b, ldb,
473 $ alphar, alphai, beta, vl, ldvl, vr, ldvr,
474 $ work( iwrk ), lwork+1-iwrk, ierr )
476 IF( ierr.GT.0 .AND. ierr.LE.n )
THEN
478 ELSE IF( ierr.GT.n .AND. ierr.LE.2*n )
THEN
498 CALL dtgevc( chtemp,
'B', ldumma, n, a, lda, b, ldb, vl, ldvl,
499 $ vr, ldvr, n, in, work( iwrk ), ierr )
508 CALL dggbak(
'P',
'L', n, ilo, ihi, work( ileft ),
509 $ work( iright ), n, vl, ldvl, ierr )
511 IF( alphai( jc ).LT.zero )
514 IF( alphai( jc ).EQ.zero )
THEN
516 temp = max( temp, abs( vl( jr, jc ) ) )
520 temp = max( temp, abs( vl( jr, jc ) )+
521 $ abs( vl( jr, jc+1 ) ) )
527 IF( alphai( jc ).EQ.zero )
THEN
529 vl( jr, jc ) = vl( jr, jc )*temp
533 vl( jr, jc ) = vl( jr, jc )*temp
534 vl( jr, jc+1 ) = vl( jr, jc+1 )*temp
540 CALL dggbak(
'P',
'R', n, ilo, ihi, work( ileft ),
541 $ work( iright ), n, vr, ldvr, ierr )
543 IF( alphai( jc ).LT.zero )
546 IF( alphai( jc ).EQ.zero )
THEN
548 temp = max( temp, abs( vr( jr, jc ) ) )
552 temp = max( temp, abs( vr( jr, jc ) )+
553 $ abs( vr( jr, jc+1 ) ) )
559 IF( alphai( jc ).EQ.zero )
THEN
561 vr( jr, jc ) = vr( jr, jc )*temp
565 vr( jr, jc ) = vr( jr, jc )*temp
566 vr( jr, jc+1 ) = vr( jr, jc+1 )*temp
581 CALL dlascl(
'G', 0, 0, anrmto, anrm, n, 1, alphar, n, ierr )
582 CALL dlascl(
'G', 0, 0, anrmto, anrm, n, 1, alphai, n, ierr )
586 CALL dlascl(
'G', 0, 0, bnrmto, bnrm, n, 1, beta, n, ierr )
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 dgghd3(COMPQ, COMPZ, N, ILO, IHI, A, LDA, B, LDB, Q, LDQ, Z, LDZ, WORK, LWORK, INFO)
DGGHD3
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 dormqr(SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC, WORK, LWORK, INFO)
DORMQR
subroutine dtgevc(SIDE, HOWMNY, SELECT, N, S, LDS, P, LDP, VL, LDVL, VR, LDVR, MM, M, WORK, INFO)
DTGEVC
subroutine xerbla(SRNAME, INFO)
XERBLA
subroutine dlabad(SMALL, LARGE)
DLABAD
subroutine dggbal(JOB, N, A, LDA, B, LDB, ILO, IHI, LSCALE, RSCALE, WORK, INFO)
DGGBAL
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 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 dorgqr(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
DORGQR