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