LAPACK 3.3.1
Linear Algebra PACKage
|
00001 SUBROUTINE CSTEMR( 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.1) -- 00007 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00008 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00009 * -- April 2009 -- 00010 * 00011 * .. Scalar Arguments .. 00012 CHARACTER JOBZ, RANGE 00013 LOGICAL TRYRAC 00014 INTEGER IL, INFO, IU, LDZ, NZC, LIWORK, LWORK, M, N 00015 REAL VL, VU 00016 * .. 00017 * .. Array Arguments .. 00018 INTEGER ISUPPZ( * ), IWORK( * ) 00019 REAL D( * ), E( * ), W( * ), WORK( * ) 00020 COMPLEX Z( LDZ, * ) 00021 * .. 00022 * 00023 * Purpose 00024 * ======= 00025 * 00026 * CSTEMR 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.CSTEMR 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 * 2. LAPACK routines can be used to reduce a complex Hermitean matrix to 00078 * real symmetric tridiagonal form. 00079 * 00080 * (Any complex Hermitean tridiagonal matrix has real values on its diagonal 00081 * and potentially complex numbers on its off-diagonals. By applying a 00082 * similarity transform with an appropriate diagonal matrix 00083 * diag(1,e^{i \phy_1}, ... , e^{i \phy_{n-1}}), the complex Hermitean 00084 * matrix can be transformed into a real symmetric matrix and complex 00085 * arithmetic can be entirely avoided.) 00086 * 00087 * While the eigenvectors of the real symmetric tridiagonal matrix are real, 00088 * the eigenvectors of original complex Hermitean matrix have complex entries 00089 * in general. 00090 * Since LAPACK drivers overwrite the matrix data with the eigenvectors, 00091 * CSTEMR accepts complex workspace to facilitate interoperability 00092 * with CUNMTR or CUPMTR. 00093 * 00094 * Arguments 00095 * ========= 00096 * 00097 * JOBZ (input) CHARACTER*1 00098 * = 'N': Compute eigenvalues only; 00099 * = 'V': Compute eigenvalues and eigenvectors. 00100 * 00101 * RANGE (input) CHARACTER*1 00102 * = 'A': all eigenvalues will be found. 00103 * = 'V': all eigenvalues in the half-open interval (VL,VU] 00104 * will be found. 00105 * = 'I': the IL-th through IU-th eigenvalues will be found. 00106 * 00107 * N (input) INTEGER 00108 * The order of the matrix. N >= 0. 00109 * 00110 * D (input/output) REAL array, dimension (N) 00111 * On entry, the N diagonal elements of the tridiagonal matrix 00112 * T. On exit, D is overwritten. 00113 * 00114 * E (input/output) REAL array, dimension (N) 00115 * On entry, the (N-1) subdiagonal elements of the tridiagonal 00116 * matrix T in elements 1 to N-1 of E. E(N) need not be set on 00117 * input, but is used internally as workspace. 00118 * On exit, E is overwritten. 00119 * 00120 * VL (input) REAL 00121 * VU (input) REAL 00122 * If RANGE='V', the lower and upper bounds of the interval to 00123 * be searched for eigenvalues. VL < VU. 00124 * Not referenced if RANGE = 'A' or 'I'. 00125 * 00126 * IL (input) INTEGER 00127 * IU (input) INTEGER 00128 * If RANGE='I', the indices (in ascending order) of the 00129 * smallest and largest eigenvalues to be returned. 00130 * 1 <= IL <= IU <= N, if N > 0. 00131 * Not referenced if RANGE = 'A' or 'V'. 00132 * 00133 * M (output) INTEGER 00134 * The total number of eigenvalues found. 0 <= M <= N. 00135 * If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1. 00136 * 00137 * W (output) REAL array, dimension (N) 00138 * The first M elements contain the selected eigenvalues in 00139 * ascending order. 00140 * 00141 * Z (output) COMPLEX array, dimension (LDZ, max(1,M) ) 00142 * If JOBZ = 'V', and if INFO = 0, then the first M columns of Z 00143 * contain the orthonormal eigenvectors of the matrix T 00144 * corresponding to the selected eigenvalues, with the i-th 00145 * column of Z holding the eigenvector associated with W(i). 00146 * If JOBZ = 'N', then Z is not referenced. 00147 * Note: the user must ensure that at least max(1,M) columns are 00148 * supplied in the array Z; if RANGE = 'V', the exact value of M 00149 * is not known in advance and can be computed with a workspace 00150 * query by setting NZC = -1, see below. 00151 * 00152 * LDZ (input) INTEGER 00153 * The leading dimension of the array Z. LDZ >= 1, and if 00154 * JOBZ = 'V', then LDZ >= max(1,N). 00155 * 00156 * NZC (input) INTEGER 00157 * The number of eigenvectors to be held in the array Z. 00158 * If RANGE = 'A', then NZC >= max(1,N). 00159 * If RANGE = 'V', then NZC >= the number of eigenvalues in (VL,VU]. 00160 * If RANGE = 'I', then NZC >= IU-IL+1. 00161 * If NZC = -1, then a workspace query is assumed; the 00162 * routine calculates the number of columns of the array Z that 00163 * are needed to hold the eigenvectors. 00164 * This value is returned as the first entry of the Z array, and 00165 * no error message related to NZC is issued by XERBLA. 00166 * 00167 * ISUPPZ (output) INTEGER ARRAY, dimension ( 2*max(1,M) ) 00168 * The support of the eigenvectors in Z, i.e., the indices 00169 * indicating the nonzero elements in Z. The i-th computed eigenvector 00170 * is nonzero only in elements ISUPPZ( 2*i-1 ) through 00171 * ISUPPZ( 2*i ). This is relevant in the case when the matrix 00172 * is split. ISUPPZ is only accessed when JOBZ is 'V' and N > 0. 00173 * 00174 * TRYRAC (input/output) LOGICAL 00175 * If TRYRAC.EQ..TRUE., indicates that the code should check whether 00176 * the tridiagonal matrix defines its eigenvalues to high relative 00177 * accuracy. If so, the code uses relative-accuracy preserving 00178 * algorithms that might be (a bit) slower depending on the matrix. 00179 * If the matrix does not define its eigenvalues to high relative 00180 * accuracy, the code can uses possibly faster algorithms. 00181 * If TRYRAC.EQ..FALSE., the code is not required to guarantee 00182 * relatively accurate eigenvalues and can use the fastest possible 00183 * techniques. 00184 * On exit, a .TRUE. TRYRAC will be set to .FALSE. if the matrix 00185 * does not define its eigenvalues to high relative accuracy. 00186 * 00187 * WORK (workspace/output) REAL array, dimension (LWORK) 00188 * On exit, if INFO = 0, WORK(1) returns the optimal 00189 * (and minimal) LWORK. 00190 * 00191 * LWORK (input) INTEGER 00192 * The dimension of the array WORK. LWORK >= max(1,18*N) 00193 * if JOBZ = 'V', and LWORK >= max(1,12*N) if JOBZ = 'N'. 00194 * If LWORK = -1, then a workspace query is assumed; the routine 00195 * only calculates the optimal size of the WORK array, returns 00196 * this value as the first entry of the WORK array, and no error 00197 * message related to LWORK is issued by XERBLA. 00198 * 00199 * IWORK (workspace/output) INTEGER array, dimension (LIWORK) 00200 * On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK. 00201 * 00202 * LIWORK (input) INTEGER 00203 * The dimension of the array IWORK. LIWORK >= max(1,10*N) 00204 * if the eigenvectors are desired, and LIWORK >= max(1,8*N) 00205 * if only the eigenvalues are to be computed. 00206 * If LIWORK = -1, then a workspace query is assumed; the 00207 * routine only calculates the optimal size of the IWORK array, 00208 * returns this value as the first entry of the IWORK array, and 00209 * no error message related to LIWORK is issued by XERBLA. 00210 * 00211 * INFO (output) INTEGER 00212 * On exit, INFO 00213 * = 0: successful exit 00214 * < 0: if INFO = -i, the i-th argument had an illegal value 00215 * > 0: if INFO = 1X, internal error in SLARRE, 00216 * if INFO = 2X, internal error in CLARRV. 00217 * Here, the digit X = ABS( IINFO ) < 10, where IINFO is 00218 * the nonzero error code returned by SLARRE or 00219 * CLARRV, respectively. 00220 * 00221 * 00222 * Further Details 00223 * =============== 00224 * 00225 * Based on contributions by 00226 * Beresford Parlett, University of California, Berkeley, USA 00227 * Jim Demmel, University of California, Berkeley, USA 00228 * Inderjit Dhillon, University of Texas, Austin, USA 00229 * Osni Marques, LBNL/NERSC, USA 00230 * Christof Voemel, University of California, Berkeley, USA 00231 * 00232 * ===================================================================== 00233 * 00234 * .. Parameters .. 00235 REAL ZERO, ONE, FOUR, MINRGP 00236 PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0, 00237 $ FOUR = 4.0E0, 00238 $ MINRGP = 3.0E-3 ) 00239 * .. 00240 * .. Local Scalars .. 00241 LOGICAL ALLEIG, INDEIG, LQUERY, VALEIG, WANTZ, ZQUERY 00242 INTEGER I, IBEGIN, IEND, IFIRST, IIL, IINDBL, IINDW, 00243 $ IINDWK, IINFO, IINSPL, IIU, ILAST, IN, INDD, 00244 $ INDE2, INDERR, INDGP, INDGRS, INDWRK, ITMP, 00245 $ ITMP2, J, JBLK, JJ, LIWMIN, LWMIN, NSPLIT, 00246 $ NZCMIN, OFFSET, WBEGIN, WEND 00247 REAL BIGNUM, CS, EPS, PIVMIN, R1, R2, RMAX, RMIN, 00248 $ RTOL1, RTOL2, SAFMIN, SCALE, SMLNUM, SN, 00249 $ THRESH, TMP, TNRM, WL, WU 00250 * .. 00251 * .. 00252 * .. External Functions .. 00253 LOGICAL LSAME 00254 REAL SLAMCH, SLANST 00255 EXTERNAL LSAME, SLAMCH, SLANST 00256 * .. 00257 * .. External Subroutines .. 00258 EXTERNAL CLARRV, CSWAP, SCOPY, SLAE2, SLAEV2, SLARRC, 00259 $ SLARRE, SLARRJ, SLARRR, SLASRT, SSCAL, XERBLA 00260 * .. 00261 * .. Intrinsic Functions .. 00262 INTRINSIC MAX, MIN, SQRT 00263 00264 00265 * .. 00266 * .. Executable Statements .. 00267 * 00268 * Test the input parameters. 00269 * 00270 WANTZ = LSAME( JOBZ, 'V' ) 00271 ALLEIG = LSAME( RANGE, 'A' ) 00272 VALEIG = LSAME( RANGE, 'V' ) 00273 INDEIG = LSAME( RANGE, 'I' ) 00274 * 00275 LQUERY = ( ( LWORK.EQ.-1 ).OR.( LIWORK.EQ.-1 ) ) 00276 ZQUERY = ( NZC.EQ.-1 ) 00277 00278 * SSTEMR needs WORK of size 6*N, IWORK of size 3*N. 00279 * In addition, SLARRE needs WORK of size 6*N, IWORK of size 5*N. 00280 * Furthermore, CLARRV needs WORK of size 12*N, IWORK of size 7*N. 00281 IF( WANTZ ) THEN 00282 LWMIN = 18*N 00283 LIWMIN = 10*N 00284 ELSE 00285 * need less workspace if only the eigenvalues are wanted 00286 LWMIN = 12*N 00287 LIWMIN = 8*N 00288 ENDIF 00289 00290 WL = ZERO 00291 WU = ZERO 00292 IIL = 0 00293 IIU = 0 00294 00295 IF( VALEIG ) THEN 00296 * We do not reference VL, VU in the cases RANGE = 'I','A' 00297 * The interval (WL, WU] contains all the wanted eigenvalues. 00298 * It is either given by the user or computed in SLARRE. 00299 WL = VL 00300 WU = VU 00301 ELSEIF( INDEIG ) THEN 00302 * We do not reference IL, IU in the cases RANGE = 'V','A' 00303 IIL = IL 00304 IIU = IU 00305 ENDIF 00306 * 00307 INFO = 0 00308 IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN 00309 INFO = -1 00310 ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN 00311 INFO = -2 00312 ELSE IF( N.LT.0 ) THEN 00313 INFO = -3 00314 ELSE IF( VALEIG .AND. N.GT.0 .AND. WU.LE.WL ) THEN 00315 INFO = -7 00316 ELSE IF( INDEIG .AND. ( IIL.LT.1 .OR. IIL.GT.N ) ) THEN 00317 INFO = -8 00318 ELSE IF( INDEIG .AND. ( IIU.LT.IIL .OR. IIU.GT.N ) ) THEN 00319 INFO = -9 00320 ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN 00321 INFO = -13 00322 ELSE IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN 00323 INFO = -17 00324 ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN 00325 INFO = -19 00326 END IF 00327 * 00328 * Get machine constants. 00329 * 00330 SAFMIN = SLAMCH( 'Safe minimum' ) 00331 EPS = SLAMCH( 'Precision' ) 00332 SMLNUM = SAFMIN / EPS 00333 BIGNUM = ONE / SMLNUM 00334 RMIN = SQRT( SMLNUM ) 00335 RMAX = MIN( SQRT( BIGNUM ), ONE / SQRT( SQRT( SAFMIN ) ) ) 00336 * 00337 IF( INFO.EQ.0 ) THEN 00338 WORK( 1 ) = LWMIN 00339 IWORK( 1 ) = LIWMIN 00340 * 00341 IF( WANTZ .AND. ALLEIG ) THEN 00342 NZCMIN = N 00343 ELSE IF( WANTZ .AND. VALEIG ) THEN 00344 CALL SLARRC( 'T', N, VL, VU, D, E, SAFMIN, 00345 $ NZCMIN, ITMP, ITMP2, INFO ) 00346 ELSE IF( WANTZ .AND. INDEIG ) THEN 00347 NZCMIN = IIU-IIL+1 00348 ELSE 00349 * WANTZ .EQ. FALSE. 00350 NZCMIN = 0 00351 ENDIF 00352 IF( ZQUERY .AND. INFO.EQ.0 ) THEN 00353 Z( 1,1 ) = NZCMIN 00354 ELSE IF( NZC.LT.NZCMIN .AND. .NOT.ZQUERY ) THEN 00355 INFO = -14 00356 END IF 00357 END IF 00358 00359 IF( INFO.NE.0 ) THEN 00360 * 00361 CALL XERBLA( 'CSTEMR', -INFO ) 00362 * 00363 RETURN 00364 ELSE IF( LQUERY .OR. ZQUERY ) THEN 00365 RETURN 00366 END IF 00367 * 00368 * Handle N = 0, 1, and 2 cases immediately 00369 * 00370 M = 0 00371 IF( N.EQ.0 ) 00372 $ RETURN 00373 * 00374 IF( N.EQ.1 ) THEN 00375 IF( ALLEIG .OR. INDEIG ) THEN 00376 M = 1 00377 W( 1 ) = D( 1 ) 00378 ELSE 00379 IF( WL.LT.D( 1 ) .AND. WU.GE.D( 1 ) ) THEN 00380 M = 1 00381 W( 1 ) = D( 1 ) 00382 END IF 00383 END IF 00384 IF( WANTZ.AND.(.NOT.ZQUERY) ) THEN 00385 Z( 1, 1 ) = ONE 00386 ISUPPZ(1) = 1 00387 ISUPPZ(2) = 1 00388 END IF 00389 RETURN 00390 END IF 00391 * 00392 IF( N.EQ.2 ) THEN 00393 IF( .NOT.WANTZ ) THEN 00394 CALL SLAE2( D(1), E(1), D(2), R1, R2 ) 00395 ELSE IF( WANTZ.AND.(.NOT.ZQUERY) ) THEN 00396 CALL SLAEV2( D(1), E(1), D(2), R1, R2, CS, SN ) 00397 END IF 00398 IF( ALLEIG.OR. 00399 $ (VALEIG.AND.(R2.GT.WL).AND. 00400 $ (R2.LE.WU)).OR. 00401 $ (INDEIG.AND.(IIL.EQ.1)) ) THEN 00402 M = M+1 00403 W( M ) = R2 00404 IF( WANTZ.AND.(.NOT.ZQUERY) ) THEN 00405 Z( 1, M ) = -SN 00406 Z( 2, M ) = CS 00407 * Note: At most one of SN and CS can be zero. 00408 IF (SN.NE.ZERO) THEN 00409 IF (CS.NE.ZERO) THEN 00410 ISUPPZ(2*M-1) = 1 00411 ISUPPZ(2*M-1) = 2 00412 ELSE 00413 ISUPPZ(2*M-1) = 1 00414 ISUPPZ(2*M-1) = 1 00415 END IF 00416 ELSE 00417 ISUPPZ(2*M-1) = 2 00418 ISUPPZ(2*M) = 2 00419 END IF 00420 ENDIF 00421 ENDIF 00422 IF( ALLEIG.OR. 00423 $ (VALEIG.AND.(R1.GT.WL).AND. 00424 $ (R1.LE.WU)).OR. 00425 $ (INDEIG.AND.(IIU.EQ.2)) ) THEN 00426 M = M+1 00427 W( M ) = R1 00428 IF( WANTZ.AND.(.NOT.ZQUERY) ) THEN 00429 Z( 1, M ) = CS 00430 Z( 2, M ) = SN 00431 * Note: At most one of SN and CS can be zero. 00432 IF (SN.NE.ZERO) THEN 00433 IF (CS.NE.ZERO) THEN 00434 ISUPPZ(2*M-1) = 1 00435 ISUPPZ(2*M-1) = 2 00436 ELSE 00437 ISUPPZ(2*M-1) = 1 00438 ISUPPZ(2*M-1) = 1 00439 END IF 00440 ELSE 00441 ISUPPZ(2*M-1) = 2 00442 ISUPPZ(2*M) = 2 00443 END IF 00444 ENDIF 00445 ENDIF 00446 RETURN 00447 END IF 00448 00449 * Continue with general N 00450 00451 INDGRS = 1 00452 INDERR = 2*N + 1 00453 INDGP = 3*N + 1 00454 INDD = 4*N + 1 00455 INDE2 = 5*N + 1 00456 INDWRK = 6*N + 1 00457 * 00458 IINSPL = 1 00459 IINDBL = N + 1 00460 IINDW = 2*N + 1 00461 IINDWK = 3*N + 1 00462 * 00463 * Scale matrix to allowable range, if necessary. 00464 * The allowable range is related to the PIVMIN parameter; see the 00465 * comments in SLARRD. The preference for scaling small values 00466 * up is heuristic; we expect users' matrices not to be close to the 00467 * RMAX threshold. 00468 * 00469 SCALE = ONE 00470 TNRM = SLANST( 'M', N, D, E ) 00471 IF( TNRM.GT.ZERO .AND. TNRM.LT.RMIN ) THEN 00472 SCALE = RMIN / TNRM 00473 ELSE IF( TNRM.GT.RMAX ) THEN 00474 SCALE = RMAX / TNRM 00475 END IF 00476 IF( SCALE.NE.ONE ) THEN 00477 CALL SSCAL( N, SCALE, D, 1 ) 00478 CALL SSCAL( N-1, SCALE, E, 1 ) 00479 TNRM = TNRM*SCALE 00480 IF( VALEIG ) THEN 00481 * If eigenvalues in interval have to be found, 00482 * scale (WL, WU] accordingly 00483 WL = WL*SCALE 00484 WU = WU*SCALE 00485 ENDIF 00486 END IF 00487 * 00488 * Compute the desired eigenvalues of the tridiagonal after splitting 00489 * into smaller subblocks if the corresponding off-diagonal elements 00490 * are small 00491 * THRESH is the splitting parameter for SLARRE 00492 * A negative THRESH forces the old splitting criterion based on the 00493 * size of the off-diagonal. A positive THRESH switches to splitting 00494 * which preserves relative accuracy. 00495 * 00496 IF( TRYRAC ) THEN 00497 * Test whether the matrix warrants the more expensive relative approach. 00498 CALL SLARRR( N, D, E, IINFO ) 00499 ELSE 00500 * The user does not care about relative accurately eigenvalues 00501 IINFO = -1 00502 ENDIF 00503 * Set the splitting criterion 00504 IF (IINFO.EQ.0) THEN 00505 THRESH = EPS 00506 ELSE 00507 THRESH = -EPS 00508 * relative accuracy is desired but T does not guarantee it 00509 TRYRAC = .FALSE. 00510 ENDIF 00511 * 00512 IF( TRYRAC ) THEN 00513 * Copy original diagonal, needed to guarantee relative accuracy 00514 CALL SCOPY(N,D,1,WORK(INDD),1) 00515 ENDIF 00516 * Store the squares of the offdiagonal values of T 00517 DO 5 J = 1, N-1 00518 WORK( INDE2+J-1 ) = E(J)**2 00519 5 CONTINUE 00520 00521 * Set the tolerance parameters for bisection 00522 IF( .NOT.WANTZ ) THEN 00523 * SLARRE computes the eigenvalues to full precision. 00524 RTOL1 = FOUR * EPS 00525 RTOL2 = FOUR * EPS 00526 ELSE 00527 * SLARRE computes the eigenvalues to less than full precision. 00528 * CLARRV will refine the eigenvalue approximations, and we only 00529 * need less accurate initial bisection in SLARRE. 00530 * Note: these settings do only affect the subset case and SLARRE 00531 RTOL1 = MAX( SQRT(EPS)*5.0E-2, FOUR * EPS ) 00532 RTOL2 = MAX( SQRT(EPS)*5.0E-3, FOUR * EPS ) 00533 ENDIF 00534 CALL SLARRE( RANGE, N, WL, WU, IIL, IIU, D, E, 00535 $ WORK(INDE2), RTOL1, RTOL2, THRESH, NSPLIT, 00536 $ IWORK( IINSPL ), M, W, WORK( INDERR ), 00537 $ WORK( INDGP ), IWORK( IINDBL ), 00538 $ IWORK( IINDW ), WORK( INDGRS ), PIVMIN, 00539 $ WORK( INDWRK ), IWORK( IINDWK ), IINFO ) 00540 IF( IINFO.NE.0 ) THEN 00541 INFO = 10 + ABS( IINFO ) 00542 RETURN 00543 END IF 00544 * Note that if RANGE .NE. 'V', SLARRE computes bounds on the desired 00545 * part of the spectrum. All desired eigenvalues are contained in 00546 * (WL,WU] 00547 00548 00549 IF( WANTZ ) THEN 00550 * 00551 * Compute the desired eigenvectors corresponding to the computed 00552 * eigenvalues 00553 * 00554 CALL CLARRV( N, WL, WU, D, E, 00555 $ PIVMIN, IWORK( IINSPL ), M, 00556 $ 1, M, MINRGP, RTOL1, RTOL2, 00557 $ W, WORK( INDERR ), WORK( INDGP ), IWORK( IINDBL ), 00558 $ IWORK( IINDW ), WORK( INDGRS ), Z, LDZ, 00559 $ ISUPPZ, WORK( INDWRK ), IWORK( IINDWK ), IINFO ) 00560 IF( IINFO.NE.0 ) THEN 00561 INFO = 20 + ABS( IINFO ) 00562 RETURN 00563 END IF 00564 ELSE 00565 * SLARRE computes eigenvalues of the (shifted) root representation 00566 * CLARRV returns the eigenvalues of the unshifted matrix. 00567 * However, if the eigenvectors are not desired by the user, we need 00568 * to apply the corresponding shifts from SLARRE to obtain the 00569 * eigenvalues of the original matrix. 00570 DO 20 J = 1, M 00571 ITMP = IWORK( IINDBL+J-1 ) 00572 W( J ) = W( J ) + E( IWORK( IINSPL+ITMP-1 ) ) 00573 20 CONTINUE 00574 END IF 00575 * 00576 00577 IF ( TRYRAC ) THEN 00578 * Refine computed eigenvalues so that they are relatively accurate 00579 * with respect to the original matrix T. 00580 IBEGIN = 1 00581 WBEGIN = 1 00582 DO 39 JBLK = 1, IWORK( IINDBL+M-1 ) 00583 IEND = IWORK( IINSPL+JBLK-1 ) 00584 IN = IEND - IBEGIN + 1 00585 WEND = WBEGIN - 1 00586 * check if any eigenvalues have to be refined in this block 00587 36 CONTINUE 00588 IF( WEND.LT.M ) THEN 00589 IF( IWORK( IINDBL+WEND ).EQ.JBLK ) THEN 00590 WEND = WEND + 1 00591 GO TO 36 00592 END IF 00593 END IF 00594 IF( WEND.LT.WBEGIN ) THEN 00595 IBEGIN = IEND + 1 00596 GO TO 39 00597 END IF 00598 00599 OFFSET = IWORK(IINDW+WBEGIN-1)-1 00600 IFIRST = IWORK(IINDW+WBEGIN-1) 00601 ILAST = IWORK(IINDW+WEND-1) 00602 RTOL2 = FOUR * EPS 00603 CALL SLARRJ( IN, 00604 $ WORK(INDD+IBEGIN-1), WORK(INDE2+IBEGIN-1), 00605 $ IFIRST, ILAST, RTOL2, OFFSET, W(WBEGIN), 00606 $ WORK( INDERR+WBEGIN-1 ), 00607 $ WORK( INDWRK ), IWORK( IINDWK ), PIVMIN, 00608 $ TNRM, IINFO ) 00609 IBEGIN = IEND + 1 00610 WBEGIN = WEND + 1 00611 39 CONTINUE 00612 ENDIF 00613 * 00614 * If matrix was scaled, then rescale eigenvalues appropriately. 00615 * 00616 IF( SCALE.NE.ONE ) THEN 00617 CALL SSCAL( M, ONE / SCALE, W, 1 ) 00618 END IF 00619 * 00620 * If eigenvalues are not in increasing order, then sort them, 00621 * possibly along with eigenvectors. 00622 * 00623 IF( NSPLIT.GT.1 ) THEN 00624 IF( .NOT. WANTZ ) THEN 00625 CALL SLASRT( 'I', M, W, IINFO ) 00626 IF( IINFO.NE.0 ) THEN 00627 INFO = 3 00628 RETURN 00629 END IF 00630 ELSE 00631 DO 60 J = 1, M - 1 00632 I = 0 00633 TMP = W( J ) 00634 DO 50 JJ = J + 1, M 00635 IF( W( JJ ).LT.TMP ) THEN 00636 I = JJ 00637 TMP = W( JJ ) 00638 END IF 00639 50 CONTINUE 00640 IF( I.NE.0 ) THEN 00641 W( I ) = W( J ) 00642 W( J ) = TMP 00643 IF( WANTZ ) THEN 00644 CALL CSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 ) 00645 ITMP = ISUPPZ( 2*I-1 ) 00646 ISUPPZ( 2*I-1 ) = ISUPPZ( 2*J-1 ) 00647 ISUPPZ( 2*J-1 ) = ITMP 00648 ITMP = ISUPPZ( 2*I ) 00649 ISUPPZ( 2*I ) = ISUPPZ( 2*J ) 00650 ISUPPZ( 2*J ) = ITMP 00651 END IF 00652 END IF 00653 60 CONTINUE 00654 END IF 00655 ENDIF 00656 * 00657 * 00658 WORK( 1 ) = LWMIN 00659 IWORK( 1 ) = LIWMIN 00660 RETURN 00661 * 00662 * End of CSTEMR 00663 * 00664 END