Debian Codegraph @

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

raw
1 /* ./src_f77/cngets.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_CNGETS;
15
16 #define debug_1 debug_CNGETS
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_CNGETS;
25
26 #define timing_1 timing_CNGETS
27
28 /* Table of constant values */
29
30 static logical c_true = TRUE_;
31 static integer c__1 = 1;
32
33 /* \BeginDoc */
34
35 /* \Name: cngets */
36
37 /* \Description: */
38 /* Given the eigenvalues of the upper Hessenberg matrix H, */
39 /* computes the NP shifts AMU that are zeros of the polynomial of */
40 /* degree NP which filters out components of the unwanted eigenvectors */
41 /* corresponding to the AMU's based on some given criteria. */
42
43 /* NOTE: call this even in the case of user specified shifts in order */
44 /* to sort the eigenvalues, and error bounds of H for later use. */
45
46 /* \Usage: */
47 /* call cngets */
48 /* ( ISHIFT, WHICH, KEV, NP, RITZ, BOUNDS ) */
49
50 /* \Arguments */
51 /* ISHIFT Integer. (INPUT) */
52 /* Method for selecting the implicit shifts at each iteration. */
53 /* ISHIFT = 0: user specified shifts */
54 /* ISHIFT = 1: exact shift with respect to the matrix H. */
55
56 /* WHICH Character*2. (INPUT) */
57 /* Shift selection criteria. */
58 /* 'LM' -> want the KEV eigenvalues of largest magnitude. */
59 /* 'SM' -> want the KEV eigenvalues of smallest magnitude. */
60 /* 'LR' -> want the KEV eigenvalues of largest REAL part. */
61 /* 'SR' -> want the KEV eigenvalues of smallest REAL part. */
62 /* 'LI' -> want the KEV eigenvalues of largest imaginary part. */
63 /* 'SI' -> want the KEV eigenvalues of smallest imaginary part. */
64
65 /* KEV Integer. (INPUT) */
66 /* The number of desired eigenvalues. */
67
68 /* NP Integer. (INPUT) */
69 /* The number of shifts to compute. */
70
71 /* RITZ Complex array of length KEV+NP. (INPUT/OUTPUT) */
72 /* On INPUT, RITZ contains the the eigenvalues of H. */
73 /* On OUTPUT, RITZ are sorted so that the unwanted */
74 /* eigenvalues are in the first NP locations and the wanted */
75 /* portion is in the last KEV locations. When exact shifts are */
76 /* selected, the unwanted part corresponds to the shifts to */
77 /* be applied. Also, if ISHIFT .eq. 1, the unwanted eigenvalues */
78 /* are further sorted so that the ones with largest Ritz values */
79 /* are first. */
80
81 /* BOUNDS Complex array of length KEV+NP. (INPUT/OUTPUT) */
82 /* Error bounds corresponding to the ordering in RITZ. */
83
84
85
86 /* \EndDoc */
87
88 /* ----------------------------------------------------------------------- */
89
90 /* \BeginLib */
91
92 /* \Local variables: */
93 /* xxxxxx Complex */
94
95 /* \Routines called: */
96 /* csortc ARPACK sorting routine. */
97 /* ivout ARPACK utility routine that prints integers. */
98 /* second ARPACK utility routine for timing. */
99 /* cvout ARPACK utility routine that prints vectors. */
100
101 /* \Author */
102 /* Danny Sorensen Phuong Vu */
103 /* Richard Lehoucq CRPC / Rice University */
104 /* Dept. of Computational & Houston, Texas */
105 /* Applied Mathematics */
106 /* Rice University */
107 /* Houston, Texas */
108
109 /* \SCCS Information: @(#) */
110 /* FILE: ngets.F SID: 2.2 DATE OF SID: 4/20/96 RELEASE: 2 */
111
112 /* \Remarks */
113 /* 1. This routine does not keep complex conjugate pairs of */
114 /* eigenvalues together. */
115
116 /* \EndLib */
117
118 /* ----------------------------------------------------------------------- */
119
120 /* Subroutine */ int cngets_(integer *ishift, char *which, integer *kev,
121 integer *np, realcomplex *ritz, realcomplex *bounds, ftnlen which_len)
122 {
123 /* System generated locals */
124 integer i__1;
125
126 /* Local variables */
127 static real t0, t1;
128 extern /* Subroutine */ int cvout_(integer *, integer *, realcomplex *,
129 integer *, char *, ftnlen), ivout_(integer *, integer *, integer *
130 , integer *, char *, ftnlen), second_(real *);
131 static integer msglvl;
132 extern /* Subroutine */ int csortc_(char *, logical *, integer *, realcomplex
133 *, realcomplex *, ftnlen);
134
135
136 /* %----------------------------------------------------% */
137 /* | Include files for debugging and timing information | */
138 /* %----------------------------------------------------% */
139
140
141 /* \SCCS Information: @(#) */
142 /* FILE: debug.h SID: 2.3 DATE OF SID: 11/16/95 RELEASE: 2 */
143
144 /* %---------------------------------% */
145 /* | See debug.doc for documentation | */
146 /* %---------------------------------% */
147
148 /* %------------------% */
149 /* | Scalar Arguments | */
150 /* %------------------% */
151
152 /* %--------------------------------% */
153 /* | See stat.doc for documentation | */
154 /* %--------------------------------% */
155
156 /* \SCCS Information: @(#) */
157 /* FILE: stat.h SID: 2.2 DATE OF SID: 11/16/95 RELEASE: 2 */
158
159
160
161 /* %-----------------% */
162 /* | Array Arguments | */
163 /* %-----------------% */
164
165
166 /* %------------% */
167 /* | Parameters | */
168 /* %------------% */
169
170
171 /* %---------------% */
172 /* | Local Scalars | */
173 /* %---------------% */
174
175
176 /* %----------------------% */
177 /* | External Subroutines | */
178 /* %----------------------% */
179
180
181 /* %-----------------------% */
182 /* | Executable Statements | */
183 /* %-----------------------% */
184
185 /* %-------------------------------% */
186 /* | Initialize timing statistics | */
187 /* | & message level for debugging | */
188 /* %-------------------------------% */
189
190 /* Parameter adjustments */
191 --bounds;
192 --ritz;
193
194 /* Function Body */
195 second_(&t0);
196 msglvl = debug_1.mcgets;
197
198 i__1 = *kev + *np;
199 csortc_(which, &c_true, &i__1, &ritz[1], &bounds[1], (ftnlen)2);
200
201 if (*ishift == 1) {
202
203 /* %-------------------------------------------------------% */
204 /* | Sort the unwanted Ritz values used as shifts so that | */
205 /* | the ones with largest Ritz estimates are first | */
206 /* | This will tend to minimize the effects of the | */
207 /* | forward instability of the iteration when the shifts | */
208 /* | are applied in subroutine cnapps. | */
209 /* | Be careful and use 'SM' since we want to sort BOUNDS! | */
210 /* %-------------------------------------------------------% */
211
212 csortc_("SM", &c_true, np, &bounds[1], &ritz[1], (ftnlen)2);
213
214 }
215
216 second_(&t1);
217 timing_1.tcgets += t1 - t0;
218
219 if (msglvl > 0) {
220 ivout_(&debug_1.logfil, &c__1, kev, &debug_1.ndigit, "_ngets: KEV is",
221 (ftnlen)14);
222 ivout_(&debug_1.logfil, &c__1, np, &debug_1.ndigit, "_ngets: NP is", (
223 ftnlen)13);
224 i__1 = *kev + *np;
225 cvout_(&debug_1.logfil, &i__1, &ritz[1], &debug_1.ndigit, "_ngets: E"
226 "igenvalues of current H matrix ", (ftnlen)40);
227 i__1 = *kev + *np;
228 cvout_(&debug_1.logfil, &i__1, &bounds[1], &debug_1.ndigit, "_ngets:"
229 " Ritz estimates of the current KEV+NP Ritz values", (ftnlen)
230 56);
231 }
232
233 return 0;
234
235 /* %---------------% */
236 /* | End of cngets | */
237 /* %---------------% */
238
239 } /* cngets_ */
240