254 SUBROUTINE cheevx( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL,
256 $ ABSTOL, M, W, Z, LDZ, WORK, LWORK, RWORK,
257 $ IWORK, IFAIL, INFO )
264 CHARACTER JOBZ, RANGE, UPLO
265 INTEGER IL, INFO, IU, LDA, LDZ, LWORK, M, N
269 INTEGER IFAIL( * ), IWORK( * )
270 REAL RWORK( * ), W( * )
271 COMPLEX A( LDA, * ), WORK( * ), Z( LDZ, * )
278 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0 )
280 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
283 LOGICAL ALLEIG, INDEIG, LOWER, LQUERY, TEST, VALEIG,
286 INTEGER I, IINFO, IMAX, INDD, INDE, INDEE, INDIBL,
287 $ INDISP, INDIWK, INDRWK, INDTAU, INDWRK, ISCALE,
288 $ itmp1, j, jj, llwork, lwkmin, lwkopt, nb,
290 REAL ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
291 $ SIGMA, SMLNUM, TMP1, VLL, VUU
296 REAL SLAMCH, CLANHE, SROUNDUP_LWORK
297 EXTERNAL lsame, ilaenv, slamch,
298 $ clanhe, sroundup_lwork
307 INTRINSIC real, max, min, sqrt
313 lower = lsame( uplo,
'L' )
314 wantz = lsame( jobz,
'V' )
315 alleig = lsame( range,
'A' )
316 valeig = lsame( range,
'V' )
317 indeig = lsame( range,
'I' )
318 lquery = ( lwork.EQ.-1 )
321 IF( .NOT.( wantz .OR. lsame( jobz,
'N' ) ) )
THEN
323 ELSE IF( .NOT.( alleig .OR. valeig .OR. indeig ) )
THEN
325 ELSE IF( .NOT.( lower .OR. lsame( uplo,
'U' ) ) )
THEN
327 ELSE IF( n.LT.0 )
THEN
329 ELSE IF( lda.LT.max( 1, n ) )
THEN
333 IF( n.GT.0 .AND. vu.LE.vl )
335 ELSE IF( indeig )
THEN
336 IF( il.LT.1 .OR. il.GT.max( 1, n ) )
THEN
338 ELSE IF( iu.LT.min( n, il ) .OR. iu.GT.n )
THEN
344 IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) )
THEN
355 nb = ilaenv( 1,
'CHETRD', uplo, n, -1, -1, -1 )
356 nb = max( nb, ilaenv( 1,
'CUNMTR', uplo, n, -1,
358 lwkopt = ( nb + 1 )*n
360 work( 1 ) = sroundup_lwork( lwkopt )
362 IF( lwork.LT.lwkmin .AND. .NOT.lquery )
367 CALL xerbla(
'CHEEVX', -info )
369 ELSE IF( lquery )
THEN
381 IF( alleig .OR. indeig )
THEN
383 w( 1 ) = real( a( 1, 1 ) )
384 ELSE IF( valeig )
THEN
385 IF( vl.LT.real( a( 1, 1 ) ) .AND. vu.GE.real( a( 1, 1 ) ) )
388 w( 1 ) = real( a( 1, 1 ) )
398 safmin = slamch(
'Safe minimum' )
399 eps = slamch(
'Precision' )
400 smlnum = safmin / eps
401 bignum = one / smlnum
402 rmin = sqrt( smlnum )
403 rmax = min( sqrt( bignum ), one / sqrt( sqrt( safmin ) ) )
413 anrm = clanhe(
'M', uplo, n, a, lda, rwork )
414 IF( anrm.GT.zero .AND. anrm.LT.rmin )
THEN
417 ELSE IF( anrm.GT.rmax )
THEN
421 IF( iscale.EQ.1 )
THEN
424 CALL csscal( n-j+1, sigma, a( j, j ), 1 )
428 CALL csscal( j, sigma, a( 1, j ), 1 )
432 $ abstll = abstol*sigma
446 llwork = lwork - indwrk + 1
447 CALL chetrd( uplo, n, a, lda, rwork( indd ), rwork( inde ),
448 $ work( indtau ), work( indwrk ), llwork, iinfo )
456 IF( il.EQ.1 .AND. iu.EQ.n )
THEN
460 IF( ( alleig .OR. test ) .AND. ( abstol.LE.zero ) )
THEN
461 CALL scopy( n, rwork( indd ), 1, w, 1 )
463 IF( .NOT.wantz )
THEN
464 CALL scopy( n-1, rwork( inde ), 1, rwork( indee ), 1 )
465 CALL ssterf( n, w, rwork( indee ), info )
467 CALL clacpy(
'A', n, n, a, lda, z, ldz )
468 CALL cungtr( uplo, n, z, ldz, work( indtau ),
469 $ work( indwrk ), llwork, iinfo )
470 CALL scopy( n-1, rwork( inde ), 1, rwork( indee ), 1 )
471 CALL csteqr( jobz, n, w, rwork( indee ), z, ldz,
472 $ rwork( indrwk ), info )
496 CALL sstebz( range, order, n, vll, vuu, il, iu, abstll,
497 $ rwork( indd ), rwork( inde ), m, nsplit, w,
498 $ iwork( indibl ), iwork( indisp ), rwork( indrwk ),
499 $ iwork( indiwk ), info )
502 CALL cstein( n, rwork( indd ), rwork( inde ), m, w,
503 $ iwork( indibl ), iwork( indisp ), z, ldz,
504 $ rwork( indrwk ), iwork( indiwk ), ifail, info )
509 CALL cunmtr(
'L', uplo,
'N', n, m, a, lda, work( indtau ),
511 $ ldz, work( indwrk ), llwork, iinfo )
517 IF( iscale.EQ.1 )
THEN
523 CALL sscal( imax, one / sigma, w, 1 )
534 IF( w( jj ).LT.tmp1 )
THEN
541 itmp1 = iwork( indibl+i-1 )
543 iwork( indibl+i-1 ) = iwork( indibl+j-1 )
545 iwork( indibl+j-1 ) = itmp1
546 CALL cswap( n, z( 1, i ), 1, z( 1, j ), 1 )
549 ifail( i ) = ifail( j )
558 work( 1 ) = sroundup_lwork(lwkopt)