LAPACK 3.3.1
Linear Algebra PACKage

ssyevr.f

Go to the documentation of this file.
00001       SUBROUTINE SSYEVR( 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       REAL               ABSTOL, VL, VU
00014 *     ..
00015 *     .. Array Arguments ..
00016       INTEGER            ISUPPZ( * ), IWORK( * )
00017       REAL               A( LDA, * ), W( * ), WORK( * ), Z( LDZ, * )
00018 *     ..
00019 *
00020 *  Purpose
00021 *  =======
00022 *
00023 *  SSYEVR 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 *  SSYEVR first reduces the matrix A to tridiagonal form T with a call
00029 *  to SSYTRD.  Then, whenever possible, SSYEVR calls SSTEMR to compute
00030 *  the eigenspectrum using Relatively Robust Representations.  SSTEMR
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 SSTEMR'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 : SSYEVR calls SSTEMR when the full spectrum is requested
00072 *  on machines which conform to the ieee-754 floating point standard.
00073 *  SSYEVR calls SSTEBZ and SSTEIN on non-ieee machines and
00074 *  when partial spectrum requests are made.
00075 *
00076 *  Normal execution of SSTEMR 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, SSTEBZ and
00094 ********** SSTEIN 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) REAL 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) REAL
00117 *  VU      (input) REAL
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) REAL
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 *          SLAMCH( '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) REAL array, dimension (N)
00162 *          The first M elements contain the selected eigenvalues in
00163 *          ascending order.
00164 *
00165 *  Z       (output) REAL 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) REAL 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 SSYTRD and SORMTR
00194 *          returned by ILAENV.
00195 *
00196 *          If LWORK = -1, then a workspace query is assumed; the routine
00197 *          only calculates the optimal sizes of the WORK and IWORK
00198 *          arrays, returns these values as the first entries of the WORK
00199 *          and IWORK arrays, and no error message related to LWORK or
00200 *          LIWORK is issued by XERBLA.
00201 *
00202 *  IWORK   (workspace/output) INTEGER array, dimension (MAX(1,LIWORK))
00203 *          On exit, if INFO = 0, IWORK(1) returns the optimal LWORK.
00204 *
00205 *  LIWORK  (input) INTEGER
00206 *          The dimension of the array IWORK.  LIWORK >= max(1,10*N).
00207 *
00208 *          If LIWORK = -1, then a workspace query is assumed; the
00209 *          routine only calculates the optimal sizes of the WORK and
00210 *          IWORK arrays, returns these values as the first entries of
00211 *          the WORK and IWORK arrays, and no error message related to
00212 *          LWORK or LIWORK is issued by XERBLA.
00213 *
00214 *  INFO    (output) INTEGER
00215 *          = 0:  successful exit
00216 *          < 0:  if INFO = -i, the i-th argument had an illegal value
00217 *          > 0:  Internal error
00218 *
00219 *  Further Details
00220 *  ===============
00221 *
00222 *  Based on contributions by
00223 *     Inderjit Dhillon, IBM Almaden, USA
00224 *     Osni Marques, LBNL/NERSC, USA
00225 *     Ken Stanley, Computer Science Division, University of
00226 *       California at Berkeley, USA
00227 *     Jason Riedy, Computer Science Division, University of
00228 *       California at Berkeley, USA
00229 *
00230 * =====================================================================
00231 *
00232 *     .. Parameters ..
00233       REAL               ZERO, ONE, TWO
00234       PARAMETER          ( ZERO = 0.0E+0, ONE = 1.0E+0, TWO = 2.0E+0 )
00235 *     ..
00236 *     .. Local Scalars ..
00237       LOGICAL            ALLEIG, INDEIG, LOWER, LQUERY, TEST, VALEIG,
00238      $                   WANTZ, TRYRAC
00239       CHARACTER          ORDER
00240       INTEGER            I, IEEEOK, IINFO, IMAX, INDD, INDDD, INDE,
00241      $                   INDEE, INDIBL, INDIFL, INDISP, INDIWO, INDTAU,
00242      $                   INDWK, INDWKN, ISCALE, J, JJ, LIWMIN,
00243      $                   LLWORK, LLWRKN, LWKOPT, LWMIN, NB, NSPLIT
00244       REAL               ABSTLL, ANRM, BIGNUM, EPS, RMAX, RMIN, SAFMIN,
00245      $                   SIGMA, SMLNUM, TMP1, VLL, VUU
00246 *     ..
00247 *     .. External Functions ..
00248       LOGICAL            LSAME
00249       INTEGER            ILAENV
00250       REAL               SLAMCH, SLANSY
00251       EXTERNAL           LSAME, ILAENV, SLAMCH, SLANSY
00252 *     ..
00253 *     .. External Subroutines ..
00254       EXTERNAL           SCOPY, SORMTR, SSCAL, SSTEBZ, SSTEMR, SSTEIN,
00255      $                   SSTERF, SSWAP, SSYTRD, XERBLA
00256 *     ..
00257 *     .. Intrinsic Functions ..
00258       INTRINSIC          MAX, MIN, SQRT
00259 *     ..
00260 *     .. Executable Statements ..
00261 *
00262 *     Test the input parameters.
00263 *
00264       IEEEOK = ILAENV( 10, 'SSYEVR', 'N', 1, 2, 3, 4 )
00265 *
00266       LOWER = LSAME( UPLO, 'L' )
00267       WANTZ = LSAME( JOBZ, 'V' )
00268       ALLEIG = LSAME( RANGE, 'A' )
00269       VALEIG = LSAME( RANGE, 'V' )
00270       INDEIG = LSAME( RANGE, 'I' )
00271 *
00272       LQUERY = ( ( LWORK.EQ.-1 ) .OR. ( LIWORK.EQ.-1 ) )
00273 *
00274       LWMIN = MAX( 1, 26*N )
00275       LIWMIN = MAX( 1, 10*N )
00276 *
00277       INFO = 0
00278       IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
00279          INFO = -1
00280       ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
00281          INFO = -2
00282       ELSE IF( .NOT.( LOWER .OR. LSAME( UPLO, 'U' ) ) ) THEN
00283          INFO = -3
00284       ELSE IF( N.LT.0 ) THEN
00285          INFO = -4
00286       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00287          INFO = -6
00288       ELSE
00289          IF( VALEIG ) THEN
00290             IF( N.GT.0 .AND. VU.LE.VL )
00291      $         INFO = -8
00292          ELSE IF( INDEIG ) THEN
00293             IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN
00294                INFO = -9
00295             ELSE IF( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
00296                INFO = -10
00297             END IF
00298          END IF
00299       END IF
00300       IF( INFO.EQ.0 ) THEN
00301          IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
00302             INFO = -15
00303          END IF
00304       END IF
00305 *
00306       IF( INFO.EQ.0 ) THEN
00307          NB = ILAENV( 1, 'SSYTRD', UPLO, N, -1, -1, -1 )
00308          NB = MAX( NB, ILAENV( 1, 'SORMTR', UPLO, N, -1, -1, -1 ) )
00309          LWKOPT = MAX( ( NB+1 )*N, LWMIN )
00310          WORK( 1 ) = LWKOPT
00311          IWORK( 1 ) = LIWMIN
00312 *
00313          IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
00314             INFO = -18
00315          ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN
00316             INFO = -20
00317          END IF
00318       END IF
00319 *
00320       IF( INFO.NE.0 ) THEN
00321          CALL XERBLA( 'SSYEVR', -INFO )
00322          RETURN
00323       ELSE IF( LQUERY ) THEN
00324          RETURN
00325       END IF
00326 *
00327 *     Quick return if possible
00328 *
00329       M = 0
00330       IF( N.EQ.0 ) THEN
00331          WORK( 1 ) = 1
00332          RETURN
00333       END IF
00334 *
00335       IF( N.EQ.1 ) THEN
00336          WORK( 1 ) = 26
00337          IF( ALLEIG .OR. INDEIG ) THEN
00338             M = 1
00339             W( 1 ) = A( 1, 1 )
00340          ELSE
00341             IF( VL.LT.A( 1, 1 ) .AND. VU.GE.A( 1, 1 ) ) THEN
00342                M = 1
00343                W( 1 ) = A( 1, 1 )
00344             END IF
00345          END IF
00346          IF( WANTZ ) THEN
00347             Z( 1, 1 ) = ONE
00348             ISUPPZ( 1 ) = 1
00349             ISUPPZ( 2 ) = 1
00350          END IF
00351          RETURN
00352       END IF
00353 *
00354 *     Get machine constants.
00355 *
00356       SAFMIN = SLAMCH( 'Safe minimum' )
00357       EPS = SLAMCH( 'Precision' )
00358       SMLNUM = SAFMIN / EPS
00359       BIGNUM = ONE / SMLNUM
00360       RMIN = SQRT( SMLNUM )
00361       RMAX = MIN( SQRT( BIGNUM ), ONE / SQRT( SQRT( SAFMIN ) ) )
00362 *
00363 *     Scale matrix to allowable range, if necessary.
00364 *
00365       ISCALE = 0
00366       ABSTLL = ABSTOL
00367       IF (VALEIG) THEN
00368          VLL = VL
00369          VUU = VU
00370       END IF
00371       ANRM = SLANSY( 'M', UPLO, N, A, LDA, WORK )
00372       IF( ANRM.GT.ZERO .AND. ANRM.LT.RMIN ) THEN
00373          ISCALE = 1
00374          SIGMA = RMIN / ANRM
00375       ELSE IF( ANRM.GT.RMAX ) THEN
00376          ISCALE = 1
00377          SIGMA = RMAX / ANRM
00378       END IF
00379       IF( ISCALE.EQ.1 ) THEN
00380          IF( LOWER ) THEN
00381             DO 10 J = 1, N
00382                CALL SSCAL( N-J+1, SIGMA, A( J, J ), 1 )
00383    10       CONTINUE
00384          ELSE
00385             DO 20 J = 1, N
00386                CALL SSCAL( J, SIGMA, A( 1, J ), 1 )
00387    20       CONTINUE
00388          END IF
00389          IF( ABSTOL.GT.0 )
00390      $      ABSTLL = ABSTOL*SIGMA
00391          IF( VALEIG ) THEN
00392             VLL = VL*SIGMA
00393             VUU = VU*SIGMA
00394          END IF
00395       END IF
00396 
00397 *     Initialize indices into workspaces.  Note: The IWORK indices are
00398 *     used only if SSTERF or SSTEMR fail.
00399 
00400 *     WORK(INDTAU:INDTAU+N-1) stores the scalar factors of the
00401 *     elementary reflectors used in SSYTRD.
00402       INDTAU = 1
00403 *     WORK(INDD:INDD+N-1) stores the tridiagonal's diagonal entries.
00404       INDD = INDTAU + N
00405 *     WORK(INDE:INDE+N-1) stores the off-diagonal entries of the
00406 *     tridiagonal matrix from SSYTRD.
00407       INDE = INDD + N
00408 *     WORK(INDDD:INDDD+N-1) is a copy of the diagonal entries over
00409 *     -written by SSTEMR (the SSTERF path copies the diagonal to W).
00410       INDDD = INDE + N
00411 *     WORK(INDEE:INDEE+N-1) is a copy of the off-diagonal entries over
00412 *     -written while computing the eigenvalues in SSTERF and SSTEMR.
00413       INDEE = INDDD + N
00414 *     INDWK is the starting offset of the left-over workspace, and
00415 *     LLWORK is the remaining workspace size.
00416       INDWK = INDEE + N
00417       LLWORK = LWORK - INDWK + 1
00418 
00419 *     IWORK(INDIBL:INDIBL+M-1) corresponds to IBLOCK in SSTEBZ and
00420 *     stores the block indices of each of the M<=N eigenvalues.
00421       INDIBL = 1
00422 *     IWORK(INDISP:INDISP+NSPLIT-1) corresponds to ISPLIT in SSTEBZ and
00423 *     stores the starting and finishing indices of each block.
00424       INDISP = INDIBL + N
00425 *     IWORK(INDIFL:INDIFL+N-1) stores the indices of eigenvectors
00426 *     that corresponding to eigenvectors that fail to converge in
00427 *     SSTEIN.  This information is discarded; if any fail, the driver
00428 *     returns INFO > 0.
00429       INDIFL = INDISP + N
00430 *     INDIWO is the offset of the remaining integer workspace.
00431       INDIWO = INDISP + N
00432 
00433 *
00434 *     Call SSYTRD to reduce symmetric matrix to tridiagonal form.
00435 *
00436       CALL SSYTRD( UPLO, N, A, LDA, WORK( INDD ), WORK( INDE ),
00437      $             WORK( INDTAU ), WORK( INDWK ), LLWORK, IINFO )
00438 *
00439 *     If all eigenvalues are desired
00440 *     then call SSTERF or SSTEMR and SORMTR.
00441 *
00442       TEST = .FALSE.
00443       IF( INDEIG ) THEN
00444          IF( IL.EQ.1 .AND. IU.EQ.N ) THEN
00445             TEST = .TRUE.
00446          END IF
00447       END IF
00448       IF( ( ALLEIG.OR.TEST ) .AND. ( IEEEOK.EQ.1 ) ) THEN
00449          IF( .NOT.WANTZ ) THEN
00450             CALL SCOPY( N, WORK( INDD ), 1, W, 1 )
00451             CALL SCOPY( N-1, WORK( INDE ), 1, WORK( INDEE ), 1 )
00452             CALL SSTERF( N, W, WORK( INDEE ), INFO )
00453          ELSE
00454             CALL SCOPY( N-1, WORK( INDE ), 1, WORK( INDEE ), 1 )
00455             CALL SCOPY( N, WORK( INDD ), 1, WORK( INDDD ), 1 )
00456 *
00457             IF (ABSTOL .LE. TWO*N*EPS) THEN
00458                TRYRAC = .TRUE.
00459             ELSE
00460                TRYRAC = .FALSE.
00461             END IF
00462             CALL SSTEMR( JOBZ, 'A', N, WORK( INDDD ), WORK( INDEE ),
00463      $                   VL, VU, IL, IU, M, W, Z, LDZ, N, ISUPPZ,
00464      $                   TRYRAC, WORK( INDWK ), LWORK, IWORK, LIWORK,
00465      $                   INFO )
00466 *
00467 *
00468 *
00469 *        Apply orthogonal matrix used in reduction to tridiagonal
00470 *        form to eigenvectors returned by SSTEIN.
00471 *
00472             IF( WANTZ .AND. INFO.EQ.0 ) THEN
00473                INDWKN = INDE
00474                LLWRKN = LWORK - INDWKN + 1
00475                CALL SORMTR( 'L', UPLO, 'N', N, M, A, LDA,
00476      $                      WORK( INDTAU ), Z, LDZ, WORK( INDWKN ),
00477      $                      LLWRKN, IINFO )
00478             END IF
00479          END IF
00480 *
00481 *
00482          IF( INFO.EQ.0 ) THEN
00483 *           Everything worked.  Skip SSTEBZ/SSTEIN.  IWORK(:) are
00484 *           undefined.
00485             M = N
00486             GO TO 30
00487          END IF
00488          INFO = 0
00489       END IF
00490 *
00491 *     Otherwise, call SSTEBZ and, if eigenvectors are desired, SSTEIN.
00492 *     Also call SSTEBZ and SSTEIN if SSTEMR fails.
00493 *
00494       IF( WANTZ ) THEN
00495          ORDER = 'B'
00496       ELSE
00497          ORDER = 'E'
00498       END IF
00499 
00500       CALL SSTEBZ( RANGE, ORDER, N, VLL, VUU, IL, IU, ABSTLL,
00501      $             WORK( INDD ), WORK( INDE ), M, NSPLIT, W,
00502      $             IWORK( INDIBL ), IWORK( INDISP ), WORK( INDWK ),
00503      $             IWORK( INDIWO ), INFO )
00504 *
00505       IF( WANTZ ) THEN
00506          CALL SSTEIN( N, WORK( INDD ), WORK( INDE ), M, W,
00507      $                IWORK( INDIBL ), IWORK( INDISP ), Z, LDZ,
00508      $                WORK( INDWK ), IWORK( INDIWO ), IWORK( INDIFL ),
00509      $                INFO )
00510 *
00511 *        Apply orthogonal matrix used in reduction to tridiagonal
00512 *        form to eigenvectors returned by SSTEIN.
00513 *
00514          INDWKN = INDE
00515          LLWRKN = LWORK - INDWKN + 1
00516          CALL SORMTR( 'L', UPLO, 'N', N, M, A, LDA, WORK( INDTAU ), Z,
00517      $                LDZ, WORK( INDWKN ), LLWRKN, IINFO )
00518       END IF
00519 *
00520 *     If matrix was scaled, then rescale eigenvalues appropriately.
00521 *
00522 *  Jump here if SSTEMR/SSTEIN succeeded.
00523    30 CONTINUE
00524       IF( ISCALE.EQ.1 ) THEN
00525          IF( INFO.EQ.0 ) THEN
00526             IMAX = M
00527          ELSE
00528             IMAX = INFO - 1
00529          END IF
00530          CALL SSCAL( IMAX, ONE / SIGMA, W, 1 )
00531       END IF
00532 *
00533 *     If eigenvalues are not in order, then sort them, along with
00534 *     eigenvectors.  Note: We do not sort the IFAIL portion of IWORK.
00535 *     It may not be initialized (if SSTEMR/SSTEIN succeeded), and we do
00536 *     not return this detailed information to the user.
00537 *
00538       IF( WANTZ ) THEN
00539          DO 50 J = 1, M - 1
00540             I = 0
00541             TMP1 = W( J )
00542             DO 40 JJ = J + 1, M
00543                IF( W( JJ ).LT.TMP1 ) THEN
00544                   I = JJ
00545                   TMP1 = W( JJ )
00546                END IF
00547    40       CONTINUE
00548 *
00549             IF( I.NE.0 ) THEN
00550                W( I ) = W( J )
00551                W( J ) = TMP1
00552                CALL SSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 )
00553             END IF
00554    50    CONTINUE
00555       END IF
00556 *
00557 *     Set WORK(1) to optimal workspace size.
00558 *
00559       WORK( 1 ) = LWKOPT
00560       IWORK( 1 ) = LIWMIN
00561 *
00562       RETURN
00563 *
00564 *     End of SSYEVR
00565 *
00566       END
 All Files Functions