| 1 |
/* ./src_f77/sngets.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_SNGETS; |
| 15 |
|
| 16 |
#define debug_1 debug_SNGETS |
| 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_SNGETS; |
| 25 |
|
| 26 |
#define timing_1 timing_SNGETS |
| 27 |
|
| 28 |
/* Table of constant values */ |
| 29 |
|
| 30 |
static logical c_true = TRUE_; |
| 31 |
static integer c__1 = 1; |
| 32 |
|
| 33 |
/* ----------------------------------------------------------------------- */ |
| 34 |
/* \BeginDoc */ |
| 35 |
|
| 36 |
/* \Name: sngets */ |
| 37 |
|
| 38 |
/* \Description: */ |
| 39 |
/* Given the eigenvalues of the upper Hessenberg matrix H, */ |
| 40 |
/* computes the NP shifts AMU that are zeros of the polynomial of */ |
| 41 |
/* degree NP which filters out components of the unwanted eigenvectors */ |
| 42 |
/* corresponding to the AMU's based on some given criteria. */ |
| 43 |
|
| 44 |
/* NOTE: call this even in the case of user specified shifts in order */ |
| 45 |
/* to sort the eigenvalues, and error bounds of H for later use. */ |
| 46 |
|
| 47 |
/* \Usage: */ |
| 48 |
/* call sngets */ |
| 49 |
/* ( ISHIFT, WHICH, KEV, NP, RITZR, RITZI, BOUNDS, SHIFTR, SHIFTI ) */ |
| 50 |
|
| 51 |
/* \Arguments */ |
| 52 |
/* ISHIFT Integer. (INPUT) */ |
| 53 |
/* Method for selecting the implicit shifts at each iteration. */ |
| 54 |
/* ISHIFT = 0: user specified shifts */ |
| 55 |
/* ISHIFT = 1: exact shift with respect to the matrix H. */ |
| 56 |
|
| 57 |
/* WHICH Character*2. (INPUT) */ |
| 58 |
/* Shift selection criteria. */ |
| 59 |
/* 'LM' -> want the KEV eigenvalues of largest magnitude. */ |
| 60 |
/* 'SM' -> want the KEV eigenvalues of smallest magnitude. */ |
| 61 |
/* 'LR' -> want the KEV eigenvalues of largest real part. */ |
| 62 |
/* 'SR' -> want the KEV eigenvalues of smallest real part. */ |
| 63 |
/* 'LI' -> want the KEV eigenvalues of largest imaginary part. */ |
| 64 |
/* 'SI' -> want the KEV eigenvalues of smallest imaginary part. */ |
| 65 |
|
| 66 |
/* KEV Integer. (INPUT/OUTPUT) */ |
| 67 |
/* INPUT: KEV+NP is the size of the matrix H. */ |
| 68 |
/* OUTPUT: Possibly increases KEV by one to keep complex conjugate */ |
| 69 |
/* pairs together. */ |
| 70 |
|
| 71 |
/* NP Integer. (INPUT/OUTPUT) */ |
| 72 |
/* Number of implicit shifts to be computed. */ |
| 73 |
/* OUTPUT: Possibly decreases NP by one to keep complex conjugate */ |
| 74 |
/* pairs together. */ |
| 75 |
|
| 76 |
/* RITZR, Real array of length KEV+NP. (INPUT/OUTPUT) */ |
| 77 |
/* RITZI On INPUT, RITZR and RITZI contain the real and imaginary */ |
| 78 |
/* parts of the eigenvalues of H. */ |
| 79 |
/* On OUTPUT, RITZR and RITZI are sorted so that the unwanted */ |
| 80 |
/* eigenvalues are in the first NP locations and the wanted */ |
| 81 |
/* portion is in the last KEV locations. When exact shifts are */ |
| 82 |
/* selected, the unwanted part corresponds to the shifts to */ |
| 83 |
/* be applied. Also, if ISHIFT .eq. 1, the unwanted eigenvalues */ |
| 84 |
/* are further sorted so that the ones with largest Ritz values */ |
| 85 |
/* are first. */ |
| 86 |
|
| 87 |
/* BOUNDS Real array of length KEV+NP. (INPUT/OUTPUT) */ |
| 88 |
/* Error bounds corresponding to the ordering in RITZ. */ |
| 89 |
|
| 90 |
/* SHIFTR, SHIFTI *** USE deprecated as of version 2.1. *** */ |
| 91 |
|
| 92 |
|
| 93 |
/* \EndDoc */ |
| 94 |
|
| 95 |
/* ----------------------------------------------------------------------- */ |
| 96 |
|
| 97 |
/* \BeginLib */ |
| 98 |
|
| 99 |
/* \Local variables: */ |
| 100 |
/* xxxxxx real */ |
| 101 |
|
| 102 |
/* \Routines called: */ |
| 103 |
/* ssortc ARPACK sorting routine. */ |
| 104 |
/* scopy Level 1 BLAS that copies one vector to another . */ |
| 105 |
|
| 106 |
/* \Author */ |
| 107 |
/* Danny Sorensen Phuong Vu */ |
| 108 |
/* Richard Lehoucq CRPC / Rice University */ |
| 109 |
/* Dept. of Computational & Houston, Texas */ |
| 110 |
/* Applied Mathematics */ |
| 111 |
/* Rice University */ |
| 112 |
/* Houston, Texas */ |
| 113 |
|
| 114 |
/* \Revision history: */ |
| 115 |
/* xx/xx/92: Version ' 2.1' */ |
| 116 |
|
| 117 |
/* \SCCS Information: @(#) */ |
| 118 |
/* FILE: ngets.F SID: 2.3 DATE OF SID: 4/20/96 RELEASE: 2 */ |
| 119 |
|
| 120 |
/* \Remarks */ |
| 121 |
/* 1. xxxx */ |
| 122 |
|
| 123 |
/* \EndLib */ |
| 124 |
|
| 125 |
/* ----------------------------------------------------------------------- */ |
| 126 |
|
| 127 |
/* Subroutine */ int sngets_(integer *ishift, char *which, integer *kev, |
| 128 |
integer *np, real *ritzr, real *ritzi, real *bounds, real *shiftr, |
| 129 |
real *shifti, ftnlen which_len) |
| 130 |
{ |
| 131 |
/* System generated locals */ |
| 132 |
integer i__1; |
| 133 |
|
| 134 |
/* Builtin functions */ |
| 135 |
integer s_cmp(char *, char *, ftnlen, ftnlen); |
| 136 |
|
| 137 |
/* Local variables */ |
| 138 |
static real t0, t1; |
| 139 |
extern /* Subroutine */ int ivout_(integer *, integer *, integer *, |
| 140 |
integer *, char *, ftnlen), svout_(integer *, integer *, real *, |
| 141 |
integer *, char *, ftnlen), second_(real *); |
| 142 |
static integer msglvl; |
| 143 |
extern /* Subroutine */ int ssortc_(char *, logical *, integer *, real *, |
| 144 |
real *, real *, ftnlen); |
| 145 |
|
| 146 |
|
| 147 |
/* %----------------------------------------------------% */ |
| 148 |
/* | Include files for debugging and timing information | */ |
| 149 |
/* %----------------------------------------------------% */ |
| 150 |
|
| 151 |
|
| 152 |
/* \SCCS Information: @(#) */ |
| 153 |
/* FILE: debug.h SID: 2.3 DATE OF SID: 11/16/95 RELEASE: 2 */ |
| 154 |
|
| 155 |
/* %---------------------------------% */ |
| 156 |
/* | See debug.doc for documentation | */ |
| 157 |
/* %---------------------------------% */ |
| 158 |
|
| 159 |
/* %------------------% */ |
| 160 |
/* | Scalar Arguments | */ |
| 161 |
/* %------------------% */ |
| 162 |
|
| 163 |
/* %--------------------------------% */ |
| 164 |
/* | See stat.doc for documentation | */ |
| 165 |
/* %--------------------------------% */ |
| 166 |
|
| 167 |
/* \SCCS Information: @(#) */ |
| 168 |
/* FILE: stat.h SID: 2.2 DATE OF SID: 11/16/95 RELEASE: 2 */ |
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
/* %-----------------% */ |
| 173 |
/* | Array Arguments | */ |
| 174 |
/* %-----------------% */ |
| 175 |
|
| 176 |
|
| 177 |
/* %------------% */ |
| 178 |
/* | Parameters | */ |
| 179 |
/* %------------% */ |
| 180 |
|
| 181 |
|
| 182 |
/* %---------------% */ |
| 183 |
/* | Local Scalars | */ |
| 184 |
/* %---------------% */ |
| 185 |
|
| 186 |
|
| 187 |
/* %----------------------% */ |
| 188 |
/* | External Subroutines | */ |
| 189 |
/* %----------------------% */ |
| 190 |
|
| 191 |
|
| 192 |
/* %----------------------% */ |
| 193 |
/* | Intrinsics Functions | */ |
| 194 |
/* %----------------------% */ |
| 195 |
|
| 196 |
|
| 197 |
/* %-----------------------% */ |
| 198 |
/* | Executable Statements | */ |
| 199 |
/* %-----------------------% */ |
| 200 |
|
| 201 |
/* %-------------------------------% */ |
| 202 |
/* | Initialize timing statistics | */ |
| 203 |
/* | & message level for debugging | */ |
| 204 |
/* %-------------------------------% */ |
| 205 |
|
| 206 |
/* Parameter adjustments */ |
| 207 |
--bounds; |
| 208 |
--ritzi; |
| 209 |
--ritzr; |
| 210 |
--shiftr; |
| 211 |
--shifti; |
| 212 |
|
| 213 |
/* Function Body */ |
| 214 |
second_(&t0); |
| 215 |
msglvl = debug_1.mngets; |
| 216 |
|
| 217 |
/* %----------------------------------------------------% */ |
| 218 |
/* | LM, SM, LR, SR, LI, SI case. | */ |
| 219 |
/* | Sort the eigenvalues of H into the desired order | */ |
| 220 |
/* | and apply the resulting order to BOUNDS. | */ |
| 221 |
/* | The eigenvalues are sorted so that the wanted part | */ |
| 222 |
/* | are always in the last KEV locations. | */ |
| 223 |
/* | We first do a pre-processing sort in order to keep | */ |
| 224 |
/* | complex conjugate pairs together | */ |
| 225 |
/* %----------------------------------------------------% */ |
| 226 |
|
| 227 |
if (s_cmp(which, "LM", (ftnlen)2, (ftnlen)2) == 0) { |
| 228 |
i__1 = *kev + *np; |
| 229 |
ssortc_("LR", &c_true, &i__1, &ritzr[1], &ritzi[1], &bounds[1], ( |
| 230 |
ftnlen)2); |
| 231 |
} else if (s_cmp(which, "SM", (ftnlen)2, (ftnlen)2) == 0) { |
| 232 |
i__1 = *kev + *np; |
| 233 |
ssortc_("SR", &c_true, &i__1, &ritzr[1], &ritzi[1], &bounds[1], ( |
| 234 |
ftnlen)2); |
| 235 |
} else if (s_cmp(which, "LR", (ftnlen)2, (ftnlen)2) == 0) { |
| 236 |
i__1 = *kev + *np; |
| 237 |
ssortc_("LM", &c_true, &i__1, &ritzr[1], &ritzi[1], &bounds[1], ( |
| 238 |
ftnlen)2); |
| 239 |
} else if (s_cmp(which, "SR", (ftnlen)2, (ftnlen)2) == 0) { |
| 240 |
i__1 = *kev + *np; |
| 241 |
ssortc_("SM", &c_true, &i__1, &ritzr[1], &ritzi[1], &bounds[1], ( |
| 242 |
ftnlen)2); |
| 243 |
} else if (s_cmp(which, "LI", (ftnlen)2, (ftnlen)2) == 0) { |
| 244 |
i__1 = *kev + *np; |
| 245 |
ssortc_("LM", &c_true, &i__1, &ritzr[1], &ritzi[1], &bounds[1], ( |
| 246 |
ftnlen)2); |
| 247 |
} else if (s_cmp(which, "SI", (ftnlen)2, (ftnlen)2) == 0) { |
| 248 |
i__1 = *kev + *np; |
| 249 |
ssortc_("SM", &c_true, &i__1, &ritzr[1], &ritzi[1], &bounds[1], ( |
| 250 |
ftnlen)2); |
| 251 |
} |
| 252 |
|
| 253 |
i__1 = *kev + *np; |
| 254 |
ssortc_(which, &c_true, &i__1, &ritzr[1], &ritzi[1], &bounds[1], (ftnlen) |
| 255 |
2); |
| 256 |
|
| 257 |
/* %-------------------------------------------------------% */ |
| 258 |
/* | Increase KEV by one if the ( ritzr(np),ritzi(np) ) | */ |
| 259 |
/* | = ( ritzr(np+1),-ritzi(np+1) ) and ritz(np) .ne. zero | */ |
| 260 |
/* | Accordingly decrease NP by one. In other words keep | */ |
| 261 |
/* | complex conjugate pairs together. | */ |
| 262 |
/* %-------------------------------------------------------% */ |
| 263 |
|
| 264 |
if (ritzr[*np + 1] - ritzr[*np] == 0.f && ritzi[*np + 1] + ritzi[*np] == |
| 265 |
0.f) { |
| 266 |
--(*np); |
| 267 |
++(*kev); |
| 268 |
} |
| 269 |
|
| 270 |
if (*ishift == 1) { |
| 271 |
|
| 272 |
/* %-------------------------------------------------------% */ |
| 273 |
/* | Sort the unwanted Ritz values used as shifts so that | */ |
| 274 |
/* | the ones with largest Ritz estimates are first | */ |
| 275 |
/* | This will tend to minimize the effects of the | */ |
| 276 |
/* | forward instability of the iteration when they shifts | */ |
| 277 |
/* | are applied in subroutine snapps. | */ |
| 278 |
/* | Be careful and use 'SR' since we want to sort BOUNDS! | */ |
| 279 |
/* %-------------------------------------------------------% */ |
| 280 |
|
| 281 |
ssortc_("SR", &c_true, np, &bounds[1], &ritzr[1], &ritzi[1], (ftnlen) |
| 282 |
2); |
| 283 |
} |
| 284 |
|
| 285 |
second_(&t1); |
| 286 |
timing_1.tngets += t1 - t0; |
| 287 |
|
| 288 |
if (msglvl > 0) { |
| 289 |
ivout_(&debug_1.logfil, &c__1, kev, &debug_1.ndigit, "_ngets: KEV is", |
| 290 |
(ftnlen)14); |
| 291 |
ivout_(&debug_1.logfil, &c__1, np, &debug_1.ndigit, "_ngets: NP is", ( |
| 292 |
ftnlen)13); |
| 293 |
i__1 = *kev + *np; |
| 294 |
svout_(&debug_1.logfil, &i__1, &ritzr[1], &debug_1.ndigit, "_ngets: " |
| 295 |
"Eigenvalues of current H matrix -- real part", (ftnlen)52); |
| 296 |
i__1 = *kev + *np; |
| 297 |
svout_(&debug_1.logfil, &i__1, &ritzi[1], &debug_1.ndigit, "_ngets: " |
| 298 |
"Eigenvalues of current H matrix -- imag part", (ftnlen)52); |
| 299 |
i__1 = *kev + *np; |
| 300 |
svout_(&debug_1.logfil, &i__1, &bounds[1], &debug_1.ndigit, "_ngets:" |
| 301 |
" Ritz estimates of the current KEV+NP Ritz values", (ftnlen) |
| 302 |
56); |
| 303 |
} |
| 304 |
|
| 305 |
return 0; |
| 306 |
|
| 307 |
/* %---------------% */ |
| 308 |
/* | End of sngets | */ |
| 309 |
/* %---------------% */ |
| 310 |
|
| 311 |
} /* sngets_ */ |
| 312 |
|