source: issm/trunk-jpl/externalpackages/petsc-dev/src/externalpackages/fblaslapack-3.1.1/lapack/cstemr.f@ 11896

Last change on this file since 11896 was 11896, checked in by habbalf, 13 years ago

petsc-dev : Petsc development code in external packages. Mercurial updates

File size: 24.1 KB
Line 
1 SUBROUTINE CSTEMR( JOBZ, RANGE, N, D, E, VL, VU, IL, IU,
2 $ M, W, Z, LDZ, NZC, ISUPPZ, TRYRAC, WORK, LWORK,
3 $ IWORK, LIWORK, INFO )
4 IMPLICIT NONE
5*
6* -- LAPACK computational routine (version 3.1) --
7* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
8* November 2006
9*
10* .. Scalar Arguments ..
11 CHARACTER JOBZ, RANGE
12 LOGICAL TRYRAC
13 INTEGER IL, INFO, IU, LDZ, NZC, LIWORK, LWORK, M, N
14 REAL VL, VU
15* ..
16* .. Array Arguments ..
17 INTEGER ISUPPZ( * ), IWORK( * )
18 REAL D( * ), E( * ), W( * ), WORK( * )
19 COMPLEX Z( LDZ, * )
20* ..
21*
22* Purpose
23* =======
24*
25* CSTEMR computes selected eigenvalues and, optionally, eigenvectors
26* of a real symmetric tridiagonal matrix T. Any such unreduced matrix has
27* a well defined set of pairwise different real eigenvalues, the corresponding
28* real eigenvectors are pairwise orthogonal.
29*
30* The spectrum may be computed either completely or partially by specifying
31* either an interval (VL,VU] or a range of indices IL:IU for the desired
32* eigenvalues.
33*
34* Depending on the number of desired eigenvalues, these are computed either
35* by bisection or the dqds algorithm. Numerically orthogonal eigenvectors are
36* computed by the use of various suitable L D L^T factorizations near clusters
37* of close eigenvalues (referred to as RRRs, Relatively Robust
38* Representations). An informal sketch of the algorithm follows.
39*
40* For each unreduced block (submatrix) of T,
41* (a) Compute T - sigma I = L D L^T, so that L and D
42* define all the wanted eigenvalues to high relative accuracy.
43* This means that small relative changes in the entries of D and L
44* cause only small relative changes in the eigenvalues and
45* eigenvectors. The standard (unfactored) representation of the
46* tridiagonal matrix T does not have this property in general.
47* (b) Compute the eigenvalues to suitable accuracy.
48* If the eigenvectors are desired, the algorithm attains full
49* accuracy of the computed eigenvalues only right before
50* the corresponding vectors have to be computed, see steps c) and d).
51* (c) For each cluster of close eigenvalues, select a new
52* shift close to the cluster, find a new factorization, and refine
53* the shifted eigenvalues to suitable accuracy.
54* (d) For each eigenvalue with a large enough relative separation compute
55* the corresponding eigenvector by forming a rank revealing twisted
56* factorization. Go back to (c) for any clusters that remain.
57*
58* For more details, see:
59* - Inderjit S. Dhillon and Beresford N. Parlett: "Multiple representations
60* to compute orthogonal eigenvectors of symmetric tridiagonal matrices,"
61* Linear Algebra and its Applications, 387(1), pp. 1-28, August 2004.
62* - Inderjit Dhillon and Beresford Parlett: "Orthogonal Eigenvectors and
63* Relative Gaps," SIAM Journal on Matrix Analysis and Applications, Vol. 25,
64* 2004. Also LAPACK Working Note 154.
65* - Inderjit Dhillon: "A new O(n^2) algorithm for the symmetric
66* tridiagonal eigenvalue/eigenvector problem",
67* Computer Science Division Technical Report No. UCB/CSD-97-971,
68* UC Berkeley, May 1997.
69*
70* Notes:
71* 1.CSTEMR works only on machines which follow IEEE-754
72* floating-point standard in their handling of infinities and NaNs.
73* This permits the use of efficient inner loops avoiding a check for
74* zero divisors.
75*
76* 2. LAPACK routines can be used to reduce a complex Hermitean matrix to
77* real symmetric tridiagonal form.
78*
79* (Any complex Hermitean tridiagonal matrix has real values on its diagonal
80* and potentially complex numbers on its off-diagonals. By applying a
81* similarity transform with an appropriate diagonal matrix
82* diag(1,e^{i \phy_1}, ... , e^{i \phy_{n-1}}), the complex Hermitean
83* matrix can be transformed into a real symmetric matrix and complex
84* arithmetic can be entirely avoided.)
85*
86* While the eigenvectors of the real symmetric tridiagonal matrix are real,
87* the eigenvectors of original complex Hermitean matrix have complex entries
88* in general.
89* Since LAPACK drivers overwrite the matrix data with the eigenvectors,
90* CSTEMR accepts complex workspace to facilitate interoperability
91* with CUNMTR or CUPMTR.
92*
93* Arguments
94* =========
95*
96* JOBZ (input) CHARACTER*1
97* = 'N': Compute eigenvalues only;
98* = 'V': Compute eigenvalues and eigenvectors.
99*
100* RANGE (input) CHARACTER*1
101* = 'A': all eigenvalues will be found.
102* = 'V': all eigenvalues in the half-open interval (VL,VU]
103* will be found.
104* = 'I': the IL-th through IU-th eigenvalues will be found.
105*
106* N (input) INTEGER
107* The order of the matrix. N >= 0.
108*
109* D (input/output) REAL array, dimension (N)
110* On entry, the N diagonal elements of the tridiagonal matrix
111* T. On exit, D is overwritten.
112*
113* E (input/output) REAL array, dimension (N)
114* On entry, the (N-1) subdiagonal elements of the tridiagonal
115* matrix T in elements 1 to N-1 of E. E(N) need not be set on
116* input, but is used internally as workspace.
117* On exit, E is overwritten.
118*
119* VL (input) REAL
120* VU (input) REAL
121* If RANGE='V', the lower and upper bounds of the interval to
122* be searched for eigenvalues. VL < VU.
123* Not referenced if RANGE = 'A' or 'I'.
124*
125* IL (input) INTEGER
126* IU (input) INTEGER
127* If RANGE='I', the indices (in ascending order) of the
128* smallest and largest eigenvalues to be returned.
129* 1 <= IL <= IU <= N, if N > 0.
130* Not referenced if RANGE = 'A' or 'V'.
131*
132* M (output) INTEGER
133* The total number of eigenvalues found. 0 <= M <= N.
134* If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
135*
136* W (output) REAL array, dimension (N)
137* The first M elements contain the selected eigenvalues in
138* ascending order.
139*
140* Z (output) COMPLEX array, dimension (LDZ, max(1,M) )
141* If JOBZ = 'V', and if INFO = 0, then the first M columns of Z
142* contain the orthonormal eigenvectors of the matrix T
143* corresponding to the selected eigenvalues, with the i-th
144* column of Z holding the eigenvector associated with W(i).
145* If JOBZ = 'N', then Z is not referenced.
146* Note: the user must ensure that at least max(1,M) columns are
147* supplied in the array Z; if RANGE = 'V', the exact value of M
148* is not known in advance and can be computed with a workspace
149* query by setting NZC = -1, see below.
150*
151* LDZ (input) INTEGER
152* The leading dimension of the array Z. LDZ >= 1, and if
153* JOBZ = 'V', then LDZ >= max(1,N).
154*
155* NZC (input) INTEGER
156* The number of eigenvectors to be held in the array Z.
157* If RANGE = 'A', then NZC >= max(1,N).
158* If RANGE = 'V', then NZC >= the number of eigenvalues in (VL,VU].
159* If RANGE = 'I', then NZC >= IU-IL+1.
160* If NZC = -1, then a workspace query is assumed; the
161* routine calculates the number of columns of the array Z that
162* are needed to hold the eigenvectors.
163* This value is returned as the first entry of the Z array, and
164* no error message related to NZC is issued by XERBLA.
165*
166* ISUPPZ (output) INTEGER ARRAY, dimension ( 2*max(1,M) )
167* The support of the eigenvectors in Z, i.e., the indices
168* indicating the nonzero elements in Z. The i-th computed eigenvector
169* is nonzero only in elements ISUPPZ( 2*i-1 ) through
170* ISUPPZ( 2*i ). This is relevant in the case when the matrix
171* is split. ISUPPZ is only accessed when JOBZ is 'V' and N > 0.
172*
173* TRYRAC (input/output) LOGICAL
174* If TRYRAC.EQ..TRUE., indicates that the code should check whether
175* the tridiagonal matrix defines its eigenvalues to high relative
176* accuracy. If so, the code uses relative-accuracy preserving
177* algorithms that might be (a bit) slower depending on the matrix.
178* If the matrix does not define its eigenvalues to high relative
179* accuracy, the code can uses possibly faster algorithms.
180* If TRYRAC.EQ..FALSE., the code is not required to guarantee
181* relatively accurate eigenvalues and can use the fastest possible
182* techniques.
183* On exit, a .TRUE. TRYRAC will be set to .FALSE. if the matrix
184* does not define its eigenvalues to high relative accuracy.
185*
186* WORK (workspace/output) REAL array, dimension (LWORK)
187* On exit, if INFO = 0, WORK(1) returns the optimal
188* (and minimal) LWORK.
189*
190* LWORK (input) INTEGER
191* The dimension of the array WORK. LWORK >= max(1,18*N)
192* if JOBZ = 'V', and LWORK >= max(1,12*N) if JOBZ = 'N'.
193* If LWORK = -1, then a workspace query is assumed; the routine
194* only calculates the optimal size of the WORK array, returns
195* this value as the first entry of the WORK array, and no error
196* message related to LWORK is issued by XERBLA.
197*
198* IWORK (workspace/output) INTEGER array, dimension (LIWORK)
199* On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
200*
201* LIWORK (input) INTEGER
202* The dimension of the array IWORK. LIWORK >= max(1,10*N)
203* if the eigenvectors are desired, and LIWORK >= max(1,8*N)
204* if only the eigenvalues are to be computed.
205* If LIWORK = -1, then a workspace query is assumed; the
206* routine only calculates the optimal size of the IWORK array,
207* returns this value as the first entry of the IWORK array, and
208* no error message related to LIWORK is issued by XERBLA.
209*
210* INFO (output) INTEGER
211* On exit, INFO
212* = 0: successful exit
213* < 0: if INFO = -i, the i-th argument had an illegal value
214* > 0: if INFO = 1X, internal error in SLARRE,
215* if INFO = 2X, internal error in CLARRV.
216* Here, the digit X = ABS( IINFO ) < 10, where IINFO is
217* the nonzero error code returned by SLARRE or
218* CLARRV, respectively.
219*
220*
221* Further Details
222* ===============
223*
224* Based on contributions by
225* Beresford Parlett, University of California, Berkeley, USA
226* Jim Demmel, University of California, Berkeley, USA
227* Inderjit Dhillon, University of Texas, Austin, USA
228* Osni Marques, LBNL/NERSC, USA
229* Christof Voemel, University of California, Berkeley, USA
230*
231* =====================================================================
232*
233* .. Parameters ..
234 REAL ZERO, ONE, FOUR, MINRGP
235 PARAMETER ( ZERO = 0.0E0, ONE = 1.0E0,
236 $ FOUR = 4.0E0,
237 $ MINRGP = 3.0E-3 )
238* ..
239* .. Local Scalars ..
240 LOGICAL ALLEIG, INDEIG, LQUERY, VALEIG, WANTZ, ZQUERY
241 INTEGER I, IBEGIN, IEND, IFIRST, IIL, IINDBL, IINDW,
242 $ IINDWK, IINFO, IINSPL, IIU, ILAST, IN, INDD,
243 $ INDE2, INDERR, INDGP, INDGRS, INDWRK, ITMP,
244 $ ITMP2, J, JBLK, JJ, LIWMIN, LWMIN, NSPLIT,
245 $ NZCMIN, OFFSET, WBEGIN, WEND
246 REAL BIGNUM, CS, EPS, PIVMIN, R1, R2, RMAX, RMIN,
247 $ RTOL1, RTOL2, SAFMIN, SCALE, SMLNUM, SN,
248 $ THRESH, TMP, TNRM, WL, WU
249* ..
250* ..
251* .. External Functions ..
252 LOGICAL LSAME
253 REAL SLAMCH, SLANST
254 EXTERNAL LSAME, SLAMCH, SLANST
255* ..
256* .. External Subroutines ..
257 EXTERNAL CLARRV, CSWAP, SCOPY, SLAE2, SLAEV2, SLARRC,
258 $ SLARRE, SLARRJ, SLARRR, SLASRT, SSCAL, XERBLA
259* ..
260* .. Intrinsic Functions ..
261 INTRINSIC MAX, MIN, SQRT
262
263
264* ..
265* .. Executable Statements ..
266*
267* Test the input parameters.
268*
269 WANTZ = LSAME( JOBZ, 'V' )
270 ALLEIG = LSAME( RANGE, 'A' )
271 VALEIG = LSAME( RANGE, 'V' )
272 INDEIG = LSAME( RANGE, 'I' )
273*
274 LQUERY = ( ( LWORK.EQ.-1 ).OR.( LIWORK.EQ.-1 ) )
275 ZQUERY = ( NZC.EQ.-1 )
276 TRYRAC = ( INFO.NE.0 )
277
278* SSTEMR needs WORK of size 6*N, IWORK of size 3*N.
279* In addition, SLARRE needs WORK of size 6*N, IWORK of size 5*N.
280* Furthermore, CLARRV needs WORK of size 12*N, IWORK of size 7*N.
281 IF( WANTZ ) THEN
282 LWMIN = 18*N
283 LIWMIN = 10*N
284 ELSE
285* need less workspace if only the eigenvalues are wanted
286 LWMIN = 12*N
287 LIWMIN = 8*N
288 ENDIF
289
290 WL = ZERO
291 WU = ZERO
292 IIL = 0
293 IIU = 0
294
295 IF( VALEIG ) THEN
296* We do not reference VL, VU in the cases RANGE = 'I','A'
297* The interval (WL, WU] contains all the wanted eigenvalues.
298* It is either given by the user or computed in SLARRE.
299 WL = VL
300 WU = VU
301 ELSEIF( INDEIG ) THEN
302* We do not reference IL, IU in the cases RANGE = 'V','A'
303 IIL = IL
304 IIU = IU
305 ENDIF
306*
307 INFO = 0
308 IF( .NOT.( WANTZ .OR. LSAME( JOBZ, 'N' ) ) ) THEN
309 INFO = -1
310 ELSE IF( .NOT.( ALLEIG .OR. VALEIG .OR. INDEIG ) ) THEN
311 INFO = -2
312 ELSE IF( N.LT.0 ) THEN
313 INFO = -3
314 ELSE IF( VALEIG .AND. N.GT.0 .AND. WU.LE.WL ) THEN
315 INFO = -7
316 ELSE IF( INDEIG .AND. ( IIL.LT.1 .OR. IIL.GT.N ) ) THEN
317 INFO = -8
318 ELSE IF( INDEIG .AND. ( IIU.LT.IIL .OR. IIU.GT.N ) ) THEN
319 INFO = -9
320 ELSE IF( LDZ.LT.1 .OR. ( WANTZ .AND. LDZ.LT.N ) ) THEN
321 INFO = -13
322 ELSE IF( LWORK.LT.LWMIN .AND. .NOT.LQUERY ) THEN
323 INFO = -17
324 ELSE IF( LIWORK.LT.LIWMIN .AND. .NOT.LQUERY ) THEN
325 INFO = -19
326 END IF
327*
328* Get machine constants.
329*
330 SAFMIN = SLAMCH( 'Safe minimum' )
331 EPS = SLAMCH( 'Precision' )
332 SMLNUM = SAFMIN / EPS
333 BIGNUM = ONE / SMLNUM
334 RMIN = SQRT( SMLNUM )
335 RMAX = MIN( SQRT( BIGNUM ), ONE / SQRT( SQRT( SAFMIN ) ) )
336*
337 IF( INFO.EQ.0 ) THEN
338 WORK( 1 ) = LWMIN
339 IWORK( 1 ) = LIWMIN
340*
341 IF( WANTZ .AND. ALLEIG ) THEN
342 NZCMIN = N
343 ELSE IF( WANTZ .AND. VALEIG ) THEN
344 CALL SLARRC( 'T', N, VL, VU, D, E, SAFMIN,
345 $ NZCMIN, ITMP, ITMP2, INFO )
346 ELSE IF( WANTZ .AND. INDEIG ) THEN
347 NZCMIN = IIU-IIL+1
348 ELSE
349* WANTZ .EQ. FALSE.
350 NZCMIN = 0
351 ENDIF
352 IF( ZQUERY .AND. INFO.EQ.0 ) THEN
353 Z( 1,1 ) = NZCMIN
354 ELSE IF( NZC.LT.NZCMIN .AND. .NOT.ZQUERY ) THEN
355 INFO = -14
356 END IF
357 END IF
358
359 IF( INFO.NE.0 ) THEN
360*
361 CALL XERBLA( 'CSTEMR', -INFO )
362*
363 RETURN
364 ELSE IF( LQUERY .OR. ZQUERY ) THEN
365 RETURN
366 END IF
367*
368* Handle N = 0, 1, and 2 cases immediately
369*
370 M = 0
371 IF( N.EQ.0 )
372 $ RETURN
373*
374 IF( N.EQ.1 ) THEN
375 IF( ALLEIG .OR. INDEIG ) THEN
376 M = 1
377 W( 1 ) = D( 1 )
378 ELSE
379 IF( WL.LT.D( 1 ) .AND. WU.GE.D( 1 ) ) THEN
380 M = 1
381 W( 1 ) = D( 1 )
382 END IF
383 END IF
384 IF( WANTZ.AND.(.NOT.ZQUERY) ) THEN
385 Z( 1, 1 ) = ONE
386 ISUPPZ(1) = 1
387 ISUPPZ(2) = 1
388 END IF
389 RETURN
390 END IF
391*
392 IF( N.EQ.2 ) THEN
393 IF( .NOT.WANTZ ) THEN
394 CALL SLAE2( D(1), E(1), D(2), R1, R2 )
395 ELSE IF( WANTZ.AND.(.NOT.ZQUERY) ) THEN
396 CALL SLAEV2( D(1), E(1), D(2), R1, R2, CS, SN )
397 END IF
398 IF( ALLEIG.OR.
399 $ (VALEIG.AND.(R2.GT.WL).AND.
400 $ (R2.LE.WU)).OR.
401 $ (INDEIG.AND.(IIL.EQ.1)) ) THEN
402 M = M+1
403 W( M ) = R2
404 IF( WANTZ.AND.(.NOT.ZQUERY) ) THEN
405 Z( 1, M ) = -SN
406 Z( 2, M ) = CS
407* Note: At most one of SN and CS can be zero.
408 IF (SN.NE.ZERO) THEN
409 IF (CS.NE.ZERO) THEN
410 ISUPPZ(2*M-1) = 1
411 ISUPPZ(2*M-1) = 2
412 ELSE
413 ISUPPZ(2*M-1) = 1
414 ISUPPZ(2*M-1) = 1
415 END IF
416 ELSE
417 ISUPPZ(2*M-1) = 2
418 ISUPPZ(2*M) = 2
419 END IF
420 ENDIF
421 ENDIF
422 IF( ALLEIG.OR.
423 $ (VALEIG.AND.(R1.GT.WL).AND.
424 $ (R1.LE.WU)).OR.
425 $ (INDEIG.AND.(IIU.EQ.2)) ) THEN
426 M = M+1
427 W( M ) = R1
428 IF( WANTZ.AND.(.NOT.ZQUERY) ) THEN
429 Z( 1, M ) = CS
430 Z( 2, M ) = SN
431* Note: At most one of SN and CS can be zero.
432 IF (SN.NE.ZERO) THEN
433 IF (CS.NE.ZERO) THEN
434 ISUPPZ(2*M-1) = 1
435 ISUPPZ(2*M-1) = 2
436 ELSE
437 ISUPPZ(2*M-1) = 1
438 ISUPPZ(2*M-1) = 1
439 END IF
440 ELSE
441 ISUPPZ(2*M-1) = 2
442 ISUPPZ(2*M) = 2
443 END IF
444 ENDIF
445 ENDIF
446 RETURN
447 END IF
448
449* Continue with general N
450
451 INDGRS = 1
452 INDERR = 2*N + 1
453 INDGP = 3*N + 1
454 INDD = 4*N + 1
455 INDE2 = 5*N + 1
456 INDWRK = 6*N + 1
457*
458 IINSPL = 1
459 IINDBL = N + 1
460 IINDW = 2*N + 1
461 IINDWK = 3*N + 1
462*
463* Scale matrix to allowable range, if necessary.
464* The allowable range is related to the PIVMIN parameter; see the
465* comments in SLARRD. The preference for scaling small values
466* up is heuristic; we expect users' matrices not to be close to the
467* RMAX threshold.
468*
469 SCALE = ONE
470 TNRM = SLANST( 'M', N, D, E )
471 IF( TNRM.GT.ZERO .AND. TNRM.LT.RMIN ) THEN
472 SCALE = RMIN / TNRM
473 ELSE IF( TNRM.GT.RMAX ) THEN
474 SCALE = RMAX / TNRM
475 END IF
476 IF( SCALE.NE.ONE ) THEN
477 CALL SSCAL( N, SCALE, D, 1 )
478 CALL SSCAL( N-1, SCALE, E, 1 )
479 TNRM = TNRM*SCALE
480 IF( VALEIG ) THEN
481* If eigenvalues in interval have to be found,
482* scale (WL, WU] accordingly
483 WL = WL*SCALE
484 WU = WU*SCALE
485 ENDIF
486 END IF
487*
488* Compute the desired eigenvalues of the tridiagonal after splitting
489* into smaller subblocks if the corresponding off-diagonal elements
490* are small
491* THRESH is the splitting parameter for SLARRE
492* A negative THRESH forces the old splitting criterion based on the
493* size of the off-diagonal. A positive THRESH switches to splitting
494* which preserves relative accuracy.
495*
496 IF( TRYRAC ) THEN
497* Test whether the matrix warrants the more expensive relative approach.
498 CALL SLARRR( N, D, E, IINFO )
499 ELSE
500* The user does not care about relative accurately eigenvalues
501 IINFO = -1
502 ENDIF
503* Set the splitting criterion
504 IF (IINFO.EQ.0) THEN
505 THRESH = EPS
506 ELSE
507 THRESH = -EPS
508* relative accuracy is desired but T does not guarantee it
509 TRYRAC = .FALSE.
510 ENDIF
511*
512 IF( TRYRAC ) THEN
513* Copy original diagonal, needed to guarantee relative accuracy
514 CALL SCOPY(N,D,1,WORK(INDD),1)
515 ENDIF
516* Store the squares of the offdiagonal values of T
517 DO 5 J = 1, N-1
518 WORK( INDE2+J-1 ) = E(J)**2
519 5 CONTINUE
520
521* Set the tolerance parameters for bisection
522 IF( .NOT.WANTZ ) THEN
523* SLARRE computes the eigenvalues to full precision.
524 RTOL1 = FOUR * EPS
525 RTOL2 = FOUR * EPS
526 ELSE
527* SLARRE computes the eigenvalues to less than full precision.
528* CLARRV will refine the eigenvalue approximations, and we only
529* need less accurate initial bisection in SLARRE.
530* Note: these settings do only affect the subset case and SLARRE
531 RTOL1 = MAX( SQRT(EPS)*5.0E-2, FOUR * EPS )
532 RTOL2 = MAX( SQRT(EPS)*5.0E-3, FOUR * EPS )
533 ENDIF
534 CALL SLARRE( RANGE, N, WL, WU, IIL, IIU, D, E,
535 $ WORK(INDE2), RTOL1, RTOL2, THRESH, NSPLIT,
536 $ IWORK( IINSPL ), M, W, WORK( INDERR ),
537 $ WORK( INDGP ), IWORK( IINDBL ),
538 $ IWORK( IINDW ), WORK( INDGRS ), PIVMIN,
539 $ WORK( INDWRK ), IWORK( IINDWK ), IINFO )
540 IF( IINFO.NE.0 ) THEN
541 INFO = 10 + ABS( IINFO )
542 RETURN
543 END IF
544* Note that if RANGE .NE. 'V', SLARRE computes bounds on the desired
545* part of the spectrum. All desired eigenvalues are contained in
546* (WL,WU]
547
548
549 IF( WANTZ ) THEN
550*
551* Compute the desired eigenvectors corresponding to the computed
552* eigenvalues
553*
554 CALL CLARRV( N, WL, WU, D, E,
555 $ PIVMIN, IWORK( IINSPL ), M,
556 $ 1, M, MINRGP, RTOL1, RTOL2,
557 $ W, WORK( INDERR ), WORK( INDGP ), IWORK( IINDBL ),
558 $ IWORK( IINDW ), WORK( INDGRS ), Z, LDZ,
559 $ ISUPPZ, WORK( INDWRK ), IWORK( IINDWK ), IINFO )
560 IF( IINFO.NE.0 ) THEN
561 INFO = 20 + ABS( IINFO )
562 RETURN
563 END IF
564 ELSE
565* SLARRE computes eigenvalues of the (shifted) root representation
566* CLARRV returns the eigenvalues of the unshifted matrix.
567* However, if the eigenvectors are not desired by the user, we need
568* to apply the corresponding shifts from SLARRE to obtain the
569* eigenvalues of the original matrix.
570 DO 20 J = 1, M
571 ITMP = IWORK( IINDBL+J-1 )
572 W( J ) = W( J ) + E( IWORK( IINSPL+ITMP-1 ) )
573 20 CONTINUE
574 END IF
575*
576
577 IF ( TRYRAC ) THEN
578* Refine computed eigenvalues so that they are relatively accurate
579* with respect to the original matrix T.
580 IBEGIN = 1
581 WBEGIN = 1
582 DO 39 JBLK = 1, IWORK( IINDBL+M-1 )
583 IEND = IWORK( IINSPL+JBLK-1 )
584 IN = IEND - IBEGIN + 1
585 WEND = WBEGIN - 1
586* check if any eigenvalues have to be refined in this block
587 36 CONTINUE
588 IF( WEND.LT.M ) THEN
589 IF( IWORK( IINDBL+WEND ).EQ.JBLK ) THEN
590 WEND = WEND + 1
591 GO TO 36
592 END IF
593 END IF
594 IF( WEND.LT.WBEGIN ) THEN
595 IBEGIN = IEND + 1
596 GO TO 39
597 END IF
598
599 OFFSET = IWORK(IINDW+WBEGIN-1)-1
600 IFIRST = IWORK(IINDW+WBEGIN-1)
601 ILAST = IWORK(IINDW+WEND-1)
602 RTOL2 = FOUR * EPS
603 CALL SLARRJ( IN,
604 $ WORK(INDD+IBEGIN-1), WORK(INDE2+IBEGIN-1),
605 $ IFIRST, ILAST, RTOL2, OFFSET, W(WBEGIN),
606 $ WORK( INDERR+WBEGIN-1 ),
607 $ WORK( INDWRK ), IWORK( IINDWK ), PIVMIN,
608 $ TNRM, IINFO )
609 IBEGIN = IEND + 1
610 WBEGIN = WEND + 1
611 39 CONTINUE
612 ENDIF
613*
614* If matrix was scaled, then rescale eigenvalues appropriately.
615*
616 IF( SCALE.NE.ONE ) THEN
617 CALL SSCAL( M, ONE / SCALE, W, 1 )
618 END IF
619*
620* If eigenvalues are not in increasing order, then sort them,
621* possibly along with eigenvectors.
622*
623 IF( NSPLIT.GT.1 ) THEN
624 IF( .NOT. WANTZ ) THEN
625 CALL SLASRT( 'I', M, W, IINFO )
626 IF( IINFO.NE.0 ) THEN
627 INFO = 3
628 RETURN
629 END IF
630 ELSE
631 DO 60 J = 1, M - 1
632 I = 0
633 TMP = W( J )
634 DO 50 JJ = J + 1, M
635 IF( W( JJ ).LT.TMP ) THEN
636 I = JJ
637 TMP = W( JJ )
638 END IF
639 50 CONTINUE
640 IF( I.NE.0 ) THEN
641 W( I ) = W( J )
642 W( J ) = TMP
643 IF( WANTZ ) THEN
644 CALL CSWAP( N, Z( 1, I ), 1, Z( 1, J ), 1 )
645 ITMP = ISUPPZ( 2*I-1 )
646 ISUPPZ( 2*I-1 ) = ISUPPZ( 2*J-1 )
647 ISUPPZ( 2*J-1 ) = ITMP
648 ITMP = ISUPPZ( 2*I )
649 ISUPPZ( 2*I ) = ISUPPZ( 2*J )
650 ISUPPZ( 2*J ) = ITMP
651 END IF
652 END IF
653 60 CONTINUE
654 END IF
655 ENDIF
656*
657*
658 WORK( 1 ) = LWMIN
659 IWORK( 1 ) = LIWMIN
660 RETURN
661*
662* End of CSTEMR
663*
664 END
Note: See TracBrowser for help on using the repository browser.