236 SUBROUTINE cgeesx( 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
252 COMPLEX A( LDA, * ), VS( LDVS, * ), W( * ), WORK( * )
263 PARAMETER ( ZERO = 0.0e0, one = 1.0e0 )
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 REAL ANRM, BIGNUM, CSCALE, EPS, SMLNUM
282 REAL CLANGE, SLAMCH, SROUNDUP_LWORK
283 EXTERNAL lsame, ilaenv, clange, slamch, sroundup_lwork
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,
'CGEHRD',
' ', n, 1, n, 0 )
338 CALL chseqr(
'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,
'CUNGHR',
346 $
' ', n, 1, n, -1 ) )
347 maxwrk = max( maxwrk, hswork )
351 $ lwrk = max( lwrk, ( n*n )/2 )
353 work( 1 ) = sroundup_lwork(lwrk)
355 IF( lwork.LT.minwrk .AND. .NOT.lquery )
THEN
361 CALL xerbla(
'CGEESX', -info )
363 ELSE IF( lquery )
THEN
377 smlnum = slamch(
'S' )
378 bignum = one / smlnum
379 smlnum = sqrt( smlnum ) / eps
380 bignum = one / smlnum
384 anrm = clange(
'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 clascl(
'G', 0, 0, anrm, cscale, n, n, a, lda, ierr )
402 CALL cgebal(
'P', n, a, lda, ilo, ihi, rwork( ibal ), ierr )
410 CALL cgehrd( n, ilo, ihi, a, lda, work( itau ), work( iwrk ),
411 $ lwork-iwrk+1, ierr )
417 CALL clacpy(
'L', n, n, a, lda, vs, ldvs )
423 CALL cunghr( n, ilo, ihi, vs, ldvs, work( itau ), work( iwrk ),
424 $ lwork-iwrk+1, ierr )
434 CALL chseqr(
'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 clascl(
'G', 0, 0, cscale, anrm, n, 1, w, n, ierr )
445 bwork( i ) =
SELECT( w( i ) )
454 CALL ctrsen( 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 cgebak(
'P',
'R', n, ilo, ihi, rwork( ibal ), n, vs, ldvs,
481 CALL clascl(
'U', 0, 0, cscale, anrm, n, n, a, lda, ierr )
482 CALL ccopy( n, a, lda+1, w, 1 )
483 IF( ( wantsv .OR. wantsb ) .AND. info.EQ.0 )
THEN
485 CALL slascl(
'G', 0, 0, cscale, anrm, 1, 1, dum, 1, ierr )
490 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 cgeesx(jobvs, sort, select, sense, n, a, lda, sdim, w, vs, ldvs, rconde, rcondv, work, lwork, rwork, bwork, info)
CGEESX computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors for GE ...
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 slascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
SLASCL 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