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