LAPACK 3.3.1
Linear Algebra PACKage
|
00001 SUBROUTINE DSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU, 00002 $ M, W, Z, LDZ, NZC, ISUPPZ, TRYRAC, WORK, LWORK, 00003 $ IWORK, LIWORK, INFO ) 00004 IMPLICIT NONE 00005 * 00006 * -- LAPACK computational routine (version 3.2.2) -- 00007 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00008 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00009 * -- June 2010 -- 00010 * 00011 * .. Scalar Arguments .. 00012 CHARACTER JOBZ, RANGE 00013 LOGICAL TRYRAC 00014 INTEGER IL, INFO, IU, LDZ, NZC, LIWORK, LWORK, M, N 00015 DOUBLE PRECISION VL, VU 00016 * .. 00017 * .. Array Arguments .. 00018 INTEGER ISUPPZ( * ), IWORK( * ) 00019 DOUBLE PRECISION D( * ), E( * ), W( * ), WORK( * ) 00020 DOUBLE PRECISION Z( LDZ, * ) 00021 * .. 00022 * 00023 * Purpose 00024 * ======= 00025 * 00026 * DSTEMR computes selected eigenvalues and, optionally, eigenvectors 00027 * of a real symmetric tridiagonal matrix T. Any such unreduced matrix has 00028 * a well defined set of pairwise different real eigenvalues, the corresponding 00029 * real eigenvectors are pairwise orthogonal. 00030 * 00031 * The spectrum may be computed either completely or partially by specifying 00032 * either an interval (VL,VU] or a range of indices IL:IU for the desired 00033 * eigenvalues. 00034 * 00035 * Depending on the number of desired eigenvalues, these are computed either 00036 * by bisection or the dqds algorithm. Numerically orthogonal eigenvectors are 00037 * computed by the use of various suitable L D L^T factorizations near clusters 00038 * of close eigenvalues (referred to as RRRs, Relatively Robust 00039 * Representations). An informal sketch of the algorithm follows. 00040 * 00041 * For each unreduced block (submatrix) of T, 00042 * (a) Compute T - sigma I = L D L^T, so that L and D 00043 * define all the wanted eigenvalues to high relative accuracy. 00044 * This means that small relative changes in the entries of D and L 00045 * cause only small relative changes in the eigenvalues and 00046 * eigenvectors. The standard (unfactored) representation of the 00047 * tridiagonal matrix T does not have this property in general. 00048 * (b) Compute the eigenvalues to suitable accuracy. 00049 * If the eigenvectors are desired, the algorithm attains full 00050 * accuracy of the computed eigenvalues only right before 00051 * the corresponding vectors have to be computed, see steps c) and d). 00052 * (c) For each cluster of close eigenvalues, select a new 00053 * shift close to the cluster, find a new factorization, and refine 00054 * the shifted eigenvalues to suitable accuracy. 00055 * (d) For each eigenvalue with a large enough relative separation compute 00056 * the corresponding eigenvector by forming a rank revealing twisted 00057 * factorization. Go back to (c) for any clusters that remain. 00058 * 00059 * For more details, see: 00060 * - Inderjit S. Dhillon and Beresford N. Parlett: "Multiple representations 00061 * to compute orthogonal eigenvectors of symmetric tridiagonal matrices," 00062 * Linear Algebra and its Applications, 387(1), pp. 1-28, August 2004. 00063 * - Inderjit Dhillon and Beresford Parlett: "Orthogonal Eigenvectors and 00064 * Relative Gaps," SIAM Journal on Matrix Analysis and Applications, Vol. 25, 00065 * 2004. Also LAPACK Working Note 154. 00066 * - Inderjit Dhillon: "A new O(n^2) algorithm for the symmetric 00067 * tridiagonal eigenvalue/eigenvector problem", 00068 * Computer Science Division Technical Report No. UCB/CSD-97-971, 00069 * UC Berkeley, May 1997. 00070 * 00071 * Further Details 00072 * 1.DSTEMR works only on machines which follow IEEE-754 00073 * floating-point standard in their handling of infinities and NaNs. 00074 * This permits the use of efficient inner loops avoiding a check for 00075 * zero divisors. 00076 * 00077 * Arguments 00078 * ========= 00079 * 00080 * JOBZ (input) CHARACTER*1 00081 * = 'N': Compute eigenvalues only; 00082 * = 'V': Compute eigenvalues and eigenvectors. 00083 * 00084 * RANGE (input) CHARACTER*1 00085 * = 'A': all eigenvalues will be found. 00086 * = 'V': all eigenvalues in the half-open interval (VL,VU] 00087 * will be found. 00088 * = 'I': the IL-th through IU-th eigenvalues will be found. 00089 * 00090 * N (input) INTEGER 00091 * The order of the matrix. N >= 0. 00092 * 00093 * D (input/output) DOUBLE PRECISION array, dimension (N) 00094 * On entry, the N diagonal elements of the tridiagonal matrix 00095 * T. On exit, D is overwritten. 00096 * 00097 * E (input/output) DOUBLE PRECISION array, dimension (N) 00098 * On entry, the (N-1) subdiagonal elements of the tridiagonal 00099 * matrix T in elements 1 to N-1 of E. E(N) need not be set on 00100 * input, but is used internally as workspace. 00101 * On exit, E is overwritten. 00102 * 00103 * VL (input) DOUBLE PRECISION 00104 * VU (input) DOUBLE PRECISION 00105 * If RANGE='V', the lower and upper bounds of the interval to 00106 * be searched for eigenvalues. VL < VU. 00107 * Not referenced if RANGE = 'A' or 'I'. 00108 * 00109 * IL (input) INTEGER 00110 * IU (input) INTEGER 00111 * If RANGE='I', the indices (in ascending order) of the 00112 * smallest and largest eigenvalues to be returned. 00113 * 1 <= IL <= IU <= N, if N > 0. 00114 * Not referenced if RANGE = 'A' or 'V'. 00115 * 00116 * M (output) INTEGER 00117 * The total number of eigenvalues found. 0 <= M <= N. 00118 * If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1. 00119 * 00120 * W (output) DOUBLE PRECISION array, dimension (N) 00121 * The first M elements contain the selected eigenvalues in 00122 * ascending order. 00123 * 00124 * Z (output) DOUBLE PRECISION array, dimension (LDZ, max(1,M) ) 00125 * If JOBZ = 'V', and if INFO = 0, then the first M columns of Z 00126 * contain the orthonormal eigenvectors of the matrix T 00127 * corresponding to the selected eigenvalues, with the i-th 00128 * column of Z holding the eigenvector associated with W(i). 00129 * If JOBZ = 'N', then Z is not referenced. 00130 * Note: the user must ensure that at least max(1,M) columns are 00131 * supplied in the array Z; if RANGE = 'V', the exact value of M 00132 * is not known in advance and can be computed with a workspace 00133 * query by setting NZC = -1, see below. 00134 * 00135 * LDZ (input) INTEGER 00136 * The leading dimension of the array Z. LDZ >= 1, and if 00137 * JOBZ = 'V', then LDZ >= max(1,N). 00138 * 00139 * NZC (input) INTEGER 00140 * The number of eigenvectors to be held in the array Z. 00141 * If RANGE = 'A', then NZC >= max(1,N). 00142 * If RANGE = 'V', then NZC >= the number of eigenvalues in (VL,VU]. 00143 * If RANGE = 'I', then NZC >= IU-IL+1. 00144 * If NZC = -1, then a workspace query is assumed; the 00145 * routine calculates the number of columns of the array Z that 00146 * are needed to hold the eigenvectors. 00147 * This value is returned as the first entry of the Z array, and 00148 * no error message related to NZC is issued by XERBLA. 00149 * 00150 * ISUPPZ (output) INTEGER ARRAY, dimension ( 2*max(1,M) ) 00151 * The support of the eigenvectors in Z, i.e., the indices 00152 * indicating the nonzero elements in Z. The i-th computed eigenvector 00153 * is nonzero only in elements ISUPPZ( 2*i-1 ) through 00154 * ISUPPZ( 2*i ). This is relevant in the case when the matrix 00155 * is split. ISUPPZ is only accessed when JOBZ is 'V' and N > 0. 00156 * 00157 * TRYRAC (input/output) LOGICAL 00158 * If TRYRAC.EQ..TRUE., indicates that the code should check whether 00159 * the tridiagonal matrix defines its eigenvalues to high relative 00160 * accuracy. If so, the code uses relative-accuracy preserving 00161 * algorithms that might be (a bit) slower depending on the matrix. 00162 * If the matrix does not define its eigenvalues to high relative 00163 * accuracy, the code can uses possibly faster algorithms. 00164 * If TRYRAC.EQ..FALSE., the code is not required to guarantee 00165 * relatively accurate eigenvalues and can use the fastest possible 00166 * techniques. 00167 * On exit, a .TRUE. TRYRAC will be set to .FALSE. if the matrix 00168 * does not define its eigenvalues to high relative accuracy. 00169 * 00170 * WORK (workspace/output) DOUBLE PRECISION array, dimension (LWORK) 00171 * On exit, if INFO = 0, WORK(1) returns the optimal 00172 * (and minimal) LWORK. 00173 * 00174 * LWORK (input) INTEGER 00175 * The dimension of the array WORK. LWORK >= max(1,18*N) 00176 * if JOBZ = 'V', and LWORK >= max(1,12*N) if JOBZ = 'N'. 00177 * If LWORK = -1, then a workspace query is assumed; the routine 00178 * only calculates the optimal size of the WORK array, returns 00179 * this value as the first entry of the WORK array, and no error 00180 * message related to LWORK is issued by XERBLA. 00181 * 00182 * IWORK (workspace/output) INTEGER array, dimension (LIWORK) 00183 * On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK. 00184 * 00185 * LIWORK (input) INTEGER 00186 * The dimension of the array IWORK. LIWORK >= max(1,10*N) 00187 * if the eigenvectors are desired, and LIWORK >= max(1,8*N) 00188 * if only the eigenvalues are to be computed. 00189 * If LIWORK = -1, then a workspace query is assumed; the 00190 * routine only calculates the optimal size of the IWORK array, 00191 * returns this value as the first entry of the IWORK array, and 00192 * no error message related to LIWORK is issued by XERBLA. 00193 * 00194 * INFO (output) INTEGER 00195 * On exit, INFO 00196 * = 0: successful exit 00197 * < 0: if INFO = -i, the i-th argument had an illegal value 00198 * > 0: if INFO = 1X, internal error in DLARRE, 00199 * if INFO = 2X, internal error in DLARRV. 00200 * Here, the digit X = ABS( IINFO ) < 10, where IINFO is 00201 * the nonzero error code returned by DLARRE or 00202 * DLARRV, respectively. 00203 * 00204 * 00205 * Further Details 00206 * =============== 00207 * 00208 * Based on contributions by 00209 * Beresford Parlett, University of California, Berkeley, USA 00210 * Jim Demmel, University of California, Berkeley, USA 00211 * Inderjit Dhillon, University of Texas, Austin, USA 00212 * Osni Marques, LBNL/NERSC, USA 00213 * Christof Voemel, University of California, Berkeley, USA 00214 * 00215 * ===================================================================== 00216 * 00217 * .. Parameters .. 00218 DOUBLE PRECISION ZERO, ONE, FOUR, MINRGP 00219 PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0, 00220 $ FOUR = 4.0D0, 00221 $ MINRGP = 1.0D-3 ) 00222 * .. 00223 * .. Local Scalars .. 00224 LOGICAL ALLEIG, INDEIG, LQUERY, VALEIG, WANTZ, ZQUERY 00225 INTEGER I, IBEGIN, IEND, IFIRST, IIL, IINDBL, IINDW, 00226 $ IINDWK, IINFO, IINSPL, IIU, ILAST, IN, INDD, 00227 $ INDE2, INDERR, INDGP, INDGRS, INDWRK, ITMP, 00228 $ ITMP2, J, JBLK, JJ, LIWMIN, LWMIN, NSPLIT, 00229 $ NZCMIN, OFFSET, WBEGIN, WEND 00230 DOUBLE PRECISION BIGNUM, CS, EPS, PIVMIN, R1, R2, RMAX, RMIN, 00231 $ RTOL1, RTOL2, SAFMIN, SCALE, SMLNUM, SN, 00232 $ THRESH, TMP, TNRM, WL, WU 00233 * .. 00234 * .. 00235 * .. External Functions .. 00236 LOGICAL LSAME 00237 DOUBLE PRECISION DLAMCH, DLANST 00238 EXTERNAL LSAME, DLAMCH, DLANST 00239 * .. 00240 * .. External Subroutines .. 00241 EXTERNAL DCOPY, DLAE2, DLAEV2, DLARRC, DLARRE, DLARRJ, 00242 $ DLARRR, DLARRV, DLASRT, DSCAL, DSWAP, XERBLA 00243 * .. 00244 * .. Intrinsic Functions .. 00245 INTRINSIC MAX, MIN, SQRT 00246 00247 00248 * .. 00249 * .. Executable Statements .. 00250 * 00251 * Test the input parameters. 00252 * 00253 WANTZ = LSAME( JOBZ, 'V' ) 00254 ALLEIG = LSAME( RANGE, 'A' ) 00255 VALEIG = LSAME( RANGE, 'V' ) 00256 INDEIG = LSAME( RANGE, 'I' ) 00257 * 00258 LQUERY = ( ( LWORK.EQ.-1 ).OR.( LIWORK.EQ.-1 ) ) 00259 ZQUERY = ( NZC.EQ.-1 ) 00260 00261 * DSTEMR needs WORK of size 6*N, IWORK of size 3*N. 00262 * In addition, DLARRE needs WORK of size 6*N, IWORK of size 5*N. 00263 * Furthermore, DLARRV needs WORK of size 12*N, IWORK of size 7*N. 00264 IF( WANTZ ) THEN 00265 LWMIN = 18*N 00266 LIWMIN = 10*N 00267 ELSE 00268 * need less workspace if only the eigenvalues are wanted 00269 LWMIN = 12*N 00270 LIWMIN = 8*N 00271 ENDIF 00272 00273 WL = ZERO 00274 WU = ZERO 00275 IIL = 0 00276 IIU = 0 00277 00278 IF( VALEIG ) THEN 00279 * We do not reference VL, VU in the cases RANGE = 'I','A' 00280 * The interval (WL, WU] contains all the wanted eigenvalues. 00281 * It is either given by the user or computed in DLARRE. 00282 WL = VL 00283 WU = VU 00284 ELSEIF( INDEIG ) THEN 00285 * We do not reference IL, IU in the cases RANGE = 'V','A' 00286 IIL = IL 00287 IIU = IU 00288 ENDIF 00289 * 00290 INFO = 0 00291 IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN 00292 INFO = -1 00293 ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN 00294 INFO = -2 00295 ELSE IF( N.LT.0 ) THEN 00296 INFO = -3 00297 ELSE IF( VALEIG .AND. N.GT.0 .AND. WU.LE.WL ) THEN 00298 INFO = -7 00299 ELSE IF( INDEIG .AND. ( IIL.LT.1 .OR. IIL.GT.N ) ) THEN 00300 INFO = -8 00301 ELSE IF( INDEIG .AND. ( IIU.LT.IIL .OR. IIU.GT.N ) ) THEN 00302 INFO = -9 00303 ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN 00304 INFO = -13 00305 ELSE IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN 00306 INFO = -17 00307 ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN 00308 INFO = -19 00309 END IF 00310 * 00311 * Get machine constants. 00312 * 00313 SAFMIN = DLAMCH( 'Safe minimum' ) 00314 EPS = DLAMCH( 'Precision' ) 00315 SMLNUM = SAFMIN / EPS 00316 BIGNUM = ONE / SMLNUM 00317 RMIN = SQRT( SMLNUM ) 00318 RMAX = MIN( SQRT( BIGNUM ), ONE / SQRT( SQRT( SAFMIN ) ) ) 00319 * 00320 IF( INFO.EQ.0 ) THEN 00321 WORK( 1 ) = LWMIN 00322 IWORK( 1 ) = LIWMIN 00323 * 00324 IF( WANTZ .AND. ALLEIG ) THEN 00325 NZCMIN = N 00326 ELSE IF( WANTZ .AND. VALEIG ) THEN 00327 CALL DLARRC( 'T', N, VL, VU, D, E, SAFMIN, 00328 $ NZCMIN, ITMP, ITMP2, INFO ) 00329 ELSE IF( WANTZ .AND. INDEIG ) THEN 00330 NZCMIN = IIU-IIL+1 00331 ELSE 00332 * WANTZ .EQ. FALSE. 00333 NZCMIN = 0 00334 ENDIF 00335 IF( ZQUERY .AND. INFO.EQ.0 ) THEN 00336 Z( 1,1 ) = NZCMIN 00337 ELSE IF( NZC.LT.NZCMIN .AND. .NOT.ZQUERY ) THEN 00338 INFO = -14 00339 END IF 00340 END IF 00341 00342 IF( INFO.NE.0 ) THEN 00343 * 00344 CALL XERBLA( 'DSTEMR', -INFO ) 00345 * 00346 RETURN 00347 ELSE IF( LQUERY .OR. ZQUERY ) THEN 00348 RETURN 00349 END IF 00350 * 00351 * Handle N = 0, 1, and 2 cases immediately 00352 * 00353 M = 0 00354 IF( N.EQ.0 ) 00355 $ RETURN 00356 * 00357 IF( N.EQ.1 ) THEN 00358 IF( ALLEIG .OR. INDEIG ) THEN 00359 M = 1 00360 W( 1 ) = D( 1 ) 00361 ELSE 00362 IF( WL.LT.D( 1 ) .AND. WU.GE.D( 1 ) ) THEN 00363 M = 1 00364 W( 1 ) = D( 1 ) 00365 END IF 00366 END IF 00367 IF( WANTZ.AND.(.NOT.ZQUERY) ) THEN 00368 Z( 1, 1 ) = ONE 00369 ISUPPZ(1) = 1 00370 ISUPPZ(2) = 1 00371 END IF 00372 RETURN 00373 END IF 00374 * 00375 IF( N.EQ.2 ) THEN 00376 IF( .NOT.WANTZ ) THEN 00377 CALL DLAE2( D(1), E(1), D(2), R1, R2 ) 00378 ELSE IF( WANTZ.AND.(.NOT.ZQUERY) ) THEN 00379 CALL DLAEV2( D(1), E(1), D(2), R1, R2, CS, SN ) 00380 END IF 00381 IF( ALLEIG.OR. 00382 $ (VALEIG.AND.(R2.GT.WL).AND. 00383 $ (R2.LE.WU)).OR. 00384 $ (INDEIG.AND.(IIL.EQ.1)) ) THEN 00385 M = M+1 00386 W( M ) = R2 00387 IF( WANTZ.AND.(.NOT.ZQUERY) ) THEN 00388 Z( 1, M ) = -SN 00389 Z( 2, M ) = CS 00390 * Note: At most one of SN and CS can be zero. 00391 IF (SN.NE.ZERO) THEN 00392 IF (CS.NE.ZERO) THEN 00393 ISUPPZ(2*M-1) = 1 00394 ISUPPZ(2*M) = 2 00395 ELSE 00396 ISUPPZ(2*M-1) = 1 00397 ISUPPZ(2*M) = 1 00398 END IF 00399 ELSE 00400 ISUPPZ(2*M-1) = 2 00401 ISUPPZ(2*M) = 2 00402 END IF 00403 ENDIF 00404 ENDIF 00405 IF( ALLEIG.OR. 00406 $ (VALEIG.AND.(R1.GT.WL).AND. 00407 $ (R1.LE.WU)).OR. 00408 $ (INDEIG.AND.(IIU.EQ.2)) ) THEN 00409 M = M+1 00410 W( M ) = R1 00411 IF( WANTZ.AND.(.NOT.ZQUERY) ) THEN 00412 Z( 1, M ) = CS 00413 Z( 2, M ) = SN 00414 * Note: At most one of SN and CS can be zero. 00415 IF (SN.NE.ZERO) THEN 00416 IF (CS.NE.ZERO) THEN 00417 ISUPPZ(2*M-1) = 1 00418 ISUPPZ(2*M) = 2 00419 ELSE 00420 ISUPPZ(2*M-1) = 1 00421 ISUPPZ(2*M) = 1 00422 END IF 00423 ELSE 00424 ISUPPZ(2*M-1) = 2 00425 ISUPPZ(2*M) = 2 00426 END IF 00427 ENDIF 00428 ENDIF 00429 RETURN 00430 END IF 00431 00432 * Continue with general N 00433 00434 INDGRS = 1 00435 INDERR = 2*N + 1 00436 INDGP = 3*N + 1 00437 INDD = 4*N + 1 00438 INDE2 = 5*N + 1 00439 INDWRK = 6*N + 1 00440 * 00441 IINSPL = 1 00442 IINDBL = N + 1 00443 IINDW = 2*N + 1 00444 IINDWK = 3*N + 1 00445 * 00446 * Scale matrix to allowable range, if necessary. 00447 * The allowable range is related to the PIVMIN parameter; see the 00448 * comments in DLARRD. The preference for scaling small values 00449 * up is heuristic; we expect users' matrices not to be close to the 00450 * RMAX threshold. 00451 * 00452 SCALE = ONE 00453 TNRM = DLANST( 'M', N, D, E ) 00454 IF( TNRM.GT.ZERO .AND. TNRM.LT.RMIN ) THEN 00455 SCALE = RMIN / TNRM 00456 ELSE IF( TNRM.GT.RMAX ) THEN 00457 SCALE = RMAX / TNRM 00458 END IF 00459 IF( SCALE.NE.ONE ) THEN 00460 CALL DSCAL( N, SCALE, D, 1 ) 00461 CALL DSCAL( N-1, SCALE, E, 1 ) 00462 TNRM = TNRM*SCALE 00463 IF( VALEIG ) THEN 00464 * If eigenvalues in interval have to be found, 00465 * scale (WL, WU] accordingly 00466 WL = WL*SCALE 00467 WU = WU*SCALE 00468 ENDIF 00469 END IF 00470 * 00471 * Compute the desired eigenvalues of the tridiagonal after splitting 00472 * into smaller subblocks if the corresponding off-diagonal elements 00473 * are small 00474 * THRESH is the splitting parameter for DLARRE 00475 * A negative THRESH forces the old splitting criterion based on the 00476 * size of the off-diagonal. A positive THRESH switches to splitting 00477 * which preserves relative accuracy. 00478 * 00479 IF( TRYRAC ) THEN 00480 * Test whether the matrix warrants the more expensive relative approach. 00481 CALL DLARRR( N, D, E, IINFO ) 00482 ELSE 00483 * The user does not care about relative accurately eigenvalues 00484 IINFO = -1 00485 ENDIF 00486 * Set the splitting criterion 00487 IF (IINFO.EQ.0) THEN 00488 THRESH = EPS 00489 ELSE 00490 THRESH = -EPS 00491 * relative accuracy is desired but T does not guarantee it 00492 TRYRAC = .FALSE. 00493 ENDIF 00494 * 00495 IF( TRYRAC ) THEN 00496 * Copy original diagonal, needed to guarantee relative accuracy 00497 CALL DCOPY(N,D,1,WORK(INDD),1) 00498 ENDIF 00499 * Store the squares of the offdiagonal values of T 00500 DO 5 J = 1, N-1 00501 WORK( INDE2+J-1 ) = E(J)**2 00502 5 CONTINUE 00503 00504 * Set the tolerance parameters for bisection 00505 IF( .NOT.WANTZ ) THEN 00506 * DLARRE computes the eigenvalues to full precision. 00507 RTOL1 = FOUR * EPS 00508 RTOL2 = FOUR * EPS 00509 ELSE 00510 * DLARRE computes the eigenvalues to less than full precision. 00511 * DLARRV will refine the eigenvalue approximations, and we can 00512 * need less accurate initial bisection in DLARRE. 00513 * Note: these settings do only affect the subset case and DLARRE 00514 RTOL1 = SQRT(EPS) 00515 RTOL2 = MAX( SQRT(EPS)*5.0D-3, FOUR * EPS ) 00516 ENDIF 00517 CALL DLARRE( RANGE, N, WL, WU, IIL, IIU, D, E, 00518 $ WORK(INDE2), RTOL1, RTOL2, THRESH, NSPLIT, 00519 $ IWORK( IINSPL ), M, W, WORK( INDERR ), 00520 $ WORK( INDGP ), IWORK( IINDBL ), 00521 $ IWORK( IINDW ), WORK( INDGRS ), PIVMIN, 00522 $ WORK( INDWRK ), IWORK( IINDWK ), IINFO ) 00523 IF( IINFO.NE.0 ) THEN 00524 INFO = 10 + ABS( IINFO ) 00525 RETURN 00526 END IF 00527 * Note that if RANGE .NE. 'V', DLARRE computes bounds on the desired 00528 * part of the spectrum. All desired eigenvalues are contained in 00529 * (WL,WU] 00530 00531 00532 IF( WANTZ ) THEN 00533 * 00534 * Compute the desired eigenvectors corresponding to the computed 00535 * eigenvalues 00536 * 00537 CALL DLARRV( N, WL, WU, D, E, 00538 $ PIVMIN, IWORK( IINSPL ), M, 00539 $ 1, M, MINRGP, RTOL1, RTOL2, 00540 $ W, WORK( INDERR ), WORK( INDGP ), IWORK( IINDBL ), 00541 $ IWORK( IINDW ), WORK( INDGRS ), Z, LDZ, 00542 $ ISUPPZ, WORK( INDWRK ), IWORK( IINDWK ), IINFO ) 00543 IF( IINFO.NE.0 ) THEN 00544 INFO = 20 + ABS( IINFO ) 00545 RETURN 00546 END IF 00547 ELSE 00548 * DLARRE computes eigenvalues of the (shifted) root representation 00549 * DLARRV returns the eigenvalues of the unshifted matrix. 00550 * However, if the eigenvectors are not desired by the user, we need 00551 * to apply the corresponding shifts from DLARRE to obtain the 00552 * eigenvalues of the original matrix. 00553 DO 20 J = 1, M 00554 ITMP = IWORK( IINDBL+J-1 ) 00555 W( J ) = W( J ) + E( IWORK( IINSPL+ITMP-1 ) ) 00556 20 CONTINUE 00557 END IF 00558 * 00559 00560 IF ( TRYRAC ) THEN 00561 * Refine computed eigenvalues so that they are relatively accurate 00562 * with respect to the original matrix T. 00563 IBEGIN = 1 00564 WBEGIN = 1 00565 DO 39 JBLK = 1, IWORK( IINDBL+M-1 ) 00566 IEND = IWORK( IINSPL+JBLK-1 ) 00567 IN = IEND - IBEGIN + 1 00568 WEND = WBEGIN - 1 00569 * check if any eigenvalues have to be refined in this block 00570 36 CONTINUE 00571 IF( WEND.LT.M ) THEN 00572 IF( IWORK( IINDBL+WEND ).EQ.JBLK ) THEN 00573 WEND = WEND + 1 00574 GO TO 36 00575 END IF 00576 END IF 00577 IF( WEND.LT.WBEGIN ) THEN 00578 IBEGIN = IEND + 1 00579 GO TO 39 00580 END IF 00581 00582 OFFSET = IWORK(IINDW+WBEGIN-1)-1 00583 IFIRST = IWORK(IINDW+WBEGIN-1) 00584 ILAST = IWORK(IINDW+WEND-1) 00585 RTOL2 = FOUR * EPS 00586 CALL DLARRJ( IN, 00587 $ WORK(INDD+IBEGIN-1), WORK(INDE2+IBEGIN-1), 00588 $ IFIRST, ILAST, RTOL2, OFFSET, W(WBEGIN), 00589 $ WORK( INDERR+WBEGIN-1 ), 00590 $ WORK( INDWRK ), IWORK( IINDWK ), PIVMIN, 00591 $ TNRM, IINFO ) 00592 IBEGIN = IEND + 1 00593 WBEGIN = WEND + 1 00594 39 CONTINUE 00595 ENDIF 00596 * 00597 * If matrix was scaled, then rescale eigenvalues appropriately. 00598 * 00599 IF( SCALE.NE.ONE ) THEN 00600 CALL DSCAL( M, ONE / SCALE, W, 1 ) 00601 END IF 00602 * 00603 * If eigenvalues are not in increasing order, then sort them, 00604 * possibly along with eigenvectors. 00605 * 00606 IF( NSPLIT.GT.1 ) THEN 00607 IF( .NOT. WANTZ ) THEN 00608 CALL DLASRT( 'I', M, W, IINFO ) 00609 IF( IINFO.NE.0 ) THEN 00610 INFO = 3 00611 RETURN 00612 END IF 00613 ELSE 00614 DO 60 J = 1, M - 1 00615 I = 0 00616 TMP = W( J ) 00617 DO 50 JJ = J + 1, M 00618 IF( W( JJ ).LT.TMP ) THEN 00619 I = JJ 00620 TMP = W( JJ ) 00621 END IF 00622 50 CONTINUE 00623 IF( I.NE.0 ) THEN 00624 W( I ) = W( J ) 00625 W( J ) = TMP 00626 IF( WANTZ ) THEN 00627 CALL DSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 ) 00628 ITMP = ISUPPZ( 2*I-1 ) 00629 ISUPPZ( 2*I-1 ) = ISUPPZ( 2*J-1 ) 00630 ISUPPZ( 2*J-1 ) = ITMP 00631 ITMP = ISUPPZ( 2*I ) 00632 ISUPPZ( 2*I ) = ISUPPZ( 2*J ) 00633 ISUPPZ( 2*J ) = ITMP 00634 END IF 00635 END IF 00636 60 CONTINUE 00637 END IF 00638 ENDIF 00639 * 00640 * 00641 WORK( 1 ) = LWMIN 00642 IWORK( 1 ) = LIWMIN 00643 RETURN 00644 * 00645 * End of DSTEMR 00646 * 00647 END