267 SUBROUTINE zgges( JOBVSL, JOBVSR, SORT, SELCTG, N, A, LDA, B, LDB,
268 $ SDIM, ALPHA, BETA, VSL, LDVSL, VSR, LDVSR, WORK,
269 $ LWORK, RWORK, BWORK, INFO )
276 CHARACTER JOBVSL, JOBVSR, SORT
277 INTEGER INFO, LDA, LDB, LDVSL, LDVSR, LWORK, N, SDIM
281 DOUBLE PRECISION RWORK( * )
282 COMPLEX*16 A( LDA, * ), ALPHA( * ), B( LDB, * ),
283 $ beta( * ), vsl( ldvsl, * ), vsr( ldvsr, * ),
294 DOUBLE PRECISION ZERO, ONE
295 PARAMETER ( ZERO = 0.0d0, one = 1.0d0 )
296 COMPLEX*16 CZERO, CONE
297 parameter( czero = ( 0.0d0, 0.0d0 ),
298 $ cone = ( 1.0d0, 0.0d0 ) )
301 LOGICAL CURSL, ILASCL, ILBSCL, ILVSL, ILVSR, LASTSL,
303 INTEGER I, ICOLS, IERR, IHI, IJOBVL, IJOBVR, ILEFT,
304 $ ILO, IRIGHT, IROWS, IRWRK, ITAU, IWRK, LWKMIN,
306 DOUBLE PRECISION ANRM, ANRMTO, BIGNUM, BNRM, BNRMTO, EPS, PVSL,
311 DOUBLE PRECISION DIF( 2 )
320 DOUBLE PRECISION DLAMCH, ZLANGE
321 EXTERNAL lsame, ilaenv, dlamch, zlange
330 IF( lsame( jobvsl,
'N' ) )
THEN
333 ELSE IF( lsame( jobvsl,
'V' ) )
THEN
341 IF( lsame( jobvsr,
'N' ) )
THEN
344 ELSE IF( lsame( jobvsr,
'V' ) )
THEN
352 wantst = lsame( sort,
'S' )
357 lquery = ( lwork.EQ.-1 )
358 IF( ijobvl.LE.0 )
THEN
360 ELSE IF( ijobvr.LE.0 )
THEN
362 ELSE IF( ( .NOT.wantst ) .AND. ( .NOT.lsame( sort,
'N' ) ) )
THEN
364 ELSE IF( n.LT.0 )
THEN
366 ELSE IF( lda.LT.max( 1, n ) )
THEN
368 ELSE IF( ldb.LT.max( 1, n ) )
THEN
370 ELSE IF( ldvsl.LT.1 .OR. ( ilvsl .AND. ldvsl.LT.n ) )
THEN
372 ELSE IF( ldvsr.LT.1 .OR. ( ilvsr .AND. ldvsr.LT.n ) )
THEN
384 lwkmin = max( 1, 2*n )
385 lwkopt = max( 1, n + n*ilaenv( 1,
'ZGEQRF',
' ', n, 1, n, 0 ) )
386 lwkopt = max( lwkopt, n +
387 $ n*ilaenv( 1,
'ZUNMQR',
' ', n, 1, n, -1 ) )
389 lwkopt = max( lwkopt, n +
390 $ n*ilaenv( 1,
'ZUNGQR',
' ', n, 1, n, -1 ) )
394 IF( lwork.LT.lwkmin .AND. .NOT.lquery )
399 CALL xerbla(
'ZGGES ', -info )
401 ELSE IF( lquery )
THEN
415 smlnum = dlamch(
'S' )
416 bignum = one / smlnum
417 smlnum = sqrt( smlnum ) / eps
418 bignum = one / smlnum
422 anrm = zlange(
'M', n, n, a, lda, rwork )
424 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
427 ELSE IF( anrm.GT.bignum )
THEN
433 $
CALL zlascl(
'G', 0, 0, anrm, anrmto, n, n, a, lda, ierr )
437 bnrm = zlange(
'M', n, n, b, ldb, rwork )
439 IF( bnrm.GT.zero .AND. bnrm.LT.smlnum )
THEN
442 ELSE IF( bnrm.GT.bignum )
THEN
448 $
CALL zlascl(
'G', 0, 0, bnrm, bnrmto, n, n, b, ldb, ierr )
456 CALL zggbal(
'P', n, a, lda, b, ldb, ilo, ihi, rwork( ileft ),
457 $ rwork( iright ), rwork( irwrk ), ierr )
462 irows = ihi + 1 - ilo
466 CALL zgeqrf( irows, icols, b( ilo, ilo ), ldb, work( itau ),
467 $ work( iwrk ), lwork+1-iwrk, ierr )
472 CALL zunmqr(
'L',
'C', irows, icols, irows, b( ilo, ilo ), ldb,
473 $ work( itau ), a( ilo, ilo ), lda, work( iwrk ),
474 $ lwork+1-iwrk, ierr )
480 CALL zlaset(
'Full', n, n, czero, cone, vsl, ldvsl )
481 IF( irows.GT.1 )
THEN
482 CALL zlacpy(
'L', irows-1, irows-1, b( ilo+1, ilo ), ldb,
483 $ vsl( ilo+1, ilo ), ldvsl )
485 CALL zungqr( irows, irows, irows, vsl( ilo, ilo ), ldvsl,
486 $ work( itau ), work( iwrk ), lwork+1-iwrk, ierr )
492 $
CALL zlaset(
'Full', n, n, czero, cone, vsr, ldvsr )
497 CALL zgghrd( jobvsl, jobvsr, n, ilo, ihi, a, lda, b, ldb, vsl,
498 $ ldvsl, vsr, ldvsr, ierr )
507 CALL zhgeqz(
'S', jobvsl, jobvsr, n, ilo, ihi, a, lda, b, ldb,
508 $ alpha, beta, vsl, ldvsl, vsr, ldvsr, work( iwrk ),
509 $ lwork+1-iwrk, rwork( irwrk ), ierr )
511 IF( ierr.GT.0 .AND. ierr.LE.n )
THEN
513 ELSE IF( ierr.GT.n .AND. ierr.LE.2*n )
THEN
529 $
CALL zlascl(
'G', 0, 0, anrm, anrmto, n, 1, alpha, n, ierr )
531 $
CALL zlascl(
'G', 0, 0, bnrm, bnrmto, n, 1, beta, n, ierr )
536 bwork( i ) = selctg( alpha( i ), beta( i ) )
539 CALL ztgsen( 0, ilvsl, ilvsr, bwork, n, a, lda, b, ldb, alpha,
540 $ beta, vsl, ldvsl, vsr, ldvsr, sdim, pvsl, pvsr,
541 $ dif, work( iwrk ), lwork-iwrk+1, idum, 1, ierr )
551 $
CALL zggbak(
'P',
'L', n, ilo, ihi, rwork( ileft ),
552 $ rwork( iright ), n, vsl, ldvsl, ierr )
554 $
CALL zggbak(
'P',
'R', n, ilo, ihi, rwork( ileft ),
555 $ rwork( iright ), n, vsr, ldvsr, ierr )
560 CALL zlascl(
'U', 0, 0, anrmto, anrm, n, n, a, lda, ierr )
561 CALL zlascl(
'G', 0, 0, anrmto, anrm, n, 1, alpha, n, ierr )
565 CALL zlascl(
'U', 0, 0, bnrmto, bnrm, n, n, b, ldb, ierr )
566 CALL zlascl(
'G', 0, 0, bnrmto, bnrm, n, 1, beta, n, ierr )
576 cursl = selctg( alpha( i ), beta( i ) )
579 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 zgges(jobvsl, jobvsr, sort, selctg, n, a, lda, b, ldb, sdim, alpha, beta, vsl, ldvsl, vsr, ldvsr, work, lwork, rwork, bwork, info)
ZGGES computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE m...
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