215 SUBROUTINE zggev( JOBVL, JOBVR, N, A, LDA, B, LDB, ALPHA, BETA,
216 $ VL, LDVL, VR, LDVR, WORK, LWORK, RWORK, INFO )
223 CHARACTER JOBVL, JOBVR
224 INTEGER INFO, LDA, LDB, LDVL, LDVR, LWORK, N
227 DOUBLE PRECISION RWORK( * )
228 COMPLEX*16 A( LDA, * ), ALPHA( * ), B( LDB, * ),
229 $ beta( * ), vl( ldvl, * ), vr( ldvr, * ),
236 DOUBLE PRECISION ZERO, ONE
237 parameter( zero = 0.0d0, one = 1.0d0 )
238 COMPLEX*16 CZERO, CONE
239 parameter( czero = ( 0.0d0, 0.0d0 ),
240 $ cone = ( 1.0d0, 0.0d0 ) )
243 LOGICAL ILASCL, ILBSCL, ILV, ILVL, ILVR, LQUERY
245 INTEGER ICOLS, IERR, IHI, IJOBVL, IJOBVR, ILEFT, ILO,
246 $ in, iright, irows, irwrk, itau, iwrk, jc, jr,
248 DOUBLE PRECISION ANRM, ANRMTO, BIGNUM, BNRM, BNRMTO, EPS,
262 DOUBLE PRECISION DLAMCH, ZLANGE
263 EXTERNAL lsame, ilaenv, dlamch, zlange
266 INTRINSIC abs, dble, dimag, max, sqrt
269 DOUBLE PRECISION ABS1
272 abs1( x ) = abs( dble( x ) ) + abs( dimag( x ) )
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
330 lwkmin = max( 1, 2*n )
331 lwkopt = max( 1, n + n*ilaenv( 1,
'ZGEQRF',
' ', n, 1, n, 0 ) )
332 lwkopt = max( lwkopt, n +
333 $ n*ilaenv( 1,
'ZUNMQR',
' ', n, 1, n, 0 ) )
335 lwkopt = max( lwkopt, n +
336 $ n*ilaenv( 1,
'ZUNGQR',
' ', n, 1, n, -1 ) )
340 IF( lwork.LT.lwkmin .AND. .NOT.lquery )
345 CALL xerbla(
'ZGGEV ', -info )
347 ELSE IF( lquery )
THEN
358 eps = dlamch(
'E' )*dlamch(
'B' )
359 smlnum = dlamch(
'S' )
360 bignum = one / smlnum
361 smlnum = sqrt( smlnum ) / eps
362 bignum = one / smlnum
366 anrm = zlange(
'M', n, n, a, lda, rwork )
368 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
371 ELSE IF( anrm.GT.bignum )
THEN
376 $
CALL zlascl(
'G', 0, 0, anrm, anrmto, n, n, a, lda, ierr )
380 bnrm = zlange(
'M', n, n, b, ldb, rwork )
382 IF( bnrm.GT.zero .AND. bnrm.LT.smlnum )
THEN
385 ELSE IF( bnrm.GT.bignum )
THEN
390 $
CALL zlascl(
'G', 0, 0, bnrm, bnrmto, n, n, b, ldb, ierr )
398 CALL zggbal(
'P', n, a, lda, b, ldb, ilo, ihi, rwork( ileft ),
399 $ rwork( iright ), rwork( irwrk ), ierr )
404 irows = ihi + 1 - ilo
412 CALL zgeqrf( irows, icols, b( ilo, ilo ), ldb, work( itau ),
413 $ work( iwrk ), lwork+1-iwrk, ierr )
418 CALL zunmqr(
'L',
'C', irows, icols, irows, b( ilo, ilo ), ldb,
419 $ work( itau ), a( ilo, ilo ), lda, work( iwrk ),
420 $ lwork+1-iwrk, ierr )
426 CALL zlaset(
'Full', n, n, czero, cone, vl, ldvl )
427 IF( irows.GT.1 )
THEN
428 CALL zlacpy(
'L', irows-1, irows-1, b( ilo+1, ilo ), ldb,
429 $ vl( ilo+1, ilo ), ldvl )
431 CALL zungqr( irows, irows, irows, vl( ilo, ilo ), ldvl,
432 $ work( itau ), work( iwrk ), lwork+1-iwrk, ierr )
438 $
CALL zlaset(
'Full', n, n, czero, cone, vr, ldvr )
446 CALL zgghrd( jobvl, jobvr, n, ilo, ihi, a, lda, b, ldb, vl,
447 $ ldvl, vr, ldvr, ierr )
449 CALL zgghrd(
'N',
'N', irows, 1, irows, a( ilo, ilo ), lda,
450 $ b( ilo, ilo ), ldb, vl, ldvl, vr, ldvr, ierr )
464 CALL zhgeqz( chtemp, jobvl, jobvr, n, ilo, ihi, a, lda, b, ldb,
465 $ alpha, beta, vl, ldvl, vr, ldvr, work( iwrk ),
466 $ lwork+1-iwrk, rwork( irwrk ), ierr )
468 IF( ierr.GT.0 .AND. ierr.LE.n )
THEN
470 ELSE IF( ierr.GT.n .AND. ierr.LE.2*n )
THEN
493 CALL ztgevc( chtemp,
'B', ldumma, n, a, lda, b, ldb, vl, ldvl,
494 $ vr, ldvr, n, in, work( iwrk ), rwork( irwrk ),
505 CALL zggbak(
'P',
'L', n, ilo, ihi, rwork( ileft ),
506 $ rwork( iright ), n, vl, ldvl, ierr )
510 temp = max( temp, abs1( vl( jr, jc ) ) )
516 vl( jr, jc ) = vl( jr, jc )*temp
521 CALL zggbak(
'P',
'R', n, ilo, ihi, rwork( ileft ),
522 $ rwork( iright ), n, vr, ldvr, ierr )
526 temp = max( temp, abs1( vr( jr, jc ) ) )
532 vr( jr, jc ) = vr( jr, jc )*temp
543 $
CALL zlascl(
'G', 0, 0, anrmto, anrm, n, 1, alpha, n, ierr )
546 $
CALL zlascl(
'G', 0, 0, bnrmto, bnrm, n, 1, beta, n, ierr )
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 zggev(jobvl, jobvr, n, a, lda, b, ldb, alpha, beta, vl, ldvl, vr, ldvr, work, lwork, rwork, info)
ZGGEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for GE matrices
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 ztgevc(side, howmny, select, n, s, lds, p, ldp, vl, ldvl, vr, ldvr, mm, m, work, rwork, info)
ZTGEVC
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