1 /* ../netlib/slarrc.f -- translated by f2c (version 20100827). You must link the resulting object file with libf2c: on Microsoft Windows system, link with libf2c.lib;
2  on Linux or Unix systems, link with .../path/to/libf2c.a -lm or, if you install libf2c.a in a standard place, with -lf2c -lm -- in that order, at the end of the command line, as in cc *.o -lf2c -lm Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., http://www.netlib.org/f2c/libf2c.zip */
3 #include "FLA_f2c.h" /* > \brief \b SLARRC computes the number of eigenvalues of the symmetric tridiagonal matrix. */
4 /* =========== DOCUMENTATION =========== */
5 /* Online html documentation available at */
6 /* http://www.netlib.org/lapack/explore-html/ */
7 /* > \htmlonly */
8 /* > Download SLARRC + dependencies */
9 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slarrc. f"> */
10 /* > [TGZ]</a> */
11 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slarrc. f"> */
12 /* > [ZIP]</a> */
13 /* > <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slarrc. f"> */
14 /* > [TXT]</a> */
15 /* > \endhtmlonly */
16 /* Definition: */
17 /* =========== */
18 /* SUBROUTINE SLARRC( JOBT, N, VL, VU, D, E, PIVMIN, */
19 /* EIGCNT, LCNT, RCNT, INFO ) */
20 /* .. Scalar Arguments .. */
21 /* CHARACTER JOBT */
22 /* INTEGER EIGCNT, INFO, LCNT, N, RCNT */
23 /* REAL PIVMIN, VL, VU */
24 /* .. */
25 /* .. Array Arguments .. */
26 /* REAL D( * ), E( * ) */
27 /* .. */
28 /* > \par Purpose: */
29 /* ============= */
30 /* > */
31 /* > \verbatim */
32 /* > */
33 /* > Find the number of eigenvalues of the symmetric tridiagonal matrix T */
34 /* > that are in the interval (VL,VU] if JOBT = 'T', and of L D L^T */
35 /* > if JOBT = 'L'. */
36 /* > \endverbatim */
37 /* Arguments: */
38 /* ========== */
39 /* > \param[in] JOBT */
40 /* > \verbatim */
41 /* > JOBT is CHARACTER*1 */
42 /* > = 'T': Compute Sturm count for matrix T. */
43 /* > = 'L': Compute Sturm count for matrix L D L^T. */
44 /* > \endverbatim */
45 /* > */
46 /* > \param[in] N */
47 /* > \verbatim */
48 /* > N is INTEGER */
49 /* > The order of the matrix. N > 0. */
50 /* > \endverbatim */
51 /* > */
52 /* > \param[in] VL */
53 /* > \verbatim */
54 /* > VL is DOUBLE PRECISION */
55 /* > \endverbatim */
56 /* > */
57 /* > \param[in] VU */
58 /* > \verbatim */
59 /* > VU is DOUBLE PRECISION */
60 /* > The lower and upper bounds for the eigenvalues. */
61 /* > \endverbatim */
62 /* > */
63 /* > \param[in] D */
64 /* > \verbatim */
65 /* > D is DOUBLE PRECISION array, dimension (N) */
66 /* > JOBT = 'T': The N diagonal elements of the tridiagonal matrix T. */
67 /* > JOBT = 'L': The N diagonal elements of the diagonal matrix D. */
68 /* > \endverbatim */
69 /* > */
70 /* > \param[in] E */
71 /* > \verbatim */
72 /* > E is DOUBLE PRECISION array, dimension (N) */
73 /* > JOBT = 'T': The N-1 offdiagonal elements of the matrix T. */
74 /* > JOBT = 'L': The N-1 offdiagonal elements of the matrix L. */
75 /* > \endverbatim */
76 /* > */
77 /* > \param[in] PIVMIN */
78 /* > \verbatim */
79 /* > PIVMIN is REAL */
80 /* > The minimum pivot in the Sturm sequence for T. */
81 /* > \endverbatim */
82 /* > */
83 /* > \param[out] EIGCNT */
84 /* > \verbatim */
85 /* > EIGCNT is INTEGER */
86 /* > The number of eigenvalues of the symmetric tridiagonal matrix T */
87 /* > that are in the interval (VL,VU] */
88 /* > \endverbatim */
89 /* > */
90 /* > \param[out] LCNT */
91 /* > \verbatim */
92 /* > LCNT is INTEGER */
93 /* > \endverbatim */
94 /* > */
95 /* > \param[out] RCNT */
96 /* > \verbatim */
97 /* > RCNT is INTEGER */
98 /* > The left and right negcounts of the interval. */
99 /* > \endverbatim */
100 /* > */
101 /* > \param[out] INFO */
102 /* > \verbatim */
103 /* > INFO is INTEGER */
104 /* > \endverbatim */
105 /* Authors: */
106 /* ======== */
107 /* > \author Univ. of Tennessee */
108 /* > \author Univ. of California Berkeley */
109 /* > \author Univ. of Colorado Denver */
110 /* > \author NAG Ltd. */
111 /* > \date September 2012 */
112 /* > \ingroup auxOTHERauxiliary */
113 /* > \par Contributors: */
114 /* ================== */
115 /* > */
116 /* > Beresford Parlett, University of California, Berkeley, USA \n */
117 /* > Jim Demmel, University of California, Berkeley, USA \n */
118 /* > Inderjit Dhillon, University of Texas, Austin, USA \n */
119 /* > Osni Marques, LBNL/NERSC, USA \n */
120 /* > Christof Voemel, University of California, Berkeley, USA */
121 /* ===================================================================== */
122 /* Subroutine */
slarrc_(char * jobt,integer * n,real * vl,real * vu,real * d__,real * e,real * pivmin,integer * eigcnt,integer * lcnt,integer * rcnt,integer * info)123 int slarrc_(char *jobt, integer *n, real *vl, real *vu, real *d__, real *e, real *pivmin, integer *eigcnt, integer *lcnt, integer * rcnt, integer *info)
124 {
125     /* System generated locals */
126     integer i__1;
127     real r__1;
128     /* Local variables */
129     integer i__;
130     real sl, su, tmp, tmp2;
131     logical matt;
132     extern logical lsame_(char *, char *);
133     real lpivot, rpivot;
134     /* -- LAPACK auxiliary routine (version 3.4.2) -- */
135     /* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
136     /* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
137     /* September 2012 */
138     /* .. Scalar Arguments .. */
139     /* .. */
140     /* .. Array Arguments .. */
141     /* .. */
142     /* ===================================================================== */
143     /* .. Parameters .. */
144     /* .. */
145     /* .. Local Scalars .. */
146     /* .. */
147     /* .. External Functions .. */
148     /* .. */
149     /* .. Executable Statements .. */
150     /* Parameter adjustments */
151     --e;
152     --d__;
153     /* Function Body */
154     *info = 0;
155     *lcnt = 0;
156     *rcnt = 0;
157     *eigcnt = 0;
158     matt = lsame_(jobt, "T");
159     if (matt)
160     {
161         /* Sturm sequence count on T */
162         lpivot = d__[1] - *vl;
163         rpivot = d__[1] - *vu;
164         if (lpivot <= 0.f)
165         {
166             ++(*lcnt);
167         }
168         if (rpivot <= 0.f)
169         {
170             ++(*rcnt);
171         }
172         i__1 = *n - 1;
173         for (i__ = 1;
174                 i__ <= i__1;
175                 ++i__)
176         {
177             /* Computing 2nd power */
178             r__1 = e[i__];
179             tmp = r__1 * r__1;
180             lpivot = d__[i__ + 1] - *vl - tmp / lpivot;
181             rpivot = d__[i__ + 1] - *vu - tmp / rpivot;
182             if (lpivot <= 0.f)
183             {
184                 ++(*lcnt);
185             }
186             if (rpivot <= 0.f)
187             {
188                 ++(*rcnt);
189             }
190             /* L10: */
191         }
192     }
193     else
194     {
195         /* Sturm sequence count on L D L^T */
196         sl = -(*vl);
197         su = -(*vu);
198         i__1 = *n - 1;
199         for (i__ = 1;
200                 i__ <= i__1;
201                 ++i__)
202         {
203             lpivot = d__[i__] + sl;
204             rpivot = d__[i__] + su;
205             if (lpivot <= 0.f)
206             {
207                 ++(*lcnt);
208             }
209             if (rpivot <= 0.f)
210             {
211                 ++(*rcnt);
212             }
213             tmp = e[i__] * d__[i__] * e[i__];
214             tmp2 = tmp / lpivot;
215             if (tmp2 == 0.f)
216             {
217                 sl = tmp - *vl;
218             }
219             else
220             {
221                 sl = sl * tmp2 - *vl;
222             }
223             tmp2 = tmp / rpivot;
224             if (tmp2 == 0.f)
225             {
226                 su = tmp - *vu;
227             }
228             else
229             {
230                 su = su * tmp2 - *vu;
231             }
232             /* L20: */
233         }
234         lpivot = d__[*n] + sl;
235         rpivot = d__[*n] + su;
236         if (lpivot <= 0.f)
237         {
238             ++(*lcnt);
239         }
240         if (rpivot <= 0.f)
241         {
242             ++(*rcnt);
243         }
244     }
245     *eigcnt = *rcnt - *lcnt;
246     return 0;
247     /* end of SLARRC */
248 }
249 /* slarrc_ */
250