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