Debian Codegraph @

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

raw
1 /* ./src_f77/dnconv.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_DNCONV;
15
16 #define debug_1 debug_DNCONV
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_DNCONV;
25
26 #define timing_1 timing_DNCONV
27
28 /* Table of constant values */
29
30 static doublereal c_b3 = .66666666666666663;
31
32 /* ----------------------------------------------------------------------- */
33 /* \BeginDoc */
34
35 /* \Name: dnconv */
36
37 /* \Description: */
38 /* Convergence testing for the nonsymmetric Arnoldi eigenvalue routine. */
39
40 /* \Usage: */
41 /* call dnconv */
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, Double precision arrays of length N. (INPUT) */
49 /* RITZI Real and imaginary parts of the Ritz values to be checked */
50 /* for convergence. */
51 /* BOUNDS Double precision array of length N. (INPUT) */
52 /* Ritz estimates for the Ritz values in RITZR and RITZI. */
53
54 /* TOL Double precision 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 /* dlamch LAPACK routine that determines machine constants. */
73 /* dlapy2 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 dnconv_(integer *n, doublereal *ritzr, doublereal *ritzi,
97 doublereal *bounds, doublereal *tol, integer *nconv)
98 {
99 /* System generated locals */
100 integer i__1;
101 doublereal d__1, d__2;
102
103 /* Builtin functions */
104 double pow_dd(doublereal *, doublereal *);
105
106 /* Local variables */
107 static integer i__;
108 static real t0, t1;
109 static doublereal eps23, temp;
110 extern doublereal dlapy2_(doublereal *, doublereal *), dlamch_(char *,
111 ftnlen);
112 extern /* Subroutine */ int second_(real *);
113
114
115 /* %----------------------------------------------------% */
116 /* | Include files for debugging and timing information | */
117 /* %----------------------------------------------------% */
118
119
120 /* \SCCS Information: @(#) */
121 /* FILE: debug.h SID: 2.3 DATE OF SID: 11/16/95 RELEASE: 2 */
122
123 /* %---------------------------------% */
124 /* | See debug.doc for documentation | */
125 /* %---------------------------------% */
126
127 /* %------------------% */
128 /* | Scalar Arguments | */
129 /* %------------------% */
130
131 /* %--------------------------------% */
132 /* | See stat.doc for documentation | */
133 /* %--------------------------------% */
134
135 /* \SCCS Information: @(#) */
136 /* FILE: stat.h SID: 2.2 DATE OF SID: 11/16/95 RELEASE: 2 */
137
138
139
140 /* %-----------------% */
141 /* | Array Arguments | */
142 /* %-----------------% */
143
144 /* %---------------% */
145 /* | Local Scalars | */
146 /* %---------------% */
147
148
149 /* %--------------------% */
150 /* | External Functions | */
151 /* %--------------------% */
152
153 /* %-----------------------% */
154 /* | Executable Statements | */
155 /* %-----------------------% */
156
157 /* %-------------------------------------------------------------% */
158 /* | Convergence test: unlike in the symmetric code, I am not | */
159 /* | using things like refined error bounds and gap condition | */
160 /* | because I don't know the exact equivalent concept. | */
161 /* | | */
162 /* | Instead the i-th Ritz value is considered "converged" when: | */
163 /* | | */
164 /* | bounds(i) .le. ( TOL * | ritz | ) | */
165 /* | | */
166 /* | for some appropriate choice of norm. | */
167 /* %-------------------------------------------------------------% */
168
169 /* Parameter adjustments */
170 --bounds;
171 --ritzi;
172 --ritzr;
173
174 /* Function Body */
175 second_(&t0);
176
177 /* %---------------------------------% */
178 /* | Get machine dependent constant. | */
179 /* %---------------------------------% */
180
181 eps23 = dlamch_("Epsilon-Machine", (ftnlen)15);
182 eps23 = pow_dd(&eps23, &c_b3);
183
184 *nconv = 0;
185 i__1 = *n;
186 for (i__ = 1; i__ <= i__1; ++i__) {
187 /* Computing MAX */
188 d__1 = eps23, d__2 = dlapy2_(&ritzr[i__], &ritzi[i__]);
189 temp = max(d__1,d__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 dnconv | */
203 /* %---------------% */
204
205 } /* dnconv_ */
206