3 /* Subroutine */ int slarrr_(integer *n, real *d__, real *e, integer *info)
5 /* System generated locals */
9 /* Builtin functions */
10 double sqrt(doublereal);
14 real eps, tmp, tmp2, rmin, offdig;
15 extern doublereal slamch_(char *);
21 /* -- LAPACK auxiliary routine (version 3.1) -- */
22 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
25 /* .. Scalar Arguments .. */
27 /* .. Array Arguments .. */
34 /* Perform tests to decide whether the symmetric tridiagonal matrix T */
35 /* warrants expensive computations which guarantee high relative accuracy */
36 /* in the eigenvalues. */
41 /* N (input) INTEGER */
42 /* The order of the matrix. N > 0. */
44 /* D (input) REAL array, dimension (N) */
45 /* The N diagonal elements of the tridiagonal matrix T. */
47 /* E (input/output) REAL array, dimension (N) */
48 /* On entry, the first (N-1) entries contain the subdiagonal */
49 /* elements of the tridiagonal matrix T; E(N) is set to ZERO. */
51 /* INFO (output) INTEGER */
52 /* INFO = 0(default) : the matrix warrants computations preserving */
53 /* relative accuracy. */
54 /* INFO = 1 : the matrix warrants computations guaranteeing */
55 /* only absolute accuracy. */
60 /* Based on contributions by */
61 /* Beresford Parlett, University of California, Berkeley, USA */
62 /* Jim Demmel, University of California, Berkeley, USA */
63 /* Inderjit Dhillon, University of Texas, Austin, USA */
64 /* Osni Marques, LBNL/NERSC, USA */
65 /* Christof Voemel, University of California, Berkeley, USA */
67 /* ===================================================================== */
69 /* .. Parameters .. */
71 /* .. Local Scalars .. */
73 /* .. External Functions .. */
75 /* .. Intrinsic Functions .. */
77 /* .. Executable Statements .. */
79 /* As a default, do NOT go for relative-accuracy preserving computations. */
80 /* Parameter adjustments */
86 safmin = slamch_("Safe minimum");
87 eps = slamch_("Precision");
88 smlnum = safmin / eps;
90 /* Tests for relative accuracy */
92 /* Test for scaled diagonal dominance */
93 /* Scale the diagonal entries to one and check whether the sum of the */
94 /* off-diagonals is less than one */
96 /* The sdd relative error bounds have a 1/(1- 2*x) factor in them, */
97 /* x = max(OFFDIG + OFFDIG2), so when x is close to 1/2, no relative */
98 /* accuracy is promised. In the notation of the code fragment below, */
99 /* 1/(1 - (OFFDIG + OFFDIG2)) is the condition number. */
100 /* We don't think it is worth going into "sdd mode" unless the relative */
101 /* condition number is reasonable, not 1/macheps. */
102 /* The threshold should be compatible with other thresholds used in the */
103 /* code. We set OFFDIG + OFFDIG2 <= .999 =: RELCOND, it corresponds */
104 /* to losing at most 3 decimal digits: 1 / (1 - (OFFDIG + OFFDIG2)) <= 1000 */
105 /* instead of the current OFFDIG + OFFDIG2 < 1 */
109 tmp = sqrt((dabs(d__[1])));
117 for (i__ = 2; i__ <= i__1; ++i__) {
118 tmp2 = sqrt((r__1 = d__[i__], dabs(r__1)));
125 offdig2 = (r__1 = e[i__ - 1], dabs(r__1)) / (tmp * tmp2);
126 if (offdig + offdig2 >= .999f) {
144 /* *** MORE TO BE IMPLEMENTED *** */
147 /* Test if the lower bidiagonal matrix L from T = L D L^T */
148 /* (zero shift facto) is well conditioned */
151 /* Test if the upper bidiagonal matrix U from T = U D U^T */
152 /* (zero shift facto) is well conditioned. */
153 /* In this case, the matrix needs to be flipped and, at the end */
154 /* of the eigenvector computation, the flip needs to be applied */
155 /* to the computed eigenvectors (and the support) */