| 1 |
/* ./src_f77/ssaupd.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_SSAUPD; |
| 15 |
|
| 16 |
#define debug_1 debug_SSAUPD |
| 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_SSAUPD; |
| 25 |
|
| 26 |
#define timing_1 timing_SSAUPD |
| 27 |
|
| 28 |
/* Table of constant values */ |
| 29 |
|
| 30 |
static integer c__1 = 1; |
| 31 |
|
| 32 |
/* ----------------------------------------------------------------------- */ |
| 33 |
/* \BeginDoc */ |
| 34 |
|
| 35 |
/* \Name: ssaupd */ |
| 36 |
|
| 37 |
/* \Description: */ |
| 38 |
|
| 39 |
/* Reverse communication interface for the Implicitly Restarted Arnoldi */ |
| 40 |
/* Iteration. For symmetric problems this reduces to a variant of the Lanczos */ |
| 41 |
/* method. This method has been designed to compute approximations to a */ |
| 42 |
/* few eigenpairs of a linear operator OP that is real and symmetric */ |
| 43 |
/* with respect to a real positive semi-definite symmetric matrix B, */ |
| 44 |
/* i.e. */ |
| 45 |
|
| 46 |
/* B*OP = (OP`)*B. */ |
| 47 |
|
| 48 |
/* Another way to express this condition is */ |
| 49 |
|
| 50 |
/* < x,OPy > = < OPx,y > where < z,w > = z`Bw . */ |
| 51 |
|
| 52 |
/* In the standard eigenproblem B is the identity matrix. */ |
| 53 |
/* ( A` denotes transpose of A) */ |
| 54 |
|
| 55 |
/* The computed approximate eigenvalues are called Ritz values and */ |
| 56 |
/* the corresponding approximate eigenvectors are called Ritz vectors. */ |
| 57 |
|
| 58 |
/* ssaupd is usually called iteratively to solve one of the */ |
| 59 |
/* following problems: */ |
| 60 |
|
| 61 |
/* Mode 1: A*x = lambda*x, A symmetric */ |
| 62 |
/* ===> OP = A and B = I. */ |
| 63 |
|
| 64 |
/* Mode 2: A*x = lambda*M*x, A symmetric, M symmetric positive definite */ |
| 65 |
/* ===> OP = inv[M]*A and B = M. */ |
| 66 |
/* ===> (If M can be factored see remark 3 below) */ |
| 67 |
|
| 68 |
/* Mode 3: K*x = lambda*M*x, K symmetric, M symmetric positive semi-definite */ |
| 69 |
/* ===> OP = (inv[K - sigma*M])*M and B = M. */ |
| 70 |
/* ===> Shift-and-Invert mode */ |
| 71 |
|
| 72 |
/* Mode 4: K*x = lambda*KG*x, K symmetric positive semi-definite, */ |
| 73 |
/* KG symmetric indefinite */ |
| 74 |
/* ===> OP = (inv[K - sigma*KG])*K and B = K. */ |
| 75 |
/* ===> Buckling mode */ |
| 76 |
|
| 77 |
/* Mode 5: A*x = lambda*M*x, A symmetric, M symmetric positive semi-definite */ |
| 78 |
/* ===> OP = inv[A - sigma*M]*[A + sigma*M] and B = M. */ |
| 79 |
/* ===> Cayley transformed mode */ |
| 80 |
|
| 81 |
/* NOTE: The action of w <- inv[A - sigma*M]*v or w <- inv[M]*v */ |
| 82 |
/* should be accomplished either by a direct method */ |
| 83 |
/* using a sparse matrix factorization and solving */ |
| 84 |
|
| 85 |
/* [A - sigma*M]*w = v or M*w = v, */ |
| 86 |
|
| 87 |
/* or through an iterative method for solving these */ |
| 88 |
/* systems. If an iterative method is used, the */ |
| 89 |
/* convergence test must be more stringent than */ |
| 90 |
/* the accuracy requirements for the eigenvalue */ |
| 91 |
/* approximations. */ |
| 92 |
|
| 93 |
/* \Usage: */ |
| 94 |
/* call ssaupd */ |
| 95 |
/* ( IDO, BMAT, N, WHICH, NEV, TOL, RESID, NCV, V, LDV, IPARAM, */ |
| 96 |
/* IPNTR, WORKD, WORKL, LWORKL, INFO ) */ |
| 97 |
|
| 98 |
/* \Arguments */ |
| 99 |
/* IDO Integer. (INPUT/OUTPUT) */ |
| 100 |
/* Reverse communication flag. IDO must be zero on the first */ |
| 101 |
/* call to ssaupd. IDO will be set internally to */ |
| 102 |
/* indicate the type of operation to be performed. Control is */ |
| 103 |
/* then given back to the calling routine which has the */ |
| 104 |
/* responsibility to carry out the requested operation and call */ |
| 105 |
/* ssaupd with the result. The operand is given in */ |
| 106 |
/* WORKD(IPNTR(1)), the result must be put in WORKD(IPNTR(2)). */ |
| 107 |
/* (If Mode = 2 see remark 5 below) */ |
| 108 |
/* ------------------------------------------------------------- */ |
| 109 |
/* IDO = 0: first call to the reverse communication interface */ |
| 110 |
/* IDO = -1: compute Y = OP * X where */ |
| 111 |
/* IPNTR(1) is the pointer into WORKD for X, */ |
| 112 |
/* IPNTR(2) is the pointer into WORKD for Y. */ |
| 113 |
/* This is for the initialization phase to force the */ |
| 114 |
/* starting vector into the range of OP. */ |
| 115 |
/* IDO = 1: compute Y = OP * X where */ |
| 116 |
/* IPNTR(1) is the pointer into WORKD for X, */ |
| 117 |
/* IPNTR(2) is the pointer into WORKD for Y. */ |
| 118 |
/* In mode 3,4 and 5, the vector B * X is already */ |
| 119 |
/* available in WORKD(ipntr(3)). It does not */ |
| 120 |
/* need to be recomputed in forming OP * X. */ |
| 121 |
/* IDO = 2: compute Y = B * X where */ |
| 122 |
/* IPNTR(1) is the pointer into WORKD for X, */ |
| 123 |
/* IPNTR(2) is the pointer into WORKD for Y. */ |
| 124 |
/* IDO = 3: compute the IPARAM(8) shifts where */ |
| 125 |
/* IPNTR(11) is the pointer into WORKL for */ |
| 126 |
/* placing the shifts. See remark 6 below. */ |
| 127 |
/* IDO = 99: done */ |
| 128 |
/* ------------------------------------------------------------- */ |
| 129 |
|
| 130 |
/* BMAT Character*1. (INPUT) */ |
| 131 |
/* BMAT specifies the type of the matrix B that defines the */ |
| 132 |
/* semi-inner product for the operator OP. */ |
| 133 |
/* B = 'I' -> standard eigenvalue problem A*x = lambda*x */ |
| 134 |
/* B = 'G' -> generalized eigenvalue problem A*x = lambda*B*x */ |
| 135 |
|
| 136 |
/* N Integer. (INPUT) */ |
| 137 |
/* Dimension of the eigenproblem. */ |
| 138 |
|
| 139 |
/* WHICH Character*2. (INPUT) */ |
| 140 |
/* Specify which of the Ritz values of OP to compute. */ |
| 141 |
|
| 142 |
/* 'LA' - compute the NEV largest (algebraic) eigenvalues. */ |
| 143 |
/* 'SA' - compute the NEV smallest (algebraic) eigenvalues. */ |
| 144 |
/* 'LM' - compute the NEV largest (in magnitude) eigenvalues. */ |
| 145 |
/* 'SM' - compute the NEV smallest (in magnitude) eigenvalues. */ |
| 146 |
/* 'BE' - compute NEV eigenvalues, half from each end of the */ |
| 147 |
/* spectrum. When NEV is odd, compute one more from the */ |
| 148 |
/* high end than from the low end. */ |
| 149 |
/* (see remark 1 below) */ |
| 150 |
|
| 151 |
/* NEV Integer. (INPUT) */ |
| 152 |
/* Number of eigenvalues of OP to be computed. 0 < NEV < N. */ |
| 153 |
|
| 154 |
/* TOL Real scalar. (INPUT) */ |
| 155 |
/* Stopping criterion: the relative accuracy of the Ritz value */ |
| 156 |
/* is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I)). */ |
| 157 |
/* If TOL .LE. 0. is passed a default is set: */ |
| 158 |
/* DEFAULT = SLAMCH('EPS') (machine precision as computed */ |
| 159 |
/* by the LAPACK auxiliary subroutine SLAMCH). */ |
| 160 |
|
| 161 |
/* RESID Real array of length N. (INPUT/OUTPUT) */ |
| 162 |
/* On INPUT: */ |
| 163 |
/* If INFO .EQ. 0, a random initial residual vector is used. */ |
| 164 |
/* If INFO .NE. 0, RESID contains the initial residual vector, */ |
| 165 |
/* possibly from a previous run. */ |
| 166 |
/* On OUTPUT: */ |
| 167 |
/* RESID contains the final residual vector. */ |
| 168 |
|
| 169 |
/* NCV Integer. (INPUT) */ |
| 170 |
/* Number of columns of the matrix V (less than or equal to N). */ |
| 171 |
/* This will indicate how many Lanczos vectors are generated */ |
| 172 |
/* at each iteration. After the startup phase in which NEV */ |
| 173 |
/* Lanczos vectors are generated, the algorithm generates */ |
| 174 |
/* NCV-NEV Lanczos vectors at each subsequent update iteration. */ |
| 175 |
/* Most of the cost in generating each Lanczos vector is in the */ |
| 176 |
/* matrix-vector product OP*x. (See remark 4 below). */ |
| 177 |
|
| 178 |
/* V Real N by NCV array. (OUTPUT) */ |
| 179 |
/* The NCV columns of V contain the Lanczos basis vectors. */ |
| 180 |
|
| 181 |
/* LDV Integer. (INPUT) */ |
| 182 |
/* Leading dimension of V exactly as declared in the calling */ |
| 183 |
/* program. */ |
| 184 |
|
| 185 |
/* IPARAM Integer array of length 11. (INPUT/OUTPUT) */ |
| 186 |
/* IPARAM(1) = ISHIFT: method for selecting the implicit shifts. */ |
| 187 |
/* The shifts selected at each iteration are used to restart */ |
| 188 |
/* the Arnoldi iteration in an implicit fashion. */ |
| 189 |
/* ------------------------------------------------------------- */ |
| 190 |
/* ISHIFT = 0: the shifts are provided by the user via */ |
| 191 |
/* reverse communication. The NCV eigenvalues of */ |
| 192 |
/* the current tridiagonal matrix T are returned in */ |
| 193 |
/* the part of WORKL array corresponding to RITZ. */ |
| 194 |
/* See remark 6 below. */ |
| 195 |
/* ISHIFT = 1: exact shifts with respect to the reduced */ |
| 196 |
/* tridiagonal matrix T. This is equivalent to */ |
| 197 |
/* restarting the iteration with a starting vector */ |
| 198 |
/* that is a linear combination of Ritz vectors */ |
| 199 |
/* associated with the "wanted" Ritz values. */ |
| 200 |
/* ------------------------------------------------------------- */ |
| 201 |
|
| 202 |
/* IPARAM(2) = LEVEC */ |
| 203 |
/* No longer referenced. See remark 2 below. */ |
| 204 |
|
| 205 |
/* IPARAM(3) = MXITER */ |
| 206 |
/* On INPUT: maximum number of Arnoldi update iterations allowed. */ |
| 207 |
/* On OUTPUT: actual number of Arnoldi update iterations taken. */ |
| 208 |
|
| 209 |
/* IPARAM(4) = NB: blocksize to be used in the recurrence. */ |
| 210 |
/* The code currently works only for NB = 1. */ |
| 211 |
|
| 212 |
/* IPARAM(5) = NCONV: number of "converged" Ritz values. */ |
| 213 |
/* This represents the number of Ritz values that satisfy */ |
| 214 |
/* the convergence criterion. */ |
| 215 |
|
| 216 |
/* IPARAM(6) = IUPD */ |
| 217 |
/* No longer referenced. Implicit restarting is ALWAYS used. */ |
| 218 |
|
| 219 |
/* IPARAM(7) = MODE */ |
| 220 |
/* On INPUT determines what type of eigenproblem is being solved. */ |
| 221 |
/* Must be 1,2,3,4,5; See under \Description of ssaupd for the */ |
| 222 |
/* five modes available. */ |
| 223 |
|
| 224 |
/* IPARAM(8) = NP */ |
| 225 |
/* When ido = 3 and the user provides shifts through reverse */ |
| 226 |
/* communication (IPARAM(1)=0), ssaupd returns NP, the number */ |
| 227 |
/* of shifts the user is to provide. 0 < NP <=NCV-NEV. See Remark */ |
| 228 |
/* 6 below. */ |
| 229 |
|
| 230 |
/* IPARAM(9) = NUMOP, IPARAM(10) = NUMOPB, IPARAM(11) = NUMREO, */ |
| 231 |
/* OUTPUT: NUMOP = total number of OP*x operations, */ |
| 232 |
/* NUMOPB = total number of B*x operations if BMAT='G', */ |
| 233 |
/* NUMREO = total number of steps of re-orthogonalization. */ |
| 234 |
|
| 235 |
/* IPNTR Integer array of length 11. (OUTPUT) */ |
| 236 |
/* Pointer to mark the starting locations in the WORKD and WORKL */ |
| 237 |
/* arrays for matrices/vectors used by the Lanczos iteration. */ |
| 238 |
/* ------------------------------------------------------------- */ |
| 239 |
/* IPNTR(1): pointer to the current operand vector X in WORKD. */ |
| 240 |
/* IPNTR(2): pointer to the current result vector Y in WORKD. */ |
| 241 |
/* IPNTR(3): pointer to the vector B * X in WORKD when used in */ |
| 242 |
/* the shift-and-invert mode. */ |
| 243 |
/* IPNTR(4): pointer to the next available location in WORKL */ |
| 244 |
/* that is untouched by the program. */ |
| 245 |
/* IPNTR(5): pointer to the NCV by 2 tridiagonal matrix T in WORKL. */ |
| 246 |
/* IPNTR(6): pointer to the NCV RITZ values array in WORKL. */ |
| 247 |
/* IPNTR(7): pointer to the Ritz estimates in array WORKL associated */ |
| 248 |
/* with the Ritz values located in RITZ in WORKL. */ |
| 249 |
/* IPNTR(11): pointer to the NP shifts in WORKL. See Remark 6 below. */ |
| 250 |
|
| 251 |
/* Note: IPNTR(8:10) is only referenced by sseupd. See Remark 2. */ |
| 252 |
/* IPNTR(8): pointer to the NCV RITZ values of the original system. */ |
| 253 |
/* IPNTR(9): pointer to the NCV corresponding error bounds. */ |
| 254 |
/* IPNTR(10): pointer to the NCV by NCV matrix of eigenvectors */ |
| 255 |
/* of the tridiagonal matrix T. Only referenced by */ |
| 256 |
/* sseupd if RVEC = .TRUE. See Remarks. */ |
| 257 |
/* ------------------------------------------------------------- */ |
| 258 |
|
| 259 |
/* WORKD Real work array of length 3*N. (REVERSE COMMUNICATION) */ |
| 260 |
/* Distributed array to be used in the basic Arnoldi iteration */ |
| 261 |
/* for reverse communication. The user should not use WORKD */ |
| 262 |
/* as temporary workspace during the iteration. Upon termination */ |
| 263 |
/* WORKD(1:N) contains B*RESID(1:N). If the Ritz vectors are desired */ |
| 264 |
/* subroutine sseupd uses this output. */ |
| 265 |
/* See Data Distribution Note below. */ |
| 266 |
|
| 267 |
/* WORKL Real work array of length LWORKL. (OUTPUT/WORKSPACE) */ |
| 268 |
/* Private (replicated) array on each PE or array allocated on */ |
| 269 |
/* the front end. See Data Distribution Note below. */ |
| 270 |
|
| 271 |
/* LWORKL Integer. (INPUT) */ |
| 272 |
/* LWORKL must be at least NCV**2 + 8*NCV . */ |
| 273 |
|
| 274 |
/* INFO Integer. (INPUT/OUTPUT) */ |
| 275 |
/* If INFO .EQ. 0, a randomly initial residual vector is used. */ |
| 276 |
/* If INFO .NE. 0, RESID contains the initial residual vector, */ |
| 277 |
/* possibly from a previous run. */ |
| 278 |
/* Error flag on output. */ |
| 279 |
/* = 0: Normal exit. */ |
| 280 |
/* = 1: Maximum number of iterations taken. */ |
| 281 |
/* All possible eigenvalues of OP has been found. IPARAM(5) */ |
| 282 |
/* returns the number of wanted converged Ritz values. */ |
| 283 |
/* = 2: No longer an informational error. Deprecated starting */ |
| 284 |
/* with release 2 of ARPACK. */ |
| 285 |
/* = 3: No shifts could be applied during a cycle of the */ |
| 286 |
/* Implicitly restarted Arnoldi iteration. One possibility */ |
| 287 |
/* is to increase the size of NCV relative to NEV. */ |
| 288 |
/* See remark 4 below. */ |
| 289 |
/* = -1: N must be positive. */ |
| 290 |
/* = -2: NEV must be positive. */ |
| 291 |
/* = -3: NCV must be greater than NEV and less than or equal to N. */ |
| 292 |
/* = -4: The maximum number of Arnoldi update iterations allowed */ |
| 293 |
/* must be greater than zero. */ |
| 294 |
/* = -5: WHICH must be one of 'LM', 'SM', 'LA', 'SA' or 'BE'. */ |
| 295 |
/* = -6: BMAT must be one of 'I' or 'G'. */ |
| 296 |
/* = -7: Length of private work array WORKL is not sufficient. */ |
| 297 |
/* = -8: Error return from trid. eigenvalue calculation; */ |
| 298 |
/* Informatinal error from LAPACK routine ssteqr. */ |
| 299 |
/* = -9: Starting vector is zero. */ |
| 300 |
/* = -10: IPARAM(7) must be 1,2,3,4,5. */ |
| 301 |
/* = -11: IPARAM(7) = 1 and BMAT = 'G' are incompatable. */ |
| 302 |
/* = -12: IPARAM(1) must be equal to 0 or 1. */ |
| 303 |
/* = -13: NEV and WHICH = 'BE' are incompatable. */ |
| 304 |
/* = -9999: Could not build an Arnoldi factorization. */ |
| 305 |
/* IPARAM(5) returns the size of the current Arnoldi */ |
| 306 |
/* factorization. The user is advised to check that */ |
| 307 |
/* enough workspace and array storage has been allocated. */ |
| 308 |
|
| 309 |
|
| 310 |
/* \Remarks */ |
| 311 |
/* 1. The converged Ritz values are always returned in ascending */ |
| 312 |
/* algebraic order. The computed Ritz values are approximate */ |
| 313 |
/* eigenvalues of OP. The selection of WHICH should be made */ |
| 314 |
/* with this in mind when Mode = 3,4,5. After convergence, */ |
| 315 |
/* approximate eigenvalues of the original problem may be obtained */ |
| 316 |
/* with the ARPACK subroutine sseupd. */ |
| 317 |
|
| 318 |
/* 2. If the Ritz vectors corresponding to the converged Ritz values */ |
| 319 |
/* are needed, the user must call sseupd immediately following completion */ |
| 320 |
/* of ssaupd. This is new starting with version 2.1 of ARPACK. */ |
| 321 |
|
| 322 |
/* 3. If M can be factored into a Cholesky factorization M = LL` */ |
| 323 |
/* then Mode = 2 should not be selected. Instead one should use */ |
| 324 |
/* Mode = 1 with OP = inv(L)*A*inv(L`). Appropriate triangular */ |
| 325 |
/* linear systems should be solved with L and L` rather */ |
| 326 |
/* than computing inverses. After convergence, an approximate */ |
| 327 |
/* eigenvector z of the original problem is recovered by solving */ |
| 328 |
/* L`z = x where x is a Ritz vector of OP. */ |
| 329 |
|
| 330 |
/* 4. At present there is no a-priori analysis to guide the selection */ |
| 331 |
/* of NCV relative to NEV. The only formal requrement is that NCV > NEV. */ |
| 332 |
/* However, it is recommended that NCV .ge. 2*NEV. If many problems of */ |
| 333 |
/* the same type are to be solved, one should experiment with increasing */ |
| 334 |
/* NCV while keeping NEV fixed for a given test problem. This will */ |
| 335 |
/* usually decrease the required number of OP*x operations but it */ |
| 336 |
/* also increases the work and storage required to maintain the orthogonal */ |
| 337 |
/* basis vectors. The optimal "cross-over" with respect to CPU time */ |
| 338 |
/* is problem dependent and must be determined empirically. */ |
| 339 |
|
| 340 |
/* 5. If IPARAM(7) = 2 then in the Reverse commuication interface the user */ |
| 341 |
/* must do the following. When IDO = 1, Y = OP * X is to be computed. */ |
| 342 |
/* When IPARAM(7) = 2 OP = inv(B)*A. After computing A*X the user */ |
| 343 |
/* must overwrite X with A*X. Y is then the solution to the linear set */ |
| 344 |
/* of equations B*Y = A*X. */ |
| 345 |
|
| 346 |
/* 6. When IPARAM(1) = 0, and IDO = 3, the user needs to provide the */ |
| 347 |
/* NP = IPARAM(8) shifts in locations: */ |
| 348 |
/* 1 WORKL(IPNTR(11)) */ |
| 349 |
/* 2 WORKL(IPNTR(11)+1) */ |
| 350 |
/* . */ |
| 351 |
/* . */ |
| 352 |
/* . */ |
| 353 |
/* NP WORKL(IPNTR(11)+NP-1). */ |
| 354 |
|
| 355 |
/* The eigenvalues of the current tridiagonal matrix are located in */ |
| 356 |
/* WORKL(IPNTR(6)) through WORKL(IPNTR(6)+NCV-1). They are in the */ |
| 357 |
/* order defined by WHICH. The associated Ritz estimates are located in */ |
| 358 |
/* WORKL(IPNTR(8)), WORKL(IPNTR(8)+1), ... , WORKL(IPNTR(8)+NCV-1). */ |
| 359 |
|
| 360 |
/* ----------------------------------------------------------------------- */ |
| 361 |
|
| 362 |
/* \Data Distribution Note: */ |
| 363 |
|
| 364 |
/* Fortran-D syntax: */ |
| 365 |
/* ================ */ |
| 366 |
/* REAL RESID(N), V(LDV,NCV), WORKD(3*N), WORKL(LWORKL) */ |
| 367 |
/* DECOMPOSE D1(N), D2(N,NCV) */ |
| 368 |
/* ALIGN RESID(I) with D1(I) */ |
| 369 |
/* ALIGN V(I,J) with D2(I,J) */ |
| 370 |
/* ALIGN WORKD(I) with D1(I) range (1:N) */ |
| 371 |
/* ALIGN WORKD(I) with D1(I-N) range (N+1:2*N) */ |
| 372 |
/* ALIGN WORKD(I) with D1(I-2*N) range (2*N+1:3*N) */ |
| 373 |
/* DISTRIBUTE D1(BLOCK), D2(BLOCK,:) */ |
| 374 |
/* REPLICATED WORKL(LWORKL) */ |
| 375 |
|
| 376 |
/* Cray MPP syntax: */ |
| 377 |
/* =============== */ |
| 378 |
/* REAL RESID(N), V(LDV,NCV), WORKD(N,3), WORKL(LWORKL) */ |
| 379 |
/* SHARED RESID(BLOCK), V(BLOCK,:), WORKD(BLOCK,:) */ |
| 380 |
/* REPLICATED WORKL(LWORKL) */ |
| 381 |
|
| 382 |
|
| 383 |
/* \BeginLib */ |
| 384 |
|
| 385 |
/* \References: */ |
| 386 |
/* 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in */ |
| 387 |
/* a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992), */ |
| 388 |
/* pp 357-385. */ |
| 389 |
/* 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly */ |
| 390 |
/* Restarted Arnoldi Iteration", Rice University Technical Report */ |
| 391 |
/* TR95-13, Department of Computational and Applied Mathematics. */ |
| 392 |
/* 3. B.N. Parlett, "The Symmetric Eigenvalue Problem". Prentice-Hall, */ |
| 393 |
/* 1980. */ |
| 394 |
/* 4. B.N. Parlett, B. Nour-Omid, "Towards a Black Box Lanczos Program", */ |
| 395 |
/* Computer Physics Communications, 53 (1989), pp 169-179. */ |
| 396 |
/* 5. B. Nour-Omid, B.N. Parlett, T. Ericson, P.S. Jensen, "How to */ |
| 397 |
/* Implement the Spectral Transformation", Math. Comp., 48 (1987), */ |
| 398 |
/* pp 663-673. */ |
| 399 |
/* 6. R.G. Grimes, J.G. Lewis and H.D. Simon, "A Shifted Block Lanczos */ |
| 400 |
/* Algorithm for Solving Sparse Symmetric Generalized Eigenproblems", */ |
| 401 |
/* SIAM J. Matr. Anal. Apps., January (1993). */ |
| 402 |
/* 7. L. Reichel, W.B. Gragg, "Algorithm 686: FORTRAN Subroutines */ |
| 403 |
/* for Updating the QR decomposition", ACM TOMS, December 1990, */ |
| 404 |
/* Volume 16 Number 4, pp 369-377. */ |
| 405 |
/* 8. R.B. Lehoucq, D.C. Sorensen, "Implementation of Some Spectral */ |
| 406 |
/* Transformations in a k-Step Arnoldi Method". In Preparation. */ |
| 407 |
|
| 408 |
/* \Routines called: */ |
| 409 |
/* ssaup2 ARPACK routine that implements the Implicitly Restarted */ |
| 410 |
/* Arnoldi Iteration. */ |
| 411 |
/* sstats ARPACK routine that initialize timing and other statistics */ |
| 412 |
/* variables. */ |
| 413 |
/* ivout ARPACK utility routine that prints integers. */ |
| 414 |
/* second ARPACK utility routine for timing. */ |
| 415 |
/* svout ARPACK utility routine that prints vectors. */ |
| 416 |
/* slamch LAPACK routine that determines machine constants. */ |
| 417 |
|
| 418 |
/* \Authors */ |
| 419 |
/* Danny Sorensen Phuong Vu */ |
| 420 |
/* Richard Lehoucq CRPC / Rice University */ |
| 421 |
/* Dept. of Computational & Houston, Texas */ |
| 422 |
/* Applied Mathematics */ |
| 423 |
/* Rice University */ |
| 424 |
/* Houston, Texas */ |
| 425 |
|
| 426 |
/* \Revision history: */ |
| 427 |
/* 12/15/93: Version ' 2.4' */ |
| 428 |
|
| 429 |
/* \SCCS Information: @(#) */ |
| 430 |
/* FILE: saupd.F SID: 2.8 DATE OF SID: 04/10/01 RELEASE: 2 */ |
| 431 |
|
| 432 |
/* \Remarks */ |
| 433 |
/* 1. None */ |
| 434 |
|
| 435 |
/* \EndLib */ |
| 436 |
|
| 437 |
/* ----------------------------------------------------------------------- */ |
| 438 |
|
| 439 |
/* Subroutine */ int ssaupd_(integer *ido, char *bmat, integer *n, char * |
| 440 |
which, integer *nev, real *tol, real *resid, integer *ncv, real *v, |
| 441 |
integer *ldv, integer *iparam, integer *ipntr, real *workd, real * |
| 442 |
workl, integer *lworkl, integer *info, ftnlen bmat_len, ftnlen |
| 443 |
which_len) |
| 444 |
{ |
| 445 |
/* Format strings */ |
| 446 |
static char fmt_1000[] = "(//,5x,\002===================================" |
| 447 |
"=======\002,/5x,\002= Symmetric implicit Arnoldi update code " |
| 448 |
"=\002,/5x,\002= Version Number:\002,\002 2.4\002,19x,\002 =\002," |
| 449 |
"/5x,\002= Version Date: \002,\002 07/31/96\002,14x,\002 =\002,/" |
| 450 |
"5x,\002==========================================\002,/5x,\002= " |
| 451 |
"Summary of timing statistics =\002,/5x,\002===========" |
| 452 |
"===============================\002,//)"; |
| 453 |
static char fmt_1100[] = "(5x,\002Total number update iterations " |
| 454 |
" = \002,i5,/5x,\002Total number of OP*x operations " |
| 455 |
" = \002,i5,/5x,\002Total number of B*x operations = " |
| 456 |
"\002,i5,/5x,\002Total number of reorthogonalization steps = " |
| 457 |
"\002,i5,/5x,\002Total number of iterative refinement steps = " |
| 458 |
"\002,i5,/5x,\002Total number of restart steps = " |
| 459 |
"\002,i5,/5x,\002Total time in user OP*x operation = " |
| 460 |
"\002,f12.6,/5x,\002Total time in user B*x operation =" |
| 461 |
" \002,f12.6,/5x,\002Total time in Arnoldi update routine = " |
| 462 |
"\002,f12.6,/5x,\002Total time in saup2 routine =" |
| 463 |
" \002,f12.6,/5x,\002Total time in basic Arnoldi iteration loop = " |
| 464 |
"\002,f12.6,/5x,\002Total time in reorthogonalization phase =" |
| 465 |
" \002,f12.6,/5x,\002Total time in (re)start vector generation = " |
| 466 |
"\002,f12.6,/5x,\002Total time in trid eigenvalue subproblem =" |
| 467 |
" \002,f12.6,/5x,\002Total time in getting the shifts = " |
| 468 |
"\002,f12.6,/5x,\002Total time in applying the shifts =" |
| 469 |
" \002,f12.6,/5x,\002Total time in convergence testing = " |
| 470 |
"\002,f12.6)"; |
| 471 |
|
| 472 |
/* System generated locals */ |
| 473 |
integer v_dim1, v_offset, i__1, i__2; |
| 474 |
|
| 475 |
/* Builtin functions */ |
| 476 |
integer s_cmp(char *, char *, ftnlen, ftnlen), s_wsfe(cilist *), e_wsfe( |
| 477 |
void), do_fio(integer *, char *, ftnlen); |
| 478 |
|
| 479 |
/* Local variables */ |
| 480 |
static integer j; |
| 481 |
static real t0, t1; |
| 482 |
static integer nb, ih, iq, np, iw, ldh, ldq, nev0, mode, ierr, iupd, next, |
| 483 |
ritz; |
| 484 |
extern /* Subroutine */ int ivout_(integer *, integer *, integer *, |
| 485 |
integer *, char *, ftnlen), svout_(integer *, integer *, real *, |
| 486 |
integer *, char *, ftnlen), ssaup2_(integer *, char *, integer *, |
| 487 |
char *, integer *, integer *, real *, real *, integer *, integer * |
| 488 |
, integer *, integer *, real *, integer *, real *, integer *, |
| 489 |
real *, real *, real *, integer *, real *, integer *, real *, |
| 490 |
integer *, ftnlen, ftnlen); |
| 491 |
extern doublereal slamch_(char *, ftnlen); |
| 492 |
extern /* Subroutine */ int second_(real *); |
| 493 |
static integer bounds, ishift, msglvl, mxiter; |
| 494 |
extern /* Subroutine */ int sstats_(void); |
| 495 |
|
| 496 |
/* Fortran I/O blocks */ |
| 497 |
static cilist io___21 = { 0, 6, 0, fmt_1000, 0 }; |
| 498 |
static cilist io___22 = { 0, 6, 0, fmt_1100, 0 }; |
| 499 |
|
| 500 |
|
| 501 |
|
| 502 |
/* %----------------------------------------------------% */ |
| 503 |
/* | Include files for debugging and timing information | */ |
| 504 |
/* %----------------------------------------------------% */ |
| 505 |
|
| 506 |
|
| 507 |
/* \SCCS Information: @(#) */ |
| 508 |
/* FILE: debug.h SID: 2.3 DATE OF SID: 11/16/95 RELEASE: 2 */ |
| 509 |
|
| 510 |
/* %---------------------------------% */ |
| 511 |
/* | See debug.doc for documentation | */ |
| 512 |
/* %---------------------------------% */ |
| 513 |
|
| 514 |
/* %------------------% */ |
| 515 |
/* | Scalar Arguments | */ |
| 516 |
/* %------------------% */ |
| 517 |
|
| 518 |
/* %--------------------------------% */ |
| 519 |
/* | See stat.doc for documentation | */ |
| 520 |
/* %--------------------------------% */ |
| 521 |
|
| 522 |
/* \SCCS Information: @(#) */ |
| 523 |
/* FILE: stat.h SID: 2.2 DATE OF SID: 11/16/95 RELEASE: 2 */ |
| 524 |
|
| 525 |
|
| 526 |
|
| 527 |
/* %-----------------% */ |
| 528 |
/* | Array Arguments | */ |
| 529 |
/* %-----------------% */ |
| 530 |
|
| 531 |
|
| 532 |
/* %------------% */ |
| 533 |
/* | Parameters | */ |
| 534 |
/* %------------% */ |
| 535 |
|
| 536 |
|
| 537 |
/* %---------------% */ |
| 538 |
/* | Local Scalars | */ |
| 539 |
/* %---------------% */ |
| 540 |
|
| 541 |
|
| 542 |
/* %----------------------% */ |
| 543 |
/* | External Subroutines | */ |
| 544 |
/* %----------------------% */ |
| 545 |
|
| 546 |
|
| 547 |
/* %--------------------% */ |
| 548 |
/* | External Functions | */ |
| 549 |
/* %--------------------% */ |
| 550 |
|
| 551 |
|
| 552 |
/* %-----------------------% */ |
| 553 |
/* | Executable Statements | */ |
| 554 |
/* %-----------------------% */ |
| 555 |
|
| 556 |
/* Parameter adjustments */ |
| 557 |
--workd; |
| 558 |
--resid; |
| 559 |
v_dim1 = *ldv; |
| 560 |
v_offset = 1 + v_dim1; |
| 561 |
v -= v_offset; |
| 562 |
--iparam; |
| 563 |
--ipntr; |
| 564 |
--workl; |
| 565 |
|
| 566 |
/* Function Body */ |
| 567 |
if (*ido == 0) { |
| 568 |
|
| 569 |
/* %-------------------------------% */ |
| 570 |
/* | Initialize timing statistics | */ |
| 571 |
/* | & message level for debugging | */ |
| 572 |
/* %-------------------------------% */ |
| 573 |
|
| 574 |
sstats_(); |
| 575 |
second_(&t0); |
| 576 |
msglvl = debug_1.msaupd; |
| 577 |
|
| 578 |
ierr = 0; |
| 579 |
ishift = iparam[1]; |
| 580 |
mxiter = iparam[3]; |
| 581 |
/* nb = iparam(4) */ |
| 582 |
nb = 1; |
| 583 |
|
| 584 |
/* %--------------------------------------------% */ |
| 585 |
/* | Revision 2 performs only implicit restart. | */ |
| 586 |
/* %--------------------------------------------% */ |
| 587 |
|
| 588 |
iupd = 1; |
| 589 |
mode = iparam[7]; |
| 590 |
|
| 591 |
/* %----------------% */ |
| 592 |
/* | Error checking | */ |
| 593 |
/* %----------------% */ |
| 594 |
|
| 595 |
if (*n <= 0) { |
| 596 |
ierr = -1; |
| 597 |
} else if (*nev <= 0) { |
| 598 |
ierr = -2; |
| 599 |
} else if (*ncv <= *nev || *ncv > *n) { |
| 600 |
ierr = -3; |
| 601 |
} |
| 602 |
|
| 603 |
/* %----------------------------------------------% */ |
| 604 |
/* | NP is the number of additional steps to | */ |
| 605 |
/* | extend the length NEV Lanczos factorization. | */ |
| 606 |
/* %----------------------------------------------% */ |
| 607 |
|
| 608 |
np = *ncv - *nev; |
| 609 |
|
| 610 |
if (mxiter <= 0) { |
| 611 |
ierr = -4; |
| 612 |
} |
| 613 |
if (s_cmp(which, "LM", (ftnlen)2, (ftnlen)2) != 0 && s_cmp(which, |
| 614 |
"SM", (ftnlen)2, (ftnlen)2) != 0 && s_cmp(which, "LA", ( |
| 615 |
ftnlen)2, (ftnlen)2) != 0 && s_cmp(which, "SA", (ftnlen)2, ( |
| 616 |
ftnlen)2) != 0 && s_cmp(which, "BE", (ftnlen)2, (ftnlen)2) != |
| 617 |
0) { |
| 618 |
ierr = -5; |
| 619 |
} |
| 620 |
if (*(unsigned char *)bmat != 'I' && *(unsigned char *)bmat != 'G') { |
| 621 |
ierr = -6; |
| 622 |
} |
| 623 |
|
| 624 |
/* Computing 2nd power */ |
| 625 |
i__1 = *ncv; |
| 626 |
if (*lworkl < i__1 * i__1 + (*ncv << 3)) { |
| 627 |
ierr = -7; |
| 628 |
} |
| 629 |
if (mode < 1 || mode > 5) { |
| 630 |
ierr = -10; |
| 631 |
} else if (mode == 1 && *(unsigned char *)bmat == 'G') { |
| 632 |
ierr = -11; |
| 633 |
} else if (ishift < 0 || ishift > 1) { |
| 634 |
ierr = -12; |
| 635 |
} else if (*nev == 1 && s_cmp(which, "BE", (ftnlen)2, (ftnlen)2) == 0) |
| 636 |
{ |
| 637 |
ierr = -13; |
| 638 |
} |
| 639 |
|
| 640 |
/* %------------% */ |
| 641 |
/* | Error Exit | */ |
| 642 |
/* %------------% */ |
| 643 |
|
| 644 |
if (ierr != 0) { |
| 645 |
*info = ierr; |
| 646 |
*ido = 99; |
| 647 |
goto L9000; |
| 648 |
} |
| 649 |
|
| 650 |
/* %------------------------% */ |
| 651 |
/* | Set default parameters | */ |
| 652 |
/* %------------------------% */ |
| 653 |
|
| 654 |
if (nb <= 0) { |
| 655 |
nb = 1; |
| 656 |
} |
| 657 |
if (*tol <= 0.f) { |
| 658 |
*tol = slamch_("EpsMach", (ftnlen)7); |
| 659 |
} |
| 660 |
|
| 661 |
/* %----------------------------------------------% */ |
| 662 |
/* | NP is the number of additional steps to | */ |
| 663 |
/* | extend the length NEV Lanczos factorization. | */ |
| 664 |
/* | NEV0 is the local variable designating the | */ |
| 665 |
/* | size of the invariant subspace desired. | */ |
| 666 |
/* %----------------------------------------------% */ |
| 667 |
|
| 668 |
np = *ncv - *nev; |
| 669 |
nev0 = *nev; |
| 670 |
|
| 671 |
/* %-----------------------------% */ |
| 672 |
/* | Zero out internal workspace | */ |
| 673 |
/* %-----------------------------% */ |
| 674 |
|
| 675 |
/* Computing 2nd power */ |
| 676 |
i__2 = *ncv; |
| 677 |
i__1 = i__2 * i__2 + (*ncv << 3); |
| 678 |
for (j = 1; j <= i__1; ++j) { |
| 679 |
workl[j] = 0.f; |
| 680 |
/* L10: */ |
| 681 |
} |
| 682 |
|
| 683 |
/* %-------------------------------------------------------% */ |
| 684 |
/* | Pointer into WORKL for address of H, RITZ, BOUNDS, Q | */ |
| 685 |
/* | etc... and the remaining workspace. | */ |
| 686 |
/* | Also update pointer to be used on output. | */ |
| 687 |
/* | Memory is laid out as follows: | */ |
| 688 |
/* | workl(1:2*ncv) := generated tridiagonal matrix | */ |
| 689 |
/* | workl(2*ncv+1:2*ncv+ncv) := ritz values | */ |
| 690 |
/* | workl(3*ncv+1:3*ncv+ncv) := computed error bounds | */ |
| 691 |
/* | workl(4*ncv+1:4*ncv+ncv*ncv) := rotation matrix Q | */ |
| 692 |
/* | workl(4*ncv+ncv*ncv+1:7*ncv+ncv*ncv) := workspace | */ |
| 693 |
/* %-------------------------------------------------------% */ |
| 694 |
|
| 695 |
ldh = *ncv; |
| 696 |
ldq = *ncv; |
| 697 |
ih = 1; |
| 698 |
ritz = ih + (ldh << 1); |
| 699 |
bounds = ritz + *ncv; |
| 700 |
iq = bounds + *ncv; |
| 701 |
/* Computing 2nd power */ |
| 702 |
i__1 = *ncv; |
| 703 |
iw = iq + i__1 * i__1; |
| 704 |
next = iw + *ncv * 3; |
| 705 |
|
| 706 |
ipntr[4] = next; |
| 707 |
ipntr[5] = ih; |
| 708 |
ipntr[6] = ritz; |
| 709 |
ipntr[7] = bounds; |
| 710 |
ipntr[11] = iw; |
| 711 |
} |
| 712 |
|
| 713 |
/* %-------------------------------------------------------% */ |
| 714 |
/* | Carry out the Implicitly restarted Lanczos Iteration. | */ |
| 715 |
/* %-------------------------------------------------------% */ |
| 716 |
|
| 717 |
ssaup2_(ido, bmat, n, which, &nev0, &np, tol, &resid[1], &mode, &iupd, & |
| 718 |
ishift, &mxiter, &v[v_offset], ldv, &workl[ih], &ldh, &workl[ritz] |
| 719 |
, &workl[bounds], &workl[iq], &ldq, &workl[iw], &ipntr[1], &workd[ |
| 720 |
1], info, (ftnlen)1, (ftnlen)2); |
| 721 |
|
| 722 |
/* %--------------------------------------------------% */ |
| 723 |
/* | ido .ne. 99 implies use of reverse communication | */ |
| 724 |
/* | to compute operations involving OP or shifts. | */ |
| 725 |
/* %--------------------------------------------------% */ |
| 726 |
|
| 727 |
if (*ido == 3) { |
| 728 |
iparam[8] = np; |
| 729 |
} |
| 730 |
if (*ido != 99) { |
| 731 |
goto L9000; |
| 732 |
} |
| 733 |
|
| 734 |
iparam[3] = mxiter; |
| 735 |
iparam[5] = np; |
| 736 |
iparam[9] = timing_1.nopx; |
| 737 |
iparam[10] = timing_1.nbx; |
| 738 |
iparam[11] = timing_1.nrorth; |
| 739 |
|
| 740 |
/* %------------------------------------% */ |
| 741 |
/* | Exit if there was an informational | */ |
| 742 |
/* | error within ssaup2. | */ |
| 743 |
/* %------------------------------------% */ |
| 744 |
|
| 745 |
if (*info < 0) { |
| 746 |
goto L9000; |
| 747 |
} |
| 748 |
if (*info == 2) { |
| 749 |
*info = 3; |
| 750 |
} |
| 751 |
|
| 752 |
if (msglvl > 0) { |
| 753 |
ivout_(&debug_1.logfil, &c__1, &mxiter, &debug_1.ndigit, "_saupd: nu" |
| 754 |
"mber of update iterations taken", (ftnlen)41); |
| 755 |
ivout_(&debug_1.logfil, &c__1, &np, &debug_1.ndigit, "_saupd: number" |
| 756 |
" of \"converged\" Ritz values", (ftnlen)41); |
| 757 |
svout_(&debug_1.logfil, &np, &workl[ritz], &debug_1.ndigit, "_saupd:" |
| 758 |
" final Ritz values", (ftnlen)25); |
| 759 |
svout_(&debug_1.logfil, &np, &workl[bounds], &debug_1.ndigit, "_saup" |
| 760 |
"d: corresponding error bounds", (ftnlen)34); |
| 761 |
} |
| 762 |
|
| 763 |
second_(&t1); |
| 764 |
timing_1.tsaupd = t1 - t0; |
| 765 |
|
| 766 |
if (msglvl > 0) { |
| 767 |
|
| 768 |
/* %--------------------------------------------------------% */ |
| 769 |
/* | Version Number & Version Date are defined in version.h | */ |
| 770 |
/* %--------------------------------------------------------% */ |
| 771 |
|
| 772 |
s_wsfe(&io___21); |
| 773 |
e_wsfe(); |
| 774 |
s_wsfe(&io___22); |
| 775 |
do_fio(&c__1, (char *)&mxiter, (ftnlen)sizeof(integer)); |
| 776 |
do_fio(&c__1, (char *)&timing_1.nopx, (ftnlen)sizeof(integer)); |
| 777 |
do_fio(&c__1, (char *)&timing_1.nbx, (ftnlen)sizeof(integer)); |
| 778 |
do_fio(&c__1, (char *)&timing_1.nrorth, (ftnlen)sizeof(integer)); |
| 779 |
do_fio(&c__1, (char *)&timing_1.nitref, (ftnlen)sizeof(integer)); |
| 780 |
do_fio(&c__1, (char *)&timing_1.nrstrt, (ftnlen)sizeof(integer)); |
| 781 |
do_fio(&c__1, (char *)&timing_1.tmvopx, (ftnlen)sizeof(real)); |
| 782 |
do_fio(&c__1, (char *)&timing_1.tmvbx, (ftnlen)sizeof(real)); |
| 783 |
do_fio(&c__1, (char *)&timing_1.tsaupd, (ftnlen)sizeof(real)); |
| 784 |
do_fio(&c__1, (char *)&timing_1.tsaup2, (ftnlen)sizeof(real)); |
| 785 |
do_fio(&c__1, (char *)&timing_1.tsaitr, (ftnlen)sizeof(real)); |
| 786 |
do_fio(&c__1, (char *)&timing_1.titref, (ftnlen)sizeof(real)); |
| 787 |
do_fio(&c__1, (char *)&timing_1.tgetv0, (ftnlen)sizeof(real)); |
| 788 |
do_fio(&c__1, (char *)&timing_1.tseigt, (ftnlen)sizeof(real)); |
| 789 |
do_fio(&c__1, (char *)&timing_1.tsgets, (ftnlen)sizeof(real)); |
| 790 |
do_fio(&c__1, (char *)&timing_1.tsapps, (ftnlen)sizeof(real)); |
| 791 |
do_fio(&c__1, (char *)&timing_1.tsconv, (ftnlen)sizeof(real)); |
| 792 |
e_wsfe(); |
| 793 |
} |
| 794 |
|
| 795 |
L9000: |
| 796 |
|
| 797 |
return 0; |
| 798 |
|
| 799 |
/* %---------------% */ |
| 800 |
/* | End of ssaupd | */ |
| 801 |
/* %---------------% */ |
| 802 |
|
| 803 |
} /* ssaupd_ */ |
| 804 |
|