326 SUBROUTINE zggesx( JOBVSL, JOBVSR, SORT, SELCTG, SENSE, N, A, LDA,
327 $ B, LDB, SDIM, ALPHA, BETA, VSL, LDVSL, VSR,
328 $ LDVSR, RCONDE, RCONDV, WORK, LWORK, RWORK,
329 $ IWORK, LIWORK, BWORK, INFO )
336 CHARACTER JOBVSL, JOBVSR, SENSE, SORT
337 INTEGER INFO, LDA, LDB, LDVSL, LDVSR, LIWORK, LWORK, N,
343 DOUBLE PRECISION RCONDE( 2 ), RCONDV( 2 ), RWORK( * )
344 COMPLEX*16 A( LDA, * ), ALPHA( * ), B( LDB, * ),
345 $ beta( * ), vsl( ldvsl, * ), vsr( ldvsr, * ),
356 DOUBLE PRECISION ZERO, ONE
357 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0 )
358 COMPLEX*16 CZERO, CONE
359 parameter( czero = ( 0.0d+0, 0.0d+0 ),
360 $ cone = ( 1.0d+0, 0.0d+0 ) )
363 LOGICAL CURSL, ILASCL, ILBSCL, ILVSL, ILVSR, LASTSL,
364 $ LQUERY, WANTSB, WANTSE, WANTSN, WANTST, WANTSV
365 INTEGER I, ICOLS, IERR, IHI, IJOB, IJOBVL, IJOBVR,
366 $ ileft, ilo, iright, irows, irwrk, itau, iwrk,
367 $ liwmin, lwrk, maxwrk, minwrk
368 DOUBLE PRECISION ANRM, ANRMTO, BIGNUM, BNRM, BNRMTO, EPS, PL,
372 DOUBLE PRECISION DIF( 2 )
381 DOUBLE PRECISION DLAMCH, ZLANGE
382 EXTERNAL lsame, ilaenv, dlamch, zlange
391 IF( lsame( jobvsl,
'N' ) )
THEN
394 ELSE IF( lsame( jobvsl,
'V' ) )
THEN
402 IF( lsame( jobvsr,
'N' ) )
THEN
405 ELSE IF( lsame( jobvsr,
'V' ) )
THEN
413 wantst = lsame( sort,
'S' )
414 wantsn = lsame( sense,
'N' )
415 wantse = lsame( sense,
'E' )
416 wantsv = lsame( sense,
'V' )
417 wantsb = lsame( sense,
'B' )
418 lquery = ( lwork.EQ.-1 .OR. liwork.EQ.-1 )
421 ELSE IF( wantse )
THEN
423 ELSE IF( wantsv )
THEN
425 ELSE IF( wantsb )
THEN
432 IF( ijobvl.LE.0 )
THEN
434 ELSE IF( ijobvr.LE.0 )
THEN
436 ELSE IF( ( .NOT.wantst ) .AND. ( .NOT.lsame( sort,
'N' ) ) )
THEN
438 ELSE IF( .NOT.( wantsn .OR. wantse .OR. wantsv .OR. wantsb ) .OR.
439 $ ( .NOT.wantst .AND. .NOT.wantsn ) )
THEN
441 ELSE IF( n.LT.0 )
THEN
443 ELSE IF( lda.LT.max( 1, n ) )
THEN
445 ELSE IF( ldb.LT.max( 1, n ) )
THEN
447 ELSE IF( ldvsl.LT.1 .OR. ( ilvsl .AND. ldvsl.LT.n ) )
THEN
449 ELSE IF( ldvsr.LT.1 .OR. ( ilvsr .AND. ldvsr.LT.n ) )
THEN
463 maxwrk = n*(1 + ilaenv( 1,
'ZGEQRF',
' ', n, 1, n, 0 ) )
464 maxwrk = max( maxwrk, n*( 1 +
465 $ ilaenv( 1,
'ZUNMQR',
' ', n, 1, n, -1 ) ) )
467 maxwrk = max( maxwrk, n*( 1 +
468 $ ilaenv( 1,
'ZUNGQR',
' ', n, 1, n, -1 ) ) )
472 $ lwrk = max( lwrk, n*n/2 )
479 IF( wantsn .OR. n.EQ.0 )
THEN
486 IF( lwork.LT.minwrk .AND. .NOT.lquery )
THEN
488 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery)
THEN
494 CALL xerbla(
'ZGGESX', -info )
496 ELSE IF (lquery)
THEN
510 smlnum = dlamch(
'S' )
511 bignum = one / smlnum
512 smlnum = sqrt( smlnum ) / eps
513 bignum = one / smlnum
517 anrm = zlange(
'M', n, n, a, lda, rwork )
519 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
522 ELSE IF( anrm.GT.bignum )
THEN
527 $
CALL zlascl(
'G', 0, 0, anrm, anrmto, n, n, a, lda, ierr )
531 bnrm = zlange(
'M', n, n, b, ldb, rwork )
533 IF( bnrm.GT.zero .AND. bnrm.LT.smlnum )
THEN
536 ELSE IF( bnrm.GT.bignum )
THEN
541 $
CALL zlascl(
'G', 0, 0, bnrm, bnrmto, n, n, b, ldb, ierr )
549 CALL zggbal(
'P', n, a, lda, b, ldb, ilo, ihi, rwork( ileft ),
550 $ rwork( iright ), rwork( irwrk ), ierr )
555 irows = ihi + 1 - ilo
559 CALL zgeqrf( irows, icols, b( ilo, ilo ), ldb, work( itau ),
560 $ work( iwrk ), lwork+1-iwrk, ierr )
565 CALL zunmqr(
'L',
'C', irows, icols, irows, b( ilo, ilo ), ldb,
566 $ work( itau ), a( ilo, ilo ), lda, work( iwrk ),
567 $ lwork+1-iwrk, ierr )
573 CALL zlaset(
'Full', n, n, czero, cone, vsl, ldvsl )
574 IF( irows.GT.1 )
THEN
575 CALL zlacpy(
'L', irows-1, irows-1, b( ilo+1, ilo ), ldb,
576 $ vsl( ilo+1, ilo ), ldvsl )
578 CALL zungqr( irows, irows, irows, vsl( ilo, ilo ), ldvsl,
579 $ work( itau ), work( iwrk ), lwork+1-iwrk, ierr )
585 $
CALL zlaset(
'Full', n, n, czero, cone, vsr, ldvsr )
590 CALL zgghrd( jobvsl, jobvsr, n, ilo, ihi, a, lda, b, ldb, vsl,
591 $ ldvsl, vsr, ldvsr, ierr )
600 CALL zhgeqz(
'S', jobvsl, jobvsr, n, ilo, ihi, a, lda, b, ldb,
601 $ alpha, beta, vsl, ldvsl, vsr, ldvsr, work( iwrk ),
602 $ lwork+1-iwrk, rwork( irwrk ), ierr )
604 IF( ierr.GT.0 .AND. ierr.LE.n )
THEN
606 ELSE IF( ierr.GT.n .AND. ierr.LE.2*n )
THEN
622 $
CALL zlascl(
'G', 0, 0, anrmto, anrm, n, 1, alpha, n, ierr )
624 $
CALL zlascl(
'G', 0, 0, bnrmto, bnrm, n, 1, beta, n, ierr )
629 bwork( i ) = selctg( alpha( i ), beta( i ) )
637 CALL ztgsen( ijob, ilvsl, ilvsr, bwork, n, a, lda, b, ldb,
638 $ alpha, beta, vsl, ldvsl, vsr, ldvsr, sdim, pl, pr,
639 $ dif, work( iwrk ), lwork-iwrk+1, iwork, liwork,
643 $ maxwrk = max( maxwrk, 2*sdim*( n-sdim ) )
644 IF( ierr.EQ.-21 )
THEN
650 IF( ijob.EQ.1 .OR. ijob.EQ.4 )
THEN
654 IF( ijob.EQ.2 .OR. ijob.EQ.4 )
THEN
655 rcondv( 1 ) = dif( 1 )
656 rcondv( 2 ) = dif( 2 )
668 $
CALL zggbak(
'P',
'L', n, ilo, ihi, rwork( ileft ),
669 $ rwork( iright ), n, vsl, ldvsl, ierr )
672 $
CALL zggbak(
'P',
'R', n, ilo, ihi, rwork( ileft ),
673 $ rwork( iright ), n, vsr, ldvsr, ierr )
678 CALL zlascl(
'U', 0, 0, anrmto, anrm, n, n, a, lda, ierr )
679 CALL zlascl(
'G', 0, 0, anrmto, anrm, n, 1, alpha, n, ierr )
683 CALL zlascl(
'U', 0, 0, bnrmto, bnrm, n, n, b, ldb, ierr )
684 CALL zlascl(
'G', 0, 0, bnrmto, bnrm, n, 1, beta, n, ierr )
694 cursl = selctg( alpha( i ), beta( i ) )
697 IF( cursl .AND. .NOT.lastsl )
subroutine xerbla(srname, info)
subroutine zgeqrf(m, n, a, lda, tau, work, lwork, info)
ZGEQRF
subroutine zggbak(job, side, n, ilo, ihi, lscale, rscale, m, v, ldv, info)
ZGGBAK
subroutine zggbal(job, n, a, lda, b, ldb, ilo, ihi, lscale, rscale, work, info)
ZGGBAL
subroutine zggesx(jobvsl, jobvsr, sort, selctg, sense, n, a, lda, b, ldb, sdim, alpha, beta, vsl, ldvsl, vsr, ldvsr, rconde, rcondv, work, lwork, rwork, iwork, liwork, bwork, info)
ZGGESX computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE ...
subroutine zgghrd(compq, compz, n, ilo, ihi, a, lda, b, ldb, q, ldq, z, ldz, info)
ZGGHRD
subroutine zhgeqz(job, compq, compz, n, ilo, ihi, h, ldh, t, ldt, alpha, beta, q, ldq, z, ldz, work, lwork, rwork, info)
ZHGEQZ
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
subroutine zlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
ZLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine zlaset(uplo, m, n, alpha, beta, a, lda)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
subroutine ztgsen(ijob, wantq, wantz, select, n, a, lda, b, ldb, alpha, beta, q, ldq, z, ldz, m, pl, pr, dif, work, lwork, iwork, liwork, info)
ZTGSEN
subroutine zungqr(m, n, k, a, lda, tau, work, lwork, info)
ZUNGQR
subroutine zunmqr(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
ZUNMQR