278 SUBROUTINE dgeesx( JOBVS, SORT, SELECT, SENSE, N, A, LDA, SDIM,
279 $ WR, WI, VS, LDVS, RCONDE, RCONDV, WORK, LWORK,
280 $ IWORK, LIWORK, BWORK, INFO )
287 CHARACTER JOBVS, SENSE, SORT
288 INTEGER INFO, LDA, LDVS, LIWORK, LWORK, N, SDIM
289 DOUBLE PRECISION RCONDE, RCONDV
294 DOUBLE PRECISION A( LDA, * ), VS( LDVS, * ), WI( * ), WORK( * ),
305 DOUBLE PRECISION ZERO, ONE
306 PARAMETER ( ZERO = 0.0d0, one = 1.0d0 )
309 LOGICAL CURSL, LASTSL, LQUERY, LST2SL, SCALEA, WANTSB,
310 $ WANTSE, WANTSN, WANTST, WANTSV, WANTVS
311 INTEGER HSWORK, I, I1, I2, IBAL, ICOND, IERR, IEVAL,
312 $ IHI, ILO, INXT, IP, ITAU, IWRK, LIWRK, LWRK,
314 DOUBLE PRECISION ANRM, BIGNUM, CSCALE, EPS, SMLNUM
317 DOUBLE PRECISION DUM( 1 )
326 DOUBLE PRECISION DLAMCH, DLANGE
327 EXTERNAL lsame, ilaenv, dlamch, dlange
337 wantvs = lsame( jobvs,
'V' )
338 wantst = lsame( sort,
'S' )
339 wantsn = lsame( sense,
'N' )
340 wantse = lsame( sense,
'E' )
341 wantsv = lsame( sense,
'V' )
342 wantsb = lsame( sense,
'B' )
343 lquery = ( lwork.EQ.-1 .OR. liwork.EQ.-1 )
345 IF( ( .NOT.wantvs ) .AND. ( .NOT.lsame( jobvs,
'N' ) ) )
THEN
347 ELSE IF( ( .NOT.wantst ) .AND. ( .NOT.lsame( sort,
'N' ) ) )
THEN
349 ELSE IF( .NOT.( wantsn .OR. wantse .OR. wantsv .OR. wantsb ) .OR.
350 $ ( .NOT.wantst .AND. .NOT.wantsn ) )
THEN
352 ELSE IF( n.LT.0 )
THEN
354 ELSE IF( lda.LT.max( 1, n ) )
THEN
356 ELSE IF( ldvs.LT.1 .OR. ( wantvs .AND. ldvs.LT.n ) )
THEN
380 maxwrk = 2*n + n*ilaenv( 1,
'DGEHRD',
' ', n, 1, n, 0 )
383 CALL dhseqr(
'S', jobvs, n, 1, n, a, lda, wr, wi, vs, ldvs,
385 hswork = int( work( 1 ) )
387 IF( .NOT.wantvs )
THEN
388 maxwrk = max( maxwrk, n + hswork )
390 maxwrk = max( maxwrk, 2*n + ( n - 1 )*ilaenv( 1,
391 $
'DORGHR',
' ', n, 1, n, -1 ) )
392 maxwrk = max( maxwrk, n + hswork )
396 $ lwrk = max( lwrk, n + ( n*n )/2 )
397 IF( wantsv .OR. wantsb )
403 IF( lwork.LT.minwrk .AND. .NOT.lquery )
THEN
405 ELSE IF( liwork.LT.1 .AND. .NOT.lquery )
THEN
411 CALL xerbla(
'DGEESX', -info )
413 ELSE IF( lquery )
THEN
427 smlnum = dlamch(
'S' )
428 bignum = one / smlnum
429 smlnum = sqrt( smlnum ) / eps
430 bignum = one / smlnum
434 anrm = dlange(
'M', n, n, a, lda, dum )
436 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
439 ELSE IF( anrm.GT.bignum )
THEN
444 $
CALL dlascl(
'G', 0, 0, anrm, cscale, n, n, a, lda, ierr )
450 CALL dgebal(
'P', n, a, lda, ilo, ihi, work( ibal ), ierr )
457 CALL dgehrd( n, ilo, ihi, a, lda, work( itau ), work( iwrk ),
458 $ lwork-iwrk+1, ierr )
464 CALL dlacpy(
'L', n, n, a, lda, vs, ldvs )
469 CALL dorghr( n, ilo, ihi, vs, ldvs, work( itau ), work( iwrk ),
470 $ lwork-iwrk+1, ierr )
479 CALL dhseqr(
'S', jobvs, n, ilo, ihi, a, lda, wr, wi, vs, ldvs,
480 $ work( iwrk ), lwork-iwrk+1, ieval )
486 IF( wantst .AND. info.EQ.0 )
THEN
488 CALL dlascl(
'G', 0, 0, cscale, anrm, n, 1, wr, n, ierr )
489 CALL dlascl(
'G', 0, 0, cscale, anrm, n, 1, wi, n, ierr )
492 bwork( i ) =
SELECT( wr( i ), wi( i ) )
502 CALL dtrsen( sense, jobvs, bwork, n, a, lda, vs, ldvs, wr, wi,
503 $ sdim, rconde, rcondv, work( iwrk ), lwork-iwrk+1,
504 $ iwork, liwork, icond )
506 $ maxwrk = max( maxwrk, n+2*sdim*( n-sdim ) )
507 IF( icond.EQ.-15 )
THEN
512 ELSE IF( icond.EQ.-17 )
THEN
517 ELSE IF( icond.GT.0 )
THEN
530 CALL dgebak(
'P',
'R', n, ilo, ihi, work( ibal ), n, vs, ldvs,
538 CALL dlascl(
'H', 0, 0, cscale, anrm, n, n, a, lda, ierr )
539 CALL dcopy( n, a, lda+1, wr, 1 )
540 IF( ( wantsv .OR. wantsb ) .AND. info.EQ.0 )
THEN
542 CALL dlascl(
'G', 0, 0, cscale, anrm, 1, 1, dum, 1, ierr )
545 IF( cscale.EQ.smlnum )
THEN
551 IF( ieval.GT.0 )
THEN
554 CALL dlascl(
'G', 0, 0, cscale, anrm, ilo-1, 1, wi, n,
556 ELSE IF( wantst )
THEN
567 IF( wi( i ).EQ.zero )
THEN
570 IF( a( i+1, i ).EQ.zero )
THEN
573 ELSE IF( a( i+1, i ).NE.zero .AND. a( i, i+1 ).EQ.
578 $
CALL dswap( i-1, a( 1, i ), 1, a( 1, i+1 ), 1 )
580 $
CALL dswap( n-i-1, a( i, i+2 ), lda,
581 $ a( i+1, i+2 ), lda )
583 CALL dswap( n, vs( 1, i ), 1, vs( 1, i+1 ), 1 )
585 a( i, i+1 ) = a( i+1, i )
592 CALL dlascl(
'G', 0, 0, cscale, anrm, n-ieval, 1,
593 $ wi( ieval+1 ), max( n-ieval, 1 ), ierr )
596 IF( wantst .AND. info.EQ.0 )
THEN
605 cursl =
SELECT( wr( i ), wi( i ) )
606 IF( wi( i ).EQ.zero )
THEN
610 IF( cursl .AND. .NOT.lastsl )
617 cursl = cursl .OR. lastsl
622 IF( cursl .AND. .NOT.lst2sl )
637 IF( wantsv .OR. wantsb )
THEN
638 iwork( 1 ) = max( 1, sdim*( n-sdim ) )
subroutine xerbla(srname, info)
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
subroutine dgebak(job, side, n, ilo, ihi, scale, m, v, ldv, info)
DGEBAK
subroutine dgebal(job, n, a, lda, ilo, ihi, scale, info)
DGEBAL
subroutine dgeesx(jobvs, sort, select, sense, n, a, lda, sdim, wr, wi, vs, ldvs, rconde, rcondv, work, lwork, iwork, liwork, bwork, info)
DGEESX computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE ...
subroutine dgehrd(n, ilo, ihi, a, lda, tau, work, lwork, info)
DGEHRD
subroutine dhseqr(job, compz, n, ilo, ihi, h, ldh, wr, wi, z, ldz, work, lwork, info)
DHSEQR
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
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 dswap(n, dx, incx, dy, incy)
DSWAP
subroutine dtrsen(job, compq, select, n, t, ldt, q, ldq, wr, wi, m, s, sep, work, lwork, iwork, liwork, info)
DTRSEN
subroutine dorghr(n, ilo, ihi, a, lda, tau, work, lwork, info)
DORGHR