254 SUBROUTINE zheevx( 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
266 DOUBLE PRECISION ABSTOL, VL, VU
269 INTEGER IFAIL( * ), IWORK( * )
270 DOUBLE PRECISION RWORK( * ), W( * )
271 COMPLEX*16 A( LDA, * ), WORK( * ), Z( LDZ, * )
277 DOUBLE PRECISION ZERO, ONE
278 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0 )
280 parameter( cone = ( 1.0d+0, 0.0d+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 DOUBLE PRECISION ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
291 $ SIGMA, SMLNUM, TMP1, VLL, VUU
296 DOUBLE PRECISION DLAMCH, ZLANHE
297 EXTERNAL lsame, ilaenv, dlamch, zlanhe
306 INTRINSIC dble, 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,
'ZHETRD', uplo, n, -1, -1, -1 )
355 nb = max( nb, ilaenv( 1,
'ZUNMTR', uplo, n, -1, -1,
357 lwkopt = max( 1, ( nb + 1 )*n )
361 IF( lwork.LT.lwkmin .AND. .NOT.lquery )
366 CALL xerbla(
'ZHEEVX', -info )
368 ELSE IF( lquery )
THEN
380 IF( alleig .OR. indeig )
THEN
382 w( 1 ) = dble( a( 1, 1 ) )
383 ELSE IF( valeig )
THEN
384 IF( vl.LT.dble( a( 1, 1 ) ) .AND. vu.GE.dble( a( 1, 1 ) ) )
387 w( 1 ) = dble( a( 1, 1 ) )
397 safmin = dlamch(
'Safe minimum' )
398 eps = dlamch(
'Precision' )
399 smlnum = safmin / eps
400 bignum = one / smlnum
401 rmin = sqrt( smlnum )
402 rmax = min( sqrt( bignum ), one / sqrt( sqrt( safmin ) ) )
412 anrm = zlanhe(
'M', uplo, n, a, lda, rwork )
413 IF( anrm.GT.zero .AND. anrm.LT.rmin )
THEN
416 ELSE IF( anrm.GT.rmax )
THEN
420 IF( iscale.EQ.1 )
THEN
423 CALL zdscal( n-j+1, sigma, a( j, j ), 1 )
427 CALL zdscal( j, sigma, a( 1, j ), 1 )
431 $ abstll = abstol*sigma
445 llwork = lwork - indwrk + 1
446 CALL zhetrd( uplo, n, a, lda, rwork( indd ), rwork( inde ),
447 $ work( indtau ), work( indwrk ), llwork, iinfo )
455 IF( il.EQ.1 .AND. iu.EQ.n )
THEN
459 IF( ( alleig .OR. test ) .AND. ( abstol.LE.zero ) )
THEN
460 CALL dcopy( n, rwork( indd ), 1, w, 1 )
462 IF( .NOT.wantz )
THEN
463 CALL dcopy( n-1, rwork( inde ), 1, rwork( indee ), 1 )
464 CALL dsterf( n, w, rwork( indee ), info )
466 CALL zlacpy(
'A', n, n, a, lda, z, ldz )
467 CALL zungtr( uplo, n, z, ldz, work( indtau ),
468 $ work( indwrk ), llwork, iinfo )
469 CALL dcopy( n-1, rwork( inde ), 1, rwork( indee ), 1 )
470 CALL zsteqr( jobz, n, w, rwork( indee ), z, ldz,
471 $ rwork( indrwk ), info )
495 CALL dstebz( range, order, n, vll, vuu, il, iu, abstll,
496 $ rwork( indd ), rwork( inde ), m, nsplit, w,
497 $ iwork( indibl ), iwork( indisp ), rwork( indrwk ),
498 $ iwork( indiwk ), info )
501 CALL zstein( n, rwork( indd ), rwork( inde ), m, w,
502 $ iwork( indibl ), iwork( indisp ), z, ldz,
503 $ rwork( indrwk ), iwork( indiwk ), ifail, info )
508 CALL zunmtr(
'L', uplo,
'N', n, m, a, lda, work( indtau ),
510 $ ldz, work( indwrk ), llwork, iinfo )
516 IF( iscale.EQ.1 )
THEN
522 CALL dscal( imax, one / sigma, w, 1 )
533 IF( w( jj ).LT.tmp1 )
THEN
540 itmp1 = iwork( indibl+i-1 )
542 iwork( indibl+i-1 ) = iwork( indibl+j-1 )
544 iwork( indibl+j-1 ) = itmp1
545 CALL zswap( n, z( 1, i ), 1, z( 1, j ), 1 )
548 ifail( i ) = ifail( j )