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