3 /* Table of constant values */
5 static integer c__1 = 1;
6 static integer c__2 = 2;
8 /* Subroutine */ int slarre_(char *range, integer *n, real *vl, real *vu,
9 integer *il, integer *iu, real *d__, real *e, real *e2, real *rtol1,
10 real *rtol2, real *spltol, integer *nsplit, integer *isplit, integer *
11 m, real *w, real *werr, real *wgap, integer *iblock, integer *indexw,
12 real *gers, real *pivmin, real *work, integer *iwork, integer *info)
14 /* System generated locals */
16 real r__1, r__2, r__3;
18 /* Builtin functions */
19 double sqrt(doublereal), log(doublereal);
29 real eps, tau, tmp, rtl;
36 integer wend, idum, indu;
40 extern logical lsame_(char *, char *);
43 extern /* Subroutine */ int scopy_(integer *, real *, integer *, real *,
44 integer *), slasq2_(integer *, real *, integer *);
49 extern doublereal slamch_(char *);
52 extern /* Subroutine */ int slarra_(integer *, real *, real *, real *,
53 real *, real *, integer *, integer *, integer *);
56 extern /* Subroutine */ int slarrb_(integer *, real *, real *, integer *,
57 integer *, real *, real *, integer *, real *, real *, real *,
58 real *, integer *, real *, real *, integer *, integer *), slarrc_(
59 char *, integer *, real *, real *, real *, real *, real *,
60 integer *, integer *, integer *, integer *), slarrd_(char
61 *, char *, integer *, real *, real *, integer *, integer *, real *
62 , real *, real *, real *, real *, real *, integer *, integer *,
63 integer *, real *, real *, real *, real *, integer *, integer *,
64 real *, integer *, integer *), slarrk_(integer *,
65 integer *, real *, real *, real *, real *, real *, real *, real *,
67 real isrght, bsrtol, dpivot;
68 extern /* Subroutine */ int slarnv_(integer *, integer *, integer *, real
72 /* -- LAPACK auxiliary routine (version 3.1) -- */
73 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
76 /* .. Scalar Arguments .. */
78 /* .. Array Arguments .. */
84 /* To find the desired eigenvalues of a given real symmetric */
85 /* tridiagonal matrix T, SLARRE sets any "small" off-diagonal */
86 /* elements to zero, and for each unreduced block T_i, it finds */
87 /* (a) a suitable shift at one end of the block's spectrum, */
88 /* (b) the base representation, T_i - sigma_i I = L_i D_i L_i^T, and */
89 /* (c) eigenvalues of each L_i D_i L_i^T. */
90 /* The representations and eigenvalues found are then used by */
91 /* SSTEMR to compute the eigenvectors of T. */
92 /* The accuracy varies depending on whether bisection is used to */
93 /* find a few eigenvalues or the dqds algorithm (subroutine SLASQ2) to */
94 /* conpute all and then discard any unwanted one. */
95 /* As an added benefit, SLARRE also outputs the n */
96 /* Gerschgorin intervals for the matrices L_i D_i L_i^T. */
101 /* RANGE (input) CHARACTER */
102 /* = 'A': ("All") all eigenvalues will be found. */
103 /* = 'V': ("Value") all eigenvalues in the half-open interval */
104 /* (VL, VU] will be found. */
105 /* = 'I': ("Index") the IL-th through IU-th eigenvalues (of the */
106 /* entire matrix) will be found. */
108 /* N (input) INTEGER */
109 /* The order of the matrix. N > 0. */
111 /* VL (input/output) REAL */
112 /* VU (input/output) REAL */
113 /* If RANGE='V', the lower and upper bounds for the eigenvalues. */
114 /* Eigenvalues less than or equal to VL, or greater than VU, */
115 /* will not be returned. VL < VU. */
116 /* If RANGE='I' or ='A', SLARRE computes bounds on the desired */
117 /* part of the spectrum. */
119 /* IL (input) INTEGER */
120 /* IU (input) INTEGER */
121 /* If RANGE='I', the indices (in ascending order) of the */
122 /* smallest and largest eigenvalues to be returned. */
123 /* 1 <= IL <= IU <= N. */
125 /* D (input/output) REAL array, dimension (N) */
126 /* On entry, the N diagonal elements of the tridiagonal */
128 /* On exit, the N diagonal elements of the diagonal */
131 /* E (input/output) REAL array, dimension (N) */
132 /* On entry, the first (N-1) entries contain the subdiagonal */
133 /* elements of the tridiagonal matrix T; E(N) need not be set. */
134 /* On exit, E contains the subdiagonal elements of the unit */
135 /* bidiagonal matrices L_i. The entries E( ISPLIT( I ) ), */
136 /* 1 <= I <= NSPLIT, contain the base points sigma_i on output. */
138 /* E2 (input/output) REAL array, dimension (N) */
139 /* On entry, the first (N-1) entries contain the SQUARES of the */
140 /* subdiagonal elements of the tridiagonal matrix T; */
141 /* E2(N) need not be set. */
142 /* On exit, the entries E2( ISPLIT( I ) ), */
143 /* 1 <= I <= NSPLIT, have been set to zero */
145 /* RTOL1 (input) REAL */
146 /* RTOL2 (input) REAL */
147 /* Parameters for bisection. */
148 /* An interval [LEFT,RIGHT] has converged if */
149 /* RIGHT-LEFT.LT.MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) ) */
151 /* SPLTOL (input) REAL */
152 /* The threshold for splitting. */
154 /* NSPLIT (output) INTEGER */
155 /* The number of blocks T splits into. 1 <= NSPLIT <= N. */
157 /* ISPLIT (output) INTEGER array, dimension (N) */
158 /* The splitting points, at which T breaks up into blocks. */
159 /* The first block consists of rows/columns 1 to ISPLIT(1), */
160 /* the second of rows/columns ISPLIT(1)+1 through ISPLIT(2), */
161 /* etc., and the NSPLIT-th consists of rows/columns */
162 /* ISPLIT(NSPLIT-1)+1 through ISPLIT(NSPLIT)=N. */
164 /* M (output) INTEGER */
165 /* The total number of eigenvalues (of all L_i D_i L_i^T) */
168 /* W (output) REAL array, dimension (N) */
169 /* The first M elements contain the eigenvalues. The */
170 /* eigenvalues of each of the blocks, L_i D_i L_i^T, are */
171 /* sorted in ascending order ( SLARRE may use the */
172 /* remaining N-M elements as workspace). */
174 /* WERR (output) REAL array, dimension (N) */
175 /* The error bound on the corresponding eigenvalue in W. */
177 /* WGAP (output) REAL array, dimension (N) */
178 /* The separation from the right neighbor eigenvalue in W. */
179 /* The gap is only with respect to the eigenvalues of the same block */
180 /* as each block has its own representation tree. */
181 /* Exception: at the right end of a block we store the left gap */
183 /* IBLOCK (output) INTEGER array, dimension (N) */
184 /* The indices of the blocks (submatrices) associated with the */
185 /* corresponding eigenvalues in W; IBLOCK(i)=1 if eigenvalue */
186 /* W(i) belongs to the first block from the top, =2 if W(i) */
187 /* belongs to the second block, etc. */
189 /* INDEXW (output) INTEGER array, dimension (N) */
190 /* The indices of the eigenvalues within each block (submatrix); */
191 /* for example, INDEXW(i)= 10 and IBLOCK(i)=2 imply that the */
192 /* i-th eigenvalue W(i) is the 10-th eigenvalue in block 2 */
194 /* GERS (output) REAL array, dimension (2*N) */
195 /* The N Gerschgorin intervals (the i-th Gerschgorin interval */
196 /* is (GERS(2*i-1), GERS(2*i)). */
198 /* PIVMIN (output) DOUBLE PRECISION */
199 /* The minimum pivot in the Sturm sequence for T. */
201 /* WORK (workspace) REAL array, dimension (6*N) */
204 /* IWORK (workspace) INTEGER array, dimension (5*N) */
207 /* INFO (output) INTEGER */
208 /* = 0: successful exit */
209 /* > 0: A problem occured in SLARRE. */
210 /* < 0: One of the called subroutines signaled an internal problem. */
211 /* Needs inspection of the corresponding parameter IINFO */
212 /* for further information. */
214 /* =-1: Problem in SLARRD. */
215 /* = 2: No base representation could be found in MAXTRY iterations. */
216 /* Increasing MAXTRY and recompilation might be a remedy. */
217 /* =-3: Problem in SLARRB when computing the refined root */
218 /* representation for SLASQ2. */
219 /* =-4: Problem in SLARRB when preforming bisection on the */
220 /* desired part of the spectrum. */
221 /* =-5: Problem in SLASQ2. */
222 /* =-6: Problem in SLASQ2. */
224 /* Further Details */
225 /* The base representations are required to suffer very little */
226 /* element growth and consequently define all their eigenvalues to */
227 /* high relative accuracy. */
228 /* =============== */
230 /* Based on contributions by */
231 /* Beresford Parlett, University of California, Berkeley, USA */
232 /* Jim Demmel, University of California, Berkeley, USA */
233 /* Inderjit Dhillon, University of Texas, Austin, USA */
234 /* Osni Marques, LBNL/NERSC, USA */
235 /* Christof Voemel, University of California, Berkeley, USA */
237 /* ===================================================================== */
239 /* .. Parameters .. */
241 /* .. Local Scalars .. */
243 /* .. Local Arrays .. */
245 /* .. External Functions .. */
247 /* .. External Subroutines .. */
249 /* .. Intrinsic Functions .. */
251 /* .. Executable Statements .. */
253 /* Parameter adjustments */
272 if (lsame_(range, "A")) {
274 } else if (lsame_(range, "V")) {
276 } else if (lsame_(range, "I")) {
280 /* Get machine constants */
281 safmin = slamch_("S");
285 /* If one were ever to ask for less initial precision in BSRTOL, */
286 /* one should keep in mind that for the subset case, the extremal */
287 /* eigenvalues must be at least as accurate as the current setting */
288 /* (eigenvalues in the middle need not as much accuracy) */
289 bsrtol = sqrt(eps) * 5e-4f;
290 /* Treat case of 1x1 matrix for quick return */
292 if (irange == 1 || irange == 3 && d__[1] > *vl && d__[1] <= *vu ||
293 irange == 2 && *il == 1 && *iu == 1) {
296 /* The computation error of the eigenvalue is zero */
304 /* store the shift for the initial RRR, which is zero in this case */
308 /* General case: tridiagonal matrix of order > 1 */
310 /* Init WERR, WGAP. Compute Gerschgorin intervals and spectral diameter. */
311 /* Compute maximum off-diagonal entry and pivmin. */
318 for (i__ = 1; i__ <= i__1; ++i__) {
321 eabs = (r__1 = e[i__], dabs(r__1));
326 gers[(i__ << 1) - 1] = d__[i__] - tmp1;
328 r__1 = gl, r__2 = gers[(i__ << 1) - 1];
329 gl = dmin(r__1,r__2);
330 gers[i__ * 2] = d__[i__] + tmp1;
332 r__1 = gu, r__2 = gers[i__ * 2];
333 gu = dmax(r__1,r__2);
337 /* The minimum pivot allowed in the Sturm sequence for T */
339 /* Computing 2nd power */
341 r__1 = 1.f, r__2 = r__3 * r__3;
342 *pivmin = safmin * dmax(r__1,r__2);
343 /* Compute spectral diameter. The Gerschgorin bounds give an */
344 /* estimate that is wrong by at most a factor of SQRT(2) */
346 /* Compute splitting points */
347 slarra_(n, &d__[1], &e[1], &e2[1], spltol, &spdiam, nsplit, &isplit[1], &
349 /* Can force use of bisection instead of faster DQDS. */
350 /* Option left in the code for future multisection work. */
352 if (irange == 1 && ! forceb) {
353 /* Set interval [VL,VU] that contains all eigenvalues */
357 /* We call SLARRD to find crude approximations to the eigenvalues */
358 /* in the desired range. In case IRANGE = INDRNG, we also obtain the */
359 /* interval (VL,VU] that contains all the wanted eigenvalues. */
360 /* An interval [LEFT,RIGHT] has converged if */
361 /* RIGHT-LEFT.LT.RTOL*MAX(ABS(LEFT),ABS(RIGHT)) */
362 /* SLARRD needs a WORK of size 4*N, IWORK of size 3*N */
363 slarrd_(range, "B", n, vl, vu, il, iu, &gers[1], &bsrtol, &d__[1], &e[
364 1], &e2[1], pivmin, nsplit, &isplit[1], &mm, &w[1], &werr[1],
365 vl, vu, &iblock[1], &indexw[1], &work[1], &iwork[1], &iinfo);
370 /* Make sure that the entries M+1 to N in W, WERR, IBLOCK, INDEXW are 0 */
372 for (i__ = mm + 1; i__ <= i__1; ++i__) {
381 /* Loop over unreduced blocks */
385 for (jblk = 1; jblk <= i__1; ++jblk) {
387 in = iend - ibegin + 1;
390 if (irange == 1 || irange == 3 && d__[ibegin] > *vl && d__[ibegin]
391 <= *vu || irange == 2 && iblock[wbegin] == jblk) {
395 /* The gap for a single block doesn't matter for the later */
396 /* algorithm and is assigned an arbitrary large value */
402 /* E( IEND ) holds the shift for the initial RRR */
408 /* Blocks of size larger than 1x1 */
410 /* E( IEND ) will hold the shift for the initial RRR, for now set it =0 */
413 /* Find local outer bounds GL,GU for the block */
417 for (i__ = ibegin; i__ <= i__2; ++i__) {
419 r__1 = gers[(i__ << 1) - 1];
422 r__1 = gers[i__ * 2];
427 if (! (irange == 1 && ! forceb)) {
428 /* Count the number of eigenvalues in the current block. */
431 for (i__ = wbegin; i__ <= i__2; ++i__) {
432 if (iblock[i__] == jblk) {
441 /* No eigenvalue in the current block lies in the desired range */
442 /* E( IEND ) holds the shift for the initial RRR */
447 /* Decide whether dqds or bisection is more efficient */
448 usedqd = (real) mb > in * .5f && ! forceb;
449 wend = wbegin + mb - 1;
450 /* Calculate gaps for the current block */
451 /* In later stages, when representations for individual */
452 /* eigenvalues are different, we use SIGMA = E( IEND ). */
455 for (i__ = wbegin; i__ <= i__2; ++i__) {
457 r__1 = 0.f, r__2 = w[i__ + 1] - werr[i__ + 1] - (w[i__] +
459 wgap[i__] = dmax(r__1,r__2);
463 r__1 = 0.f, r__2 = *vu - sigma - (w[wend] + werr[wend]);
464 wgap[wend] = dmax(r__1,r__2);
465 /* Find local index of the first and last desired evalue. */
466 indl = indexw[wbegin];
470 if (irange == 1 && ! forceb || usedqd) {
472 /* Find approximations to the extremal eigenvalues of the block */
473 slarrk_(&in, &c__1, &gl, &gu, &d__[ibegin], &e2[ibegin], pivmin, &
474 rtl, &tmp, &tmp1, &iinfo);
480 r__2 = gl, r__3 = tmp - tmp1 - eps * 100.f * (r__1 = tmp - tmp1,
482 isleft = dmax(r__2,r__3);
483 slarrk_(&in, &in, &gl, &gu, &d__[ibegin], &e2[ibegin], pivmin, &
484 rtl, &tmp, &tmp1, &iinfo);
490 r__2 = gu, r__3 = tmp + tmp1 + eps * 100.f * (r__1 = tmp + tmp1,
492 isrght = dmin(r__2,r__3);
493 /* Improve the estimate of the spectral diameter */
494 spdiam = isrght - isleft;
496 /* Case of bisection */
497 /* Find approximations to the wanted extremal eigenvalues */
499 r__2 = gl, r__3 = w[wbegin] - werr[wbegin] - eps * 100.f * (r__1 =
500 w[wbegin] - werr[wbegin], dabs(r__1));
501 isleft = dmax(r__2,r__3);
503 r__2 = gu, r__3 = w[wend] + werr[wend] + eps * 100.f * (r__1 = w[
504 wend] + werr[wend], dabs(r__1));
505 isrght = dmin(r__2,r__3);
507 /* Decide whether the base representation for the current block */
508 /* L_JBLK D_JBLK L_JBLK^T = T_JBLK - sigma_JBLK I */
509 /* should be on the left or the right end of the current block. */
510 /* The strategy is to shift to the end which is "more populated" */
511 /* Furthermore, decide whether to use DQDS for the computation of */
512 /* the eigenvalue approximations at the end of SLARRE or bisection. */
513 /* dqds is chosen if all eigenvalues are desired or the number of */
514 /* eigenvalues to be computed is large compared to the blocksize. */
515 if (irange == 1 && ! forceb) {
516 /* If all the eigenvalues have to be computed, we use dqd */
518 /* INDL is the local index of the first eigenvalue to compute */
521 /* MB = number of eigenvalues to compute */
523 wend = wbegin + mb - 1;
524 /* Define 1/4 and 3/4 points of the spectrum */
525 s1 = isleft + spdiam * .25f;
526 s2 = isrght - spdiam * .25f;
528 /* SLARRD has computed IBLOCK and INDEXW for each eigenvalue */
532 s1 = isleft + spdiam * .25f;
533 s2 = isrght - spdiam * .25f;
535 tmp = dmin(isrght,*vu) - dmax(isleft,*vl);
536 s1 = dmax(isleft,*vl) + tmp * .25f;
537 s2 = dmin(isrght,*vu) - tmp * .25f;
540 /* Compute the negcount at the 1/4 and 3/4 points */
542 slarrc_("T", &in, &s1, &s2, &d__[ibegin], &e[ibegin], pivmin, &
543 cnt, &cnt1, &cnt2, &iinfo);
548 } else if (cnt1 - indl >= indu - cnt2) {
549 if (irange == 1 && ! forceb) {
550 sigma = dmax(isleft,gl);
552 /* use Gerschgorin bound as shift to get pos def matrix */
556 /* use approximation of the first desired eigenvalue of the */
558 sigma = dmax(isleft,*vl);
562 if (irange == 1 && ! forceb) {
563 sigma = dmin(isrght,gu);
565 /* use Gerschgorin bound as shift to get neg def matrix */
569 /* use approximation of the first desired eigenvalue of the */
571 sigma = dmin(isrght,*vu);
575 /* An initial SIGMA has been chosen that will be used for computing */
576 /* T - SIGMA I = L D L^T */
577 /* Define the increment TAU of the shift in case the initial shift */
578 /* needs to be refined to obtain a factorization with not too much */
579 /* element growth. */
581 /* The initial SIGMA was to the outer end of the spectrum */
582 /* the matrix is definite and we need not retreat. */
583 tau = spdiam * eps * *n + *pivmin * 2.f;
586 clwdth = w[wend] + werr[wend] - w[wbegin] - werr[wbegin];
587 avgap = (r__1 = clwdth / (real) (wend - wbegin), dabs(r__1));
591 tau = dmax(r__1,avgap) * .5f;
593 r__1 = tau, r__2 = werr[wbegin];
594 tau = dmax(r__1,r__2);
597 r__1 = wgap[wend - 1];
598 tau = dmax(r__1,avgap) * .5f;
600 r__1 = tau, r__2 = werr[wend];
601 tau = dmax(r__1,r__2);
608 for (idum = 1; idum <= 6; ++idum) {
609 /* Compute L D L^T factorization of tridiagonal matrix T - sigma I. */
610 /* Store D in WORK(1:IN), L in WORK(IN+1:2*IN), and reciprocals of */
611 /* pivots in WORK(2*IN+1:3*IN) */
612 dpivot = d__[ibegin] - sigma;
614 dmax__ = dabs(work[1]);
617 for (i__ = 1; i__ <= i__2; ++i__) {
618 work[(in << 1) + i__] = 1.f / work[i__];
619 tmp = e[j] * work[(in << 1) + i__];
620 work[in + i__] = tmp;
621 dpivot = d__[j + 1] - sigma - tmp * e[j];
622 work[i__ + 1] = dpivot;
624 r__1 = dmax__, r__2 = dabs(dpivot);
625 dmax__ = dmax(r__1,r__2);
629 /* check for element growth */
630 if (dmax__ > spdiam * 64.f) {
635 if (usedqd && ! norep) {
636 /* Ensure the definiteness of the representation */
637 /* All entries of D (of L D L^T) must have the same sign */
639 for (i__ = 1; i__ <= i__2; ++i__) {
640 tmp = sgndef * work[i__];
648 /* Note that in the case of IRANGE=ALLRNG, we use the Gerschgorin */
649 /* shift which makes the matrix definite. So we should end up */
650 /* here really only in the case of IRANGE = VALRNG or INDRNG. */
653 /* The fudged Gerschgorin shift should succeed */
654 sigma = gl - spdiam * 2.f * eps * *n - *pivmin * 4.f;
656 sigma = gu + spdiam * 2.f * eps * *n + *pivmin * 4.f;
659 sigma -= sgndef * tau;
663 /* an initial RRR is found */
668 /* if the program reaches this point, no base representation could be */
669 /* found in MAXTRY iterations. */
673 /* At this point, we have found an initial base representation */
674 /* T - SIGMA I = L D L^T with not too much element growth. */
675 /* Store the shift. */
678 scopy_(&in, &work[1], &c__1, &d__[ibegin], &c__1);
680 scopy_(&i__2, &work[in + 1], &c__1, &e[ibegin], &c__1);
683 /* Perturb each entry of the base representation by a small */
684 /* (but random) relative amount to overcome difficulties with */
685 /* glued matrices. */
687 for (i__ = 1; i__ <= 4; ++i__) {
691 i__2 = (in << 1) - 1;
692 slarnv_(&c__2, iseed, &i__2, &work[1]);
694 for (i__ = 1; i__ <= i__2; ++i__) {
695 d__[ibegin + i__ - 1] *= eps * 4.f * work[i__] + 1.f;
696 e[ibegin + i__ - 1] *= eps * 4.f * work[in + i__] + 1.f;
699 d__[iend] *= eps * 4.f * work[in] + 1.f;
703 /* Don't update the Gerschgorin intervals because keeping track */
704 /* of the updates would be too much work in SLARRV. */
705 /* We update W instead and use it to locate the proper Gerschgorin */
707 /* Compute the required eigenvalues of L D L' by bisection or dqds */
709 /* If SLARRD has been used, shift the eigenvalue approximations */
710 /* according to their representation. This is necessary for */
711 /* a uniform SLARRV since dqds computes eigenvalues of the */
712 /* shifted representation. In SLARRV, W will always hold the */
713 /* UNshifted eigenvalue approximation. */
715 for (j = wbegin; j <= i__2; ++j) {
717 werr[j] += (r__1 = w[j], dabs(r__1)) * eps;
720 /* call SLARRB to reduce eigenvalue error of the approximations */
723 for (i__ = ibegin; i__ <= i__2; ++i__) {
724 /* Computing 2nd power */
726 work[i__] = d__[i__] * (r__1 * r__1);
729 /* use bisection to find EV from INDL to INDU */
731 slarrb_(&in, &d__[ibegin], &work[ibegin], &indl, &indu, rtol1,
732 rtol2, &i__2, &w[wbegin], &wgap[wbegin], &werr[wbegin], &
733 work[(*n << 1) + 1], &iwork[1], pivmin, &spdiam, &in, &
739 /* SLARRB computes all gaps correctly except for the last one */
740 /* Record distance to VU/GU */
742 r__1 = 0.f, r__2 = *vu - sigma - (w[wend] + werr[wend]);
743 wgap[wend] = dmax(r__1,r__2);
745 for (i__ = indl; i__ <= i__2; ++i__) {
752 /* Call dqds to get all eigs (and then possibly delete unwanted */
754 /* Note that dqds finds the eigenvalues of the L D L^T representation */
755 /* of T to high relative accuracy. High relative accuracy */
756 /* might be lost when the shift of the RRR is subtracted to obtain */
757 /* the eigenvalues of T. However, T is not guaranteed to define its */
758 /* eigenvalues to high relative accuracy anyway. */
759 /* Set RTOL to the order of the tolerance used in SLASQ2 */
760 /* This is an ESTIMATED error, the worst case bound is 4*N*EPS */
761 /* which is usually too large and requires unnecessary work to be */
762 /* done by bisection when computing the eigenvectors */
763 rtol = log((real) in) * 4.f * eps;
766 for (i__ = 1; i__ <= i__2; ++i__) {
767 work[(i__ << 1) - 1] = (r__1 = d__[j], dabs(r__1));
768 work[i__ * 2] = e[j] * e[j] * work[(i__ << 1) - 1];
772 work[(in << 1) - 1] = (r__1 = d__[iend], dabs(r__1));
774 slasq2_(&in, &work[1], &iinfo);
776 /* If IINFO = -5 then an index is part of a tight cluster */
777 /* and should be changed. The index is in IWORK(1) and the */
778 /* gap is in WORK(N+1) */
782 /* Test that all eigenvalues are positive as expected */
784 for (i__ = 1; i__ <= i__2; ++i__) {
785 if (work[i__] < 0.f) {
794 for (i__ = indl; i__ <= i__2; ++i__) {
796 w[*m] = work[in - i__ + 1];
803 for (i__ = indl; i__ <= i__2; ++i__) {
812 for (i__ = *m - mb + 1; i__ <= i__2; ++i__) {
813 /* the value of RTOL below should be the tolerance in SLASQ2 */
814 werr[i__] = rtol * (r__1 = w[i__], dabs(r__1));
818 for (i__ = *m - mb + 1; i__ <= i__2; ++i__) {
819 /* compute the right gap between the intervals */
821 r__1 = 0.f, r__2 = w[i__ + 1] - werr[i__ + 1] - (w[i__] +
823 wgap[i__] = dmax(r__1,r__2);
827 r__1 = 0.f, r__2 = *vu - sigma - (w[*m] + werr[*m]);
828 wgap[*m] = dmax(r__1,r__2);
830 /* proceed with next block */