LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dsyevr_2stage()

subroutine dsyevr_2stage ( character jobz,
character range,
character uplo,
integer n,
double precision, dimension( lda, * ) a,
integer lda,
double precision vl,
double precision vu,
integer il,
integer iu,
double precision abstol,
integer m,
double precision, dimension( * ) w,
double precision, dimension( ldz, * ) z,
integer ldz,
integer, dimension( * ) isuppz,
double precision, dimension( * ) work,
integer lwork,
integer, dimension( * ) iwork,
integer liwork,
integer info )

DSYEVR_2STAGE computes the eigenvalues and, optionally, the left and/or right eigenvectors for SY matrices

Download DSYEVR_2STAGE + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> DSYEVR_2STAGE computes selected eigenvalues and, optionally, eigenvectors
!> of a real symmetric matrix A using the 2stage technique for
!> the reduction to tridiagonal.  Eigenvalues and eigenvectors can be
!> selected by specifying either a range of values or a range of
!> indices for the desired eigenvalues.
!>
!> DSYEVR_2STAGE first reduces the matrix A to tridiagonal form T with a call
!> to DSYTRD.  Then, whenever possible, DSYEVR_2STAGE calls DSTEMR to compute
!> the eigenspectrum using Relatively Robust Representations.  DSTEMR
!> computes eigenvalues by the dqds algorithm, while orthogonal
!> eigenvectors are computed from various  L D L^T representations
!> (also known as Relatively Robust Representations). Gram-Schmidt
!> orthogonalization is avoided as far as possible. More specifically,
!> the various steps of the algorithm are as follows.
!>
!> For each unreduced block (submatrix) of T,
!>    (a) Compute T - sigma I  = L D L^T, so that L and D
!>        define all the wanted eigenvalues to high relative accuracy.
!>        This means that small relative changes in the entries of D and L
!>        cause only small relative changes in the eigenvalues and
!>        eigenvectors. The standard (unfactored) representation of the
!>        tridiagonal matrix T does not have this property in general.
!>    (b) Compute the eigenvalues to suitable accuracy.
!>        If the eigenvectors are desired, the algorithm attains full
!>        accuracy of the computed eigenvalues only right before
!>        the corresponding vectors have to be computed, see steps c) and d).
!>    (c) For each cluster of close eigenvalues, select a new
!>        shift close to the cluster, find a new factorization, and refine
!>        the shifted eigenvalues to suitable accuracy.
!>    (d) For each eigenvalue with a large enough relative separation compute
!>        the corresponding eigenvector by forming a rank revealing twisted
!>        factorization. Go back to (c) for any clusters that remain.
!>
!> The desired accuracy of the output can be specified by the input
!> parameter ABSTOL.
!>
!> For more details, see DSTEMR's documentation and:
!> - Inderjit S. Dhillon and Beresford N. Parlett: 
!>   Linear Algebra and its Applications, 387(1), pp. 1-28, August 2004.
!> - Inderjit Dhillon and Beresford Parlett:  SIAM Journal on Matrix Analysis and Applications, Vol. 25,
!>   2004.  Also LAPACK Working Note 154.
!> - Inderjit Dhillon: ,
!>   Computer Science Division Technical Report No. UCB/CSD-97-971,
!>   UC Berkeley, May 1997.
!>
!>
!> Note 1 : DSYEVR_2STAGE calls DSTEMR when the full spectrum is requested
!> on machines which conform to the ieee-754 floating point standard.
!> DSYEVR_2STAGE calls DSTEBZ and SSTEIN on non-ieee machines and
!> when partial spectrum requests are made.
!>
!> Normal execution of DSTEMR may create NaNs and infinities and
!> hence may abort due to a floating point exception in environments
!> which do not handle NaNs and infinities in the ieee standard default
!> manner.
!> 
Parameters
[in]JOBZ
!>          JOBZ is CHARACTER*1
!>          = 'N':  Compute eigenvalues only;
!>          = 'V':  Compute eigenvalues and eigenvectors.
!>                  Not available in this release.
!> 
[in]RANGE
!>          RANGE is CHARACTER*1
!>          = 'A': all eigenvalues will be found.
!>          = 'V': all eigenvalues in the half-open interval (VL,VU]
!>                 will be found.
!>          = 'I': the IL-th through IU-th eigenvalues will be found.
!>          For RANGE = 'V' or 'I' and IU - IL < N - 1, DSTEBZ and
!>          DSTEIN are called
!> 
[in]UPLO
!>          UPLO is CHARACTER*1
!>          = 'U':  Upper triangle of A is stored;
!>          = 'L':  Lower triangle of A is stored.
!> 
[in]N
!>          N is INTEGER
!>          The order of the matrix A.  N >= 0.
!> 
[in,out]A
!>          A is DOUBLE PRECISION array, dimension (LDA, N)
!>          On entry, the symmetric matrix A.  If UPLO = 'U', the
!>          leading N-by-N upper triangular part of A contains the
!>          upper triangular part of the matrix A.  If UPLO = 'L',
!>          the leading N-by-N lower triangular part of A contains
!>          the lower triangular part of the matrix A.
!>          On exit, the lower triangle (if UPLO='L') or the upper
!>          triangle (if UPLO='U') of A, including the diagonal, is
!>          destroyed.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,N).
!> 
[in]VL
!>          VL is DOUBLE PRECISION
!>          If RANGE='V', the lower bound of the interval to
!>          be searched for eigenvalues. VL < VU.
!>          Not referenced if RANGE = 'A' or 'I'.
!> 
[in]VU
!>          VU is DOUBLE PRECISION
!>          If RANGE='V', the upper bound of the interval to
!>          be searched for eigenvalues. VL < VU.
!>          Not referenced if RANGE = 'A' or 'I'.
!> 
[in]IL
!>          IL is INTEGER
!>          If RANGE='I', the index of the
!>          smallest eigenvalue to be returned.
!>          1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
!>          Not referenced if RANGE = 'A' or 'V'.
!> 
[in]IU
!>          IU is INTEGER
!>          If RANGE='I', the index of the
!>          largest eigenvalue to be returned.
!>          1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
!>          Not referenced if RANGE = 'A' or 'V'.
!> 
[in]ABSTOL
!>          ABSTOL is DOUBLE PRECISION
!>          The absolute error tolerance for the eigenvalues.
!>          An approximate eigenvalue is accepted as converged
!>          when it is determined to lie in an interval [a,b]
!>          of width less than or equal to
!>
!>                  ABSTOL + EPS *   max( |a|,|b| ) ,
!>
!>          where EPS is the machine precision.  If ABSTOL is less than
!>          or equal to zero, then  EPS*|T|  will be used in its place,
!>          where |T| is the 1-norm of the tridiagonal matrix obtained
!>          by reducing A to tridiagonal form.
!>
!>          See  by Demmel and
!>          Kahan, LAPACK Working Note #3.
!>
!>          If high relative accuracy is important, set ABSTOL to
!>          DLAMCH( 'Safe minimum' ).  Doing so will guarantee that
!>          eigenvalues are computed to high relative accuracy when
!>          possible in future releases.  The current code does not
!>          make any guarantees about high relative accuracy, but
!>          future releases will. See J. Barlow and J. Demmel,
!>          , LAPACK Working Note #7, for a discussion
!>          of which matrices define their eigenvalues to high relative
!>          accuracy.
!> 
[out]M
!>          M is INTEGER
!>          The total number of eigenvalues found.  0 <= M <= N.
!>          If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
!> 
[out]W
!>          W is DOUBLE PRECISION array, dimension (N)
!>          The first M elements contain the selected eigenvalues in
!>          ascending order.
!> 
[out]Z
!>          Z is DOUBLE PRECISION array, dimension (LDZ, max(1,M))
!>          If JOBZ = 'V', then if INFO = 0, the first M columns of Z
!>          contain the orthonormal eigenvectors of the matrix A
!>          corresponding to the selected eigenvalues, with the i-th
!>          column of Z holding the eigenvector associated with W(i).
!>          If JOBZ = 'N', then Z is not referenced.
!>          Note: the user must ensure that at least max(1,M) columns are
!>          supplied in the array Z; if RANGE = 'V', the exact value of M
!>          is not known in advance and an upper bound must be used.
!>          Supplying N columns is always safe.
!> 
[in]LDZ
!>          LDZ is INTEGER
!>          The leading dimension of the array Z.  LDZ >= 1, and if
!>          JOBZ = 'V', LDZ >= max(1,N).
!> 
[out]ISUPPZ
!>          ISUPPZ is INTEGER array, dimension ( 2*max(1,M) )
!>          The support of the eigenvectors in Z, i.e., the indices
!>          indicating the nonzero elements in Z. The i-th eigenvector
!>          is nonzero only in elements ISUPPZ( 2*i-1 ) through
!>          ISUPPZ( 2*i ). This is an output of DSTEMR (tridiagonal
!>          matrix). The support of the eigenvectors of A is typically
!>          1:N because of the orthogonal transformations applied by DORMTR.
!>          Implemented only for RANGE = 'A' or 'I' and IU - IL = N - 1
!> 
[out]WORK
!>          WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK))
!>          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
!> 
[in]LWORK
!>          LWORK is INTEGER
!>          The dimension of the array WORK.
!>          If N <= 1,               LWORK must be at least 1.
!>          If JOBZ = 'N' and N > 1, LWORK must be queried.
!>                                   LWORK = MAX(1, 26*N, dimension) where
!>                                   dimension = max(stage1,stage2) + (KD+1)*N + 5*N
!>                                             = N*KD + N*max(KD+1,FACTOPTNB)
!>                                               + max(2*KD*KD, KD*NTHREADS)
!>                                               + (KD+1)*N + 5*N
!>                                   where KD is the blocking size of the reduction,
!>                                   FACTOPTNB is the blocking used by the QR or LQ
!>                                   algorithm, usually FACTOPTNB=128 is a good choice
!>                                   NTHREADS is the number of threads used when
!>                                   openMP compilation is enabled, otherwise =1.
!>          If JOBZ = 'V' and N > 1, LWORK must be queried. Not yet available
!>
!>          If LWORK = -1, then a workspace query is assumed; the routine
!>          only calculates the optimal size of the WORK array, returns
!>          this value as the first entry of the WORK array, and no error
!>          message related to LWORK is issued by XERBLA.
!> 
[out]IWORK
!>          IWORK is INTEGER array, dimension (MAX(1,LIWORK))
!>          On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
!> 
[in]LIWORK
!>          LIWORK is INTEGER
!>          The dimension of the array IWORK.
!>          If N <= 1, LIWORK >= 1, else LIWORK >= 10*N.
!>
!>          If LIWORK = -1, then a workspace query is assumed; the
!>          routine only calculates the optimal size of the IWORK array,
!>          returns this value as the first entry of the IWORK array, and
!>          no error message related to LIWORK is issued by XERBLA.
!> 
[out]INFO
!>          INFO is INTEGER
!>          = 0:  successful exit
!>          < 0:  if INFO = -i, the i-th argument had an illegal value
!>          > 0:  Internal error
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors:
Inderjit Dhillon, IBM Almaden, USA \n
Osni Marques, LBNL/NERSC, USA \n
Ken Stanley, Computer Science Division, University of
  California at Berkeley, USA \n
Jason Riedy, Computer Science Division, University of
  California at Berkeley, USA \n
Further Details:
!>
!>  All details about the 2stage techniques are available in:
!>
!>  Azzam Haidar, Hatem Ltaief, and Jack Dongarra.
!>  Parallel reduction to condensed forms for symmetric eigenvalue problems
!>  using aggregated fine-grained and memory-aware kernels. In Proceedings
!>  of 2011 International Conference for High Performance Computing,
!>  Networking, Storage and Analysis (SC '11), New York, NY, USA,
!>  Article 8 , 11 pages.
!>  http://doi.acm.org/10.1145/2063384.2063394
!>
!>  A. Haidar, J. Kurzak, P. Luszczek, 2013.
!>  An improved parallel singular value algorithm and its implementation
!>  for multicore hardware, In Proceedings of 2013 International Conference
!>  for High Performance Computing, Networking, Storage and Analysis (SC '13).
!>  Denver, Colorado, USA, 2013.
!>  Article 90, 12 pages.
!>  http://doi.acm.org/10.1145/2503210.2503292
!>
!>  A. Haidar, R. Solca, S. Tomov, T. Schulthess and J. Dongarra.
!>  A novel hybrid CPU-GPU generalized eigensolver for electronic structure
!>  calculations based on fine-grained memory aware tasks.
!>  International Journal of High Performance Computing Applications.
!>  Volume 28 Issue 2, Pages 196-209, May 2014.
!>  http://hpc.sagepub.com/content/28/2/196
!>
!> 

Definition at line 378 of file dsyevr_2stage.f.

381*
382 IMPLICIT NONE
383*
384* -- LAPACK driver routine --
385* -- LAPACK is a software package provided by Univ. of Tennessee, --
386* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
387*
388* .. Scalar Arguments ..
389 CHARACTER JOBZ, RANGE, UPLO
390 INTEGER IL, INFO, IU, LDA, LDZ, LIWORK, LWORK, M, N
391 DOUBLE PRECISION ABSTOL, VL, VU
392* ..
393* .. Array Arguments ..
394 INTEGER ISUPPZ( * ), IWORK( * )
395 DOUBLE PRECISION A( LDA, * ), W( * ), WORK( * ), Z( LDZ, * )
396* ..
397*
398* =====================================================================
399*
400* .. Parameters ..
401 DOUBLE PRECISION ZERO, ONE, TWO
402 parameter( zero = 0.0d+0, one = 1.0d+0, two = 2.0d+0 )
403* ..
404* .. Local Scalars ..
405 LOGICAL ALLEIG, INDEIG, LOWER, LQUERY, VALEIG, WANTZ,
406 $ TRYRAC
407 CHARACTER ORDER
408 INTEGER I, IEEEOK, IINFO, IMAX, INDD, INDDD, INDE,
409 $ INDEE, INDIBL, INDIFL, INDISP, INDIWO, INDTAU,
410 $ INDWK, INDWKN, ISCALE, J, JJ, LIWMIN,
411 $ LLWORK, LLWRKN, LWMIN, NSPLIT,
412 $ LHTRD, LWTRD, KD, IB, INDHOUS
413 DOUBLE PRECISION ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
414 $ SIGMA, SMLNUM, TMP1, VLL, VUU
415* ..
416* .. External Functions ..
417 LOGICAL LSAME
418 INTEGER ILAENV, ILAENV2STAGE
419 DOUBLE PRECISION DLAMCH, DLANSY
420 EXTERNAL lsame, dlamch, dlansy, ilaenv,
422* ..
423* .. External Subroutines ..
424 EXTERNAL dcopy, dormtr, dscal, dstebz, dstemr,
425 $ dstein,
427* ..
428* .. Intrinsic Functions ..
429 INTRINSIC max, min, sqrt
430* ..
431* .. Executable Statements ..
432*
433* Test the input parameters.
434*
435 ieeeok = ilaenv( 10, 'DSYEVR', 'N', 1, 2, 3, 4 )
436*
437 lower = lsame( uplo, 'L' )
438 wantz = lsame( jobz, 'V' )
439 alleig = lsame( range, 'A' )
440 valeig = lsame( range, 'V' )
441 indeig = lsame( range, 'I' )
442*
443 lquery = ( ( lwork.EQ.-1 ) .OR. ( liwork.EQ.-1 ) )
444*
445 kd = ilaenv2stage( 1, 'DSYTRD_2STAGE', jobz, n, -1, -1,
446 $ -1 )
447 ib = ilaenv2stage( 2, 'DSYTRD_2STAGE', jobz, n, kd, -1,
448 $ -1 )
449 lhtrd = ilaenv2stage( 3, 'DSYTRD_2STAGE', jobz, n, kd, ib,
450 $ -1 )
451 lwtrd = ilaenv2stage( 4, 'DSYTRD_2STAGE', jobz, n, kd, ib,
452 $ -1 )
453*
454 IF( n.LE.1 ) THEN
455 lwmin = 1
456 liwmin = 1
457 ELSE
458 lwmin = max( 26*n, 5*n + lhtrd + lwtrd )
459 liwmin = 10*n
460 END IF
461*
462 info = 0
463 IF( .NOT.( lsame( jobz, 'N' ) ) ) THEN
464 info = -1
465 ELSE IF( .NOT.( alleig .OR. valeig .OR. indeig ) ) THEN
466 info = -2
467 ELSE IF( .NOT.( lower .OR. lsame( uplo, 'U' ) ) ) THEN
468 info = -3
469 ELSE IF( n.LT.0 ) THEN
470 info = -4
471 ELSE IF( lda.LT.max( 1, n ) ) THEN
472 info = -6
473 ELSE
474 IF( valeig ) THEN
475 IF( n.GT.0 .AND. vu.LE.vl )
476 $ info = -8
477 ELSE IF( indeig ) THEN
478 IF( il.LT.1 .OR. il.GT.max( 1, n ) ) THEN
479 info = -9
480 ELSE IF( iu.LT.min( n, il ) .OR. iu.GT.n ) THEN
481 info = -10
482 END IF
483 END IF
484 END IF
485 IF( info.EQ.0 ) THEN
486 IF( ldz.LT.1 .OR. ( wantz .AND. ldz.LT.n ) ) THEN
487 info = -15
488 ELSE IF( lwork.LT.lwmin .AND. .NOT.lquery ) THEN
489 info = -18
490 ELSE IF( liwork.LT.liwmin .AND. .NOT.lquery ) THEN
491 info = -20
492 END IF
493 END IF
494*
495 IF( info.EQ.0 ) THEN
496* NB = ILAENV( 1, 'DSYTRD', UPLO, N, -1, -1, -1 )
497* NB = MAX( NB, ILAENV( 1, 'DORMTR', UPLO, N, -1, -1, -1 ) )
498* LWKOPT = MAX( ( NB+1 )*N, LWMIN )
499 work( 1 ) = lwmin
500 iwork( 1 ) = liwmin
501 END IF
502*
503 IF( info.NE.0 ) THEN
504 CALL xerbla( 'DSYEVR_2STAGE', -info )
505 RETURN
506 ELSE IF( lquery ) THEN
507 RETURN
508 END IF
509*
510* Quick return if possible
511*
512 m = 0
513 IF( n.EQ.0 ) THEN
514 work( 1 ) = 1
515 RETURN
516 END IF
517*
518 IF( n.EQ.1 ) THEN
519 work( 1 ) = 1
520 IF( alleig .OR. indeig ) THEN
521 m = 1
522 w( 1 ) = a( 1, 1 )
523 ELSE
524 IF( vl.LT.a( 1, 1 ) .AND. vu.GE.a( 1, 1 ) ) THEN
525 m = 1
526 w( 1 ) = a( 1, 1 )
527 END IF
528 END IF
529 IF( wantz ) THEN
530 z( 1, 1 ) = one
531 isuppz( 1 ) = 1
532 isuppz( 2 ) = 1
533 END IF
534 RETURN
535 END IF
536*
537* Get machine constants.
538*
539 safmin = dlamch( 'Safe minimum' )
540 eps = dlamch( 'Precision' )
541 smlnum = safmin / eps
542 bignum = one / smlnum
543 rmin = sqrt( smlnum )
544 rmax = min( sqrt( bignum ), one / sqrt( sqrt( safmin ) ) )
545*
546* Scale matrix to allowable range, if necessary.
547*
548 iscale = 0
549 abstll = abstol
550 IF (valeig) THEN
551 vll = vl
552 vuu = vu
553 END IF
554 anrm = dlansy( 'M', uplo, n, a, lda, work )
555 IF( anrm.GT.zero .AND. anrm.LT.rmin ) THEN
556 iscale = 1
557 sigma = rmin / anrm
558 ELSE IF( anrm.GT.rmax ) THEN
559 iscale = 1
560 sigma = rmax / anrm
561 END IF
562 IF( iscale.EQ.1 ) THEN
563 IF( lower ) THEN
564 DO 10 j = 1, n
565 CALL dscal( n-j+1, sigma, a( j, j ), 1 )
566 10 CONTINUE
567 ELSE
568 DO 20 j = 1, n
569 CALL dscal( j, sigma, a( 1, j ), 1 )
570 20 CONTINUE
571 END IF
572 IF( abstol.GT.0 )
573 $ abstll = abstol*sigma
574 IF( valeig ) THEN
575 vll = vl*sigma
576 vuu = vu*sigma
577 END IF
578 END IF
579
580* Initialize indices into workspaces. Note: The IWORK indices are
581* used only if DSTERF or DSTEMR fail.
582
583* WORK(INDTAU:INDTAU+N-1) stores the scalar factors of the
584* elementary reflectors used in DSYTRD.
585 indtau = 1
586* WORK(INDD:INDD+N-1) stores the tridiagonal's diagonal entries.
587 indd = indtau + n
588* WORK(INDE:INDE+N-1) stores the off-diagonal entries of the
589* tridiagonal matrix from DSYTRD.
590 inde = indd + n
591* WORK(INDDD:INDDD+N-1) is a copy of the diagonal entries over
592* -written by DSTEMR (the DSTERF path copies the diagonal to W).
593 inddd = inde + n
594* WORK(INDEE:INDEE+N-1) is a copy of the off-diagonal entries over
595* -written while computing the eigenvalues in DSTERF and DSTEMR.
596 indee = inddd + n
597* INDHOUS is the starting offset Householder storage of stage 2
598 indhous = indee + n
599* INDWK is the starting offset of the left-over workspace, and
600* LLWORK is the remaining workspace size.
601 indwk = indhous + lhtrd
602 llwork = lwork - indwk + 1
603
604
605* IWORK(INDIBL:INDIBL+M-1) corresponds to IBLOCK in DSTEBZ and
606* stores the block indices of each of the M<=N eigenvalues.
607 indibl = 1
608* IWORK(INDISP:INDISP+NSPLIT-1) corresponds to ISPLIT in DSTEBZ and
609* stores the starting and finishing indices of each block.
610 indisp = indibl + n
611* IWORK(INDIFL:INDIFL+N-1) stores the indices of eigenvectors
612* that corresponding to eigenvectors that fail to converge in
613* DSTEIN. This information is discarded; if any fail, the driver
614* returns INFO > 0.
615 indifl = indisp + n
616* INDIWO is the offset of the remaining integer workspace.
617 indiwo = indifl + n
618
619*
620* Call DSYTRD_2STAGE to reduce symmetric matrix to tridiagonal form.
621*
622*
623 CALL dsytrd_2stage( jobz, uplo, n, a, lda, work( indd ),
624 $ work( inde ), work( indtau ), work( indhous ),
625 $ lhtrd, work( indwk ), llwork, iinfo )
626*
627* If all eigenvalues are desired
628* then call DSTERF or DSTEMR and DORMTR.
629*
630 IF( ( alleig .OR. ( indeig .AND. il.EQ.1 .AND. iu.EQ.n ) ) .AND.
631 $ ieeeok.EQ.1 ) THEN
632 IF( .NOT.wantz ) THEN
633 CALL dcopy( n, work( indd ), 1, w, 1 )
634 CALL dcopy( n-1, work( inde ), 1, work( indee ), 1 )
635 CALL dsterf( n, w, work( indee ), info )
636 ELSE
637 CALL dcopy( n-1, work( inde ), 1, work( indee ), 1 )
638 CALL dcopy( n, work( indd ), 1, work( inddd ), 1 )
639*
640 IF (abstol .LE. two*n*eps) THEN
641 tryrac = .true.
642 ELSE
643 tryrac = .false.
644 END IF
645 CALL dstemr( jobz, 'A', n, work( inddd ), work( indee ),
646 $ vl, vu, il, iu, m, w, z, ldz, n, isuppz,
647 $ tryrac, work( indwk ), lwork, iwork, liwork,
648 $ info )
649*
650*
651*
652* Apply orthogonal matrix used in reduction to tridiagonal
653* form to eigenvectors returned by DSTEMR.
654*
655 IF( wantz .AND. info.EQ.0 ) THEN
656 indwkn = inde
657 llwrkn = lwork - indwkn + 1
658 CALL dormtr( 'L', uplo, 'N', n, m, a, lda,
659 $ work( indtau ), z, ldz, work( indwkn ),
660 $ llwrkn, iinfo )
661 END IF
662 END IF
663*
664*
665 IF( info.EQ.0 ) THEN
666* Everything worked. Skip DSTEBZ/DSTEIN. IWORK(:) are
667* undefined.
668 m = n
669 GO TO 30
670 END IF
671 info = 0
672 END IF
673*
674* Otherwise, call DSTEBZ and, if eigenvectors are desired, DSTEIN.
675* Also call DSTEBZ and DSTEIN if DSTEMR fails.
676*
677 IF( wantz ) THEN
678 order = 'B'
679 ELSE
680 order = 'E'
681 END IF
682
683 CALL dstebz( range, order, n, vll, vuu, il, iu, abstll,
684 $ work( indd ), work( inde ), m, nsplit, w,
685 $ iwork( indibl ), iwork( indisp ), work( indwk ),
686 $ iwork( indiwo ), info )
687*
688 IF( wantz ) THEN
689 CALL dstein( n, work( indd ), work( inde ), m, w,
690 $ iwork( indibl ), iwork( indisp ), z, ldz,
691 $ work( indwk ), iwork( indiwo ), iwork( indifl ),
692 $ info )
693*
694* Apply orthogonal matrix used in reduction to tridiagonal
695* form to eigenvectors returned by DSTEIN.
696*
697 indwkn = inde
698 llwrkn = lwork - indwkn + 1
699 CALL dormtr( 'L', uplo, 'N', n, m, a, lda, work( indtau ),
700 $ z,
701 $ ldz, work( indwkn ), llwrkn, iinfo )
702 END IF
703*
704* If matrix was scaled, then rescale eigenvalues appropriately.
705*
706* Jump here if DSTEMR/DSTEIN succeeded.
707 30 CONTINUE
708 IF( iscale.EQ.1 ) THEN
709 IF( info.EQ.0 ) THEN
710 imax = m
711 ELSE
712 imax = info - 1
713 END IF
714 CALL dscal( imax, one / sigma, w, 1 )
715 END IF
716*
717* If eigenvalues are not in order, then sort them, along with
718* eigenvectors. Note: We do not sort the IFAIL portion of IWORK.
719* It may not be initialized (if DSTEMR/DSTEIN succeeded), and we do
720* not return this detailed information to the user.
721*
722 IF( wantz ) THEN
723 DO 50 j = 1, m - 1
724 i = 0
725 tmp1 = w( j )
726 DO 40 jj = j + 1, m
727 IF( w( jj ).LT.tmp1 ) THEN
728 i = jj
729 tmp1 = w( jj )
730 END IF
731 40 CONTINUE
732*
733 IF( i.NE.0 ) THEN
734 w( i ) = w( j )
735 w( j ) = tmp1
736 CALL dswap( n, z( 1, i ), 1, z( 1, j ), 1 )
737 END IF
738 50 CONTINUE
739 END IF
740*
741* Set WORK(1) to optimal workspace size.
742*
743 work( 1 ) = lwmin
744 iwork( 1 ) = liwmin
745*
746 RETURN
747*
748* End of DSYEVR_2STAGE
749*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
Definition dcopy.f:82
subroutine dsytrd_2stage(vect, uplo, n, a, lda, d, e, tau, hous2, lhous2, work, lwork, info)
DSYTRD_2STAGE
integer function ilaenv2stage(ispec, name, opts, n1, n2, n3, n4)
ILAENV2STAGE
integer function ilaenv(ispec, name, opts, n1, n2, n3, n4)
ILAENV
Definition ilaenv.f:160
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
double precision function dlansy(norm, uplo, n, a, lda, work)
DLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition dlansy.f:120
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
subroutine dscal(n, da, dx, incx)
DSCAL
Definition dscal.f:79
subroutine dstebz(range, order, n, vl, vu, il, iu, abstol, d, e, m, nsplit, w, iblock, isplit, work, iwork, info)
DSTEBZ
Definition dstebz.f:272
subroutine dstein(n, d, e, m, w, iblock, isplit, z, ldz, work, iwork, ifail, info)
DSTEIN
Definition dstein.f:172
subroutine dstemr(jobz, range, n, d, e, vl, vu, il, iu, m, w, z, ldz, nzc, isuppz, tryrac, work, lwork, iwork, liwork, info)
DSTEMR
Definition dstemr.f:320
subroutine dsterf(n, d, e, info)
DSTERF
Definition dsterf.f:84
subroutine dswap(n, dx, incx, dy, incy)
DSWAP
Definition dswap.f:82
subroutine dormtr(side, uplo, trans, m, n, a, lda, tau, c, ldc, work, lwork, info)
DORMTR
Definition dormtr.f:170
Here is the call graph for this function:
Here is the caller graph for this function: