222 SUBROUTINE zgegs( JOBVSL, JOBVSR, N, A, LDA, B, LDB, ALPHA, BETA,
223 $ VSL, LDVSL, VSR, LDVSR, WORK, LWORK, RWORK,
231 CHARACTER JOBVSL, JOBVSR
232 INTEGER INFO, LDA, LDB, LDVSL, LDVSR, LWORK, N
235 DOUBLE PRECISION RWORK( * )
236 COMPLEX*16 A( LDA, * ), ALPHA( * ), B( LDB, * ),
237 $ beta( * ), vsl( ldvsl, * ), vsr( ldvsr, * ),
244 DOUBLE PRECISION ZERO, ONE
245 PARAMETER ( ZERO = 0.0d0, one = 1.0d0 )
246 COMPLEX*16 CZERO, CONE
247 parameter( czero = ( 0.0d0, 0.0d0 ),
248 $ cone = ( 1.0d0, 0.0d0 ) )
251 LOGICAL ILASCL, ILBSCL, ILVSL, ILVSR, LQUERY
252 INTEGER ICOLS, IHI, IINFO, IJOBVL, IJOBVR, ILEFT, ILO,
253 $ iright, irows, irwork, itau, iwork, lopt,
254 $ lwkmin, lwkopt, nb, nb1, nb2, nb3
255 DOUBLE PRECISION ANRM, ANRMTO, BIGNUM, BNRM, BNRMTO, EPS,
265 DOUBLE PRECISION DLAMCH, ZLANGE
266 EXTERNAL lsame, ilaenv, dlamch, zlange
275 IF( lsame( jobvsl,
'N' ) )
THEN
278 ELSE IF( lsame( jobvsl,
'V' ) )
THEN
286 IF( lsame( jobvsr,
'N' ) )
THEN
289 ELSE IF( lsame( jobvsr,
'V' ) )
THEN
299 lwkmin = max( 2*n, 1 )
302 lquery = ( lwork.EQ.-1 )
304 IF( ijobvl.LE.0 )
THEN
306 ELSE IF( ijobvr.LE.0 )
THEN
308 ELSE IF( n.LT.0 )
THEN
310 ELSE IF( lda.LT.max( 1, n ) )
THEN
312 ELSE IF( ldb.LT.max( 1, n ) )
THEN
314 ELSE IF( ldvsl.LT.1 .OR. ( ilvsl .AND. ldvsl.LT.n ) )
THEN
316 ELSE IF( ldvsr.LT.1 .OR. ( ilvsr .AND. ldvsr.LT.n ) )
THEN
318 ELSE IF( lwork.LT.lwkmin .AND. .NOT.lquery )
THEN
323 nb1 = ilaenv( 1,
'ZGEQRF',
' ', n, n, -1, -1 )
324 nb2 = ilaenv( 1,
'ZUNMQR',
' ', n, n, n, -1 )
325 nb3 = ilaenv( 1,
'ZUNGQR',
' ', n, n, n, -1 )
326 nb = max( nb1, nb2, nb3 )
332 CALL xerbla(
'ZGEGS ', -info )
334 ELSE IF( lquery )
THEN
345 eps = dlamch(
'E' )*dlamch(
'B' )
346 safmin = dlamch(
'S' )
347 smlnum = n*safmin / eps
348 bignum = one / smlnum
352 anrm = zlange(
'M', n, n, a, lda, rwork )
354 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
357 ELSE IF( anrm.GT.bignum )
THEN
363 CALL zlascl(
'G', -1, -1, anrm, anrmto, n, n, a, lda, iinfo )
364 IF( iinfo.NE.0 )
THEN
372 bnrm = zlange(
'M', n, n, b, ldb, rwork )
374 IF( bnrm.GT.zero .AND. bnrm.LT.smlnum )
THEN
377 ELSE IF( bnrm.GT.bignum )
THEN
383 CALL zlascl(
'G', -1, -1, bnrm, bnrmto, n, n, b, ldb, iinfo )
384 IF( iinfo.NE.0 )
THEN
396 CALL zggbal(
'P', n, a, lda, b, ldb, ilo, ihi, rwork( ileft ),
397 $ rwork( iright ), rwork( irwork ), iinfo )
398 IF( iinfo.NE.0 )
THEN
405 irows = ihi + 1 - ilo
409 CALL zgeqrf( irows, icols, b( ilo, ilo ), ldb, work( itau ),
410 $ work( iwork ), lwork+1-iwork, iinfo )
412 $ lwkopt = max( lwkopt, int( work( iwork ) )+iwork-1 )
413 IF( iinfo.NE.0 )
THEN
418 CALL zunmqr(
'L',
'C', irows, icols, irows, b( ilo, ilo ), ldb,
419 $ work( itau ), a( ilo, ilo ), lda, work( iwork ),
420 $ lwork+1-iwork, iinfo )
422 $ lwkopt = max( lwkopt, int( work( iwork ) )+iwork-1 )
423 IF( iinfo.NE.0 )
THEN
429 CALL zlaset(
'Full', n, n, czero, cone, vsl, ldvsl )
430 CALL zlacpy(
'L', irows-1, irows-1, b( ilo+1, ilo ), ldb,
431 $ vsl( ilo+1, ilo ), ldvsl )
432 CALL zungqr( irows, irows, irows, vsl( ilo, ilo ), ldvsl,
433 $ work( itau ), work( iwork ), lwork+1-iwork,
436 $ lwkopt = max( lwkopt, int( work( iwork ) )+iwork-1 )
437 IF( iinfo.NE.0 )
THEN
444 $
CALL zlaset(
'Full', n, n, czero, cone, vsr, ldvsr )
448 CALL zgghrd( jobvsl, jobvsr, n, ilo, ihi, a, lda, b, ldb, vsl,
449 $ ldvsl, vsr, ldvsr, iinfo )
450 IF( iinfo.NE.0 )
THEN
458 CALL zhgeqz(
'S', jobvsl, jobvsr, n, ilo, ihi, a, lda, b, ldb,
459 $ alpha, beta, vsl, ldvsl, vsr, ldvsr, work( iwork ),
460 $ lwork+1-iwork, rwork( irwork ), iinfo )
462 $ lwkopt = max( lwkopt, int( work( iwork ) )+iwork-1 )
463 IF( iinfo.NE.0 )
THEN
464 IF( iinfo.GT.0 .AND. iinfo.LE.n )
THEN
466 ELSE IF( iinfo.GT.n .AND. iinfo.LE.2*n )
THEN
477 CALL zggbak(
'P',
'L', n, ilo, ihi, rwork( ileft ),
478 $ rwork( iright ), n, vsl, ldvsl, iinfo )
479 IF( iinfo.NE.0 )
THEN
485 CALL zggbak(
'P',
'R', n, ilo, ihi, rwork( ileft ),
486 $ rwork( iright ), n, vsr, ldvsr, iinfo )
487 IF( iinfo.NE.0 )
THEN
496 CALL zlascl(
'U', -1, -1, anrmto, anrm, n, n, a, lda, iinfo )
497 IF( iinfo.NE.0 )
THEN
501 CALL zlascl(
'G', -1, -1, anrmto, anrm, n, 1, alpha, n, iinfo )
502 IF( iinfo.NE.0 )
THEN
509 CALL zlascl(
'U', -1, -1, bnrmto, bnrm, n, n, b, ldb, iinfo )
510 IF( iinfo.NE.0 )
THEN
514 CALL zlascl(
'G', -1, -1, bnrmto, bnrm, n, 1, beta, n, iinfo )
515 IF( iinfo.NE.0 )
THEN
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 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 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
subroutine zgegs(jobvsl, jobvsr, n, a, lda, b, ldb, alpha, beta, vsl, ldvsl, vsr, ldvsr, work, lwork, rwork, info)
ZGEGS computes the eigenvalues, Schur form, and, optionally, the left and or/right Schur vectors of a...