14 typedef long long BLASLONG;
15 typedef unsigned long long BLASULONG;
17 typedef long BLASLONG;
18 typedef unsigned long BLASULONG;
22 typedef BLASLONG blasint;
24 #define blasabs(x) llabs(x)
26 #define blasabs(x) labs(x)
30 #define blasabs(x) abs(x)
33 typedef blasint integer;
35 typedef unsigned int uinteger;
36 typedef char *address;
37 typedef short int shortint;
39 typedef double doublereal;
40 typedef struct { real r, i; } complex;
41 typedef struct { doublereal r, i; } doublecomplex;
43 static inline _Fcomplex Cf(complex *z) {_Fcomplex zz={z->r , z->i}; return zz;}
44 static inline _Dcomplex Cd(doublecomplex *z) {_Dcomplex zz={z->r , z->i};return zz;}
45 static inline _Fcomplex * _pCf(complex *z) {return (_Fcomplex*)z;}
46 static inline _Dcomplex * _pCd(doublecomplex *z) {return (_Dcomplex*)z;}
48 static inline _Complex float Cf(complex *z) {return z->r + z->i*_Complex_I;}
49 static inline _Complex double Cd(doublecomplex *z) {return z->r + z->i*_Complex_I;}
50 static inline _Complex float * _pCf(complex *z) {return (_Complex float*)z;}
51 static inline _Complex double * _pCd(doublecomplex *z) {return (_Complex double*)z;}
53 #define pCf(z) (*_pCf(z))
54 #define pCd(z) (*_pCd(z))
56 typedef short int shortlogical;
57 typedef char logical1;
58 typedef char integer1;
63 /* Extern is for use with -E */
74 /*external read, write*/
83 /*internal read, write*/
113 /*rewind, backspace, endfile*/
125 ftnint *inex; /*parameters in standard's order*/
151 union Multitype { /* for multiple entry points */
162 typedef union Multitype Multitype;
164 struct Vardesc { /* for Namelist */
170 typedef struct Vardesc Vardesc;
177 typedef struct Namelist Namelist;
179 #define abs(x) ((x) >= 0 ? (x) : -(x))
180 #define dabs(x) (fabs(x))
181 #define f2cmin(a,b) ((a) <= (b) ? (a) : (b))
182 #define f2cmax(a,b) ((a) >= (b) ? (a) : (b))
183 #define dmin(a,b) (f2cmin(a,b))
184 #define dmax(a,b) (f2cmax(a,b))
185 #define bit_test(a,b) ((a) >> (b) & 1)
186 #define bit_clear(a,b) ((a) & ~((uinteger)1 << (b)))
187 #define bit_set(a,b) ((a) | ((uinteger)1 << (b)))
189 #define abort_() { sig_die("Fortran abort routine called", 1); }
190 #define c_abs(z) (cabsf(Cf(z)))
191 #define c_cos(R,Z) { pCf(R)=ccos(Cf(Z)); }
193 #define c_div(c, a, b) {Cf(c)._Val[0] = (Cf(a)._Val[0]/Cf(b)._Val[0]); Cf(c)._Val[1]=(Cf(a)._Val[1]/Cf(b)._Val[1]);}
194 #define z_div(c, a, b) {Cd(c)._Val[0] = (Cd(a)._Val[0]/Cd(b)._Val[0]); Cd(c)._Val[1]=(Cd(a)._Val[1]/df(b)._Val[1]);}
196 #define c_div(c, a, b) {pCf(c) = Cf(a)/Cf(b);}
197 #define z_div(c, a, b) {pCd(c) = Cd(a)/Cd(b);}
199 #define c_exp(R, Z) {pCf(R) = cexpf(Cf(Z));}
200 #define c_log(R, Z) {pCf(R) = clogf(Cf(Z));}
201 #define c_sin(R, Z) {pCf(R) = csinf(Cf(Z));}
202 //#define c_sqrt(R, Z) {*(R) = csqrtf(Cf(Z));}
203 #define c_sqrt(R, Z) {pCf(R) = csqrtf(Cf(Z));}
204 #define d_abs(x) (fabs(*(x)))
205 #define d_acos(x) (acos(*(x)))
206 #define d_asin(x) (asin(*(x)))
207 #define d_atan(x) (atan(*(x)))
208 #define d_atn2(x, y) (atan2(*(x),*(y)))
209 #define d_cnjg(R, Z) { pCd(R) = conj(Cd(Z)); }
210 #define r_cnjg(R, Z) { pCf(R) = conjf(Cf(Z)); }
211 #define d_cos(x) (cos(*(x)))
212 #define d_cosh(x) (cosh(*(x)))
213 #define d_dim(__a, __b) ( *(__a) > *(__b) ? *(__a) - *(__b) : 0.0 )
214 #define d_exp(x) (exp(*(x)))
215 #define d_imag(z) (cimag(Cd(z)))
216 #define r_imag(z) (cimagf(Cf(z)))
217 #define d_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
218 #define r_int(__x) (*(__x)>0 ? floor(*(__x)) : -floor(- *(__x)))
219 #define d_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
220 #define r_lg10(x) ( 0.43429448190325182765 * log(*(x)) )
221 #define d_log(x) (log(*(x)))
222 #define d_mod(x, y) (fmod(*(x), *(y)))
223 #define u_nint(__x) ((__x)>=0 ? floor((__x) + .5) : -floor(.5 - (__x)))
224 #define d_nint(x) u_nint(*(x))
225 #define u_sign(__a,__b) ((__b) >= 0 ? ((__a) >= 0 ? (__a) : -(__a)) : -((__a) >= 0 ? (__a) : -(__a)))
226 #define d_sign(a,b) u_sign(*(a),*(b))
227 #define r_sign(a,b) u_sign(*(a),*(b))
228 #define d_sin(x) (sin(*(x)))
229 #define d_sinh(x) (sinh(*(x)))
230 #define d_sqrt(x) (sqrt(*(x)))
231 #define d_tan(x) (tan(*(x)))
232 #define d_tanh(x) (tanh(*(x)))
233 #define i_abs(x) abs(*(x))
234 #define i_dnnt(x) ((integer)u_nint(*(x)))
235 #define i_len(s, n) (n)
236 #define i_nint(x) ((integer)u_nint(*(x)))
237 #define i_sign(a,b) ((integer)u_sign((integer)*(a),(integer)*(b)))
238 #define pow_dd(ap, bp) ( pow(*(ap), *(bp)))
239 #define pow_si(B,E) spow_ui(*(B),*(E))
240 #define pow_ri(B,E) spow_ui(*(B),*(E))
241 #define pow_di(B,E) dpow_ui(*(B),*(E))
242 #define pow_zi(p, a, b) {pCd(p) = zpow_ui(Cd(a), *(b));}
243 #define pow_ci(p, a, b) {pCf(p) = cpow_ui(Cf(a), *(b));}
244 #define pow_zz(R,A,B) {pCd(R) = cpow(Cd(A),*(B));}
245 #define s_cat(lpp, rpp, rnp, np, llp) { ftnlen i, nc, ll; char *f__rp, *lp; ll = (llp); lp = (lpp); for(i=0; i < (int)*(np); ++i) { nc = ll; if((rnp)[i] < nc) nc = (rnp)[i]; ll -= nc; f__rp = (rpp)[i]; while(--nc >= 0) *lp++ = *(f__rp)++; } while(--ll >= 0) *lp++ = ' '; }
246 #define s_cmp(a,b,c,d) ((integer)strncmp((a),(b),f2cmin((c),(d))))
247 #define s_copy(A,B,C,D) { int __i,__m; for (__i=0, __m=f2cmin((C),(D)); __i<__m && (B)[__i] != 0; ++__i) (A)[__i] = (B)[__i]; }
248 #define sig_die(s, kill) { exit(1); }
249 #define s_stop(s, n) {exit(0);}
250 static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n";
251 #define z_abs(z) (cabs(Cd(z)))
252 #define z_exp(R, Z) {pCd(R) = cexp(Cd(Z));}
253 #define z_sqrt(R, Z) {pCd(R) = csqrt(Cd(Z));}
254 #define myexit_() break;
255 #define mycycle() continue;
256 #define myceiling(w) {ceil(w)}
257 #define myhuge(w) {HUGE_VAL}
258 //#define mymaxloc_(w,s,e,n) {if (sizeof(*(w)) == sizeof(double)) dmaxloc_((w),*(s),*(e),n); else dmaxloc_((w),*(s),*(e),n);}
259 #define mymaxloc(w,s,e,n) {dmaxloc_(w,*(s),*(e),n)}
261 /* procedure parameter types for -A and -C++ */
263 #define F2C_proc_par_types 1
265 typedef logical (*L_fp)(...);
267 typedef logical (*L_fp)();
270 static float spow_ui(float x, integer n) {
271 float pow=1.0; unsigned long int u;
273 if(n < 0) n = -n, x = 1/x;
282 static double dpow_ui(double x, integer n) {
283 double pow=1.0; unsigned long int u;
285 if(n < 0) n = -n, x = 1/x;
295 static _Fcomplex cpow_ui(complex x, integer n) {
296 complex pow={1.0,0.0}; unsigned long int u;
298 if(n < 0) n = -n, x.r = 1/x.r, x.i=1/x.i;
300 if(u & 01) pow.r *= x.r, pow.i *= x.i;
301 if(u >>= 1) x.r *= x.r, x.i *= x.i;
305 _Fcomplex p={pow.r, pow.i};
309 static _Complex float cpow_ui(_Complex float x, integer n) {
310 _Complex float pow=1.0; unsigned long int u;
312 if(n < 0) n = -n, x = 1/x;
323 static _Dcomplex zpow_ui(_Dcomplex x, integer n) {
324 _Dcomplex pow={1.0,0.0}; unsigned long int u;
326 if(n < 0) n = -n, x._Val[0] = 1/x._Val[0], x._Val[1] =1/x._Val[1];
328 if(u & 01) pow._Val[0] *= x._Val[0], pow._Val[1] *= x._Val[1];
329 if(u >>= 1) x._Val[0] *= x._Val[0], x._Val[1] *= x._Val[1];
333 _Dcomplex p = {pow._Val[0], pow._Val[1]};
337 static _Complex double zpow_ui(_Complex double x, integer n) {
338 _Complex double pow=1.0; unsigned long int u;
340 if(n < 0) n = -n, x = 1/x;
350 static integer pow_ii(integer x, integer n) {
351 integer pow; unsigned long int u;
353 if (n == 0 || x == 1) pow = 1;
354 else if (x != -1) pow = x == 0 ? 1/x : 0;
357 if ((n > 0) || !(n == 0 || x == 1 || x != -1)) {
367 static integer dmaxloc_(double *w, integer s, integer e, integer *n)
369 double m; integer i, mi;
370 for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
371 if (w[i-1]>m) mi=i ,m=w[i-1];
374 static integer smaxloc_(float *w, integer s, integer e, integer *n)
376 float m; integer i, mi;
377 for(m=w[s-1], mi=s, i=s+1; i<=e; i++)
378 if (w[i-1]>m) mi=i ,m=w[i-1];
381 static inline void cdotc_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
382 integer n = *n_, incx = *incx_, incy = *incy_, i;
384 _Fcomplex zdotc = {0.0, 0.0};
385 if (incx == 1 && incy == 1) {
386 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
387 zdotc._Val[0] += conjf(Cf(&x[i]))._Val[0] * Cf(&y[i])._Val[0];
388 zdotc._Val[1] += conjf(Cf(&x[i]))._Val[1] * Cf(&y[i])._Val[1];
391 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
392 zdotc._Val[0] += conjf(Cf(&x[i*incx]))._Val[0] * Cf(&y[i*incy])._Val[0];
393 zdotc._Val[1] += conjf(Cf(&x[i*incx]))._Val[1] * Cf(&y[i*incy])._Val[1];
399 _Complex float zdotc = 0.0;
400 if (incx == 1 && incy == 1) {
401 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
402 zdotc += conjf(Cf(&x[i])) * Cf(&y[i]);
405 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
406 zdotc += conjf(Cf(&x[i*incx])) * Cf(&y[i*incy]);
412 static inline void zdotc_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
413 integer n = *n_, incx = *incx_, incy = *incy_, i;
415 _Dcomplex zdotc = {0.0, 0.0};
416 if (incx == 1 && incy == 1) {
417 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
418 zdotc._Val[0] += conj(Cd(&x[i]))._Val[0] * Cd(&y[i])._Val[0];
419 zdotc._Val[1] += conj(Cd(&x[i]))._Val[1] * Cd(&y[i])._Val[1];
422 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
423 zdotc._Val[0] += conj(Cd(&x[i*incx]))._Val[0] * Cd(&y[i*incy])._Val[0];
424 zdotc._Val[1] += conj(Cd(&x[i*incx]))._Val[1] * Cd(&y[i*incy])._Val[1];
430 _Complex double zdotc = 0.0;
431 if (incx == 1 && incy == 1) {
432 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
433 zdotc += conj(Cd(&x[i])) * Cd(&y[i]);
436 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
437 zdotc += conj(Cd(&x[i*incx])) * Cd(&y[i*incy]);
443 static inline void cdotu_(complex *z, integer *n_, complex *x, integer *incx_, complex *y, integer *incy_) {
444 integer n = *n_, incx = *incx_, incy = *incy_, i;
446 _Fcomplex zdotc = {0.0, 0.0};
447 if (incx == 1 && incy == 1) {
448 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
449 zdotc._Val[0] += Cf(&x[i])._Val[0] * Cf(&y[i])._Val[0];
450 zdotc._Val[1] += Cf(&x[i])._Val[1] * Cf(&y[i])._Val[1];
453 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
454 zdotc._Val[0] += Cf(&x[i*incx])._Val[0] * Cf(&y[i*incy])._Val[0];
455 zdotc._Val[1] += Cf(&x[i*incx])._Val[1] * Cf(&y[i*incy])._Val[1];
461 _Complex float zdotc = 0.0;
462 if (incx == 1 && incy == 1) {
463 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
464 zdotc += Cf(&x[i]) * Cf(&y[i]);
467 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
468 zdotc += Cf(&x[i*incx]) * Cf(&y[i*incy]);
474 static inline void zdotu_(doublecomplex *z, integer *n_, doublecomplex *x, integer *incx_, doublecomplex *y, integer *incy_) {
475 integer n = *n_, incx = *incx_, incy = *incy_, i;
477 _Dcomplex zdotc = {0.0, 0.0};
478 if (incx == 1 && incy == 1) {
479 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
480 zdotc._Val[0] += Cd(&x[i])._Val[0] * Cd(&y[i])._Val[0];
481 zdotc._Val[1] += Cd(&x[i])._Val[1] * Cd(&y[i])._Val[1];
484 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
485 zdotc._Val[0] += Cd(&x[i*incx])._Val[0] * Cd(&y[i*incy])._Val[0];
486 zdotc._Val[1] += Cd(&x[i*incx])._Val[1] * Cd(&y[i*incy])._Val[1];
492 _Complex double zdotc = 0.0;
493 if (incx == 1 && incy == 1) {
494 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
495 zdotc += Cd(&x[i]) * Cd(&y[i]);
498 for (i=0;i<n;i++) { /* zdotc = zdotc + dconjg(x(i))* y(i) */
499 zdotc += Cd(&x[i*incx]) * Cd(&y[i*incy]);
505 /* -- translated by f2c (version 20000121).
506 You must link the resulting object file with the libraries:
507 -lf2c -lm (in that order)
513 /* Table of constant values */
515 static real c_b5 = 0.f;
516 static integer c__1 = 1;
517 static integer c__2 = 2;
519 /* > \brief \b SLARRV computes the eigenvectors of the tridiagonal matrix T = L D LT given L, D and the eigenv
522 /* =========== DOCUMENTATION =========== */
524 /* Online html documentation available at */
525 /* http://www.netlib.org/lapack/explore-html/ */
528 /* > Download SLARRV + dependencies */
529 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slarrv.
532 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slarrv.
535 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slarrv.
543 /* SUBROUTINE SLARRV( N, VL, VU, D, L, PIVMIN, */
544 /* ISPLIT, M, DOL, DOU, MINRGP, */
545 /* RTOL1, RTOL2, W, WERR, WGAP, */
546 /* IBLOCK, INDEXW, GERS, Z, LDZ, ISUPPZ, */
547 /* WORK, IWORK, INFO ) */
549 /* INTEGER DOL, DOU, INFO, LDZ, M, N */
550 /* REAL MINRGP, PIVMIN, RTOL1, RTOL2, VL, VU */
551 /* INTEGER IBLOCK( * ), INDEXW( * ), ISPLIT( * ), */
552 /* $ ISUPPZ( * ), IWORK( * ) */
553 /* REAL D( * ), GERS( * ), L( * ), W( * ), WERR( * ), */
554 /* $ WGAP( * ), WORK( * ) */
555 /* REAL Z( LDZ, * ) */
558 /* > \par Purpose: */
563 /* > SLARRV computes the eigenvectors of the tridiagonal matrix */
564 /* > T = L D L**T given L, D and APPROXIMATIONS to the eigenvalues of L D L**T. */
565 /* > The input eigenvalues should have been computed by SLARRE. */
574 /* > The order of the matrix. N >= 0. */
577 /* > \param[in] VL */
580 /* > Lower bound of the interval that contains the desired */
581 /* > eigenvalues. VL < VU. Needed to compute gaps on the left or right */
582 /* > end of the extremal eigenvalues in the desired RANGE. */
585 /* > \param[in] VU */
588 /* > Upper bound of the interval that contains the desired */
589 /* > eigenvalues. VL < VU. */
590 /* > Note: VU is currently not used by this implementation of SLARRV, VU is */
591 /* > passed to SLARRV because it could be used compute gaps on the right end */
592 /* > of the extremal eigenvalues. However, with not much initial accuracy in */
593 /* > LAMBDA and VU, the formula can lead to an overestimation of the right gap */
594 /* > and thus to inadequately early RQI 'convergence'. This is currently */
595 /* > prevented this by forcing a small right gap. And so it turns out that VU */
596 /* > is currently not used by this implementation of SLARRV. */
599 /* > \param[in,out] D */
601 /* > D is REAL array, dimension (N) */
602 /* > On entry, the N diagonal elements of the diagonal matrix D. */
603 /* > On exit, D may be overwritten. */
606 /* > \param[in,out] L */
608 /* > L is REAL array, dimension (N) */
609 /* > On entry, the (N-1) subdiagonal elements of the unit */
610 /* > bidiagonal matrix L are in elements 1 to N-1 of L */
611 /* > (if the matrix is not split.) At the end of each block */
612 /* > is stored the corresponding shift as given by SLARRE. */
613 /* > On exit, L is overwritten. */
616 /* > \param[in] PIVMIN */
618 /* > PIVMIN is REAL */
619 /* > The minimum pivot allowed in the Sturm sequence. */
622 /* > \param[in] ISPLIT */
624 /* > ISPLIT is INTEGER array, dimension (N) */
625 /* > The splitting points, at which T breaks up into blocks. */
626 /* > The first block consists of rows/columns 1 to */
627 /* > ISPLIT( 1 ), the second of rows/columns ISPLIT( 1 )+1 */
628 /* > through ISPLIT( 2 ), etc. */
634 /* > The total number of input eigenvalues. 0 <= M <= N. */
637 /* > \param[in] DOL */
639 /* > DOL is INTEGER */
642 /* > \param[in] DOU */
644 /* > DOU is INTEGER */
645 /* > If the user wants to compute only selected eigenvectors from all */
646 /* > the eigenvalues supplied, he can specify an index range DOL:DOU. */
647 /* > Or else the setting DOL=1, DOU=M should be applied. */
648 /* > Note that DOL and DOU refer to the order in which the eigenvalues */
649 /* > are stored in W. */
650 /* > If the user wants to compute only selected eigenpairs, then */
651 /* > the columns DOL-1 to DOU+1 of the eigenvector space Z contain the */
652 /* > computed eigenvectors. All other columns of Z are set to zero. */
655 /* > \param[in] MINRGP */
657 /* > MINRGP is REAL */
660 /* > \param[in] RTOL1 */
662 /* > RTOL1 is REAL */
665 /* > \param[in] RTOL2 */
667 /* > RTOL2 is REAL */
668 /* > Parameters for bisection. */
669 /* > An interval [LEFT,RIGHT] has converged if */
670 /* > RIGHT-LEFT < MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) ) */
673 /* > \param[in,out] W */
675 /* > W is REAL array, dimension (N) */
676 /* > The first M elements of W contain the APPROXIMATE eigenvalues for */
677 /* > which eigenvectors are to be computed. The eigenvalues */
678 /* > should be grouped by split-off block and ordered from */
679 /* > smallest to largest within the block ( The output array */
680 /* > W from SLARRE is expected here ). Furthermore, they are with */
681 /* > respect to the shift of the corresponding root representation */
682 /* > for their block. On exit, W holds the eigenvalues of the */
683 /* > UNshifted matrix. */
686 /* > \param[in,out] WERR */
688 /* > WERR is REAL array, dimension (N) */
689 /* > The first M elements contain the semiwidth of the uncertainty */
690 /* > interval of the corresponding eigenvalue in W */
693 /* > \param[in,out] WGAP */
695 /* > WGAP is REAL array, dimension (N) */
696 /* > The separation from the right neighbor eigenvalue in W. */
699 /* > \param[in] IBLOCK */
701 /* > IBLOCK is INTEGER array, dimension (N) */
702 /* > The indices of the blocks (submatrices) associated with the */
703 /* > corresponding eigenvalues in W; IBLOCK(i)=1 if eigenvalue */
704 /* > W(i) belongs to the first block from the top, =2 if W(i) */
705 /* > belongs to the second block, etc. */
708 /* > \param[in] INDEXW */
710 /* > INDEXW is INTEGER array, dimension (N) */
711 /* > The indices of the eigenvalues within each block (submatrix); */
712 /* > for example, INDEXW(i)= 10 and IBLOCK(i)=2 imply that the */
713 /* > i-th eigenvalue W(i) is the 10-th eigenvalue in the second block. */
716 /* > \param[in] GERS */
718 /* > GERS is REAL array, dimension (2*N) */
719 /* > The N Gerschgorin intervals (the i-th Gerschgorin interval */
720 /* > is (GERS(2*i-1), GERS(2*i)). The Gerschgorin intervals should */
721 /* > be computed from the original UNshifted matrix. */
724 /* > \param[out] Z */
726 /* > Z is REAL array, dimension (LDZ, f2cmax(1,M) ) */
727 /* > If INFO = 0, the first M columns of Z contain the */
728 /* > orthonormal eigenvectors of the matrix T */
729 /* > corresponding to the input eigenvalues, with the i-th */
730 /* > column of Z holding the eigenvector associated with W(i). */
731 /* > Note: the user must ensure that at least f2cmax(1,M) columns are */
732 /* > supplied in the array Z. */
735 /* > \param[in] LDZ */
737 /* > LDZ is INTEGER */
738 /* > The leading dimension of the array Z. LDZ >= 1, and if */
739 /* > JOBZ = 'V', LDZ >= f2cmax(1,N). */
742 /* > \param[out] ISUPPZ */
744 /* > ISUPPZ is INTEGER array, dimension ( 2*f2cmax(1,M) ) */
745 /* > The support of the eigenvectors in Z, i.e., the indices */
746 /* > indicating the nonzero elements in Z. The I-th eigenvector */
747 /* > is nonzero only in elements ISUPPZ( 2*I-1 ) through */
748 /* > ISUPPZ( 2*I ). */
751 /* > \param[out] WORK */
753 /* > WORK is REAL array, dimension (12*N) */
756 /* > \param[out] IWORK */
758 /* > IWORK is INTEGER array, dimension (7*N) */
761 /* > \param[out] INFO */
763 /* > INFO is INTEGER */
764 /* > = 0: successful exit */
766 /* > > 0: A problem occurred in SLARRV. */
767 /* > < 0: One of the called subroutines signaled an internal problem. */
768 /* > Needs inspection of the corresponding parameter IINFO */
769 /* > for further information. */
771 /* > =-1: Problem in SLARRB when refining a child's eigenvalues. */
772 /* > =-2: Problem in SLARRF when computing the RRR of a child. */
773 /* > When a child is inside a tight cluster, it can be difficult */
774 /* > to find an RRR. A partial remedy from the user's point of */
775 /* > view is to make the parameter MINRGP smaller and recompile. */
776 /* > However, as the orthogonality of the computed vectors is */
777 /* > proportional to 1/MINRGP, the user should be aware that */
778 /* > he might be trading in precision when he decreases MINRGP. */
779 /* > =-3: Problem in SLARRB when refining a single eigenvalue */
780 /* > after the Rayleigh correction was rejected. */
781 /* > = 5: The Rayleigh Quotient Iteration failed to converge to */
782 /* > full accuracy in MAXITR steps. */
788 /* > \author Univ. of Tennessee */
789 /* > \author Univ. of California Berkeley */
790 /* > \author Univ. of Colorado Denver */
791 /* > \author NAG Ltd. */
793 /* > \date June 2016 */
795 /* > \ingroup realOTHERauxiliary */
797 /* > \par Contributors: */
798 /* ================== */
800 /* > Beresford Parlett, University of California, Berkeley, USA \n */
801 /* > Jim Demmel, University of California, Berkeley, USA \n */
802 /* > Inderjit Dhillon, University of Texas, Austin, USA \n */
803 /* > Osni Marques, LBNL/NERSC, USA \n */
804 /* > Christof Voemel, University of California, Berkeley, USA */
806 /* ===================================================================== */
807 /* Subroutine */ int slarrv_(integer *n, real *vl, real *vu, real *d__, real *
808 l, real *pivmin, integer *isplit, integer *m, integer *dol, integer *
809 dou, real *minrgp, real *rtol1, real *rtol2, real *w, real *werr,
810 real *wgap, integer *iblock, integer *indexw, real *gers, real *z__,
811 integer *ldz, integer *isuppz, real *work, integer *iwork, integer *
814 /* System generated locals */
815 integer z_dim1, z_offset, i__1, i__2, i__3, i__4, i__5;
819 /* Local variables */
826 integer minwsize, itmp1, i__, j, k, p, q, indld;
830 integer iinfo, iindr;
832 extern /* Subroutine */ int sscal_(integer *, real *, real *, integer *);
835 integer nclus, zfrom;
836 extern /* Subroutine */ int scopy_(integer *, real *, integer *, real *,
839 integer iindc1, iindc2, miniwsize;
840 extern /* Subroutine */ int slar1v_(integer *, integer *, integer *, real
841 *, real *, real *, real *, real *, real *, real *, real *,
842 logical *, integer *, real *, real *, integer *, integer *, real *
843 , real *, real *, real *);
850 integer ibegin, indeig;
854 extern real slamch_(char *);
855 integer oldien, oldncl, wbegin, negcnt;
862 integer iindwk, offset;
864 extern /* Subroutine */ int slarrb_(integer *, real *, real *, integer *,
865 integer *, real *, real *, integer *, real *, real *, real *,
866 real *, integer *, real *, real *, integer *, integer *), slarrf_(
867 integer *, real *, real *, real *, integer *, integer *, real *,
868 real *, real *, real *, real *, real *, real *, real *, real *,
869 real *, real *, integer *);
870 integer newcls, oldfst, indwrk, windex, oldlst;
872 integer newfst, newftt, parity, windmn, isupmn, newlst, windpl, zusedl,
873 newsiz, zusedu, zusedw;
878 extern /* Subroutine */ int slaset_(char *, integer *, integer *, real *,
879 real *, real *, integer *);
880 real gap, eps, tau, tol, tmp;
885 /* -- LAPACK auxiliary routine (version 3.8.0) -- */
886 /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
887 /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
891 /* ===================================================================== */
893 /* Parameter adjustments */
904 z_offset = 1 + z_dim1 * 1;
913 /* Quick return if possible */
915 if (*n <= 0 || *m <= 0) {
919 /* The first N entries of WORK are reserved for the eigenvalues */
921 indlld = (*n << 1) + 1;
925 for (i__ = 1; i__ <= i__1; ++i__) {
929 /* IWORK(IINDR+1:IINDR+N) hold the twist indices R for the */
930 /* factorization used to compute the FP vector */
932 /* IWORK(IINDC1+1:IINC2+N) are used to store the clusters of the current */
933 /* layer and the one above. */
939 for (i__ = 1; i__ <= i__1; ++i__) {
945 /* Set lower bound for use of Z */
950 /* Set lower bound for use of Z */
953 /* The width of the part of Z that is used */
954 zusedw = zusedu - zusedl + 1;
955 slaset_("Full", n, &zusedw, &c_b5, &c_b5, &z__[zusedl * z_dim1 + 1], ldz);
956 eps = slamch_("Precision");
959 /* Set expert flags for standard code. */
961 if (*dol == 1 && *dou == *m) {
963 /* Only selected eigenpairs are computed. Since the other evalues */
964 /* are not refined by RQ iteration, bisection has to compute to full */
969 /* The entries WBEGIN:WEND in W, WERR, WGAP correspond to the */
970 /* desired eigenvalues. The support of the nonzero eigenvector */
971 /* entries is contained in the interval IBEGIN:IEND. */
972 /* Remark that if k eigenpairs are desired, then the eigenvectors */
973 /* are stored in k contiguous columns of Z. */
974 /* DONE is the number of eigenvectors already computed */
979 for (jblk = 1; jblk <= i__1; ++jblk) {
982 /* Find the eigenvectors of the submatrix indexed IBEGIN */
987 if (iblock[wend + 1] == jblk) {
995 } else if (wend < *dol || wbegin > *dou) {
1000 /* Find local spectral diameter of the block */
1001 gl = gers[(ibegin << 1) - 1];
1002 gu = gers[ibegin * 2];
1004 for (i__ = ibegin + 1; i__ <= i__2; ++i__) {
1006 r__1 = gers[(i__ << 1) - 1];
1007 gl = f2cmin(r__1,gl);
1009 r__1 = gers[i__ * 2];
1010 gu = f2cmax(r__1,gu);
1014 /* OLDIEN is the last index of the previous block */
1015 oldien = ibegin - 1;
1016 /* Calculate the size of the current block */
1017 in = iend - ibegin + 1;
1018 /* The number of eigenvalues in the current block */
1019 im = wend - wbegin + 1;
1020 /* This is for a 1x1 block */
1021 if (ibegin == iend) {
1023 z__[ibegin + wbegin * z_dim1] = 1.f;
1024 isuppz[(wbegin << 1) - 1] = ibegin;
1025 isuppz[wbegin * 2] = ibegin;
1027 work[wbegin] = w[wbegin];
1032 /* The desired (shifted) eigenvalues are stored in W(WBEGIN:WEND) */
1033 /* Note that these can be approximations, in this case, the corresp. */
1034 /* entries of WERR give the size of the uncertainty interval. */
1035 /* The eigenvalue approximations will be refined when necessary as */
1036 /* high relative accuracy is required for the computation of the */
1037 /* corresponding eigenvectors. */
1038 scopy_(&im, &w[wbegin], &c__1, &work[wbegin], &c__1);
1039 /* We store in W the eigenvalue approximations w.r.t. the original */
1042 for (i__ = 1; i__ <= i__2; ++i__) {
1043 w[wbegin + i__ - 1] += sigma;
1046 /* NDEPTH is the current depth of the representation tree */
1048 /* PARITY is either 1 or 0 */
1050 /* NCLUS is the number of clusters for the next level of the */
1051 /* representation tree, we start with NCLUS = 1 for the root */
1053 iwork[iindc1 + 1] = 1;
1054 iwork[iindc1 + 2] = im;
1055 /* IDONE is the number of eigenvectors already computed in the current */
1058 /* loop while( IDONE.LT.IM ) */
1059 /* generate the representation tree for the current block and */
1060 /* compute the eigenvectors */
1063 /* This is a crude protection against infinitely deep trees */
1068 /* breadth first processing of the current level of the representation */
1069 /* tree: OLDNCL = number of clusters on current level */
1071 /* reset NCLUS to count the number of child clusters */
1074 parity = 1 - parity;
1082 /* Process the clusters on the current level */
1084 for (i__ = 1; i__ <= i__2; ++i__) {
1085 j = oldcls + (i__ << 1);
1086 /* OLDFST, OLDLST = first, last index of current cluster. */
1087 /* cluster indices start with 1 and are relative */
1088 /* to WBEGIN when accessing W, WGAP, WERR, Z */
1089 oldfst = iwork[j - 1];
1092 /* Retrieve relatively robust representation (RRR) of cluster */
1093 /* that has been computed at the previous level */
1094 /* The RRR is stored in Z and overwritten once the eigenvectors */
1095 /* have been computed or when the cluster is refined */
1096 if (*dol == 1 && *dou == *m) {
1097 /* Get representation from location of the leftmost evalue */
1098 /* of the cluster */
1099 j = wbegin + oldfst - 1;
1101 if (wbegin + oldfst - 1 < *dol) {
1102 /* Get representation from the left end of Z array */
1104 } else if (wbegin + oldfst - 1 > *dou) {
1105 /* Get representation from the right end of Z array */
1108 j = wbegin + oldfst - 1;
1111 scopy_(&in, &z__[ibegin + j * z_dim1], &c__1, &d__[ibegin]
1114 scopy_(&i__3, &z__[ibegin + (j + 1) * z_dim1], &c__1, &l[
1116 sigma = z__[iend + (j + 1) * z_dim1];
1117 /* Set the corresponding entries in Z to zero */
1118 slaset_("Full", &in, &c__2, &c_b5, &c_b5, &z__[ibegin + j
1121 /* Compute DL and DLL of current RRR */
1123 for (j = ibegin; j <= i__3; ++j) {
1124 tmp = d__[j] * l[j];
1125 work[indld - 1 + j] = tmp;
1126 work[indlld - 1 + j] = tmp * l[j];
1130 /* P and Q are index of the first and last eigenvalue to compute */
1131 /* within the current block */
1132 p = indexw[wbegin - 1 + oldfst];
1133 q = indexw[wbegin - 1 + oldlst];
1134 /* Offset for the arrays WORK, WGAP and WERR, i.e., the P-OFFSET */
1135 /* through the Q-OFFSET elements of these arrays are to be used. */
1136 /* OFFSET = P-OLDFST */
1137 offset = indexw[wbegin] - 1;
1138 /* perform limited bisection (if necessary) to get approximate */
1139 /* eigenvalues to the precision needed. */
1140 slarrb_(&in, &d__[ibegin], &work[indlld + ibegin - 1], &p,
1141 &q, rtol1, rtol2, &offset, &work[wbegin], &wgap[
1142 wbegin], &werr[wbegin], &work[indwrk], &iwork[
1143 iindwk], pivmin, &spdiam, &in, &iinfo);
1148 /* We also recompute the extremal gaps. W holds all eigenvalues */
1149 /* of the unshifted matrix and must be used for computation */
1150 /* of WGAP, the entries of WORK might stem from RRRs with */
1151 /* different shifts. The gaps from WBEGIN-1+OLDFST to */
1152 /* WBEGIN-1+OLDLST are correctly computed in SLARRB. */
1153 /* However, we only allow the gaps to become greater since */
1154 /* this is what should happen when we decrease WERR */
1157 r__1 = wgap[wbegin + oldfst - 2], r__2 = w[wbegin +
1158 oldfst - 1] - werr[wbegin + oldfst - 1] - w[
1159 wbegin + oldfst - 2] - werr[wbegin + oldfst -
1161 wgap[wbegin + oldfst - 2] = f2cmax(r__1,r__2);
1163 if (wbegin + oldlst - 1 < wend) {
1165 r__1 = wgap[wbegin + oldlst - 1], r__2 = w[wbegin +
1166 oldlst] - werr[wbegin + oldlst] - w[wbegin +
1167 oldlst - 1] - werr[wbegin + oldlst - 1];
1168 wgap[wbegin + oldlst - 1] = f2cmax(r__1,r__2);
1170 /* Each time the eigenvalues in WORK get refined, we store */
1171 /* the newly found approximation with all shifts applied in W */
1173 for (j = oldfst; j <= i__3; ++j) {
1174 w[wbegin + j - 1] = work[wbegin + j - 1] + sigma;
1178 /* Process the current node. */
1181 for (j = oldfst; j <= i__3; ++j) {
1183 /* we are at the right end of the cluster, this is also the */
1184 /* boundary of the child cluster */
1186 } else if (wgap[wbegin + j - 1] >= *minrgp * (r__1 = work[
1187 wbegin + j - 1], abs(r__1))) {
1188 /* the right relative gap is big enough, the child cluster */
1189 /* (NEWFST,..,NEWLST) is well separated from the following */
1192 /* inside a child cluster, the relative gap is not */
1196 /* Compute size of child cluster found */
1197 newsiz = newlst - newfst + 1;
1198 /* NEWFTT is the place in Z where the new RRR or the computed */
1199 /* eigenvector is to be stored */
1200 if (*dol == 1 && *dou == *m) {
1201 /* Store representation at location of the leftmost evalue */
1202 /* of the cluster */
1203 newftt = wbegin + newfst - 1;
1205 if (wbegin + newfst - 1 < *dol) {
1206 /* Store representation at the left end of Z array */
1208 } else if (wbegin + newfst - 1 > *dou) {
1209 /* Store representation at the right end of Z array */
1212 newftt = wbegin + newfst - 1;
1217 /* Current child is not a singleton but a cluster. */
1218 /* Compute and store new representation of child. */
1221 /* Compute left and right cluster gap. */
1223 /* LGAP and RGAP are not computed from WORK because */
1224 /* the eigenvalue approximations may stem from RRRs */
1225 /* different shifts. However, W hold all eigenvalues */
1226 /* of the unshifted matrix. Still, the entries in WGAP */
1227 /* have to be computed from WORK since the entries */
1228 /* in W might be of the same order so that gaps are not */
1229 /* exhibited correctly for very close eigenvalues. */
1232 r__1 = 0.f, r__2 = w[wbegin] - werr[wbegin] - *vl;
1233 lgap = f2cmax(r__1,r__2);
1235 lgap = wgap[wbegin + newfst - 2];
1237 rgap = wgap[wbegin + newlst - 1];
1239 /* Compute left- and rightmost eigenvalue of child */
1240 /* to high precision in order to shift as close */
1241 /* as possible and obtain as large relative gaps */
1244 for (k = 1; k <= 2; ++k) {
1246 p = indexw[wbegin - 1 + newfst];
1248 p = indexw[wbegin - 1 + newlst];
1250 offset = indexw[wbegin] - 1;
1251 slarrb_(&in, &d__[ibegin], &work[indlld + ibegin
1252 - 1], &p, &p, &rqtol, &rqtol, &offset, &
1253 work[wbegin], &wgap[wbegin], &werr[wbegin]
1254 , &work[indwrk], &iwork[iindwk], pivmin, &
1255 spdiam, &in, &iinfo);
1259 if (wbegin + newlst - 1 < *dol || wbegin + newfst - 1
1261 /* if the cluster contains no desired eigenvalues */
1262 /* skip the computation of that branch of the rep. tree */
1264 /* We could skip before the refinement of the extremal */
1265 /* eigenvalues of the child, but then the representation */
1266 /* tree could be different from the one when nothing is */
1267 /* skipped. For this reason we skip at this place. */
1268 idone = idone + newlst - newfst + 1;
1272 /* Compute RRR of child cluster. */
1273 /* Note that the new RRR is stored in Z */
1275 /* SLARRF needs LWORK = 2*N */
1276 slarrf_(&in, &d__[ibegin], &l[ibegin], &work[indld +
1277 ibegin - 1], &newfst, &newlst, &work[wbegin],
1278 &wgap[wbegin], &werr[wbegin], &spdiam, &lgap,
1279 &rgap, pivmin, &tau, &z__[ibegin + newftt *
1280 z_dim1], &z__[ibegin + (newftt + 1) * z_dim1],
1281 &work[indwrk], &iinfo);
1283 /* a new RRR for the cluster was found by SLARRF */
1284 /* update shift and store it */
1285 ssigma = sigma + tau;
1286 z__[iend + (newftt + 1) * z_dim1] = ssigma;
1287 /* WORK() are the midpoints and WERR() the semi-width */
1288 /* Note that the entries in W are unchanged. */
1290 for (k = newfst; k <= i__4; ++k) {
1291 fudge = eps * 3.f * (r__1 = work[wbegin + k -
1293 work[wbegin + k - 1] -= tau;
1294 fudge += eps * 4.f * (r__1 = work[wbegin + k
1297 werr[wbegin + k - 1] += fudge;
1298 /* Gaps are not fudged. Provided that WERR is small */
1299 /* when eigenvalues are close, a zero gap indicates */
1300 /* that a new representation is needed for resolving */
1301 /* the cluster. A fudge could lead to a wrong decision */
1302 /* of judging eigenvalues 'separated' which in */
1303 /* reality are not. This could have a negative impact */
1304 /* on the orthogonality of the computed eigenvectors. */
1308 k = newcls + (nclus << 1);
1309 iwork[k - 1] = newfst;
1317 /* Compute eigenvector of singleton */
1321 tol = log((real) in) * 4.f * eps;
1324 windex = wbegin + k - 1;
1327 windmn = f2cmax(i__4,1);
1330 windpl = f2cmin(i__4,*m);
1331 lambda = work[windex];
1333 /* Check if eigenvector computation is to be skipped */
1334 if (windex < *dol || windex > *dou) {
1340 left = work[windex] - werr[windex];
1341 right = work[windex] + werr[windex];
1342 indeig = indexw[windex];
1343 /* Note that since we compute the eigenpairs for a child, */
1344 /* all eigenvalue approximations are w.r.t the same shift. */
1345 /* In this case, the entries in WORK should be used for */
1346 /* computing the gaps since they exhibit even very small */
1347 /* differences in the eigenvalues, as opposed to the */
1348 /* entries in W which might "look" the same. */
1350 /* In the case RANGE='I' and with not much initial */
1351 /* accuracy in LAMBDA and VL, the formula */
1352 /* LGAP = MAX( ZERO, (SIGMA - VL) + LAMBDA ) */
1353 /* can lead to an overestimation of the left gap and */
1354 /* thus to inadequately early RQI 'convergence'. */
1355 /* Prevent this by forcing a small left gap. */
1357 r__1 = abs(left), r__2 = abs(right);
1358 lgap = eps * f2cmax(r__1,r__2);
1360 lgap = wgap[windmn];
1363 /* In the case RANGE='I' and with not much initial */
1364 /* accuracy in LAMBDA and VU, the formula */
1365 /* can lead to an overestimation of the right gap and */
1366 /* thus to inadequately early RQI 'convergence'. */
1367 /* Prevent this by forcing a small right gap. */
1369 r__1 = abs(left), r__2 = abs(right);
1370 rgap = eps * f2cmax(r__1,r__2);
1372 rgap = wgap[windex];
1374 gap = f2cmin(lgap,rgap);
1375 if (k == 1 || k == im) {
1376 /* The eigenvector support can become wrong */
1377 /* because significant entries could be cut off due to a */
1378 /* large GAPTOL parameter in LAR1V. Prevent this. */
1385 /* Update WGAP so that it holds the minimum gap */
1386 /* to the left or the right. This is crucial in the */
1387 /* case where bisection is used to ensure that the */
1388 /* eigenvalue is refined up to the required precision. */
1389 /* The correct value is restored afterwards. */
1390 savgap = wgap[windex];
1392 /* We want to use the Rayleigh Quotient Correction */
1393 /* as often as possible since it converges quadratically */
1394 /* when we are close enough to the desired eigenvalue. */
1395 /* However, the Rayleigh Quotient can have the wrong sign */
1396 /* and lead us away from the desired eigenvalue. In this */
1397 /* case, the best we can do is to use bisection. */
1400 /* Bisection is initially turned off unless it is forced */
1403 /* Check if bisection should be used to refine eigenvalue */
1405 /* Take the bisection as new iterate */
1407 itmp1 = iwork[iindr + windex];
1408 offset = indexw[wbegin] - 1;
1410 slarrb_(&in, &d__[ibegin], &work[indlld + ibegin
1411 - 1], &indeig, &indeig, &c_b5, &r__1, &
1412 offset, &work[wbegin], &wgap[wbegin], &
1413 werr[wbegin], &work[indwrk], &iwork[
1414 iindwk], pivmin, &spdiam, &itmp1, &iinfo);
1419 lambda = work[windex];
1420 /* Reset twist index from inaccurate LAMBDA to */
1421 /* force computation of true MINGMA */
1422 iwork[iindr + windex] = 0;
1424 /* Given LAMBDA, compute the eigenvector. */
1426 slar1v_(&in, &c__1, &in, &lambda, &d__[ibegin], &l[
1427 ibegin], &work[indld + ibegin - 1], &work[
1428 indlld + ibegin - 1], pivmin, &gaptol, &z__[
1429 ibegin + windex * z_dim1], &L__1, &negcnt, &
1430 ztz, &mingma, &iwork[iindr + windex], &isuppz[
1431 (windex << 1) - 1], &nrminv, &resid, &rqcorr,
1436 } else if (resid < bstres) {
1441 i__4 = isupmn, i__5 = isuppz[(windex << 1) - 1];
1442 isupmn = f2cmin(i__4,i__5);
1444 i__4 = isupmx, i__5 = isuppz[windex * 2];
1445 isupmx = f2cmax(i__4,i__5);
1447 /* sin alpha <= |resid|/gap */
1448 /* Note that both the residual and the gap are */
1449 /* proportional to the matrix, so ||T|| doesn't play */
1450 /* a role in the quotient */
1452 /* Convergence test for Rayleigh-Quotient iteration */
1453 /* (omitted when Bisection has been used) */
1455 if (resid > tol * gap && abs(rqcorr) > rqtol * abs(
1456 lambda) && ! usedbs) {
1457 /* We need to check that the RQCORR update doesn't */
1458 /* move the eigenvalue away from the desired one and */
1459 /* towards a neighbor. -> protection with bisection */
1460 if (indeig <= negcnt) {
1461 /* The wanted eigenvalue lies to the left */
1464 /* The wanted eigenvalue lies to the right */
1467 /* We only use the RQCORR if it improves the */
1468 /* the iterate reasonably. */
1469 if (rqcorr * sgndef >= 0.f && lambda + rqcorr <=
1470 right && lambda + rqcorr >= left) {
1472 /* Store new midpoint of bisection interval in WORK */
1473 if (sgndef == 1.f) {
1474 /* The current LAMBDA is on the left of the true */
1477 /* We prefer to assume that the error estimate */
1478 /* is correct. We could make the interval not */
1479 /* as a bracket but to be modified if the RQCORR */
1480 /* chooses to. In this case, the RIGHT side should */
1481 /* be modified as follows: */
1482 /* RIGHT = MAX(RIGHT, LAMBDA + RQCORR) */
1484 /* The current LAMBDA is on the right of the true */
1487 /* See comment about assuming the error estimate is */
1488 /* correct above. */
1489 /* LEFT = MIN(LEFT, LAMBDA + RQCORR) */
1491 work[windex] = (right + left) * .5f;
1492 /* Take RQCORR since it has the correct sign and */
1493 /* improves the iterate reasonably */
1495 /* Update width of error interval */
1496 werr[windex] = (right - left) * .5f;
1500 if (right - left < rqtol * abs(lambda)) {
1501 /* The eigenvalue is computed to bisection accuracy */
1502 /* compute eigenvector and stop */
1505 } else if (iter < 10) {
1507 } else if (iter == 10) {
1516 if (usedrq && usedbs && bstres <= resid) {
1521 /* improve error angle by second step */
1523 slar1v_(&in, &c__1, &in, &lambda, &d__[ibegin]
1524 , &l[ibegin], &work[indld + ibegin -
1525 1], &work[indlld + ibegin - 1],
1526 pivmin, &gaptol, &z__[ibegin + windex
1527 * z_dim1], &L__1, &negcnt, &ztz, &
1528 mingma, &iwork[iindr + windex], &
1529 isuppz[(windex << 1) - 1], &nrminv, &
1530 resid, &rqcorr, &work[indwrk]);
1532 work[windex] = lambda;
1535 /* Compute FP-vector support w.r.t. whole matrix */
1537 isuppz[(windex << 1) - 1] += oldien;
1538 isuppz[windex * 2] += oldien;
1539 zfrom = isuppz[(windex << 1) - 1];
1540 zto = isuppz[windex * 2];
1543 /* Ensure vector is ok if support in the RQI has changed */
1544 if (isupmn < zfrom) {
1546 for (ii = isupmn; ii <= i__4; ++ii) {
1547 z__[ii + windex * z_dim1] = 0.f;
1553 for (ii = zto + 1; ii <= i__4; ++ii) {
1554 z__[ii + windex * z_dim1] = 0.f;
1558 i__4 = zto - zfrom + 1;
1559 sscal_(&i__4, &nrminv, &z__[zfrom + windex * z_dim1],
1563 w[windex] = lambda + sigma;
1564 /* Recompute the gaps on the left and right */
1565 /* But only allow them to become larger and not */
1566 /* smaller (which can only happen through "bad" */
1567 /* cancellation and doesn't reflect the theory */
1568 /* where the initial gaps are underestimated due */
1569 /* to WERR being too crude.) */
1573 r__1 = wgap[windmn], r__2 = w[windex] - werr[
1574 windex] - w[windmn] - werr[windmn];
1575 wgap[windmn] = f2cmax(r__1,r__2);
1577 if (windex < wend) {
1579 r__1 = savgap, r__2 = w[windpl] - werr[windpl]
1580 - w[windex] - werr[windex];
1581 wgap[windex] = f2cmax(r__1,r__2);
1586 /* here ends the code for the current child */
1589 /* Proceed to any remaining child nodes */