Debian Codegraph @

debian/external_deps/fetk/punc/src/arpack/snconv.c

raw
1 /* ./src_f77/snconv.f -- translated by f2c (version 20030320).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include <punc/vf2c.h>
7
8 /* Common Block Declarations */
9
10 struct {
11 integer logfil, ndigit, mgetv0, msaupd, msaup2, msaitr, mseigt, msapps,
12 msgets, mseupd, mnaupd, mnaup2, mnaitr, mneigh, mnapps, mngets,
13 mneupd, mcaupd, mcaup2, mcaitr, mceigh, mcapps, mcgets, mceupd;
14 } debug_SNCONV;
15
16 #define debug_1 debug_SNCONV
17
18 struct {
19 integer nopx, nbx, nrorth, nitref, nrstrt;
20 real tsaupd, tsaup2, tsaitr, tseigt, tsgets, tsapps, tsconv, tnaupd,
21 tnaup2, tnaitr, tneigh, tngets, tnapps, tnconv, tcaupd, tcaup2,
22 tcaitr, tceigh, tcgets, tcapps, tcconv, tmvopx, tmvbx, tgetv0,
23 titref, trvec;
24 } timing_SNCONV;
25
26 #define timing_1 timing_SNCONV
27
28 /* Table of constant values */
29
30 static doublereal c_b3 = .66666666666666663;
31
32 /* ----------------------------------------------------------------------- */
33 /* \BeginDoc */
34
35 /* \Name: snconv */
36
37 /* \Description: */
38 /* Convergence testing for the nonsymmetric Arnoldi eigenvalue routine. */
39
40 /* \Usage: */
41 /* call snconv */
42 /* ( N, RITZR, RITZI, BOUNDS, TOL, NCONV ) */
43
44 /* \Arguments */
45 /* N Integer. (INPUT) */
46 /* Number of Ritz values to check for convergence. */
47
48 /* RITZR, Real arrays of length N. (INPUT) */
49 /* RITZI Real and imaginary parts of the Ritz values to be checked */
50 /* for convergence. */
51 /* BOUNDS Real array of length N. (INPUT) */
52 /* Ritz estimates for the Ritz values in RITZR and RITZI. */
53
54 /* TOL Real scalar. (INPUT) */
55 /* Desired backward error for a Ritz value to be considered */
56 /* "converged". */
57
58 /* NCONV Integer scalar. (OUTPUT) */
59 /* Number of "converged" Ritz values. */
60
61 /* \EndDoc */
62
63 /* ----------------------------------------------------------------------- */
64
65 /* \BeginLib */
66
67 /* \Local variables: */
68 /* xxxxxx real */
69
70 /* \Routines called: */
71 /* second ARPACK utility routine for timing. */
72 /* slamch LAPACK routine that determines machine constants. */
73 /* slapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully. */
74
75 /* \Author */
76 /* Danny Sorensen Phuong Vu */
77 /* Richard Lehoucq CRPC / Rice University */
78 /* Dept. of Computational & Houston, Texas */
79 /* Applied Mathematics */
80 /* Rice University */
81 /* Houston, Texas */
82
83 /* \Revision history: */
84 /* xx/xx/92: Version ' 2.1' */
85
86 /* \SCCS Information: @(#) */
87 /* FILE: nconv.F SID: 2.3 DATE OF SID: 4/20/96 RELEASE: 2 */
88
89 /* \Remarks */
90 /* 1. xxxx */
91
92 /* \EndLib */
93
94 /* ----------------------------------------------------------------------- */
95
96 /* Subroutine */ int snconv_(integer *n, real *ritzr, real *ritzi, real *
97 bounds, real *tol, integer *nconv)
98 {
99 /* System generated locals */
100 integer i__1;
101 real r__1, r__2;
102 doublereal d__1;
103
104 /* Builtin functions */
105 double pow_dd(doublereal *, doublereal *);
106
107 /* Local variables */
108 static integer i__;
109 static real t0, t1, eps23, temp;
110 extern doublereal slapy2_(real *, real *), slamch_(char *, ftnlen);
111 extern /* Subroutine */ int second_(real *);
112
113
114 /* %----------------------------------------------------% */
115 /* | Include files for debugging and timing information | */
116 /* %----------------------------------------------------% */
117
118
119 /* \SCCS Information: @(#) */
120 /* FILE: debug.h SID: 2.3 DATE OF SID: 11/16/95 RELEASE: 2 */
121
122 /* %---------------------------------% */
123 /* | See debug.doc for documentation | */
124 /* %---------------------------------% */
125
126 /* %------------------% */
127 /* | Scalar Arguments | */
128 /* %------------------% */
129
130 /* %--------------------------------% */
131 /* | See stat.doc for documentation | */
132 /* %--------------------------------% */
133
134 /* \SCCS Information: @(#) */
135 /* FILE: stat.h SID: 2.2 DATE OF SID: 11/16/95 RELEASE: 2 */
136
137
138
139 /* %-----------------% */
140 /* | Array Arguments | */
141 /* %-----------------% */
142
143 /* %---------------% */
144 /* | Local Scalars | */
145 /* %---------------% */
146
147
148 /* %--------------------% */
149 /* | External Functions | */
150 /* %--------------------% */
151
152 /* %-----------------------% */
153 /* | Executable Statements | */
154 /* %-----------------------% */
155
156 /* %-------------------------------------------------------------% */
157 /* | Convergence test: unlike in the symmetric code, I am not | */
158 /* | using things like refined error bounds and gap condition | */
159 /* | because I don't know the exact equivalent concept. | */
160 /* | | */
161 /* | Instead the i-th Ritz value is considered "converged" when: | */
162 /* | | */
163 /* | bounds(i) .le. ( TOL * | ritz | ) | */
164 /* | | */
165 /* | for some appropriate choice of norm. | */
166 /* %-------------------------------------------------------------% */
167
168 /* Parameter adjustments */
169 --bounds;
170 --ritzi;
171 --ritzr;
172
173 /* Function Body */
174 second_(&t0);
175
176 /* %---------------------------------% */
177 /* | Get machine dependent constant. | */
178 /* %---------------------------------% */
179
180 eps23 = slamch_("Epsilon-Machine", (ftnlen)15);
181 d__1 = (doublereal) eps23;
182 eps23 = pow_dd(&d__1, &c_b3);
183
184 *nconv = 0;
185 i__1 = *n;
186 for (i__ = 1; i__ <= i__1; ++i__) {
187 /* Computing MAX */
188 r__1 = eps23, r__2 = slapy2_(&ritzr[i__], &ritzi[i__]);
189 temp = dmax(r__1,r__2);
190 if (bounds[i__] <= *tol * temp) {
191 ++(*nconv);
192 }
193 /* L20: */
194 }
195
196 second_(&t1);
197 timing_1.tnconv += t1 - t0;
198
199 return 0;
200
201 /* %---------------% */
202 /* | End of snconv | */
203 /* %---------------% */
204
205 } /* snconv_ */
206