Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/mathlibs/src/parpack/pcngets.f
5191 views
1
c\BeginDoc
2
c
3
c\Name: pcngets
4
c
5
c Message Passing Layer: MPI
6
c
7
c\Description:
8
c Given the eigenvalues of the upper Hessenberg matrix H,
9
c computes the NP shifts AMU that are zeros of the polynomial of
10
c degree NP which filters out components of the unwanted eigenvectors
11
c corresponding to the AMU's based on some given criteria.
12
c
13
c NOTE: call this even in the case of user specified shifts in order
14
c to sort the eigenvalues, and error bounds of H for later use.
15
c
16
c\Usage:
17
c call pcngets
18
c ( COMM, ISHIFT, WHICH, KEV, NP, RITZ, BOUNDS )
19
c
20
c\Arguments
21
c COMM MPI Communicator for the processor grid. (INPUT)
22
c
23
c ISHIFT Integer. (INPUT)
24
c Method for selecting the implicit shifts at each iteration.
25
c ISHIFT = 0: user specified shifts
26
c ISHIFT = 1: exact shift with respect to the matrix H.
27
c
28
c WHICH Character*2. (INPUT)
29
c Shift selection criteria.
30
c 'LM' -> want the KEV eigenvalues of largest magnitude.
31
c 'SM' -> want the KEV eigenvalues of smallest magnitude.
32
c 'LR' -> want the KEV eigenvalues of largest REAL part.
33
c 'SR' -> want the KEV eigenvalues of smallest REAL part.
34
c 'LI' -> want the KEV eigenvalues of largest imaginary part.
35
c 'SI' -> want the KEV eigenvalues of smallest imaginary part.
36
c
37
c KEV Integer. (INPUT)
38
c The number of desired eigenvalues.
39
c
40
c NP Integer. (INPUT)
41
c The number of shifts to compute.
42
c
43
c RITZ Complex array of length KEV+NP. (INPUT/OUTPUT)
44
c On INPUT, RITZ contains the the eigenvalues of H.
45
c On OUTPUT, RITZ are sorted so that the unwanted
46
c eigenvalues are in the first NP locations and the wanted
47
c portion is in the last KEV locations. When exact shifts are
48
c selected, the unwanted part corresponds to the shifts to
49
c be applied. Also, if ISHIFT .eq. 1, the unwanted eigenvalues
50
c are further sorted so that the ones with largest Ritz values
51
c are first.
52
c
53
c BOUNDS Complex array of length KEV+NP. (INPUT/OUTPUT)
54
c Error bounds corresponding to the ordering in RITZ.
55
c
56
c
57
c
58
c\EndDoc
59
c
60
c-----------------------------------------------------------------------
61
c
62
c\BeginLib
63
c
64
c\Local variables:
65
c xxxxxx Complex
66
c
67
c\Routines called:
68
c csortc ARPACK sorting routine.
69
c pivout Parallel ARPACK utility routine that prints integers.
70
c second ARPACK utility routine for timing.
71
c pcvout Parallel ARPACK utility routine that prints vectors.
72
c
73
c\Author
74
c Danny Sorensen Phuong Vu
75
c Richard Lehoucq CRPC / Rice University
76
c Dept. of Computational & Houston, Texas
77
c Applied Mathematics
78
c Rice University
79
c Houston, Texas
80
c
81
c\Parallel Modifications
82
c Kristi Maschhoff
83
c
84
c\Revision history:
85
c Starting Point: Serial Complex Code FILE: ngets.F SID: 2.1
86
c
87
c\SCCS Information:
88
c FILE: ngets.F SID: 1.2 DATE OF SID: 4/19/96
89
c
90
c\Remarks
91
c 1. This routine does not keep complex conjugate pairs of
92
c eigenvalues together.
93
c
94
c\EndLib
95
c
96
c-----------------------------------------------------------------------
97
c
98
subroutine pcngets ( comm, ishift, which, kev, np, ritz, bounds)
99
c
100
c %--------------------%
101
c | MPI Communicator |
102
c %--------------------%
103
c
104
integer comm
105
c
106
c %----------------------------------------------------%
107
c | Include files for debugging and timing information |
108
c %----------------------------------------------------%
109
c
110
include 'debug.h'
111
include 'stat.h'
112
c
113
c %------------------%
114
c | Scalar Arguments |
115
c %------------------%
116
c
117
character*2 which
118
integer ishift, kev, np
119
c
120
c %-----------------%
121
c | Array Arguments |
122
c %-----------------%
123
c
124
Complex
125
& bounds(kev+np), ritz(kev+np)
126
c
127
c %------------%
128
c | Parameters |
129
c %------------%
130
c
131
Complex
132
& one, zero
133
parameter (one = (1.0, 0.0), zero = (0.0, 0.0))
134
c
135
c %---------------%
136
c | Local Scalars |
137
c %---------------%
138
c
139
integer msglvl
140
c
141
c %----------------------%
142
c | External Subroutines |
143
c %----------------------%
144
c
145
external pcvout, csortc, second
146
c
147
c %-----------------------%
148
c | Executable Statements |
149
c %-----------------------%
150
c
151
c %-------------------------------%
152
c | Initialize timing statistics |
153
c | & message level for debugging |
154
c %-------------------------------%
155
c
156
call second (t0)
157
msglvl = mcgets
158
c
159
call csortc (which, .true., kev+np, ritz, bounds)
160
c
161
if ( ishift .eq. 1 ) then
162
c
163
c %-------------------------------------------------------%
164
c | Sort the unwanted Ritz values used as shifts so that |
165
c | the ones with largest Ritz estimates are first |
166
c | This will tend to minimize the effects of the |
167
c | forward instability of the iteration when the shifts |
168
c | are applied in subroutine pcnapps. |
169
c | Be careful and use 'SM' since we want to sort BOUNDS! |
170
c %-------------------------------------------------------%
171
c
172
call csortc ( 'SM', .true., np, bounds, ritz )
173
c
174
end if
175
c
176
call second (t1)
177
tcgets = tcgets + (t1 - t0)
178
c
179
if (msglvl .gt. 0) then
180
call pivout (comm, logfil, 1, [kev], ndigit, '_ngets: KEV is')
181
call pivout (comm, logfil, 1, [np], ndigit, '_ngets: NP is')
182
call pcvout (comm, logfil, kev+np, ritz, ndigit,
183
& '_ngets: Eigenvalues of current H matrix ')
184
call pcvout (comm, logfil, kev+np, bounds, ndigit,
185
& '_ngets: Ritz estimates of the current KEV+NP Ritz values')
186
end if
187
c
188
return
189
c
190
c %----------------%
191
c | End of pcngets |
192
c %----------------%
193
c
194
end
195
196