214 SUBROUTINE dgees( JOBVS, SORT, SELECT, N, A, LDA, SDIM, WR, WI,
215 $ VS, LDVS, WORK, LWORK, BWORK, INFO )
222 CHARACTER JOBVS, SORT
223 INTEGER INFO, LDA, LDVS, LWORK, N, SDIM
227 DOUBLE PRECISION A( LDA, * ), VS( LDVS, * ), WI( * ), WORK( * ),
238 DOUBLE PRECISION ZERO, ONE
239 parameter( zero = 0.0d0, one = 1.0d0 )
242 LOGICAL CURSL, LASTSL, LQUERY, LST2SL, SCALEA, WANTST,
244 INTEGER HSWORK, I, I1, I2, IBAL, ICOND, IERR, IEVAL,
245 $ ihi, ilo, inxt, ip, itau, iwrk, maxwrk, minwrk
246 DOUBLE PRECISION ANRM, BIGNUM, CSCALE, EPS, S, SEP, SMLNUM
250 DOUBLE PRECISION DUM( 1 )
259 DOUBLE PRECISION DLAMCH, DLANGE
260 EXTERNAL lsame, ilaenv, dlamch, dlange
270 lquery = ( lwork.EQ.-1 )
271 wantvs = lsame( jobvs,
'V' )
272 wantst = lsame( sort,
'S' )
273 IF( ( .NOT.wantvs ) .AND. ( .NOT.lsame( jobvs,
'N' ) ) )
THEN
275 ELSE IF( ( .NOT.wantst ) .AND. ( .NOT.lsame( sort,
'N' ) ) )
THEN
277 ELSE IF( n.LT.0 )
THEN
279 ELSE IF( lda.LT.max( 1, n ) )
THEN
281 ELSE IF( ldvs.LT.1 .OR. ( wantvs .AND. ldvs.LT.n ) )
THEN
300 maxwrk = 2*n + n*ilaenv( 1,
'DGEHRD',
' ', n, 1, n, 0 )
303 CALL dhseqr(
'S', jobvs, n, 1, n, a, lda, wr, wi, vs, ldvs,
305 hswork = int( work( 1 ) )
307 IF( .NOT.wantvs )
THEN
308 maxwrk = max( maxwrk, n + hswork )
310 maxwrk = max( maxwrk, 2*n + ( n - 1 )*ilaenv( 1,
311 $
'DORGHR',
' ', n, 1, n, -1 ) )
312 maxwrk = max( maxwrk, n + hswork )
317 IF( lwork.LT.minwrk .AND. .NOT.lquery )
THEN
323 CALL xerbla(
'DGEES ', -info )
325 ELSE IF( lquery )
THEN
339 smlnum = dlamch(
'S' )
340 bignum = one / smlnum
341 smlnum = sqrt( smlnum ) / eps
342 bignum = one / smlnum
346 anrm = dlange(
'M', n, n, a, lda, dum )
348 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
351 ELSE IF( anrm.GT.bignum )
THEN
356 $
CALL dlascl(
'G', 0, 0, anrm, cscale, n, n, a, lda, ierr )
362 CALL dgebal(
'P', n, a, lda, ilo, ihi, work( ibal ), ierr )
369 CALL dgehrd( n, ilo, ihi, a, lda, work( itau ), work( iwrk ),
370 $ lwork-iwrk+1, ierr )
376 CALL dlacpy(
'L', n, n, a, lda, vs, ldvs )
381 CALL dorghr( n, ilo, ihi, vs, ldvs, work( itau ), work( iwrk ),
382 $ lwork-iwrk+1, ierr )
391 CALL dhseqr(
'S', jobvs, n, ilo, ihi, a, lda, wr, wi, vs, ldvs,
392 $ work( iwrk ), lwork-iwrk+1, ieval )
398 IF( wantst .AND. info.EQ.0 )
THEN
400 CALL dlascl(
'G', 0, 0, cscale, anrm, n, 1, wr, n, ierr )
401 CALL dlascl(
'G', 0, 0, cscale, anrm, n, 1, wi, n, ierr )
404 bwork( i ) =
SELECT( wr( i ), wi( i ) )
410 CALL dtrsen(
'N', jobvs, bwork, n, a, lda, vs, ldvs, wr, wi,
411 $ sdim, s, sep, work( iwrk ), lwork-iwrk+1, idum, 1,
422 CALL dgebak(
'P',
'R', n, ilo, ihi, work( ibal ), n, vs, ldvs,
430 CALL dlascl(
'H', 0, 0, cscale, anrm, n, n, a, lda, ierr )
431 CALL dcopy( n, a, lda+1, wr, 1 )
432 IF( cscale.EQ.smlnum )
THEN
438 IF( ieval.GT.0 )
THEN
441 CALL dlascl(
'G', 0, 0, cscale, anrm, ilo-1, 1, wi,
442 $ max( ilo-1, 1 ), ierr )
443 ELSE IF( wantst )
THEN
454 IF( wi( i ).EQ.zero )
THEN
457 IF( a( i+1, i ).EQ.zero )
THEN
460 ELSE IF( a( i+1, i ).NE.zero .AND. a( i, i+1 ).EQ.
465 $
CALL dswap( i-1, a( 1, i ), 1, a( 1, i+1 ), 1 )
467 $
CALL dswap( n-i-1, a( i, i+2 ), lda,
468 $ a( i+1, i+2 ), lda )
470 CALL dswap( n, vs( 1, i ), 1, vs( 1, i+1 ), 1 )
472 a( i, i+1 ) = a( i+1, i )
482 CALL dlascl(
'G', 0, 0, cscale, anrm, n-ieval, 1,
483 $ wi( ieval+1 ), max( n-ieval, 1 ), ierr )
486 IF( wantst .AND. info.EQ.0 )
THEN
495 cursl =
SELECT( wr( i ), wi( i ) )
496 IF( wi( i ).EQ.zero )
THEN
500 IF( cursl .AND. .NOT.lastsl )
507 cursl = cursl .OR. lastsl
512 IF( cursl .AND. .NOT.lst2sl )
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 dgees(jobvs, sort, select, n, a, lda, sdim, wr, wi, vs, ldvs, work, lwork, bwork, info)
DGEES computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE m...
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