/src/igraph/vendor/lapack/dnconv.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* -- translated by f2c (version 20191129). |
2 | | You must link the resulting object file with libf2c: |
3 | | on Microsoft Windows system, link with libf2c.lib; |
4 | | on Linux or Unix systems, link with .../path/to/libf2c.a -lm |
5 | | or, if you install libf2c.a in a standard place, with -lf2c -lm |
6 | | -- in that order, at the end of the command line, as in |
7 | | cc *.o -lf2c -lm |
8 | | Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., |
9 | | |
10 | | http://www.netlib.org/f2c/libf2c.zip |
11 | | */ |
12 | | |
13 | | #include "f2c.h" |
14 | | |
15 | | /* Table of constant values */ |
16 | | |
17 | | static doublereal c_b3 = .66666666666666663; |
18 | | |
19 | | /* ----------------------------------------------------------------------- |
20 | | \BeginDoc |
21 | | |
22 | | \Name: dnconv |
23 | | |
24 | | \Description: |
25 | | Convergence testing for the nonsymmetric Arnoldi eigenvalue routine. |
26 | | |
27 | | \Usage: |
28 | | call dnconv |
29 | | ( N, RITZR, RITZI, BOUNDS, TOL, NCONV ) |
30 | | |
31 | | \Arguments |
32 | | N Integer. (INPUT) |
33 | | Number of Ritz values to check for convergence. |
34 | | |
35 | | RITZR, Double precision arrays of length N. (INPUT) |
36 | | RITZI Real and imaginary parts of the Ritz values to be checked |
37 | | for convergence. |
38 | | BOUNDS Double precision array of length N. (INPUT) |
39 | | Ritz estimates for the Ritz values in RITZR and RITZI. |
40 | | |
41 | | TOL Double precision scalar. (INPUT) |
42 | | Desired backward error for a Ritz value to be considered |
43 | | "converged". |
44 | | |
45 | | NCONV Integer scalar. (OUTPUT) |
46 | | Number of "converged" Ritz values. |
47 | | |
48 | | \EndDoc |
49 | | |
50 | | ----------------------------------------------------------------------- |
51 | | |
52 | | \BeginLib |
53 | | |
54 | | \Local variables: |
55 | | xxxxxx real |
56 | | |
57 | | \Routines called: |
58 | | second ARPACK utility routine for timing. |
59 | | dlamch LAPACK routine that determines machine constants. |
60 | | dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully. |
61 | | |
62 | | \Author |
63 | | Danny Sorensen Phuong Vu |
64 | | Richard Lehoucq CRPC / Rice University |
65 | | Dept. of Computational & Houston, Texas |
66 | | Applied Mathematics |
67 | | Rice University |
68 | | Houston, Texas |
69 | | |
70 | | \Revision history: |
71 | | xx/xx/92: Version ' 2.1' |
72 | | |
73 | | \SCCS Information: @(#) |
74 | | FILE: nconv.F SID: 2.3 DATE OF SID: 4/20/96 RELEASE: 2 |
75 | | |
76 | | \Remarks |
77 | | 1. xxxx |
78 | | |
79 | | \EndLib |
80 | | |
81 | | ----------------------------------------------------------------------- |
82 | | |
83 | | Subroutine */ int igraphdnconv_(integer *n, doublereal *ritzr, doublereal *ritzi, |
84 | | doublereal *bounds, doublereal *tol, integer *nconv) |
85 | 0 | { |
86 | | /* System generated locals */ |
87 | 0 | integer i__1; |
88 | 0 | doublereal d__1, d__2; |
89 | | |
90 | | /* Builtin functions */ |
91 | 0 | double pow_dd(doublereal *, doublereal *); |
92 | | |
93 | | /* Local variables */ |
94 | 0 | integer i__; |
95 | 0 | IGRAPH_F77_SAVE real t0, t1; |
96 | 0 | doublereal eps23, temp; |
97 | 0 | extern doublereal igraphdlapy2_(doublereal *, doublereal *), igraphdlamch_(char *); |
98 | 0 | extern /* Subroutine */ int igraphsecond_(real *); |
99 | 0 | real tnconv = 0.; |
100 | | |
101 | | |
102 | | /* %----------------------------------------------------% |
103 | | | Include files for debugging and timing information | |
104 | | %----------------------------------------------------% |
105 | | |
106 | | |
107 | | %------------------% |
108 | | | Scalar Arguments | |
109 | | %------------------% |
110 | | |
111 | | |
112 | | %-----------------% |
113 | | | Array Arguments | |
114 | | %-----------------% |
115 | | |
116 | | %---------------% |
117 | | | Local Scalars | |
118 | | %---------------% |
119 | | |
120 | | |
121 | | %--------------------% |
122 | | | External Functions | |
123 | | %--------------------% |
124 | | |
125 | | %-----------------------% |
126 | | | Executable Statements | |
127 | | %-----------------------% |
128 | | |
129 | | %-------------------------------------------------------------% |
130 | | | Convergence test: unlike in the symmetric code, I am not | |
131 | | | using things like refined error bounds and gap condition | |
132 | | | because I don't know the exact equivalent concept. | |
133 | | | | |
134 | | | Instead the i-th Ritz value is considered "converged" when: | |
135 | | | | |
136 | | | bounds(i) .le. ( TOL * | ritz | ) | |
137 | | | | |
138 | | | for some appropriate choice of norm. | |
139 | | %-------------------------------------------------------------% |
140 | | |
141 | | Parameter adjustments */ |
142 | 0 | --bounds; |
143 | 0 | --ritzi; |
144 | 0 | --ritzr; |
145 | | |
146 | | /* Function Body */ |
147 | 0 | igraphsecond_(&t0); |
148 | | |
149 | | /* %---------------------------------% |
150 | | | Get machine dependent constant. | |
151 | | %---------------------------------% */ |
152 | |
|
153 | 0 | eps23 = igraphdlamch_("Epsilon-Machine"); |
154 | 0 | eps23 = pow_dd(&eps23, &c_b3); |
155 | |
|
156 | 0 | *nconv = 0; |
157 | 0 | i__1 = *n; |
158 | 0 | for (i__ = 1; i__ <= i__1; ++i__) { |
159 | | /* Computing MAX */ |
160 | 0 | d__1 = eps23, d__2 = igraphdlapy2_(&ritzr[i__], &ritzi[i__]); |
161 | 0 | temp = max(d__1,d__2); |
162 | 0 | if (bounds[i__] <= *tol * temp) { |
163 | 0 | ++(*nconv); |
164 | 0 | } |
165 | | /* L20: */ |
166 | 0 | } |
167 | |
|
168 | 0 | igraphsecond_(&t1); |
169 | 0 | tnconv += t1 - t0; |
170 | |
|
171 | 0 | return 0; |
172 | | |
173 | | /* %---------------% |
174 | | | End of dnconv | |
175 | | %---------------% */ |
176 | |
|
177 | 0 | } /* igraphdnconv_ */ |
178 | | |