195 SUBROUTINE cgees( JOBVS, SORT, SELECT, N, A, LDA, SDIM, W, VS,
196 $ LDVS, WORK, LWORK, RWORK, BWORK, INFO )
203 CHARACTER JOBVS, SORT
204 INTEGER INFO, LDA, LDVS, LWORK, N, SDIM
209 COMPLEX A( LDA, * ), VS( LDVS, * ), W( * ), WORK( * )
220 parameter( zero = 0.0e0, one = 1.0e0 )
223 LOGICAL LQUERY, SCALEA, WANTST, WANTVS
224 INTEGER HSWORK, I, IBAL, ICOND, IERR, IEVAL, IHI, ILO,
225 $ itau, iwrk, maxwrk, minwrk
226 REAL ANRM, BIGNUM, CSCALE, EPS, S, SEP, SMLNUM
238 REAL CLANGE, SLAMCH, SROUNDUP_LWORK
239 EXTERNAL lsame, ilaenv, clange, 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. ( .NOT.lsame( sort,
'N' ) ) )
THEN
256 ELSE IF( n.LT.0 )
THEN
258 ELSE IF( lda.LT.max( 1, n ) )
THEN
260 ELSE IF( ldvs.LT.1 .OR. ( wantvs .AND. ldvs.LT.n ) )
THEN
280 maxwrk = n + n*ilaenv( 1,
'CGEHRD',
' ', n, 1, n, 0 )
283 CALL chseqr(
'S', jobvs, n, 1, n, a, lda, w, vs, ldvs,
285 hswork = int( work( 1 ) )
287 IF( .NOT.wantvs )
THEN
288 maxwrk = max( maxwrk, hswork )
290 maxwrk = max( maxwrk, n + ( n - 1 )*ilaenv( 1,
'CUNGHR',
291 $
' ', n, 1, n, -1 ) )
292 maxwrk = max( maxwrk, hswork )
295 work( 1 ) = sroundup_lwork(maxwrk)
297 IF( lwork.LT.minwrk .AND. .NOT.lquery )
THEN
303 CALL xerbla(
'CGEES ', -info )
305 ELSE IF( lquery )
THEN
319 smlnum = slamch(
'S' )
320 bignum = one / smlnum
321 smlnum = sqrt( smlnum ) / eps
322 bignum = one / smlnum
326 anrm = clange(
'M', n, n, a, lda, dum )
328 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
331 ELSE IF( anrm.GT.bignum )
THEN
336 $
CALL clascl(
'G', 0, 0, anrm, cscale, n, n, a, lda, ierr )
343 CALL cgebal(
'P', n, a, lda, ilo, ihi, rwork( ibal ), ierr )
351 CALL cgehrd( n, ilo, ihi, a, lda, work( itau ), work( iwrk ),
352 $ lwork-iwrk+1, ierr )
358 CALL clacpy(
'L', n, n, a, lda, vs, ldvs )
364 CALL cunghr( n, ilo, ihi, vs, ldvs, work( itau ), work( iwrk ),
365 $ lwork-iwrk+1, ierr )
375 CALL chseqr(
'S', jobvs, n, ilo, ihi, a, lda, w, vs, ldvs,
376 $ work( iwrk ), lwork-iwrk+1, ieval )
382 IF( wantst .AND. info.EQ.0 )
THEN
384 $
CALL clascl(
'G', 0, 0, cscale, anrm, n, 1, w, n, ierr )
386 bwork( i ) =
SELECT( w( i ) )
393 CALL ctrsen(
'N', jobvs, bwork, n, a, lda, vs, ldvs, w, sdim,
394 $ s, sep, work( iwrk ), lwork-iwrk+1, icond )
403 CALL cgebak(
'P',
'R', n, ilo, ihi, rwork( ibal ), n, vs, ldvs,
411 CALL clascl(
'U', 0, 0, cscale, anrm, n, n, a, lda, ierr )
412 CALL ccopy( n, a, lda+1, w, 1 )
415 work( 1 ) = sroundup_lwork(maxwrk)
subroutine xerbla(srname, info)
subroutine ccopy(n, cx, incx, cy, incy)
CCOPY
subroutine cgebak(job, side, n, ilo, ihi, scale, m, v, ldv, info)
CGEBAK
subroutine cgebal(job, n, a, lda, ilo, ihi, scale, info)
CGEBAL
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...
subroutine cgehrd(n, ilo, ihi, a, lda, tau, work, lwork, info)
CGEHRD
subroutine chseqr(job, compz, n, ilo, ihi, h, ldh, w, z, ldz, work, lwork, info)
CHSEQR
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
subroutine clascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
CLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine ctrsen(job, compq, select, n, t, ldt, q, ldq, w, m, s, sep, work, lwork, info)
CTRSEN
subroutine cunghr(n, ilo, ihi, a, lda, tau, work, lwork, info)
CUNGHR