LAPACK 3.3.1
Linear Algebra PACKage

dsyevr.f

Go to the documentation of this file.
00001       SUBROUTINE DSYEVR( JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU,
00002      $                   ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK,
00003      $                   IWORK, LIWORK, INFO )
00004 *
00005 *  -- LAPACK driver routine (version 3.2.2) --
00006 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00007 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00008 *     June 2010
00009 *
00010 *     .. Scalar Arguments ..
00011       CHARACTER          JOBZ, RANGE, UPLO
00012       INTEGER            IL, INFO, IU, LDA, LDZ, LIWORK, LWORK, M, N
00013       DOUBLE PRECISION   ABSTOL, VL, VU
00014 *     ..
00015 *     .. Array Arguments ..
00016       INTEGER            ISUPPZ( * ), IWORK( * )
00017       DOUBLE PRECISION   A( LDA, * ), W( * ), WORK( * ), Z( LDZ, * )
00018 *     ..
00019 *
00020 *  Purpose
00021 *  =======
00022 *
00023 *  DSYEVR computes selected eigenvalues and, optionally, eigenvectors
00024 *  of a real symmetric matrix A.  Eigenvalues and eigenvectors can be
00025 *  selected by specifying either a range of values or a range of
00026 *  indices for the desired eigenvalues.
00027 *
00028 *  DSYEVR first reduces the matrix A to tridiagonal form T with a call
00029 *  to DSYTRD.  Then, whenever possible, DSYEVR calls DSTEMR to compute
00030 *  the eigenspectrum using Relatively Robust Representations.  DSTEMR
00031 *  computes eigenvalues by the dqds algorithm, while orthogonal
00032 *  eigenvectors are computed from various "good" L D L^T representations
00033 *  (also known as Relatively Robust Representations). Gram-Schmidt
00034 *  orthogonalization is avoided as far as possible. More specifically,
00035 *  the various steps of the algorithm are as follows.
00036 *
00037 *  For each unreduced block (submatrix) of T,
00038 *     (a) Compute T - sigma I  = L D L^T, so that L and D
00039 *         define all the wanted eigenvalues to high relative accuracy.
00040 *         This means that small relative changes in the entries of D and L
00041 *         cause only small relative changes in the eigenvalues and
00042 *         eigenvectors. The standard (unfactored) representation of the
00043 *         tridiagonal matrix T does not have this property in general.
00044 *     (b) Compute the eigenvalues to suitable accuracy.
00045 *         If the eigenvectors are desired, the algorithm attains full
00046 *         accuracy of the computed eigenvalues only right before
00047 *         the corresponding vectors have to be computed, see steps c) and d).
00048 *     (c) For each cluster of close eigenvalues, select a new
00049 *         shift close to the cluster, find a new factorization, and refine
00050 *         the shifted eigenvalues to suitable accuracy.
00051 *     (d) For each eigenvalue with a large enough relative separation compute
00052 *         the corresponding eigenvector by forming a rank revealing twisted
00053 *         factorization. Go back to (c) for any clusters that remain.
00054 *
00055 *  The desired accuracy of the output can be specified by the input
00056 *  parameter ABSTOL.
00057 *
00058 *  For more details, see DSTEMR's documentation and:
00059 *  - Inderjit S. Dhillon and Beresford N. Parlett: "Multiple representations
00060 *    to compute orthogonal eigenvectors of symmetric tridiagonal matrices,"
00061 *    Linear Algebra and its Applications, 387(1), pp. 1-28, August 2004.
00062 *  - Inderjit Dhillon and Beresford Parlett: "Orthogonal Eigenvectors and
00063 *    Relative Gaps," SIAM Journal on Matrix Analysis and Applications, Vol. 25,
00064 *    2004.  Also LAPACK Working Note 154.
00065 *  - Inderjit Dhillon: "A new O(n^2) algorithm for the symmetric
00066 *    tridiagonal eigenvalue/eigenvector problem",
00067 *    Computer Science Division Technical Report No. UCB/CSD-97-971,
00068 *    UC Berkeley, May 1997.
00069 *
00070 *
00071 *  Note 1 : DSYEVR calls DSTEMR when the full spectrum is requested
00072 *  on machines which conform to the ieee-754 floating point standard.
00073 *  DSYEVR calls DSTEBZ and SSTEIN on non-ieee machines and
00074 *  when partial spectrum requests are made.
00075 *
00076 *  Normal execution of DSTEMR may create NaNs and infinities and
00077 *  hence may abort due to a floating point exception in environments
00078 *  which do not handle NaNs and infinities in the ieee standard default
00079 *  manner.
00080 *
00081 *  Arguments
00082 *  =========
00083 *
00084 *  JOBZ    (input) CHARACTER*1
00085 *          = 'N':  Compute eigenvalues only;
00086 *          = 'V':  Compute eigenvalues and eigenvectors.
00087 *
00088 *  RANGE   (input) CHARACTER*1
00089 *          = 'A': all eigenvalues will be found.
00090 *          = 'V': all eigenvalues in the half-open interval (VL,VU]
00091 *                 will be found.
00092 *          = 'I': the IL-th through IU-th eigenvalues will be found.
00093 ********** For RANGE = 'V' or 'I' and IU - IL < N - 1, DSTEBZ and
00094 ********** DSTEIN are called
00095 *
00096 *  UPLO    (input) CHARACTER*1
00097 *          = 'U':  Upper triangle of A is stored;
00098 *          = 'L':  Lower triangle of A is stored.
00099 *
00100 *  N       (input) INTEGER
00101 *          The order of the matrix A.  N >= 0.
00102 *
00103 *  A       (input/output) DOUBLE PRECISION array, dimension (LDA, N)
00104 *          On entry, the symmetric matrix A.  If UPLO = 'U', the
00105 *          leading N-by-N upper triangular part of A contains the
00106 *          upper triangular part of the matrix A.  If UPLO = 'L',
00107 *          the leading N-by-N lower triangular part of A contains
00108 *          the lower triangular part of the matrix A.
00109 *          On exit, the lower triangle (if UPLO='L') or the upper
00110 *          triangle (if UPLO='U') of A, including the diagonal, is
00111 *          destroyed.
00112 *
00113 *  LDA     (input) INTEGER
00114 *          The leading dimension of the array A.  LDA >= max(1,N).
00115 *
00116 *  VL      (input) DOUBLE PRECISION
00117 *  VU      (input) DOUBLE PRECISION
00118 *          If RANGE='V', the lower and upper bounds of the interval to
00119 *          be searched for eigenvalues. VL < VU.
00120 *          Not referenced if RANGE = 'A' or 'I'.
00121 *
00122 *  IL      (input) INTEGER
00123 *  IU      (input) INTEGER
00124 *          If RANGE='I', the indices (in ascending order) of the
00125 *          smallest and largest eigenvalues to be returned.
00126 *          1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
00127 *          Not referenced if RANGE = 'A' or 'V'.
00128 *
00129 *  ABSTOL  (input) DOUBLE PRECISION
00130 *          The absolute error tolerance for the eigenvalues.
00131 *          An approximate eigenvalue is accepted as converged
00132 *          when it is determined to lie in an interval [a,b]
00133 *          of width less than or equal to
00134 *
00135 *                  ABSTOL + EPS *   max( |a|,|b| ) ,
00136 *
00137 *          where EPS is the machine precision.  If ABSTOL is less than
00138 *          or equal to zero, then  EPS*|T|  will be used in its place,
00139 *          where |T| is the 1-norm of the tridiagonal matrix obtained
00140 *          by reducing A to tridiagonal form.
00141 *
00142 *          See "Computing Small Singular Values of Bidiagonal Matrices
00143 *          with Guaranteed High Relative Accuracy," by Demmel and
00144 *          Kahan, LAPACK Working Note #3.
00145 *
00146 *          If high relative accuracy is important, set ABSTOL to
00147 *          DLAMCH( 'Safe minimum' ).  Doing so will guarantee that
00148 *          eigenvalues are computed to high relative accuracy when
00149 *          possible in future releases.  The current code does not
00150 *          make any guarantees about high relative accuracy, but
00151 *          future releases will. See J. Barlow and J. Demmel,
00152 *          "Computing Accurate Eigensystems of Scaled Diagonally
00153 *          Dominant Matrices", LAPACK Working Note #7, for a discussion
00154 *          of which matrices define their eigenvalues to high relative
00155 *          accuracy.
00156 *
00157 *  M       (output) INTEGER
00158 *          The total number of eigenvalues found.  0 <= M <= N.
00159 *          If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
00160 *
00161 *  W       (output) DOUBLE PRECISION array, dimension (N)
00162 *          The first M elements contain the selected eigenvalues in
00163 *          ascending order.
00164 *
00165 *  Z       (output) DOUBLE PRECISION array, dimension (LDZ, max(1,M))
00166 *          If JOBZ = 'V', then if INFO = 0, the first M columns of Z
00167 *          contain the orthonormal eigenvectors of the matrix A
00168 *          corresponding to the selected eigenvalues, with the i-th
00169 *          column of Z holding the eigenvector associated with W(i).
00170 *          If JOBZ = 'N', then Z is not referenced.
00171 *          Note: the user must ensure that at least max(1,M) columns are
00172 *          supplied in the array Z; if RANGE = 'V', the exact value of M
00173 *          is not known in advance and an upper bound must be used.
00174 *          Supplying N columns is always safe.
00175 *
00176 *  LDZ     (input) INTEGER
00177 *          The leading dimension of the array Z.  LDZ >= 1, and if
00178 *          JOBZ = 'V', LDZ >= max(1,N).
00179 *
00180 *  ISUPPZ  (output) INTEGER array, dimension ( 2*max(1,M) )
00181 *          The support of the eigenvectors in Z, i.e., the indices
00182 *          indicating the nonzero elements in Z. The i-th eigenvector
00183 *          is nonzero only in elements ISUPPZ( 2*i-1 ) through
00184 *          ISUPPZ( 2*i ).
00185 ********** Implemented only for RANGE = 'A' or 'I' and IU - IL = N - 1
00186 *
00187 *  WORK    (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
00188 *          On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
00189 *
00190 *  LWORK   (input) INTEGER
00191 *          The dimension of the array WORK.  LWORK >= max(1,26*N).
00192 *          For optimal efficiency, LWORK >= (NB+6)*N,
00193 *          where NB is the max of the blocksize for DSYTRD and DORMTR
00194 *          returned by ILAENV.
00195 *
00196 *          If LWORK = -1, then a workspace query is assumed; the routine
00197 *          only calculates the optimal size of the WORK array, returns
00198 *          this value as the first entry of the WORK array, and no error
00199 *          message related to LWORK is issued by XERBLA.
00200 *
00201 *  IWORK   (workspace/output) INTEGER array, dimension (MAX(1,LIWORK))
00202 *          On exit, if INFO = 0, IWORK(1) returns the optimal LWORK.
00203 *
00204 *  LIWORK  (input) INTEGER
00205 *          The dimension of the array IWORK.  LIWORK >= max(1,10*N).
00206 *
00207 *          If LIWORK = -1, then a workspace query is assumed; the
00208 *          routine only calculates the optimal size of the IWORK array,
00209 *          returns this value as the first entry of the IWORK array, and
00210 *          no error message related to LIWORK is issued by XERBLA.
00211 *
00212 *  INFO    (output) INTEGER
00213 *          = 0:  successful exit
00214 *          < 0:  if INFO = -i, the i-th argument had an illegal value
00215 *          > 0:  Internal error
00216 *
00217 *  Further Details
00218 *  ===============
00219 *
00220 *  Based on contributions by
00221 *     Inderjit Dhillon, IBM Almaden, USA
00222 *     Osni Marques, LBNL/NERSC, USA
00223 *     Ken Stanley, Computer Science Division, University of
00224 *       California at Berkeley, USA
00225 *     Jason Riedy, Computer Science Division, University of
00226 *       California at Berkeley, USA
00227 *
00228 * =====================================================================
00229 *
00230 *     .. Parameters ..
00231       DOUBLE PRECISION   ZERO, ONE, TWO
00232       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0, TWO = 2.0D+0 )
00233 *     ..
00234 *     .. Local Scalars ..
00235       LOGICAL            ALLEIG, INDEIG, LOWER, LQUERY, VALEIG, WANTZ,
00236      $                   TRYRAC
00237       CHARACTER          ORDER
00238       INTEGER            I, IEEEOK, IINFO, IMAX, INDD, INDDD, INDE,
00239      $                   INDEE, INDIBL, INDIFL, INDISP, INDIWO, INDTAU,
00240      $                   INDWK, INDWKN, ISCALE, J, JJ, LIWMIN,
00241      $                   LLWORK, LLWRKN, LWKOPT, LWMIN, NB, NSPLIT
00242       DOUBLE PRECISION   ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
00243      $                   SIGMA, SMLNUM, TMP1, VLL, VUU
00244 *     ..
00245 *     .. External Functions ..
00246       LOGICAL            LSAME
00247       INTEGER            ILAENV
00248       DOUBLE PRECISION   DLAMCH, DLANSY
00249       EXTERNAL           LSAME, ILAENV, DLAMCH, DLANSY
00250 *     ..
00251 *     .. External Subroutines ..
00252       EXTERNAL           DCOPY, DORMTR, DSCAL, DSTEBZ, DSTEMR, DSTEIN,
00253      $                   DSTERF, DSWAP, DSYTRD, XERBLA
00254 *     ..
00255 *     .. Intrinsic Functions ..
00256       INTRINSIC          MAX, MIN, SQRT
00257 *     ..
00258 *     .. Executable Statements ..
00259 *
00260 *     Test the input parameters.
00261 *
00262       IEEEOK = ILAENV( 10, 'DSYEVR', 'N', 1, 2, 3, 4 )
00263 *
00264       LOWER = LSAME( UPLO, 'L' )
00265       WANTZ = LSAME( JOBZ, 'V' )
00266       ALLEIG = LSAME( RANGE, 'A' )
00267       VALEIG = LSAME( RANGE, 'V' )
00268       INDEIG = LSAME( RANGE, 'I' )
00269 *
00270       LQUERY = ( ( LWORK.EQ.-1 ) .OR. ( LIWORK.EQ.-1 ) )
00271 *
00272       LWMIN = MAX( 1, 26*N )
00273       LIWMIN = MAX( 1, 10*N )
00274 *
00275       INFO = 0
00276       IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
00277          INFO = -1
00278       ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
00279          INFO = -2
00280       ELSE IF( .NOT.( LOWER .OR. LSAME( UPLO, 'U' ) ) ) THEN
00281          INFO = -3
00282       ELSE IF( N.LT.0 ) THEN
00283          INFO = -4
00284       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00285          INFO = -6
00286       ELSE
00287          IF( VALEIG ) THEN
00288             IF( N.GT.0 .AND. VU.LE.VL )
00289      $         INFO = -8
00290          ELSE IF( INDEIG ) THEN
00291             IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN
00292                INFO = -9
00293             ELSE IF( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
00294                INFO = -10
00295             END IF
00296          END IF
00297       END IF
00298       IF( INFO.EQ.0 ) THEN
00299          IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
00300             INFO = -15
00301          ELSE IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
00302             INFO = -18
00303          ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN
00304             INFO = -20
00305          END IF
00306       END IF
00307 *
00308       IF( INFO.EQ.0 ) THEN
00309          NB = ILAENV( 1, 'DSYTRD', UPLO, N, -1, -1, -1 )
00310          NB = MAX( NB, ILAENV( 1, 'DORMTR', UPLO, N, -1, -1, -1 ) )
00311          LWKOPT = MAX( ( NB+1 )*N, LWMIN )
00312          WORK( 1 ) = LWKOPT
00313          IWORK( 1 ) = LIWMIN
00314       END IF
00315 *
00316       IF( INFO.NE.0 ) THEN
00317          CALL XERBLA( 'DSYEVR', -INFO )
00318          RETURN
00319       ELSE IF( LQUERY ) THEN
00320          RETURN
00321       END IF
00322 *
00323 *     Quick return if possible
00324 *
00325       M = 0
00326       IF( N.EQ.0 ) THEN
00327          WORK( 1 ) = 1
00328          RETURN
00329       END IF
00330 *
00331       IF( N.EQ.1 ) THEN
00332          WORK( 1 ) = 7
00333          IF( ALLEIG .OR. INDEIG ) THEN
00334             M = 1
00335             W( 1 ) = A( 1, 1 )
00336          ELSE
00337             IF( VL.LT.A( 1, 1 ) .AND. VU.GE.A( 1, 1 ) ) THEN
00338                M = 1
00339                W( 1 ) = A( 1, 1 )
00340             END IF
00341          END IF
00342          IF( WANTZ ) THEN
00343             Z( 1, 1 ) = ONE
00344             ISUPPZ( 1 ) = 1
00345             ISUPPZ( 2 ) = 1
00346          END IF
00347          RETURN
00348       END IF
00349 *
00350 *     Get machine constants.
00351 *
00352       SAFMIN = DLAMCH( 'Safe minimum' )
00353       EPS = DLAMCH( 'Precision' )
00354       SMLNUM = SAFMIN / EPS
00355       BIGNUM = ONE / SMLNUM
00356       RMIN = SQRT( SMLNUM )
00357       RMAX = MIN( SQRT( BIGNUM ), ONE / SQRT( SQRT( SAFMIN ) ) )
00358 *
00359 *     Scale matrix to allowable range, if necessary.
00360 *
00361       ISCALE = 0
00362       ABSTLL = ABSTOL
00363       IF (VALEIG) THEN
00364          VLL = VL
00365          VUU = VU
00366       END IF
00367       ANRM = DLANSY( 'M', UPLO, N, A, LDA, WORK )
00368       IF( ANRM.GT.ZERO .AND. ANRM.LT.RMIN ) THEN
00369          ISCALE = 1
00370          SIGMA = RMIN / ANRM
00371       ELSE IF( ANRM.GT.RMAX ) THEN
00372          ISCALE = 1
00373          SIGMA = RMAX / ANRM
00374       END IF
00375       IF( ISCALE.EQ.1 ) THEN
00376          IF( LOWER ) THEN
00377             DO 10 J = 1, N
00378                CALL DSCAL( N-J+1, SIGMA, A( J, J ), 1 )
00379    10       CONTINUE
00380          ELSE
00381             DO 20 J = 1, N
00382                CALL DSCAL( J, SIGMA, A( 1, J ), 1 )
00383    20       CONTINUE
00384          END IF
00385          IF( ABSTOL.GT.0 )
00386      $      ABSTLL = ABSTOL*SIGMA
00387          IF( VALEIG ) THEN
00388             VLL = VL*SIGMA
00389             VUU = VU*SIGMA
00390          END IF
00391       END IF
00392 
00393 *     Initialize indices into workspaces.  Note: The IWORK indices are
00394 *     used only if DSTERF or DSTEMR fail.
00395 
00396 *     WORK(INDTAU:INDTAU+N-1) stores the scalar factors of the
00397 *     elementary reflectors used in DSYTRD.
00398       INDTAU = 1
00399 *     WORK(INDD:INDD+N-1) stores the tridiagonal's diagonal entries.
00400       INDD = INDTAU + N
00401 *     WORK(INDE:INDE+N-1) stores the off-diagonal entries of the
00402 *     tridiagonal matrix from DSYTRD.
00403       INDE = INDD + N
00404 *     WORK(INDDD:INDDD+N-1) is a copy of the diagonal entries over
00405 *     -written by DSTEMR (the DSTERF path copies the diagonal to W).
00406       INDDD = INDE + N
00407 *     WORK(INDEE:INDEE+N-1) is a copy of the off-diagonal entries over
00408 *     -written while computing the eigenvalues in DSTERF and DSTEMR.
00409       INDEE = INDDD + N
00410 *     INDWK is the starting offset of the left-over workspace, and
00411 *     LLWORK is the remaining workspace size.
00412       INDWK = INDEE + N
00413       LLWORK = LWORK - INDWK + 1
00414 
00415 *     IWORK(INDIBL:INDIBL+M-1) corresponds to IBLOCK in DSTEBZ and
00416 *     stores the block indices of each of the M<=N eigenvalues.
00417       INDIBL = 1
00418 *     IWORK(INDISP:INDISP+NSPLIT-1) corresponds to ISPLIT in DSTEBZ and
00419 *     stores the starting and finishing indices of each block.
00420       INDISP = INDIBL + N
00421 *     IWORK(INDIFL:INDIFL+N-1) stores the indices of eigenvectors
00422 *     that corresponding to eigenvectors that fail to converge in
00423 *     DSTEIN.  This information is discarded; if any fail, the driver
00424 *     returns INFO > 0.
00425       INDIFL = INDISP + N
00426 *     INDIWO is the offset of the remaining integer workspace.
00427       INDIWO = INDISP + N
00428 
00429 *
00430 *     Call DSYTRD to reduce symmetric matrix to tridiagonal form.
00431 *
00432       CALL DSYTRD( UPLO, N, A, LDA, WORK( INDD ), WORK( INDE ),
00433      $             WORK( INDTAU ), WORK( INDWK ), LLWORK, IINFO )
00434 *
00435 *     If all eigenvalues are desired
00436 *     then call DSTERF or DSTEMR and DORMTR.
00437 *
00438       IF( ( ALLEIG .OR. ( INDEIG .AND. IL.EQ.1 .AND. IU.EQ.N ) ) .AND.
00439      $    IEEEOK.EQ.1 ) THEN
00440          IF( .NOT.WANTZ ) THEN
00441             CALL DCOPY( N, WORK( INDD ), 1, W, 1 )
00442             CALL DCOPY( N-1, WORK( INDE ), 1, WORK( INDEE ), 1 )
00443             CALL DSTERF( N, W, WORK( INDEE ), INFO )
00444          ELSE
00445             CALL DCOPY( N-1, WORK( INDE ), 1, WORK( INDEE ), 1 )
00446             CALL DCOPY( N, WORK( INDD ), 1, WORK( INDDD ), 1 )
00447 *
00448             IF (ABSTOL .LE. TWO*N*EPS) THEN
00449                TRYRAC = .TRUE.
00450             ELSE
00451                TRYRAC = .FALSE.
00452             END IF
00453             CALL DSTEMR( JOBZ, 'A', N, WORK( INDDD ), WORK( INDEE ),
00454      $                   VL, VU, IL, IU, M, W, Z, LDZ, N, ISUPPZ,
00455      $                   TRYRAC, WORK( INDWK ), LWORK, IWORK, LIWORK,
00456      $                   INFO )
00457 *
00458 *
00459 *
00460 *        Apply orthogonal matrix used in reduction to tridiagonal
00461 *        form to eigenvectors returned by DSTEIN.
00462 *
00463             IF( WANTZ .AND. INFO.EQ.0 ) THEN
00464                INDWKN = INDE
00465                LLWRKN = LWORK - INDWKN + 1
00466                CALL DORMTR( 'L', UPLO, 'N', N, M, A, LDA,
00467      $                      WORK( INDTAU ), Z, LDZ, WORK( INDWKN ),
00468      $                      LLWRKN, IINFO )
00469             END IF
00470          END IF
00471 *
00472 *
00473          IF( INFO.EQ.0 ) THEN
00474 *           Everything worked.  Skip DSTEBZ/DSTEIN.  IWORK(:) are
00475 *           undefined.
00476             M = N
00477             GO TO 30
00478          END IF
00479          INFO = 0
00480       END IF
00481 *
00482 *     Otherwise, call DSTEBZ and, if eigenvectors are desired, DSTEIN.
00483 *     Also call DSTEBZ and DSTEIN if DSTEMR fails.
00484 *
00485       IF( WANTZ ) THEN
00486          ORDER = 'B'
00487       ELSE
00488          ORDER = 'E'
00489       END IF
00490 
00491       CALL DSTEBZ( RANGE, ORDER, N, VLL, VUU, IL, IU, ABSTLL,
00492      $             WORK( INDD ), WORK( INDE ), M, NSPLIT, W,
00493      $             IWORK( INDIBL ), IWORK( INDISP ), WORK( INDWK ),
00494      $             IWORK( INDIWO ), INFO )
00495 *
00496       IF( WANTZ ) THEN
00497          CALL DSTEIN( N, WORK( INDD ), WORK( INDE ), M, W,
00498      $                IWORK( INDIBL ), IWORK( INDISP ), Z, LDZ,
00499      $                WORK( INDWK ), IWORK( INDIWO ), IWORK( INDIFL ),
00500      $                INFO )
00501 *
00502 *        Apply orthogonal matrix used in reduction to tridiagonal
00503 *        form to eigenvectors returned by DSTEIN.
00504 *
00505          INDWKN = INDE
00506          LLWRKN = LWORK - INDWKN + 1
00507          CALL DORMTR( 'L', UPLO, 'N', N, M, A, LDA, WORK( INDTAU ), Z,
00508      $                LDZ, WORK( INDWKN ), LLWRKN, IINFO )
00509       END IF
00510 *
00511 *     If matrix was scaled, then rescale eigenvalues appropriately.
00512 *
00513 *  Jump here if DSTEMR/DSTEIN succeeded.
00514    30 CONTINUE
00515       IF( ISCALE.EQ.1 ) THEN
00516          IF( INFO.EQ.0 ) THEN
00517             IMAX = M
00518          ELSE
00519             IMAX = INFO - 1
00520          END IF
00521          CALL DSCAL( IMAX, ONE / SIGMA, W, 1 )
00522       END IF
00523 *
00524 *     If eigenvalues are not in order, then sort them, along with
00525 *     eigenvectors.  Note: We do not sort the IFAIL portion of IWORK.
00526 *     It may not be initialized (if DSTEMR/DSTEIN succeeded), and we do
00527 *     not return this detailed information to the user.
00528 *
00529       IF( WANTZ ) THEN
00530          DO 50 J = 1, M - 1
00531             I = 0
00532             TMP1 = W( J )
00533             DO 40 JJ = J + 1, M
00534                IF( W( JJ ).LT.TMP1 ) THEN
00535                   I = JJ
00536                   TMP1 = W( JJ )
00537                END IF
00538    40       CONTINUE
00539 *
00540             IF( I.NE.0 ) THEN
00541                W( I ) = W( J )
00542                W( J ) = TMP1
00543                CALL DSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 )
00544             END IF
00545    50    CONTINUE
00546       END IF
00547 *
00548 *     Set WORK(1) to optimal workspace size.
00549 *
00550       WORK( 1 ) = LWKOPT
00551       IWORK( 1 ) = LIWMIN
00552 *
00553       RETURN
00554 *
00555 *     End of DSYEVR
00556 *
00557       END
 All Files Functions