248 SUBROUTINE ssyevx( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL,
250 $ ABSTOL, M, W, Z, LDZ, WORK, LWORK, IWORK,
258 CHARACTER JOBZ, RANGE, UPLO
259 INTEGER IL, INFO, IU, LDA, LDZ, LWORK, M, N
263 INTEGER IFAIL( * ), IWORK( * )
264 REAL A( LDA, * ), W( * ), WORK( * ), Z( LDZ, * )
271 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0 )
274 LOGICAL ALLEIG, INDEIG, LOWER, LQUERY, TEST, VALEIG,
277 INTEGER I, IINFO, IMAX, INDD, INDE, INDEE, INDIBL,
278 $ INDISP, INDIWO, INDTAU, INDWKN, INDWRK, ISCALE,
279 $ itmp1, j, jj, llwork, llwrkn, lwkmin,
281 REAL ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
282 $ SIGMA, SMLNUM, TMP1, VLL, VUU
287 REAL SLAMCH, SLANSY, SROUNDUP_LWORK
288 EXTERNAL lsame, ilaenv, slamch,
289 $ slansy, sroundup_lwork
297 INTRINSIC max, min, sqrt
303 lower = lsame( uplo,
'L' )
304 wantz = lsame( jobz,
'V' )
305 alleig = lsame( range,
'A' )
306 valeig = lsame( range,
'V' )
307 indeig = lsame( range,
'I' )
308 lquery = ( lwork.EQ.-1 )
311 IF( .NOT.( wantz .OR. lsame( jobz,
'N' ) ) )
THEN
313 ELSE IF( .NOT.( alleig .OR. valeig .OR. indeig ) )
THEN
315 ELSE IF( .NOT.( lower .OR. lsame( uplo,
'U' ) ) )
THEN
317 ELSE IF( n.LT.0 )
THEN
319 ELSE IF( lda.LT.max( 1, n ) )
THEN
323 IF( n.GT.0 .AND. vu.LE.vl )
325 ELSE IF( indeig )
THEN
326 IF( il.LT.1 .OR. il.GT.max( 1, n ) )
THEN
328 ELSE IF( iu.LT.min( n, il ) .OR. iu.GT.n )
THEN
334 IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) )
THEN
345 nb = ilaenv( 1,
'SSYTRD', uplo, n, -1, -1, -1 )
346 nb = max( nb, ilaenv( 1,
'SORMTR', uplo, n, -1, -1,
348 lwkopt = max( lwkmin, ( nb + 3 )*n )
350 work( 1 ) = sroundup_lwork( lwkopt )
352 IF( lwork.LT.lwkmin .AND. .NOT.lquery )
357 CALL xerbla(
'SSYEVX', -info )
359 ELSE IF( lquery )
THEN
371 IF( alleig .OR. indeig )
THEN
375 IF( vl.LT.a( 1, 1 ) .AND. vu.GE.a( 1, 1 ) )
THEN
387 safmin = slamch(
'Safe minimum' )
388 eps = slamch(
'Precision' )
389 smlnum = safmin / eps
390 bignum = one / smlnum
391 rmin = sqrt( smlnum )
392 rmax = min( sqrt( bignum ), one / sqrt( sqrt( safmin ) ) )
402 anrm = slansy(
'M', uplo, n, a, lda, work )
403 IF( anrm.GT.zero .AND. anrm.LT.rmin )
THEN
406 ELSE IF( anrm.GT.rmax )
THEN
410 IF( iscale.EQ.1 )
THEN
413 CALL sscal( n-j+1, sigma, a( j, j ), 1 )
417 CALL sscal( j, sigma, a( 1, j ), 1 )
421 $ abstll = abstol*sigma
434 llwork = lwork - indwrk + 1
435 CALL ssytrd( uplo, n, a, lda, work( indd ), work( inde ),
436 $ work( indtau ), work( indwrk ), llwork, iinfo )
444 IF( il.EQ.1 .AND. iu.EQ.n )
THEN
448 IF( ( alleig .OR. test ) .AND. ( abstol.LE.zero ) )
THEN
449 CALL scopy( n, work( indd ), 1, w, 1 )
451 IF( .NOT.wantz )
THEN
452 CALL scopy( n-1, work( inde ), 1, work( indee ), 1 )
453 CALL ssterf( n, w, work( indee ), info )
455 CALL slacpy(
'A', n, n, a, lda, z, ldz )
456 CALL sorgtr( uplo, n, z, ldz, work( indtau ),
457 $ work( indwrk ), llwork, iinfo )
458 CALL scopy( n-1, work( inde ), 1, work( indee ), 1 )
459 CALL ssteqr( jobz, n, w, work( indee ), z, ldz,
460 $ work( indwrk ), info )
484 CALL sstebz( range, order, n, vll, vuu, il, iu, abstll,
485 $ work( indd ), work( inde ), m, nsplit, w,
486 $ iwork( indibl ), iwork( indisp ), work( indwrk ),
487 $ iwork( indiwo ), info )
490 CALL sstein( n, work( indd ), work( inde ), m, w,
491 $ iwork( indibl ), iwork( indisp ), z, ldz,
492 $ work( indwrk ), iwork( indiwo ), ifail, info )
498 llwrkn = lwork - indwkn + 1
499 CALL sormtr(
'L', uplo,
'N', n, m, a, lda, work( indtau ),
501 $ ldz, work( indwkn ), llwrkn, iinfo )
507 IF( iscale.EQ.1 )
THEN
513 CALL sscal( imax, one / sigma, w, 1 )
524 IF( w( jj ).LT.tmp1 )
THEN
531 itmp1 = iwork( indibl+i-1 )
533 iwork( indibl+i-1 ) = iwork( indibl+j-1 )
535 iwork( indibl+j-1 ) = itmp1
536 CALL sswap( n, z( 1, i ), 1, z( 1, j ), 1 )
539 ifail( i ) = ifail( j )
548 work( 1 ) = sroundup_lwork( lwkopt )