193 SUBROUTINE cgees( JOBVS, SORT, SELECT, N, A, LDA, SDIM, W, VS,
194 $ LDVS, WORK, LWORK, RWORK, BWORK, INFO )
201 CHARACTER JOBVS, SORT
202 INTEGER INFO, LDA, LDVS, LWORK, N, SDIM
207 COMPLEX A( LDA, * ), VS( LDVS, * ), W( * ), WORK( * )
218 parameter( zero = 0.0e0, one = 1.0e0 )
221 LOGICAL LQUERY, SCALEA, WANTST, WANTVS
222 INTEGER HSWORK, I, IBAL, ICOND, IERR, IEVAL, IHI, ILO,
223 $ itau, iwrk, maxwrk, minwrk
224 REAL ANRM, BIGNUM, CSCALE, EPS, S, SEP, SMLNUM
237 REAL CLANGE, SLAMCH, SROUNDUP_LWORK
238 EXTERNAL lsame, ilaenv, clange,
239 $ slamch, sroundup_lwork
249 lquery = ( lwork.EQ.-1 )
250 wantvs = lsame( jobvs,
'V' )
251 wantst = lsame( sort,
'S' )
252 IF( ( .NOT.wantvs ) .AND. ( .NOT.lsame( jobvs,
'N' ) ) )
THEN
254 ELSE IF( ( .NOT.wantst ) .AND.
255 $ ( .NOT.lsame( sort,
'N' ) ) )
THEN
257 ELSE IF( n.LT.0 )
THEN
259 ELSE IF( lda.LT.max( 1, n ) )
THEN
261 ELSE IF( ldvs.LT.1 .OR. ( wantvs .AND. ldvs.LT.n ) )
THEN
281 maxwrk = n + n*ilaenv( 1,
'CGEHRD',
' ', n, 1, n, 0 )
284 CALL chseqr(
'S', jobvs, n, 1, n, a, lda, w, vs, ldvs,
286 hswork = int( work( 1 ) )
288 IF( .NOT.wantvs )
THEN
289 maxwrk = max( maxwrk, hswork )
291 maxwrk = max( maxwrk, n + ( n - 1 )*ilaenv( 1,
293 $
' ', n, 1, n, -1 ) )
294 maxwrk = max( maxwrk, hswork )
297 work( 1 ) = sroundup_lwork(maxwrk)
299 IF( lwork.LT.minwrk .AND. .NOT.lquery )
THEN
305 CALL xerbla(
'CGEES ', -info )
307 ELSE IF( lquery )
THEN
321 smlnum = slamch(
'S' )
322 bignum = one / smlnum
323 smlnum = sqrt( smlnum ) / eps
324 bignum = one / smlnum
328 anrm = clange(
'M', n, n, a, lda, dum )
330 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
333 ELSE IF( anrm.GT.bignum )
THEN
338 $
CALL clascl(
'G', 0, 0, anrm, cscale, n, n, a, lda, ierr )
345 CALL cgebal(
'P', n, a, lda, ilo, ihi, rwork( ibal ), ierr )
353 CALL cgehrd( n, ilo, ihi, a, lda, work( itau ), work( iwrk ),
354 $ lwork-iwrk+1, ierr )
360 CALL clacpy(
'L', n, n, a, lda, vs, ldvs )
366 CALL cunghr( n, ilo, ihi, vs, ldvs, work( itau ),
368 $ lwork-iwrk+1, ierr )
378 CALL chseqr(
'S', jobvs, n, ilo, ihi, a, lda, w, vs, ldvs,
379 $ work( iwrk ), lwork-iwrk+1, ieval )
385 IF( wantst .AND. info.EQ.0 )
THEN
387 $
CALL clascl(
'G', 0, 0, cscale, anrm, n, 1, w, n, ierr )
389 bwork( i ) =
SELECT( w( i ) )
396 CALL ctrsen(
'N', jobvs, bwork, n, a, lda, vs, ldvs, w,
398 $ s, sep, work( iwrk ), lwork-iwrk+1, icond )
407 CALL cgebak(
'P',
'R', n, ilo, ihi, rwork( ibal ), n, vs,
416 CALL clascl(
'U', 0, 0, cscale, anrm, n, n, a, lda, ierr )
417 CALL ccopy( n, a, lda+1, w, 1 )
420 work( 1 ) = sroundup_lwork(maxwrk)
subroutine cgees(jobvs, sort, select, n, a, lda, sdim, w, vs, ldvs, work, lwork, rwork, bwork, info)
CGEES computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE m...