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