Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/mathlibs/src/parpack/pdnaupd.f
5213 views
1
c\BeginDoc
2
c
3
c\Name: pdnaupd
4
c
5
c Message Passing Layer: MPI
6
c
7
c\Description:
8
c Reverse communication interface for the Implicitly Restarted Arnoldi
9
c iteration. This subroutine computes approximations to a few eigenpairs
10
c of a linear operator "OP" with respect to a semi-inner product defined by
11
c a symmetric positive semi-definite real matrix B. B may be the identity
12
c matrix. NOTE: If the linear operator "OP" is real and symmetric
13
c with respect to the real positive semi-definite symmetric matrix B,
14
c i.e. B*OP = (OP`)*B, then subroutine dsaupd should be used instead.
15
c
16
c The computed approximate eigenvalues are called Ritz values and
17
c the corresponding approximate eigenvectors are called Ritz vectors.
18
c
19
c pdnaupd is usually called iteratively to solve one of the
20
c following problems:
21
c
22
c Mode 1: A*x = lambda*x.
23
c ===> OP = A and B = I.
24
c
25
c Mode 2: A*x = lambda*M*x, M symmetric positive definite
26
c ===> OP = inv[M]*A and B = M.
27
c ===> (If M can be factored see remark 3 below)
28
c
29
c Mode 3: A*x = lambda*M*x, M symmetric semi-definite
30
c ===> OP = Real_Part{ inv[A - sigma*M]*M } and B = M.
31
c ===> shift-and-invert mode (in real arithmetic)
32
c If OP*x = amu*x, then
33
c amu = 1/2 * [ 1/(lambda-sigma) + 1/(lambda-conjg(sigma)) ].
34
c Note: If sigma is real, i.e. imaginary part of sigma is zero;
35
c Real_Part{ inv[A - sigma*M]*M } == inv[A - sigma*M]*M
36
c amu == 1/(lambda-sigma).
37
c
38
c Mode 4: A*x = lambda*M*x, M symmetric semi-definite
39
c ===> OP = Imaginary_Part{ inv[A - sigma*M]*M } and B = M.
40
c ===> shift-and-invert mode (in real arithmetic)
41
c If OP*x = amu*x, then
42
c amu = 1/2i * [ 1/(lambda-sigma) - 1/(lambda-conjg(sigma)) ].
43
c
44
c Both mode 3 and 4 give the same enhancement to eigenvalues close to
45
c the (complex) shift sigma. However, as lambda goes to infinity,
46
c the operator OP in mode 4 dampens the eigenvalues more strongly than
47
c does OP defined in mode 3.
48
c
49
c NOTE: The action of w <- inv[A - sigma*M]*v or w <- inv[M]*v
50
c should be accomplished either by a direct method
51
c using a sparse matrix factorization and solving
52
c
53
c [A - sigma*M]*w = v or M*w = v,
54
c
55
c or through an iterative method for solving these
56
c systems. If an iterative method is used, the
57
c convergence test must be more stringent than
58
c the accuracy requirements for the eigenvalue
59
c approximations.
60
c
61
c\Usage:
62
c call pdnaupd
63
c ( COMM, IDO, BMAT, N, WHICH, NEV, TOL, RESID, NCV, V, LDV, IPARAM,
64
c IPNTR, WORKD, WORKL, LWORKL, INFO )
65
c
66
c\Arguments
67
c COMM MPI Communicator for the processor grid. (INPUT)
68
c
69
c IDO Integer. (INPUT/OUTPUT)
70
c Reverse communication flag. IDO must be zero on the first
71
c call to pdnaupd . IDO will be set internally to
72
c indicate the type of operation to be performed. Control is
73
c then given back to the calling routine which has the
74
c responsibility to carry out the requested operation and call
75
c pdnaupd with the result. The operand is given in
76
c WORKD(IPNTR(1)), the result must be put in WORKD(IPNTR(2)).
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 and 4, 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) real and imaginary parts
94
c of the shifts where INPTR(14) is the pointer
95
c into WORKL for placing the shifts. See Remark
96
c 5 below.
97
c IDO = 99: done
98
c -------------------------------------------------------------
99
c
100
c BMAT Character*1. (INPUT)
101
c BMAT specifies the type of the matrix B that defines the
102
c semi-inner product for the operator OP.
103
c BMAT = 'I' -> standard eigenvalue problem A*x = lambda*x
104
c BMAT = 'G' -> generalized eigenvalue problem A*x = lambda*B*x
105
c
106
c N Integer. (INPUT)
107
c Dimension of the eigenproblem.
108
c
109
c WHICH Character*2. (INPUT)
110
c 'LM' -> want the NEV eigenvalues of largest magnitude.
111
c 'SM' -> want the NEV eigenvalues of smallest magnitude.
112
c 'LR' -> want the NEV eigenvalues of largest real part.
113
c 'SR' -> want the NEV eigenvalues of smallest real part.
114
c 'LI' -> want the NEV eigenvalues of largest imaginary part.
115
c 'SI' -> want the NEV eigenvalues of smallest imaginary part.
116
c
117
c NEV Integer. (INPUT)
118
c Number of eigenvalues of OP to be computed. 0 < NEV < N-1.
119
c
120
c TOL Double precision scalar. (INPUT)
121
c Stopping criterion: the relative accuracy of the Ritz value
122
c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I))
123
c where ABS(RITZ(I)) is the magnitude when RITZ(I) is complex.
124
c DEFAULT = DLAMCH ('EPS') (machine precision as computed
125
c by the LAPACK auxiliary subroutine DLAMCH ).
126
c
127
c RESID Double precision array of length N. (INPUT/OUTPUT)
128
c On INPUT:
129
c If INFO .EQ. 0, a random initial residual vector is used.
130
c If INFO .NE. 0, RESID contains the initial residual vector,
131
c possibly from a previous run.
132
c On OUTPUT:
133
c RESID contains the final residual vector.
134
c
135
c NCV Integer. (INPUT)
136
c Number of columns of the matrix V. NCV must satisfy the two
137
c inequalities 2 <= NCV-NEV and NCV <= N.
138
c This will indicate how many Arnoldi vectors are generated
139
c at each iteration. After the startup phase in which NEV
140
c Arnoldi vectors are generated, the algorithm generates
141
c approximately NCV-NEV Arnoldi vectors at each subsequent update
142
c iteration. Most of the cost in generating each Arnoldi vector is
143
c in the matrix-vector operation OP*x.
144
c NOTE: 2 <= NCV-NEV in order that complex conjugate pairs of Ritz
145
c values are kept together. (See remark 4 below)
146
c
147
c V Double precision array N by NCV. (OUTPUT)
148
c Contains the final set of Arnoldi basis vectors.
149
c
150
c LDV Integer. (INPUT)
151
c Leading dimension of V exactly as declared in the calling program.
152
c
153
c IPARAM Integer array of length 11. (INPUT/OUTPUT)
154
c IPARAM(1) = ISHIFT: method for selecting the implicit shifts.
155
c The shifts selected at each iteration are used to restart
156
c the Arnoldi iteration in an implicit fashion.
157
c -------------------------------------------------------------
158
c ISHIFT = 0: the shifts are provided by the user via
159
c reverse communication. The real and imaginary
160
c parts of the NCV eigenvalues of the Hessenberg
161
c matrix H are returned in the part of the WORKL
162
c array corresponding to RITZR and RITZI. See remark
163
c 5 below.
164
c ISHIFT = 1: exact shifts with respect to the current
165
c Hessenberg matrix H. This is equivalent to
166
c restarting the iteration with a starting vector
167
c that is a linear combination of approximate Schur
168
c vectors associated with the "wanted" Ritz values.
169
c -------------------------------------------------------------
170
c
171
c IPARAM(2) = No longer referenced.
172
c
173
c IPARAM(3) = MXITER
174
c On INPUT: maximum number of Arnoldi update iterations allowed.
175
c On OUTPUT: actual number of Arnoldi update iterations taken.
176
c
177
c IPARAM(4) = NB: blocksize to be used in the recurrence.
178
c The code currently works only for NB = 1.
179
c
180
c IPARAM(5) = NCONV: number of "converged" Ritz values.
181
c This represents the number of Ritz values that satisfy
182
c the convergence criterion.
183
c
184
c IPARAM(6) = IUPD
185
c No longer referenced. Implicit restarting is ALWAYS used.
186
c
187
c IPARAM(7) = MODE
188
c On INPUT determines what type of eigenproblem is being solved.
189
c Must be 1,2,3,4; See under \Description of pdnaupd for the
190
c four modes available.
191
c
192
c IPARAM(8) = NP
193
c When ido = 3 and the user provides shifts through reverse
194
c communication (IPARAM(1)=0), pdnaupd returns NP, the number
195
c of shifts the user is to provide. 0 < NP <=NCV-NEV. See Remark
196
c 5 below.
197
c
198
c IPARAM(9) = NUMOP, IPARAM(10) = NUMOPB, IPARAM(11) = NUMREO,
199
c OUTPUT: NUMOP = total number of OP*x operations,
200
c NUMOPB = total number of B*x operations if BMAT='G',
201
c NUMREO = total number of steps of re-orthogonalization.
202
c
203
c IPNTR Integer array of length 14. (OUTPUT)
204
c Pointer to mark the starting locations in the WORKD and WORKL
205
c arrays for matrices/vectors used by the Arnoldi iteration.
206
c -------------------------------------------------------------
207
c IPNTR(1): pointer to the current operand vector X in WORKD.
208
c IPNTR(2): pointer to the current result vector Y in WORKD.
209
c IPNTR(3): pointer to the vector B * X in WORKD when used in
210
c the shift-and-invert mode.
211
c IPNTR(4): pointer to the next available location in WORKL
212
c that is untouched by the program.
213
c IPNTR(5): pointer to the NCV by NCV upper Hessenberg matrix
214
c H in WORKL.
215
c IPNTR(6): pointer to the real part of the ritz value array
216
c RITZR in WORKL.
217
c IPNTR(7): pointer to the imaginary part of the ritz value array
218
c RITZI in WORKL.
219
c IPNTR(8): pointer to the Ritz estimates in array WORKL associated
220
c with the Ritz values located in RITZR and RITZI in WORKL.
221
c IPNTR(14): pointer to the NP shifts in WORKL. See Remark 5 below.
222
c
223
c Note: IPNTR(9:13) is only referenced by dneupd . See Remark 2 below.
224
c
225
c IPNTR(9): pointer to the real part of the NCV RITZ values of the
226
c original system.
227
c IPNTR(10): pointer to the imaginary part of the NCV RITZ values of
228
c the original system.
229
c IPNTR(11): pointer to the NCV corresponding error bounds.
230
c IPNTR(12): pointer to the NCV by NCV upper quasi-triangular
231
c Schur matrix for H.
232
c IPNTR(13): pointer to the NCV by NCV matrix of eigenvectors
233
c of the upper Hessenberg matrix H. Only referenced by
234
c pdneupd if RVEC = .TRUE. See Remark 2 below.
235
c -------------------------------------------------------------
236
c
237
c WORKD Double precision work array of length 3*N. (REVERSE COMMUNICATION)
238
c Distributed array to be used in the basic Arnoldi iteration
239
c for reverse communication. The user should not use WORKD
240
c as temporary workspace during the iteration. Upon termination
241
c WORKD(1:N) contains B*RESID(1:N). If an invariant subspace
242
c associated with the converged Ritz values is desired, see remark
243
c 2 below, subroutine dneupd uses this output.
244
c See Data Distribution Note below.
245
c
246
c WORKL Double precision work array of length LWORKL. (OUTPUT/WORKSPACE)
247
c Private (replicated) array on each PE or array allocated on
248
c the front end. See Data Distribution Note below.
249
c
250
c LWORKL Integer. (INPUT)
251
c LWORKL must be at least 3*NCV**2 + 6*NCV.
252
c
253
c INFO Integer. (INPUT/OUTPUT)
254
c If INFO .EQ. 0, a randomly initial residual vector is used.
255
c If INFO .NE. 0, RESID contains the initial residual vector,
256
c possibly from a previous run.
257
c Error flag on output.
258
c = 0: Normal exit.
259
c = 1: Maximum number of iterations taken.
260
c All possible eigenvalues of OP has been found. IPARAM(5)
261
c returns the number of wanted converged Ritz values.
262
c = 2: No longer an informational error. Deprecated starting
263
c with release 2 of ARPACK.
264
c = 3: No shifts could be applied during a cycle of the
265
c Implicitly restarted Arnoldi iteration. One possibility
266
c is to increase the size of NCV relative to NEV.
267
c See remark 4 below.
268
c = -1: N must be positive.
269
c = -2: NEV must be positive.
270
c = -3: NCV-NEV >= 2 and less than or equal to N.
271
c = -4: The maximum number of Arnoldi update iteration
272
c must be greater than zero.
273
c = -5: WHICH must be one of 'LM', 'SM', 'LR', 'SR', 'LI', 'SI'
274
c = -6: BMAT must be one of 'I' or 'G'.
275
c = -7: Length of private work array is not sufficient.
276
c = -8: Error return from LAPACK eigenvalue calculation;
277
c = -9: Starting vector is zero.
278
c = -10: IPARAM(7) must be 1,2,3,4.
279
c = -11: IPARAM(7) = 1 and BMAT = 'G' are incompatable.
280
c = -12: IPARAM(1) must be equal to 0 or 1.
281
c = -9999: Could not build an Arnoldi factorization.
282
c IPARAM(5) returns the size of the current Arnoldi
283
c factorization.
284
c
285
c\Remarks
286
c 1. The computed Ritz values are approximate eigenvalues of OP. The
287
c selection of WHICH should be made with this in mind when
288
c Mode = 3 and 4. After convergence, approximate eigenvalues of the
289
c original problem may be obtained with the ARPACK subroutine dneupd .
290
c
291
c 2. If a basis for the invariant subspace corresponding to the converged Ritz
292
c values is needed, the user must call dneupd immediately following
293
c completion of pdnaupd . This is new starting with release 2 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 + 2.
305
c However, it is recommended that NCV .ge. 2*NEV+1. 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 See Chapter 8 of Reference 2 for further information.
313
c
314
c 5. When IPARAM(1) = 0, and IDO = 3, the user needs to provide the
315
c NP = IPARAM(8) real and imaginary parts of the shifts in locations
316
c real part imaginary part
317
c ----------------------- --------------
318
c 1 WORKL(IPNTR(14)) WORKL(IPNTR(14)+NP)
319
c 2 WORKL(IPNTR(14)+1) WORKL(IPNTR(14)+NP+1)
320
c . .
321
c . .
322
c . .
323
c NP WORKL(IPNTR(14)+NP-1) WORKL(IPNTR(14)+2*NP-1).
324
c
325
c Only complex conjugate pairs of shifts may be applied and the pairs
326
c must be placed in consecutive locations. The real part of the
327
c eigenvalues of the current upper Hessenberg matrix are located in
328
c WORKL(IPNTR(6)) through WORKL(IPNTR(6)+NCV-1) and the imaginary part
329
c in WORKL(IPNTR(7)) through WORKL(IPNTR(7)+NCV-1). They are ordered
330
c according to the order defined by WHICH. The complex conjugate
331
c pairs are kept together and the associated Ritz estimates are located in
332
c WORKL(IPNTR(8)), WORKL(IPNTR(8)+1), ... , WORKL(IPNTR(8)+NCV-1).
333
c
334
c-----------------------------------------------------------------------
335
c
336
c\Data Distribution Note:
337
c
338
c Fortran-D syntax:
339
c ================
340
c Double precision resid(n), v(ldv,ncv), workd(3*n), workl(lworkl)
341
c decompose d1(n), d2(n,ncv)
342
c align resid(i) with d1(i)
343
c align v(i,j) with d2(i,j)
344
c align workd(i) with d1(i) range (1:n)
345
c align workd(i) with d1(i-n) range (n+1:2*n)
346
c align workd(i) with d1(i-2*n) range (2*n+1:3*n)
347
c distribute d1(block), d2(block,:)
348
c replicated workl(lworkl)
349
c
350
c Cray MPP syntax:
351
c ===============
352
c Double precision resid(n), v(ldv,ncv), workd(n,3), workl(lworkl)
353
c shared resid(block), v(block,:), workd(block,:)
354
c replicated workl(lworkl)
355
c
356
c CM2/CM5 syntax:
357
c ==============
358
c
359
c-----------------------------------------------------------------------
360
c
361
c include 'ex-nonsym.doc'
362
c
363
c-----------------------------------------------------------------------
364
c
365
c\BeginLib
366
c
367
c\Local variables:
368
c xxxxxx real
369
c
370
c\References:
371
c 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in
372
c a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992),
373
c pp 357-385.
374
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
375
c Restarted Arnoldi Iteration", Rice University Technical Report
376
c TR95-13, Department of Computational and Applied Mathematics.
377
c 3. B.N. Parlett & Y. Saad, "Complex Shift and Invert Strategies for
378
c Real Matrices", Linear Algebra and its Applications, vol 88/89,
379
c pp 575-595, (1987).
380
c
381
c\Routines called:
382
c pdnaup2 Parallel ARPACK routine that implements the Implicitly Restarted
383
c Arnoldi Iteration.
384
c pivout Parallel ARPACK utility routine that prints integers.
385
c second ARPACK utility routine for timing.
386
c pdvout Parallel ARPACK utility routine that prints vectors.
387
c pdlamch ScaLAPACK routine that determines machine constants.
388
c
389
c\Author
390
c Danny Sorensen Phuong Vu
391
c Richard Lehoucq Cray Research, Inc. &
392
c Dept. of Computational & CRPC / Rice University
393
c Applied Mathematics Houston, Texas
394
c Rice University
395
c Houston, Texas
396
c
397
c\Parallel Modifications
398
c Kristi Maschhoff
399
c
400
c\Revision history:
401
c Starting Point: Serial Code FILE: naupd.F SID: 2.2
402
c
403
c\SCCS Information:
404
c FILE: naupd.F SID: 1.9 DATE OF SID: 04/10/01
405
c
406
c\Remarks
407
c
408
c\EndLib
409
c
410
c-----------------------------------------------------------------------
411
c
412
subroutine pdnaupd
413
& ( comm, ido, bmat, n, which, nev, tol, resid, ncv, v, ldv,
414
& iparam, ipntr, workd, workl, lworkl, info )
415
c
416
include 'mpif.h'
417
c
418
c %------------------%
419
c | MPI Variables |
420
c %------------------%
421
c
422
integer comm, myid
423
c
424
c %----------------------------------------------------%
425
c | Include files for debugging and timing information |
426
c %----------------------------------------------------%
427
c
428
include 'debug.h'
429
include 'stat.h'
430
c
431
c %------------------%
432
c | Scalar Arguments |
433
c %------------------%
434
c
435
character bmat*1, which*2
436
integer ido, info, ldv, lworkl, n, ncv, nev
437
Double precision
438
& tol
439
c
440
c %-----------------%
441
c | Array Arguments |
442
c %-----------------%
443
c
444
integer iparam(11), ipntr(14)
445
Double precision
446
& resid(n), v(ldv,ncv), workd(3*n), workl(lworkl)
447
c
448
c %------------%
449
c | Parameters |
450
c %------------%
451
c
452
Double precision
453
& one, zero
454
parameter (one = 1.0 , zero = 0.0 )
455
c
456
c %---------------%
457
c | Local Scalars |
458
c %---------------%
459
c
460
integer bounds, ierr, ih, iq, ishift, iupd, iw,
461
& ldh, ldq, levec, mode, msglvl, mxiter, nb,
462
& nev0, next, np, ritzi, ritzr, j
463
save bounds, ih, iq, ishift, iupd, iw, ldh, ldq,
464
& levec, mode, msglvl, mxiter, nb, nev0, next,
465
& np, ritzi, ritzr
466
c
467
c %----------------------%
468
c | External Subroutines |
469
c %----------------------%
470
c
471
external pdnaup2 , pdvout , pivout, second, dstatn
472
c
473
c %--------------------%
474
c | External Functions |
475
c %--------------------%
476
c
477
Double precision
478
& pdlamch10
479
external pdlamch10
480
c
481
c %-----------------------%
482
c | Executable Statements |
483
c %-----------------------%
484
c
485
if (ido .eq. 0) then
486
c
487
c %-------------------------------%
488
c | Initialize timing statistics |
489
c | & message level for debugging |
490
c %-------------------------------%
491
c
492
call dstatn
493
call second (t0)
494
msglvl = mnaupd
495
c
496
c %----------------%
497
c | Error checking |
498
c %----------------%
499
c
500
ierr = 0
501
ishift = iparam(1)
502
c levec = iparam(2)
503
mxiter = iparam(3)
504
c nb = iparam(4)
505
nb = 1
506
c
507
c %--------------------------------------------%
508
c | Revision 2 performs only implicit restart. |
509
c %--------------------------------------------%
510
c
511
iupd = 1
512
mode = iparam(7)
513
c
514
if (n .le. 0) then
515
ierr = -1
516
else if (nev .le. 0) then
517
ierr = -2
518
else if (ncv .le. nev+1) then
519
ierr = -3
520
else if (mxiter .le. 0) then
521
ierr = -4
522
else if (which .ne. 'LM' .and.
523
& which .ne. 'SM' .and.
524
& which .ne. 'LR' .and.
525
& which .ne. 'SR' .and.
526
& which .ne. 'LI' .and.
527
& which .ne. 'SI') then
528
ierr = -5
529
else if (bmat .ne. 'I' .and. bmat .ne. 'G') then
530
ierr = -6
531
else if (lworkl .lt. 3*ncv**2 + 6*ncv) then
532
ierr = -7
533
else if (mode .lt. 1 .or. mode .gt. 4) then
534
ierr = -10
535
else if (mode .eq. 1 .and. bmat .eq. 'G') then
536
ierr = -11
537
else if (ishift .lt. 0 .or. ishift .gt. 1) then
538
ierr = -12
539
end if
540
c
541
c %------------%
542
c | Error Exit |
543
c %------------%
544
c
545
if (ierr .ne. 0) then
546
info = ierr
547
ido = 99
548
go to 9000
549
end if
550
c
551
c %------------------------%
552
c | Set default parameters |
553
c %------------------------%
554
c
555
if (nb .le. 0) nb = 1
556
if (tol .le. zero) tol = pdlamch10(comm, 'EpsMach')
557
c
558
c %----------------------------------------------%
559
c | NP is the number of additional steps to |
560
c | extend the length NEV Lanczos factorization. |
561
c | NEV0 is the local variable designating the |
562
c | size of the invariant subspace desired. |
563
c %----------------------------------------------%
564
c
565
np = ncv - nev
566
nev0 = nev
567
c
568
c %-----------------------------%
569
c | Zero out internal workspace |
570
c %-----------------------------%
571
c
572
do 10 j = 1, 3*ncv**2 + 6*ncv
573
workl(j) = zero
574
10 continue
575
c
576
c %-------------------------------------------------------------%
577
c | Pointer into WORKL for address of H, RITZ, BOUNDS, Q |
578
c | etc... and the remaining workspace. |
579
c | Also update pointer to be used on output. |
580
c | Memory is laid out as follows: |
581
c | workl(1:ncv*ncv) := generated Hessenberg matrix |
582
c | workl(ncv*ncv+1:ncv*ncv+2*ncv) := real and imaginary |
583
c | parts of ritz values |
584
c | workl(ncv*ncv+2*ncv+1:ncv*ncv+3*ncv) := error bounds |
585
c | workl(ncv*ncv+3*ncv+1:2*ncv*ncv+3*ncv) := rotation matrix Q |
586
c | workl(2*ncv*ncv+3*ncv+1:3*ncv*ncv+6*ncv) := workspace |
587
c | The final workspace is needed by subroutine pdneigh called |
588
c | by pdnaup2 . Subroutine dneigh calls LAPACK routines for |
589
c | calculating eigenvalues and the last row of the eigenvector |
590
c | matrix. |
591
c %-------------------------------------------------------------%
592
c
593
ldh = ncv
594
ldq = ncv
595
ih = 1
596
ritzr = ih + ldh*ncv
597
ritzi = ritzr + ncv
598
bounds = ritzi + ncv
599
iq = bounds + ncv
600
iw = iq + ldq*ncv
601
next = iw + ncv**2 + 3*ncv
602
c
603
ipntr(4) = next
604
ipntr(5) = ih
605
ipntr(6) = ritzr
606
ipntr(7) = ritzi
607
ipntr(8) = bounds
608
ipntr(14) = iw
609
c
610
end if
611
c
612
c %-------------------------------------------------------%
613
c | Carry out the Implicitly restarted Arnoldi Iteration. |
614
c %-------------------------------------------------------%
615
c
616
call pdnaup2
617
& ( comm, ido, bmat, n, which, nev0, np, tol, resid, mode, iupd,
618
& ishift, mxiter, v, ldv, workl(ih), ldh, workl(ritzr),
619
& workl(ritzi), workl(bounds), workl(iq), ldq, workl(iw),
620
& ipntr, workd, info )
621
c
622
c %--------------------------------------------------%
623
c | ido .ne. 99 implies use of reverse communication |
624
c | to compute operations involving OP or shifts. |
625
c %--------------------------------------------------%
626
c
627
if (ido .eq. 3) iparam(8) = np
628
if (ido .ne. 99) go to 9000
629
c
630
iparam(3) = mxiter
631
iparam(5) = np
632
iparam(9) = nopx
633
iparam(10) = nbx
634
iparam(11) = nrorth
635
c
636
c %------------------------------------%
637
c | Exit if there was an informational |
638
c | error within pdnaup2 . |
639
c %------------------------------------%
640
c
641
if (info .lt. 0) go to 9000
642
if (info .eq. 2) info = 3
643
c
644
if (msglvl .gt. 0) then
645
call pivout (comm, logfil, 1, [mxiter], ndigit,
646
& '_naupd: Number of update iterations taken')
647
call pivout (comm, logfil, 1, [np], ndigit,
648
& '_naupd: Number of wanted "converged" Ritz values')
649
call pdvout (comm, logfil, np, workl(ritzr), ndigit,
650
& '_naupd: Real part of the final Ritz values')
651
call pdvout (comm, logfil, np, workl(ritzi), ndigit,
652
& '_naupd: Imaginary part of the final Ritz values')
653
call pdvout (comm, logfil, np, workl(bounds), ndigit,
654
& '_naupd: Associated Ritz estimates')
655
end if
656
c
657
call second (t1)
658
tnaupd = 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, tnaupd, tnaup2, tnaitr, titref,
671
& tgetv0, tneigh, tngets, tnapps, tnconv, trvec
672
1000 format (//,
673
& 5x, '=============================================',/
674
& 5x, '= Nonsymmetric implicit Arnoldi update code =',/
675
& 5x, '= Version Number: ', ' 2.1' , 21x, ' =',/
676
& 5x, '= Version Date: ', ' 3/19/97' , 16x, ' =',/
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_naup2 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 Hessenberg eig. 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
& 5x, 'Total time in computing final Ritz vectors = ', f12.6/)
699
end if
700
end if
701
c
702
9000 continue
703
c
704
return
705
c
706
c %----------------%
707
c | End of pdnaupd |
708
c %----------------%
709
c
710
end
711
712