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