3 /* Table of constant values */
5 static integer c__1 = 1;
6 static integer c__2 = 2;
8 /* Subroutine */ int dlarre_(char *range, integer *n, doublereal *vl,
9 doublereal *vu, integer *il, integer *iu, doublereal *d__, doublereal
10 *e, doublereal *e2, doublereal *rtol1, doublereal *rtol2, doublereal *
11 spltol, integer *nsplit, integer *isplit, integer *m, doublereal *w,
12 doublereal *werr, doublereal *wgap, integer *iblock, integer *indexw,
13 doublereal *gers, doublereal *pivmin, doublereal *work, integer *
16 /* System generated locals */
18 doublereal d__1, d__2, d__3;
20 /* Builtin functions */
21 double sqrt(doublereal), log(doublereal);
31 doublereal eps, tau, tmp, rtl;
33 doublereal tmp1, eabs;
37 doublereal dmax__, emax;
38 integer wend, idum, indu;
41 doublereal avgap, sigma;
42 extern logical lsame_(char *, char *);
44 extern /* Subroutine */ int dcopy_(integer *, doublereal *, integer *,
45 doublereal *, integer *);
47 extern /* Subroutine */ int dlasq2_(integer *, doublereal *, integer *);
48 extern doublereal dlamch_(char *);
53 extern /* Subroutine */ int dlarra_(integer *, doublereal *, doublereal *,
54 doublereal *, doublereal *, doublereal *, integer *, integer *,
55 integer *), dlarrb_(integer *, doublereal *, doublereal *,
56 integer *, integer *, doublereal *, doublereal *, integer *,
57 doublereal *, doublereal *, doublereal *, doublereal *, integer *,
58 doublereal *, doublereal *, integer *, integer *), dlarrc_(char *
59 , integer *, doublereal *, doublereal *, doublereal *, doublereal
60 *, doublereal *, integer *, integer *, integer *, integer *);
62 extern /* Subroutine */ int dlarrd_(char *, char *, integer *, doublereal
63 *, doublereal *, integer *, integer *, doublereal *, doublereal *,
64 doublereal *, doublereal *, doublereal *, doublereal *, integer *
65 , integer *, integer *, doublereal *, doublereal *, doublereal *,
66 doublereal *, integer *, integer *, doublereal *, integer *,
68 doublereal safmin, spdiam;
69 extern /* Subroutine */ int dlarrk_(integer *, integer *, doublereal *,
70 doublereal *, doublereal *, doublereal *, doublereal *,
71 doublereal *, doublereal *, doublereal *, integer *);
73 doublereal clwdth, isleft;
74 extern /* Subroutine */ int dlarnv_(integer *, integer *, integer *,
76 doublereal isrght, bsrtol, dpivot;
79 /* -- LAPACK auxiliary routine (version 3.1) -- */
80 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
83 /* .. Scalar Arguments .. */
85 /* .. Array Arguments .. */
91 /* To find the desired eigenvalues of a given real symmetric */
92 /* tridiagonal matrix T, DLARRE sets any "small" off-diagonal */
93 /* elements to zero, and for each unreduced block T_i, it finds */
94 /* (a) a suitable shift at one end of the block's spectrum, */
95 /* (b) the base representation, T_i - sigma_i I = L_i D_i L_i^T, and */
96 /* (c) eigenvalues of each L_i D_i L_i^T. */
97 /* The representations and eigenvalues found are then used by */
98 /* DSTEMR to compute the eigenvectors of T. */
99 /* The accuracy varies depending on whether bisection is used to */
100 /* find a few eigenvalues or the dqds algorithm (subroutine DLASQ2) to */
101 /* conpute all and then discard any unwanted one. */
102 /* As an added benefit, DLARRE also outputs the n */
103 /* Gerschgorin intervals for the matrices L_i D_i L_i^T. */
108 /* RANGE (input) CHARACTER */
109 /* = 'A': ("All") all eigenvalues will be found. */
110 /* = 'V': ("Value") all eigenvalues in the half-open interval */
111 /* (VL, VU] will be found. */
112 /* = 'I': ("Index") the IL-th through IU-th eigenvalues (of the */
113 /* entire matrix) will be found. */
115 /* N (input) INTEGER */
116 /* The order of the matrix. N > 0. */
118 /* VL (input/output) DOUBLE PRECISION */
119 /* VU (input/output) DOUBLE PRECISION */
120 /* If RANGE='V', the lower and upper bounds for the eigenvalues. */
121 /* Eigenvalues less than or equal to VL, or greater than VU, */
122 /* will not be returned. VL < VU. */
123 /* If RANGE='I' or ='A', DLARRE computes bounds on the desired */
124 /* part of the spectrum. */
126 /* IL (input) INTEGER */
127 /* IU (input) INTEGER */
128 /* If RANGE='I', the indices (in ascending order) of the */
129 /* smallest and largest eigenvalues to be returned. */
130 /* 1 <= IL <= IU <= N. */
132 /* D (input/output) DOUBLE PRECISION array, dimension (N) */
133 /* On entry, the N diagonal elements of the tridiagonal */
135 /* On exit, the N diagonal elements of the diagonal */
138 /* E (input/output) DOUBLE PRECISION array, dimension (N) */
139 /* On entry, the first (N-1) entries contain the subdiagonal */
140 /* elements of the tridiagonal matrix T; E(N) need not be set. */
141 /* On exit, E contains the subdiagonal elements of the unit */
142 /* bidiagonal matrices L_i. The entries E( ISPLIT( I ) ), */
143 /* 1 <= I <= NSPLIT, contain the base points sigma_i on output. */
145 /* E2 (input/output) DOUBLE PRECISION array, dimension (N) */
146 /* On entry, the first (N-1) entries contain the SQUARES of the */
147 /* subdiagonal elements of the tridiagonal matrix T; */
148 /* E2(N) need not be set. */
149 /* On exit, the entries E2( ISPLIT( I ) ), */
150 /* 1 <= I <= NSPLIT, have been set to zero */
152 /* RTOL1 (input) DOUBLE PRECISION */
153 /* RTOL2 (input) DOUBLE PRECISION */
154 /* Parameters for bisection. */
155 /* An interval [LEFT,RIGHT] has converged if */
156 /* RIGHT-LEFT.LT.MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) ) */
158 /* SPLTOL (input) DOUBLE PRECISION */
159 /* The threshold for splitting. */
161 /* NSPLIT (output) INTEGER */
162 /* The number of blocks T splits into. 1 <= NSPLIT <= N. */
164 /* ISPLIT (output) INTEGER array, dimension (N) */
165 /* The splitting points, at which T breaks up into blocks. */
166 /* The first block consists of rows/columns 1 to ISPLIT(1), */
167 /* the second of rows/columns ISPLIT(1)+1 through ISPLIT(2), */
168 /* etc., and the NSPLIT-th consists of rows/columns */
169 /* ISPLIT(NSPLIT-1)+1 through ISPLIT(NSPLIT)=N. */
171 /* M (output) INTEGER */
172 /* The total number of eigenvalues (of all L_i D_i L_i^T) */
175 /* W (output) DOUBLE PRECISION array, dimension (N) */
176 /* The first M elements contain the eigenvalues. The */
177 /* eigenvalues of each of the blocks, L_i D_i L_i^T, are */
178 /* sorted in ascending order ( DLARRE may use the */
179 /* remaining N-M elements as workspace). */
181 /* WERR (output) DOUBLE PRECISION array, dimension (N) */
182 /* The error bound on the corresponding eigenvalue in W. */
184 /* WGAP (output) DOUBLE PRECISION array, dimension (N) */
185 /* The separation from the right neighbor eigenvalue in W. */
186 /* The gap is only with respect to the eigenvalues of the same block */
187 /* as each block has its own representation tree. */
188 /* Exception: at the right end of a block we store the left gap */
190 /* IBLOCK (output) INTEGER array, dimension (N) */
191 /* The indices of the blocks (submatrices) associated with the */
192 /* corresponding eigenvalues in W; IBLOCK(i)=1 if eigenvalue */
193 /* W(i) belongs to the first block from the top, =2 if W(i) */
194 /* belongs to the second block, etc. */
196 /* INDEXW (output) INTEGER array, dimension (N) */
197 /* The indices of the eigenvalues within each block (submatrix); */
198 /* for example, INDEXW(i)= 10 and IBLOCK(i)=2 imply that the */
199 /* i-th eigenvalue W(i) is the 10-th eigenvalue in block 2 */
201 /* GERS (output) DOUBLE PRECISION array, dimension (2*N) */
202 /* The N Gerschgorin intervals (the i-th Gerschgorin interval */
203 /* is (GERS(2*i-1), GERS(2*i)). */
205 /* PIVMIN (output) DOUBLE PRECISION */
206 /* The minimum pivot in the Sturm sequence for T. */
208 /* WORK (workspace) DOUBLE PRECISION array, dimension (6*N) */
211 /* IWORK (workspace) INTEGER array, dimension (5*N) */
214 /* INFO (output) INTEGER */
215 /* = 0: successful exit */
216 /* > 0: A problem occured in DLARRE. */
217 /* < 0: One of the called subroutines signaled an internal problem. */
218 /* Needs inspection of the corresponding parameter IINFO */
219 /* for further information. */
221 /* =-1: Problem in DLARRD. */
222 /* = 2: No base representation could be found in MAXTRY iterations. */
223 /* Increasing MAXTRY and recompilation might be a remedy. */
224 /* =-3: Problem in DLARRB when computing the refined root */
225 /* representation for DLASQ2. */
226 /* =-4: Problem in DLARRB when preforming bisection on the */
227 /* desired part of the spectrum. */
228 /* =-5: Problem in DLASQ2. */
229 /* =-6: Problem in DLASQ2. */
231 /* Further Details */
232 /* The base representations are required to suffer very little */
233 /* element growth and consequently define all their eigenvalues to */
234 /* high relative accuracy. */
235 /* =============== */
237 /* Based on contributions by */
238 /* Beresford Parlett, University of California, Berkeley, USA */
239 /* Jim Demmel, University of California, Berkeley, USA */
240 /* Inderjit Dhillon, University of Texas, Austin, USA */
241 /* Osni Marques, LBNL/NERSC, USA */
242 /* Christof Voemel, University of California, Berkeley, USA */
244 /* ===================================================================== */
246 /* .. Parameters .. */
248 /* .. Local Scalars .. */
250 /* .. Local Arrays .. */
252 /* .. External Functions .. */
254 /* .. External Subroutines .. */
256 /* .. Intrinsic Functions .. */
258 /* .. Executable Statements .. */
260 /* Parameter adjustments */
279 if (lsame_(range, "A")) {
281 } else if (lsame_(range, "V")) {
283 } else if (lsame_(range, "I")) {
287 /* Get machine constants */
288 safmin = dlamch_("S");
293 /* Treat case of 1x1 matrix for quick return */
295 if (irange == 1 || irange == 3 && d__[1] > *vl && d__[1] <= *vu ||
296 irange == 2 && *il == 1 && *iu == 1) {
299 /* The computation error of the eigenvalue is zero */
307 /* store the shift for the initial RRR, which is zero in this case */
311 /* General case: tridiagonal matrix of order > 1 */
313 /* Init WERR, WGAP. Compute Gerschgorin intervals and spectral diameter. */
314 /* Compute maximum off-diagonal entry and pivmin. */
321 for (i__ = 1; i__ <= i__1; ++i__) {
324 eabs = (d__1 = e[i__], abs(d__1));
329 gers[(i__ << 1) - 1] = d__[i__] - tmp1;
331 d__1 = gl, d__2 = gers[(i__ << 1) - 1];
333 gers[i__ * 2] = d__[i__] + tmp1;
335 d__1 = gu, d__2 = gers[i__ * 2];
340 /* The minimum pivot allowed in the Sturm sequence for T */
342 /* Computing 2nd power */
344 d__1 = 1., d__2 = d__3 * d__3;
345 *pivmin = safmin * max(d__1,d__2);
346 /* Compute spectral diameter. The Gerschgorin bounds give an */
347 /* estimate that is wrong by at most a factor of SQRT(2) */
349 /* Compute splitting points */
350 dlarra_(n, &d__[1], &e[1], &e2[1], spltol, &spdiam, nsplit, &isplit[1], &
352 /* Can force use of bisection instead of faster DQDS. */
353 /* Option left in the code for future multisection work. */
355 if (irange == 1 && ! forceb) {
356 /* Set interval [VL,VU] that contains all eigenvalues */
360 /* We call DLARRD to find crude approximations to the eigenvalues */
361 /* in the desired range. In case IRANGE = INDRNG, we also obtain the */
362 /* interval (VL,VU] that contains all the wanted eigenvalues. */
363 /* An interval [LEFT,RIGHT] has converged if */
364 /* RIGHT-LEFT.LT.RTOL*MAX(ABS(LEFT),ABS(RIGHT)) */
365 /* DLARRD needs a WORK of size 4*N, IWORK of size 3*N */
366 dlarrd_(range, "B", n, vl, vu, il, iu, &gers[1], &bsrtol, &d__[1], &e[
367 1], &e2[1], pivmin, nsplit, &isplit[1], &mm, &w[1], &werr[1],
368 vl, vu, &iblock[1], &indexw[1], &work[1], &iwork[1], &iinfo);
373 /* Make sure that the entries M+1 to N in W, WERR, IBLOCK, INDEXW are 0 */
375 for (i__ = mm + 1; i__ <= i__1; ++i__) {
384 /* Loop over unreduced blocks */
388 for (jblk = 1; jblk <= i__1; ++jblk) {
390 in = iend - ibegin + 1;
393 if (irange == 1 || irange == 3 && d__[ibegin] > *vl && d__[ibegin]
394 <= *vu || irange == 2 && iblock[wbegin] == jblk) {
398 /* The gap for a single block doesn't matter for the later */
399 /* algorithm and is assigned an arbitrary large value */
405 /* E( IEND ) holds the shift for the initial RRR */
411 /* Blocks of size larger than 1x1 */
413 /* E( IEND ) will hold the shift for the initial RRR, for now set it =0 */
416 /* Find local outer bounds GL,GU for the block */
420 for (i__ = ibegin; i__ <= i__2; ++i__) {
422 d__1 = gers[(i__ << 1) - 1];
425 d__1 = gers[i__ * 2];
430 if (! (irange == 1 && ! forceb)) {
431 /* Count the number of eigenvalues in the current block. */
434 for (i__ = wbegin; i__ <= i__2; ++i__) {
435 if (iblock[i__] == jblk) {
444 /* No eigenvalue in the current block lies in the desired range */
445 /* E( IEND ) holds the shift for the initial RRR */
450 /* Decide whether dqds or bisection is more efficient */
451 usedqd = (doublereal) mb > in * .5 && ! forceb;
452 wend = wbegin + mb - 1;
453 /* Calculate gaps for the current block */
454 /* In later stages, when representations for individual */
455 /* eigenvalues are different, we use SIGMA = E( IEND ). */
458 for (i__ = wbegin; i__ <= i__2; ++i__) {
460 d__1 = 0., d__2 = w[i__ + 1] - werr[i__ + 1] - (w[i__] +
462 wgap[i__] = max(d__1,d__2);
466 d__1 = 0., d__2 = *vu - sigma - (w[wend] + werr[wend]);
467 wgap[wend] = max(d__1,d__2);
468 /* Find local index of the first and last desired evalue. */
469 indl = indexw[wbegin];
473 if (irange == 1 && ! forceb || usedqd) {
475 /* Find approximations to the extremal eigenvalues of the block */
476 dlarrk_(&in, &c__1, &gl, &gu, &d__[ibegin], &e2[ibegin], pivmin, &
477 rtl, &tmp, &tmp1, &iinfo);
483 d__2 = gl, d__3 = tmp - tmp1 - eps * 100. * (d__1 = tmp - tmp1,
485 isleft = max(d__2,d__3);
486 dlarrk_(&in, &in, &gl, &gu, &d__[ibegin], &e2[ibegin], pivmin, &
487 rtl, &tmp, &tmp1, &iinfo);
493 d__2 = gu, d__3 = tmp + tmp1 + eps * 100. * (d__1 = tmp + tmp1,
495 isrght = min(d__2,d__3);
496 /* Improve the estimate of the spectral diameter */
497 spdiam = isrght - isleft;
499 /* Case of bisection */
500 /* Find approximations to the wanted extremal eigenvalues */
502 d__2 = gl, d__3 = w[wbegin] - werr[wbegin] - eps * 100. * (d__1 =
503 w[wbegin] - werr[wbegin], abs(d__1));
504 isleft = max(d__2,d__3);
506 d__2 = gu, d__3 = w[wend] + werr[wend] + eps * 100. * (d__1 = w[
507 wend] + werr[wend], abs(d__1));
508 isrght = min(d__2,d__3);
510 /* Decide whether the base representation for the current block */
511 /* L_JBLK D_JBLK L_JBLK^T = T_JBLK - sigma_JBLK I */
512 /* should be on the left or the right end of the current block. */
513 /* The strategy is to shift to the end which is "more populated" */
514 /* Furthermore, decide whether to use DQDS for the computation of */
515 /* the eigenvalue approximations at the end of DLARRE or bisection. */
516 /* dqds is chosen if all eigenvalues are desired or the number of */
517 /* eigenvalues to be computed is large compared to the blocksize. */
518 if (irange == 1 && ! forceb) {
519 /* If all the eigenvalues have to be computed, we use dqd */
521 /* INDL is the local index of the first eigenvalue to compute */
524 /* MB = number of eigenvalues to compute */
526 wend = wbegin + mb - 1;
527 /* Define 1/4 and 3/4 points of the spectrum */
528 s1 = isleft + spdiam * .25;
529 s2 = isrght - spdiam * .25;
531 /* DLARRD has computed IBLOCK and INDEXW for each eigenvalue */
535 s1 = isleft + spdiam * .25;
536 s2 = isrght - spdiam * .25;
538 tmp = min(isrght,*vu) - max(isleft,*vl);
539 s1 = max(isleft,*vl) + tmp * .25;
540 s2 = min(isrght,*vu) - tmp * .25;
543 /* Compute the negcount at the 1/4 and 3/4 points */
545 dlarrc_("T", &in, &s1, &s2, &d__[ibegin], &e[ibegin], pivmin, &
546 cnt, &cnt1, &cnt2, &iinfo);
551 } else if (cnt1 - indl >= indu - cnt2) {
552 if (irange == 1 && ! forceb) {
553 sigma = max(isleft,gl);
555 /* use Gerschgorin bound as shift to get pos def matrix */
559 /* use approximation of the first desired eigenvalue of the */
561 sigma = max(isleft,*vl);
565 if (irange == 1 && ! forceb) {
566 sigma = min(isrght,gu);
568 /* use Gerschgorin bound as shift to get neg def matrix */
572 /* use approximation of the first desired eigenvalue of the */
574 sigma = min(isrght,*vu);
578 /* An initial SIGMA has been chosen that will be used for computing */
579 /* T - SIGMA I = L D L^T */
580 /* Define the increment TAU of the shift in case the initial shift */
581 /* needs to be refined to obtain a factorization with not too much */
582 /* element growth. */
584 /* The initial SIGMA was to the outer end of the spectrum */
585 /* the matrix is definite and we need not retreat. */
586 tau = spdiam * eps * *n + *pivmin * 2.;
589 clwdth = w[wend] + werr[wend] - w[wbegin] - werr[wbegin];
590 avgap = (d__1 = clwdth / (doublereal) (wend - wbegin), abs(
595 tau = max(d__1,avgap) * .5;
597 d__1 = tau, d__2 = werr[wbegin];
598 tau = max(d__1,d__2);
601 d__1 = wgap[wend - 1];
602 tau = max(d__1,avgap) * .5;
604 d__1 = tau, d__2 = werr[wend];
605 tau = max(d__1,d__2);
612 for (idum = 1; idum <= 6; ++idum) {
613 /* Compute L D L^T factorization of tridiagonal matrix T - sigma I. */
614 /* Store D in WORK(1:IN), L in WORK(IN+1:2*IN), and reciprocals of */
615 /* pivots in WORK(2*IN+1:3*IN) */
616 dpivot = d__[ibegin] - sigma;
618 dmax__ = abs(work[1]);
621 for (i__ = 1; i__ <= i__2; ++i__) {
622 work[(in << 1) + i__] = 1. / work[i__];
623 tmp = e[j] * work[(in << 1) + i__];
624 work[in + i__] = tmp;
625 dpivot = d__[j + 1] - sigma - tmp * e[j];
626 work[i__ + 1] = dpivot;
628 d__1 = dmax__, d__2 = abs(dpivot);
629 dmax__ = max(d__1,d__2);
633 /* check for element growth */
634 if (dmax__ > spdiam * 64.) {
639 if (usedqd && ! norep) {
640 /* Ensure the definiteness of the representation */
641 /* All entries of D (of L D L^T) must have the same sign */
643 for (i__ = 1; i__ <= i__2; ++i__) {
644 tmp = sgndef * work[i__];
652 /* Note that in the case of IRANGE=ALLRNG, we use the Gerschgorin */
653 /* shift which makes the matrix definite. So we should end up */
654 /* here really only in the case of IRANGE = VALRNG or INDRNG. */
657 /* The fudged Gerschgorin shift should succeed */
658 sigma = gl - spdiam * 2. * eps * *n - *pivmin * 4.;
660 sigma = gu + spdiam * 2. * eps * *n + *pivmin * 4.;
663 sigma -= sgndef * tau;
667 /* an initial RRR is found */
672 /* if the program reaches this point, no base representation could be */
673 /* found in MAXTRY iterations. */
677 /* At this point, we have found an initial base representation */
678 /* T - SIGMA I = L D L^T with not too much element growth. */
679 /* Store the shift. */
682 dcopy_(&in, &work[1], &c__1, &d__[ibegin], &c__1);
684 dcopy_(&i__2, &work[in + 1], &c__1, &e[ibegin], &c__1);
687 /* Perturb each entry of the base representation by a small */
688 /* (but random) relative amount to overcome difficulties with */
689 /* glued matrices. */
691 for (i__ = 1; i__ <= 4; ++i__) {
695 i__2 = (in << 1) - 1;
696 dlarnv_(&c__2, iseed, &i__2, &work[1]);
698 for (i__ = 1; i__ <= i__2; ++i__) {
699 d__[ibegin + i__ - 1] *= eps * 8. * work[i__] + 1.;
700 e[ibegin + i__ - 1] *= eps * 8. * work[in + i__] + 1.;
703 d__[iend] *= eps * 4. * work[in] + 1.;
707 /* Don't update the Gerschgorin intervals because keeping track */
708 /* of the updates would be too much work in DLARRV. */
709 /* We update W instead and use it to locate the proper Gerschgorin */
711 /* Compute the required eigenvalues of L D L' by bisection or dqds */
713 /* If DLARRD has been used, shift the eigenvalue approximations */
714 /* according to their representation. This is necessary for */
715 /* a uniform DLARRV since dqds computes eigenvalues of the */
716 /* shifted representation. In DLARRV, W will always hold the */
717 /* UNshifted eigenvalue approximation. */
719 for (j = wbegin; j <= i__2; ++j) {
721 werr[j] += (d__1 = w[j], abs(d__1)) * eps;
724 /* call DLARRB to reduce eigenvalue error of the approximations */
727 for (i__ = ibegin; i__ <= i__2; ++i__) {
728 /* Computing 2nd power */
730 work[i__] = d__[i__] * (d__1 * d__1);
733 /* use bisection to find EV from INDL to INDU */
735 dlarrb_(&in, &d__[ibegin], &work[ibegin], &indl, &indu, rtol1,
736 rtol2, &i__2, &w[wbegin], &wgap[wbegin], &werr[wbegin], &
737 work[(*n << 1) + 1], &iwork[1], pivmin, &spdiam, &in, &
743 /* DLARRB computes all gaps correctly except for the last one */
744 /* Record distance to VU/GU */
746 d__1 = 0., d__2 = *vu - sigma - (w[wend] + werr[wend]);
747 wgap[wend] = max(d__1,d__2);
749 for (i__ = indl; i__ <= i__2; ++i__) {
756 /* Call dqds to get all eigs (and then possibly delete unwanted */
758 /* Note that dqds finds the eigenvalues of the L D L^T representation */
759 /* of T to high relative accuracy. High relative accuracy */
760 /* might be lost when the shift of the RRR is subtracted to obtain */
761 /* the eigenvalues of T. However, T is not guaranteed to define its */
762 /* eigenvalues to high relative accuracy anyway. */
763 /* Set RTOL to the order of the tolerance used in DLASQ2 */
764 /* This is an ESTIMATED error, the worst case bound is 4*N*EPS */
765 /* which is usually too large and requires unnecessary work to be */
766 /* done by bisection when computing the eigenvectors */
767 rtol = log((doublereal) in) * 4. * eps;
770 for (i__ = 1; i__ <= i__2; ++i__) {
771 work[(i__ << 1) - 1] = (d__1 = d__[j], abs(d__1));
772 work[i__ * 2] = e[j] * e[j] * work[(i__ << 1) - 1];
776 work[(in << 1) - 1] = (d__1 = d__[iend], abs(d__1));
778 dlasq2_(&in, &work[1], &iinfo);
780 /* If IINFO = -5 then an index is part of a tight cluster */
781 /* and should be changed. The index is in IWORK(1) and the */
782 /* gap is in WORK(N+1) */
786 /* Test that all eigenvalues are positive as expected */
788 for (i__ = 1; i__ <= i__2; ++i__) {
789 if (work[i__] < 0.) {
798 for (i__ = indl; i__ <= i__2; ++i__) {
800 w[*m] = work[in - i__ + 1];
807 for (i__ = indl; i__ <= i__2; ++i__) {
816 for (i__ = *m - mb + 1; i__ <= i__2; ++i__) {
817 /* the value of RTOL below should be the tolerance in DLASQ2 */
818 werr[i__] = rtol * (d__1 = w[i__], abs(d__1));
822 for (i__ = *m - mb + 1; i__ <= i__2; ++i__) {
823 /* compute the right gap between the intervals */
825 d__1 = 0., d__2 = w[i__ + 1] - werr[i__ + 1] - (w[i__] + werr[
827 wgap[i__] = max(d__1,d__2);
831 d__1 = 0., d__2 = *vu - sigma - (w[*m] + werr[*m]);
832 wgap[*m] = max(d__1,d__2);
834 /* proceed with next block */