236 SUBROUTINE zgeesx( JOBVS, SORT, SELECT, SENSE, N, A, LDA, SDIM, W,
237 $ VS, LDVS, RCONDE, RCONDV, WORK, LWORK, RWORK,
245 CHARACTER JOBVS, SENSE, SORT
246 INTEGER INFO, LDA, LDVS, LWORK, N, SDIM
247 DOUBLE PRECISION RCONDE, RCONDV
251 DOUBLE PRECISION RWORK( * )
252 COMPLEX*16 A( LDA, * ), VS( LDVS, * ), W( * ), WORK( * )
262 DOUBLE PRECISION ZERO, ONE
263 PARAMETER ( ZERO = 0.0d0, one = 1.0d0 )
266 LOGICAL LQUERY, SCALEA, WANTSB, WANTSE, WANTSN, WANTST,
268 INTEGER HSWORK, I, IBAL, ICOND, IERR, IEVAL, IHI, ILO,
269 $ ITAU, IWRK, LWRK, MAXWRK, MINWRK
270 DOUBLE PRECISION ANRM, BIGNUM, CSCALE, EPS, SMLNUM
273 DOUBLE PRECISION DUM( 1 )
282 DOUBLE PRECISION DLAMCH, ZLANGE
283 EXTERNAL lsame, ilaenv, dlamch, zlange
293 wantvs = lsame( jobvs,
'V' )
294 wantst = lsame( sort,
'S' )
295 wantsn = lsame( sense,
'N' )
296 wantse = lsame( sense,
'E' )
297 wantsv = lsame( sense,
'V' )
298 wantsb = lsame( sense,
'B' )
299 lquery = ( lwork.EQ.-1 )
301 IF( ( .NOT.wantvs ) .AND. ( .NOT.lsame( jobvs,
'N' ) ) )
THEN
303 ELSE IF( ( .NOT.wantst ) .AND. ( .NOT.lsame( sort,
'N' ) ) )
THEN
305 ELSE IF( .NOT.( wantsn .OR. wantse .OR. wantsv .OR. wantsb ) .OR.
306 $ ( .NOT.wantst .AND. .NOT.wantsn ) )
THEN
308 ELSE IF( n.LT.0 )
THEN
310 ELSE IF( lda.LT.max( 1, n ) )
THEN
312 ELSE IF( ldvs.LT.1 .OR. ( wantvs .AND. ldvs.LT.n ) )
THEN
335 maxwrk = n + n*ilaenv( 1,
'ZGEHRD',
' ', n, 1, n, 0 )
338 CALL zhseqr(
'S', jobvs, n, 1, n, a, lda, w, vs, ldvs,
340 hswork = int( work( 1 ) )
342 IF( .NOT.wantvs )
THEN
343 maxwrk = max( maxwrk, hswork )
345 maxwrk = max( maxwrk, n + ( n - 1 )*ilaenv( 1,
'ZUNGHR',
346 $
' ', n, 1, n, -1 ) )
347 maxwrk = max( maxwrk, hswork )
351 $ lwrk = max( lwrk, ( n*n )/2 )
355 IF( lwork.LT.minwrk .AND. .NOT.lquery )
THEN
361 CALL xerbla(
'ZGEESX', -info )
363 ELSE IF( lquery )
THEN
377 smlnum = dlamch(
'S' )
378 bignum = one / smlnum
379 smlnum = sqrt( smlnum ) / eps
380 bignum = one / smlnum
384 anrm = zlange(
'M', n, n, a, lda, dum )
386 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
389 ELSE IF( anrm.GT.bignum )
THEN
394 $
CALL zlascl(
'G', 0, 0, anrm, cscale, n, n, a, lda, ierr )
402 CALL zgebal(
'P', n, a, lda, ilo, ihi, rwork( ibal ), ierr )
410 CALL zgehrd( n, ilo, ihi, a, lda, work( itau ), work( iwrk ),
411 $ lwork-iwrk+1, ierr )
417 CALL zlacpy(
'L', n, n, a, lda, vs, ldvs )
423 CALL zunghr( n, ilo, ihi, vs, ldvs, work( itau ), work( iwrk ),
424 $ lwork-iwrk+1, ierr )
434 CALL zhseqr(
'S', jobvs, n, ilo, ihi, a, lda, w, vs, ldvs,
435 $ work( iwrk ), lwork-iwrk+1, ieval )
441 IF( wantst .AND. info.EQ.0 )
THEN
443 $
CALL zlascl(
'G', 0, 0, cscale, anrm, n, 1, w, n, ierr )
445 bwork( i ) =
SELECT( w( i ) )
454 CALL ztrsen( sense, jobvs, bwork, n, a, lda, vs, ldvs, w, sdim,
455 $ rconde, rcondv, work( iwrk ), lwork-iwrk+1,
458 $ maxwrk = max( maxwrk, 2*sdim*( n-sdim ) )
459 IF( icond.EQ.-14 )
THEN
473 CALL zgebak(
'P',
'R', n, ilo, ihi, rwork( ibal ), n, vs, ldvs,
481 CALL zlascl(
'U', 0, 0, cscale, anrm, n, n, a, lda, ierr )
482 CALL zcopy( n, a, lda+1, w, 1 )
483 IF( ( wantsv .OR. wantsb ) .AND. info.EQ.0 )
THEN
485 CALL dlascl(
'G', 0, 0, cscale, anrm, 1, 1, dum, 1, ierr )
subroutine xerbla(srname, info)
subroutine zcopy(n, zx, incx, zy, incy)
ZCOPY
subroutine zgebak(job, side, n, ilo, ihi, scale, m, v, ldv, info)
ZGEBAK
subroutine zgebal(job, n, a, lda, ilo, ihi, scale, info)
ZGEBAL
subroutine zgeesx(jobvs, sort, select, sense, n, a, lda, sdim, w, vs, ldvs, rconde, rcondv, work, lwork, rwork, bwork, info)
ZGEESX computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE ...
subroutine zgehrd(n, ilo, ihi, a, lda, tau, work, lwork, info)
ZGEHRD
subroutine zhseqr(job, compz, n, ilo, ihi, h, ldh, w, z, ldz, work, lwork, info)
ZHSEQR
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 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 ztrsen(job, compq, select, n, t, ldt, q, ldq, w, m, s, sep, work, lwork, info)
ZTRSEN
subroutine zunghr(n, ilo, ihi, a, lda, tau, work, lwork, info)
ZUNGHR