LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
dstevr.f
Go to the documentation of this file.
00001 *> \brief <b> DSTEVR 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 DSTEVR + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dstevr.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dstevr.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dstevr.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE DSTEVR( 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 *       DOUBLE PRECISION   ABSTOL, VL, VU
00029 *       ..
00030 *       .. Array Arguments ..
00031 *       INTEGER            ISUPPZ( * ), IWORK( * )
00032 *       DOUBLE PRECISION   D( * ), E( * ), W( * ), WORK( * ), Z( LDZ, * )
00033 *       ..
00034 *  
00035 *
00036 *> \par Purpose:
00037 *  =============
00038 *>
00039 *> \verbatim
00040 *>
00041 *> DSTEVR 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, DSTEVR calls DSTEMR to compute the
00047 *> eigenspectrum using Relatively Robust Representations.  DSTEMR
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 : DSTEVR calls DSTEMR when the full spectrum is requested
00073 *> on machines which conform to the ieee-754 floating point standard.
00074 *> DSTEVR calls DSTEBZ and DSTEIN on non-ieee machines and
00075 *> when partial spectrum requests are made.
00076 *>
00077 *> Normal execution of DSTEMR 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, DSTEBZ and
00101 *>          DSTEIN 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 DOUBLE PRECISION 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 DOUBLE PRECISION 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 DOUBLE PRECISION
00131 *> \endverbatim
00132 *>
00133 *> \param[in] VU
00134 *> \verbatim
00135 *>          VU is DOUBLE PRECISION
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 DOUBLE PRECISION
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 *>          DLAMCH( '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 DOUBLE PRECISION 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 DOUBLE PRECISION 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 DOUBLE PRECISION 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 >= max(1,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 >= max(1,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 doubleOTHEReigen
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 *>
00295 *  =====================================================================
00296       SUBROUTINE DSTEVR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, ABSTOL,
00297      $                   M, W, Z, LDZ, ISUPPZ, WORK, LWORK, IWORK,
00298      $                   LIWORK, INFO )
00299 *
00300 *  -- LAPACK driver routine (version 3.4.0) --
00301 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00302 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00303 *     November 2011
00304 *
00305 *     .. Scalar Arguments ..
00306       CHARACTER          JOBZ, RANGE
00307       INTEGER            IL, INFO, IU, LDZ, LIWORK, LWORK, M, N
00308       DOUBLE PRECISION   ABSTOL, VL, VU
00309 *     ..
00310 *     .. Array Arguments ..
00311       INTEGER            ISUPPZ( * ), IWORK( * )
00312       DOUBLE PRECISION   D( * ), E( * ), W( * ), WORK( * ), Z( LDZ, * )
00313 *     ..
00314 *
00315 *  =====================================================================
00316 *
00317 *     .. Parameters ..
00318       DOUBLE PRECISION   ZERO, ONE, TWO
00319       PARAMETER          ( ZERO = 0.0D+0, ONE = 1.0D+0, TWO = 2.0D+0 )
00320 *     ..
00321 *     .. Local Scalars ..
00322       LOGICAL            ALLEIG, INDEIG, TEST, LQUERY, VALEIG, WANTZ,
00323      $                   TRYRAC
00324       CHARACTER          ORDER
00325       INTEGER            I, IEEEOK, IMAX, INDIBL, INDIFL, INDISP,
00326      $                   INDIWO, ISCALE, ITMP1, J, JJ, LIWMIN, LWMIN,
00327      $                   NSPLIT
00328       DOUBLE PRECISION   BIGNUM, EPS, RMAX, RMIN, SAFMIN, SIGMA, SMLNUM,
00329      $                   TMP1, TNRM, VLL, VUU
00330 *     ..
00331 *     .. External Functions ..
00332       LOGICAL            LSAME
00333       INTEGER            ILAENV
00334       DOUBLE PRECISION   DLAMCH, DLANST
00335       EXTERNAL           LSAME, ILAENV, DLAMCH, DLANST
00336 *     ..
00337 *     .. External Subroutines ..
00338       EXTERNAL           DCOPY, DSCAL, DSTEBZ, DSTEMR, DSTEIN, DSTERF,
00339      $                   DSWAP, XERBLA
00340 *     ..
00341 *     .. Intrinsic Functions ..
00342       INTRINSIC          MAX, MIN, SQRT
00343 *     ..
00344 *     .. Executable Statements ..
00345 *
00346 *
00347 *     Test the input parameters.
00348 *
00349       IEEEOK = ILAENV( 10, 'DSTEVR', 'N', 1, 2, 3, 4 )
00350 *
00351       WANTZ = LSAME( JOBZ, 'V' )
00352       ALLEIG = LSAME( RANGE, 'A' )
00353       VALEIG = LSAME( RANGE, 'V' )
00354       INDEIG = LSAME( RANGE, 'I' )
00355 *
00356       LQUERY = ( ( LWORK.EQ.-1 ) .OR. ( LIWORK.EQ.-1 ) )
00357       LWMIN = MAX( 1, 20*N )
00358       LIWMIN = MAX( 1, 10*N )
00359 *
00360 *
00361       INFO = 0
00362       IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
00363          INFO = -1
00364       ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
00365          INFO = -2
00366       ELSE IF( N.LT.0 ) THEN
00367          INFO = -3
00368       ELSE
00369          IF( VALEIG ) THEN
00370             IF( N.GT.0 .AND. VU.LE.VL )
00371      $         INFO = -7
00372          ELSE IF( INDEIG ) THEN
00373             IF( IL.LT.1 .OR. IL.GT.MAX( 1, N ) ) THEN
00374                INFO = -8
00375             ELSE IF( IU.LT.MIN( N, IL ) .OR. IU.GT.N ) THEN
00376                INFO = -9
00377             END IF
00378          END IF
00379       END IF
00380       IF( INFO.EQ.0 ) THEN
00381          IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
00382             INFO = -14
00383          END IF
00384       END IF
00385 *
00386       IF( INFO.EQ.0 ) THEN
00387          WORK( 1 ) = LWMIN
00388          IWORK( 1 ) = LIWMIN
00389 *
00390          IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
00391             INFO = -17
00392          ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN
00393             INFO = -19
00394          END IF
00395       END IF
00396 *
00397       IF( INFO.NE.0 ) THEN
00398          CALL XERBLA( 'DSTEVR', -INFO )
00399          RETURN
00400       ELSE IF( LQUERY ) THEN
00401          RETURN
00402       END IF
00403 *
00404 *     Quick return if possible
00405 *
00406       M = 0
00407       IF( N.EQ.0 )
00408      $   RETURN
00409 *
00410       IF( N.EQ.1 ) THEN
00411          IF( ALLEIG .OR. INDEIG ) THEN
00412             M = 1
00413             W( 1 ) = D( 1 )
00414          ELSE
00415             IF( VL.LT.D( 1 ) .AND. VU.GE.D( 1 ) ) THEN
00416                M = 1
00417                W( 1 ) = D( 1 )
00418             END IF
00419          END IF
00420          IF( WANTZ )
00421      $      Z( 1, 1 ) = ONE
00422          RETURN
00423       END IF
00424 *
00425 *     Get machine constants.
00426 *
00427       SAFMIN = DLAMCH( 'Safe minimum' )
00428       EPS = DLAMCH( 'Precision' )
00429       SMLNUM = SAFMIN / EPS
00430       BIGNUM = ONE / SMLNUM
00431       RMIN = SQRT( SMLNUM )
00432       RMAX = MIN( SQRT( BIGNUM ), ONE / SQRT( SQRT( SAFMIN ) ) )
00433 *
00434 *
00435 *     Scale matrix to allowable range, if necessary.
00436 *
00437       ISCALE = 0
00438       VLL = VL
00439       VUU = VU
00440 *
00441       TNRM = DLANST( 'M', N, D, E )
00442       IF( TNRM.GT.ZERO .AND. TNRM.LT.RMIN ) THEN
00443          ISCALE = 1
00444          SIGMA = RMIN / TNRM
00445       ELSE IF( TNRM.GT.RMAX ) THEN
00446          ISCALE = 1
00447          SIGMA = RMAX / TNRM
00448       END IF
00449       IF( ISCALE.EQ.1 ) THEN
00450          CALL DSCAL( N, SIGMA, D, 1 )
00451          CALL DSCAL( N-1, SIGMA, E( 1 ), 1 )
00452          IF( VALEIG ) THEN
00453             VLL = VL*SIGMA
00454             VUU = VU*SIGMA
00455          END IF
00456       END IF
00457 
00458 *     Initialize indices into workspaces.  Note: These indices are used only
00459 *     if DSTERF or DSTEMR fail.
00460 
00461 *     IWORK(INDIBL:INDIBL+M-1) corresponds to IBLOCK in DSTEBZ and
00462 *     stores the block indices of each of the M<=N eigenvalues.
00463       INDIBL = 1
00464 *     IWORK(INDISP:INDISP+NSPLIT-1) corresponds to ISPLIT in DSTEBZ and
00465 *     stores the starting and finishing indices of each block.
00466       INDISP = INDIBL + N
00467 *     IWORK(INDIFL:INDIFL+N-1) stores the indices of eigenvectors
00468 *     that corresponding to eigenvectors that fail to converge in
00469 *     DSTEIN.  This information is discarded; if any fail, the driver
00470 *     returns INFO > 0.
00471       INDIFL = INDISP + N
00472 *     INDIWO is the offset of the remaining integer workspace.
00473       INDIWO = INDISP + N
00474 *
00475 *     If all eigenvalues are desired, then
00476 *     call DSTERF or DSTEMR.  If this fails for some eigenvalue, then
00477 *     try DSTEBZ.
00478 *
00479 *
00480       TEST = .FALSE.
00481       IF( INDEIG ) THEN
00482          IF( IL.EQ.1 .AND. IU.EQ.N ) THEN
00483             TEST = .TRUE.
00484          END IF
00485       END IF
00486       IF( ( ALLEIG .OR. TEST ) .AND. IEEEOK.EQ.1 ) THEN
00487          CALL DCOPY( N-1, E( 1 ), 1, WORK( 1 ), 1 )
00488          IF( .NOT.WANTZ ) THEN
00489             CALL DCOPY( N, D, 1, W, 1 )
00490             CALL DSTERF( N, W, WORK, INFO )
00491          ELSE
00492             CALL DCOPY( N, D, 1, WORK( N+1 ), 1 )
00493             IF (ABSTOL .LE. TWO*N*EPS) THEN
00494                TRYRAC = .TRUE.
00495             ELSE
00496                TRYRAC = .FALSE.
00497             END IF
00498             CALL DSTEMR( JOBZ, 'A', N, WORK( N+1 ), WORK, VL, VU, IL,
00499      $                   IU, M, W, Z, LDZ, N, ISUPPZ, TRYRAC,
00500      $                   WORK( 2*N+1 ), LWORK-2*N, IWORK, LIWORK, INFO )
00501 *
00502          END IF
00503          IF( INFO.EQ.0 ) THEN
00504             M = N
00505             GO TO 10
00506          END IF
00507          INFO = 0
00508       END IF
00509 *
00510 *     Otherwise, call DSTEBZ and, if eigenvectors are desired, DSTEIN.
00511 *
00512       IF( WANTZ ) THEN
00513          ORDER = 'B'
00514       ELSE
00515          ORDER = 'E'
00516       END IF
00517 
00518       CALL DSTEBZ( RANGE, ORDER, N, VLL, VUU, IL, IU, ABSTOL, D, E, M,
00519      $             NSPLIT, W, IWORK( INDIBL ), IWORK( INDISP ), WORK,
00520      $             IWORK( INDIWO ), INFO )
00521 *
00522       IF( WANTZ ) THEN
00523          CALL DSTEIN( N, D, E, M, W, IWORK( INDIBL ), IWORK( INDISP ),
00524      $                Z, LDZ, WORK, IWORK( INDIWO ), IWORK( INDIFL ),
00525      $                INFO )
00526       END IF
00527 *
00528 *     If matrix was scaled, then rescale eigenvalues appropriately.
00529 *
00530    10 CONTINUE
00531       IF( ISCALE.EQ.1 ) THEN
00532          IF( INFO.EQ.0 ) THEN
00533             IMAX = M
00534          ELSE
00535             IMAX = INFO - 1
00536          END IF
00537          CALL DSCAL( IMAX, ONE / SIGMA, W, 1 )
00538       END IF
00539 *
00540 *     If eigenvalues are not in order, then sort them, along with
00541 *     eigenvectors.
00542 *
00543       IF( WANTZ ) THEN
00544          DO 30 J = 1, M - 1
00545             I = 0
00546             TMP1 = W( J )
00547             DO 20 JJ = J + 1, M
00548                IF( W( JJ ).LT.TMP1 ) THEN
00549                   I = JJ
00550                   TMP1 = W( JJ )
00551                END IF
00552    20       CONTINUE
00553 *
00554             IF( I.NE.0 ) THEN
00555                ITMP1 = IWORK( I )
00556                W( I ) = W( J )
00557                IWORK( I ) = IWORK( J )
00558                W( J ) = TMP1
00559                IWORK( J ) = ITMP1
00560                CALL DSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 )
00561             END IF
00562    30    CONTINUE
00563       END IF
00564 *
00565 *      Causes problems with tests 19 & 20:
00566 *      IF (wantz .and. INDEIG ) Z( 1,1) = Z(1,1) / 1.002 + .002
00567 *
00568 *
00569       WORK( 1 ) = LWMIN
00570       IWORK( 1 ) = LIWMIN
00571       RETURN
00572 *
00573 *     End of DSTEVR
00574 *
00575       END
 All Files Functions