Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/mathlibs/src/arpack/dnconv.f
5176 views
1
c-----------------------------------------------------------------------
2
c\BeginDoc
3
c
4
c\Name: dnconv
5
c
6
c\Description:
7
c Convergence testing for the nonsymmetric Arnoldi eigenvalue routine.
8
c
9
c\Usage:
10
c call dnconv
11
c ( N, RITZR, RITZI, BOUNDS, TOL, NCONV )
12
c
13
c\Arguments
14
c N Integer. (INPUT)
15
c Number of Ritz values to check for convergence.
16
c
17
c RITZR, Double precision arrays of length N. (INPUT)
18
c RITZI Real and imaginary parts of the Ritz values to be checked
19
c for convergence.
20
21
c BOUNDS Double precision array of length N. (INPUT)
22
c Ritz estimates for the Ritz values in RITZR and RITZI.
23
c
24
c TOL Double precision scalar. (INPUT)
25
c Desired backward error for a Ritz value to be considered
26
c "converged".
27
c
28
c NCONV Integer scalar. (OUTPUT)
29
c Number of "converged" Ritz values.
30
c
31
c\EndDoc
32
c
33
c-----------------------------------------------------------------------
34
c
35
c\BeginLib
36
c
37
c\Local variables:
38
c xxxxxx real
39
c
40
c\Routines called:
41
c second ARPACK utility routine for timing.
42
c dlamch LAPACK routine that determines machine constants.
43
c dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
44
c
45
c\Author
46
c Danny Sorensen Phuong Vu
47
c Richard Lehoucq CRPC / Rice University
48
c Dept. of Computational & Houston, Texas
49
c Applied Mathematics
50
c Rice University
51
c Houston, Texas
52
c
53
c\Revision history:
54
c xx/xx/92: Version ' 2.1'
55
c
56
c\SCCS Information: @(#)
57
c FILE: nconv.F SID: 2.3 DATE OF SID: 4/20/96 RELEASE: 2
58
c
59
c\Remarks
60
c 1. xxxx
61
c
62
c\EndLib
63
c
64
c-----------------------------------------------------------------------
65
c
66
subroutine dnconv (n, ritzr, ritzi, bounds, tol, nconv)
67
c
68
c %----------------------------------------------------%
69
c | Include files for debugging and timing information |
70
c %----------------------------------------------------%
71
c
72
include 'debug.h'
73
include 'stat.h'
74
c
75
c %------------------%
76
c | Scalar Arguments |
77
c %------------------%
78
c
79
integer n, nconv
80
Double precision
81
& tol
82
c
83
c %-----------------%
84
c | Array Arguments |
85
c %-----------------%
86
87
Double precision
88
& ritzr(n), ritzi(n), bounds(n)
89
c
90
c %---------------%
91
c | Local Scalars |
92
c %---------------%
93
c
94
integer i
95
Double precision
96
& temp, eps23
97
c
98
c %--------------------%
99
c | External Functions |
100
c %--------------------%
101
c
102
Double precision
103
& dlapy2, dlamch
104
external dlapy2, dlamch
105
106
c %-----------------------%
107
c | Executable Statements |
108
c %-----------------------%
109
c
110
c %-------------------------------------------------------------%
111
c | Convergence test: unlike in the symmetric code, I am not |
112
c | using things like refined error bounds and gap condition |
113
c | because I don't know the exact equivalent concept. |
114
c | |
115
c | Instead the i-th Ritz value is considered "converged" when: |
116
c | |
117
c | bounds(i) .le. ( TOL * | ritz | ) |
118
c | |
119
c | for some appropriate choice of norm. |
120
c %-------------------------------------------------------------%
121
c
122
call second (t0)
123
c
124
c %---------------------------------%
125
c | Get machine dependent constant. |
126
c %---------------------------------%
127
c
128
eps23 = dlamch('Epsilon-Machine')
129
eps23 = eps23**(2.0D+0 / 3.0D+0)
130
c
131
nconv = 0
132
do 20 i = 1, n
133
temp = max( eps23, dlapy2( ritzr(i), ritzi(i) ) )
134
if (bounds(i) .le. tol*temp) nconv = nconv + 1
135
20 continue
136
c
137
call second (t1)
138
tnconv = tnconv + (t1 - t0)
139
c
140
return
141
c
142
c %---------------%
143
c | End of dnconv |
144
c %---------------%
145
c
146
end
147
148