256 SUBROUTINE cheevx( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU,
257 $ ABSTOL, M, W, Z, LDZ, WORK, LWORK, RWORK,
258 $ IWORK, IFAIL, INFO )
265 CHARACTER JOBZ, RANGE, UPLO
266 INTEGER IL, INFO, IU, LDA, LDZ, LWORK, M, N
270 INTEGER IFAIL( * ), IWORK( * )
271 REAL RWORK( * ), W( * )
272 COMPLEX A( LDA, * ), WORK( * ), Z( LDZ, * )
279 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0 )
281 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
284 LOGICAL ALLEIG, INDEIG, LOWER, LQUERY, TEST, VALEIG,
287 INTEGER I, IINFO, IMAX, INDD, INDE, INDEE, INDIBL,
288 $ indisp, indiwk, indrwk, indtau, indwrk, iscale,
289 $ itmp1, j, jj, llwork, lwkmin, lwkopt, nb,
291 REAL ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
292 $ SIGMA, SMLNUM, TMP1, VLL, VUU
297 REAL SLAMCH, CLANHE, SROUNDUP_LWORK
298 EXTERNAL lsame, ilaenv, slamch, clanhe, sroundup_lwork
306 INTRINSIC real, max, min, sqrt
312 lower = lsame( uplo,
'L' )
313 wantz = lsame( jobz,
'V' )
314 alleig = lsame( range,
'A' )
315 valeig = lsame( range,
'V' )
316 indeig = lsame( range,
'I' )
317 lquery = ( lwork.EQ.-1 )
320 IF( .NOT.( wantz .OR. lsame( jobz,
'N' ) ) )
THEN
322 ELSE IF( .NOT.( alleig .OR. valeig .OR. indeig ) )
THEN
324 ELSE IF( .NOT.( lower .OR. lsame( uplo,
'U' ) ) )
THEN
326 ELSE IF( n.LT.0 )
THEN
328 ELSE IF( lda.LT.max( 1, n ) )
THEN
332 IF( n.GT.0 .AND. vu.LE.vl )
334 ELSE IF( indeig )
THEN
335 IF( il.LT.1 .OR. il.GT.max( 1, n ) )
THEN
337 ELSE IF( iu.LT.min( n, il ) .OR. iu.GT.n )
THEN
343 IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) )
THEN
354 nb = ilaenv( 1,
'CHETRD', uplo, n, -1, -1, -1 )
355 nb = max( nb, ilaenv( 1,
'CUNMTR', uplo, n, -1, -1, -1 ) )
356 lwkopt = max( 1, ( nb + 1 )*n )
357 work( 1 ) = sroundup_lwork(lwkopt)
360 IF( lwork.LT.lwkmin .AND. .NOT.lquery )
365 CALL xerbla(
'CHEEVX', -info )
367 ELSE IF( lquery )
THEN
379 IF( alleig .OR. indeig )
THEN
381 w( 1 ) = real( a( 1, 1 ) )
382 ELSE IF( valeig )
THEN
383 IF( vl.LT.real( a( 1, 1 ) ) .AND. vu.GE.real( a( 1, 1 ) ) )
386 w( 1 ) = real( a( 1, 1 ) )
396 safmin = slamch(
'Safe minimum' )
397 eps = slamch(
'Precision' )
398 smlnum = safmin / eps
399 bignum = one / smlnum
400 rmin = sqrt( smlnum )
401 rmax = min( sqrt( bignum ), one / sqrt( sqrt( safmin ) ) )
411 anrm = clanhe(
'M', uplo, n, a, lda, rwork )
412 IF( anrm.GT.zero .AND. anrm.LT.rmin )
THEN
415 ELSE IF( anrm.GT.rmax )
THEN
419 IF( iscale.EQ.1 )
THEN
422 CALL csscal( n-j+1, sigma, a( j, j ), 1 )
426 CALL csscal( j, sigma, a( 1, j ), 1 )
430 $ abstll = abstol*sigma
444 llwork = lwork - indwrk + 1
445 CALL chetrd( uplo, n, a, lda, rwork( indd ), rwork( inde ),
446 $ work( indtau ), work( indwrk ), llwork, iinfo )
454 IF( il.EQ.1 .AND. iu.EQ.n )
THEN
458 IF( ( alleig .OR. test ) .AND. ( abstol.LE.zero ) )
THEN
459 CALL scopy( n, rwork( indd ), 1, w, 1 )
461 IF( .NOT.wantz )
THEN
462 CALL scopy( n-1, rwork( inde ), 1, rwork( indee ), 1 )
463 CALL ssterf( n, w, rwork( indee ), info )
465 CALL clacpy(
'A', n, n, a, lda, z, ldz )
466 CALL cungtr( uplo, n, z, ldz, work( indtau ),
467 $ work( indwrk ), llwork, iinfo )
468 CALL scopy( n-1, rwork( inde ), 1, rwork( indee ), 1 )
469 CALL csteqr( jobz, n, w, rwork( indee ), z, ldz,
470 $ rwork( indrwk ), info )
494 CALL sstebz( range, order, n, vll, vuu, il, iu, abstll,
495 $ rwork( indd ), rwork( inde ), m, nsplit, w,
496 $ iwork( indibl ), iwork( indisp ), rwork( indrwk ),
497 $ iwork( indiwk ), info )
500 CALL cstein( n, rwork( indd ), rwork( inde ), m, w,
501 $ iwork( indibl ), iwork( indisp ), z, ldz,
502 $ rwork( indrwk ), iwork( indiwk ), ifail, info )
507 CALL cunmtr(
'L', uplo,
'N', n, m, a, lda, work( indtau ), z,
508 $ ldz, work( indwrk ), llwork, iinfo )
514 IF( iscale.EQ.1 )
THEN
520 CALL sscal( imax, one / sigma, w, 1 )
531 IF( w( jj ).LT.tmp1 )
THEN
538 itmp1 = iwork( indibl+i-1 )
540 iwork( indibl+i-1 ) = iwork( indibl+j-1 )
542 iwork( indibl+j-1 ) = itmp1
543 CALL cswap( n, z( 1, i ), 1, z( 1, j ), 1 )
546 ifail( i ) = ifail( j )
555 work( 1 ) = sroundup_lwork(lwkopt)
subroutine xerbla(srname, info)
subroutine scopy(n, sx, incx, sy, incy)
SCOPY
subroutine cheevx(jobz, range, uplo, n, a, lda, vl, vu, il, iu, abstol, m, w, z, ldz, work, lwork, rwork, iwork, ifail, info)
CHEEVX computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices
subroutine chetrd(uplo, n, a, lda, d, e, tau, work, lwork, info)
CHETRD
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine sstebz(range, order, n, vl, vu, il, iu, abstol, d, e, m, nsplit, w, iblock, isplit, work, iwork, info)
SSTEBZ
subroutine cstein(n, d, e, m, w, iblock, isplit, z, ldz, work, iwork, ifail, info)
CSTEIN
subroutine csteqr(compz, n, d, e, z, ldz, work, info)
CSTEQR
subroutine ssterf(n, d, e, info)
SSTERF
subroutine cswap(n, cx, incx, cy, incy)
CSWAP
subroutine cungtr(uplo, n, a, lda, tau, work, lwork, info)
CUNGTR
subroutine cunmtr(side, uplo, trans, m, n, a, lda, tau, c, ldc, work, lwork, info)
CUNMTR