Skip to content

Commit 0d8d216

Browse files
haampieandreasnoack
authored andcommitted
Remove RQI (#140)
1 parent d565c17 commit 0d8d216

File tree

3 files changed

+3
-69
lines changed

3 files changed

+3
-69
lines changed

src/simple.jl

Lines changed: 3 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Simple methods
2-
export powm, invpowm, rqi
2+
export powm, invpowm
33

44
####################
55
# API method calls #
@@ -95,54 +95,6 @@ function invpowm_method!{T}(log::ConvergenceHistory, K::KrylovSubspace{T}, σ::N
9595
σ+1/θ, y/θ
9696
end
9797

98-
####################
99-
# API method calls #
100-
####################
101-
102-
function rqi(A;
103-
x=nothing, shift::Number=0, tol::Real=eps(real(eltype(A)))*size(A,2)^3,
104-
maxiter::Int=size(A,2), plot::Bool=false, log::Bool=false, kwargs...
105-
)
106-
K = KrylovSubspace(A, 1)
107-
x==nothing ? initrand!(K) : init!(K, x/norm(x))
108-
109-
(plot & !log) && error("Can't plot when log keyword is false")
110-
history = ConvergenceHistory(partial=!log)
111-
history[:tol] = tol
112-
reserve!(history,:resnorm, maxiter)
113-
eig, v = rqi_method!(history, K, shift; tol=tol, maxiter=maxiter, kwargs...)
114-
(plot || log) && shrink!(history)
115-
plot && showplot(history)
116-
log ? (eig, v, history) : (eig, v)
117-
end
118-
119-
#########################
120-
# Method Implementation #
121-
#########################
122-
123-
#Rayleigh quotient iteration
124-
#XXX Doesn't work well
125-
function rqi_method!{T}(log::ConvergenceHistory, K::KrylovSubspace{T}, σ::Number;
126-
tol::Real=eps(real(T)), maxiter::Int=K.n, verbose::Bool=false
127-
)
128-
verbose && @printf("=== rqi ===\n%4s\t%7s\n","iter","resnorm")
129-
v = lastvec(K)
130-
ρ = dot(v, nextvec(K))
131-
for iter=1:maxiter
132-
nextiter!(log,mvps=1)
133-
y = (K.A-ρ*eye(K))\v
134-
θ = norm(y)
135-
ρ += dot(y,v)/θ^2
136-
v = y/θ
137-
resnorm=1/θ
138-
push!(log,:resnorm,resnorm)
139-
verbose && @printf("%3d\t%1.2e\n",iter,resnorm)
140-
θ >= 1/tol && (setconv(log, resnorm >= 0); break)
141-
end
142-
verbose && @printf("\n")
143-
ρ, v
144-
end
145-
14698
#################
14799
# Documentation #
148100
#################
@@ -153,31 +105,23 @@ doc1_call = """ powm(A)
153105
"""
154106
doc2_call = """ invpowm(A)
155107
"""
156-
doc3_call = """ rqi(A)
157-
"""
158108
doc1_msg = """Find biggest eigenvalue of `A` and its associated eigenvector
159109
using the power method.
160110
"""
161111
doc2_msg = """Find closest eigenvalue of `A` to `shift` and its associated eigenvector
162112
using the inverse power iteration method.
163113
"""
164-
doc3_msg = """Try find closest eigenvalue of `A` to `shift` and its associated eigenvector
165-
using the rayleigh quotient iteration method. This method converges rapidly
166-
but is not guaranteed to compute the eigenvalue closes to `shift`.
167-
"""
168114
doc1_karg = ""
169115
doc2_karg = "`shift::Number=0`: shift to be applied to matrix A."
170-
doc3_karg = "`shift::Number=0`: shift to be applied to matrix A."
171116

172117
doc1_version = (powm, doc1_call, doc1_msg, doc1_karg)
173118
doc2_version = (invpowm, doc2_call, doc2_msg, doc2_karg)
174-
doc3_version = (rqi, doc3_call, doc3_msg, doc3_karg)
175119

176120
i=0
177-
docstring = Vector(3)
121+
docstring = Vector(2)
178122

179123
#Build docs
180-
for (func, call, msg, karg) in [doc1_version, doc2_version, doc3_version]
124+
for (func, call, msg, karg) in [doc1_version, doc2_version]
181125
i+=1
182126
docstring[i] = """
183127
$call
@@ -239,5 +183,4 @@ end
239183

240184
@doc docstring[1] -> powm
241185
@doc docstring[2] -> invpowm
242-
@doc docstring[3] -> rqi
243186
end

test/history.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ facts("ConvergenceHistory") do
3131
plot(invpowm(A; log=true)[2])
3232
@fact true --> true
3333

34-
plot(rqi(A; log=true)[2])
35-
@fact true --> true
36-
3734
plot(svdl(A; log=true)[3])
3835
@fact true --> true
3936
end

test/simple_eigensolvers.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ for T in (Float32, Float64, Complex64, Complex128)
3737
@fact norm(eval_rand-eval_ii) --> less_than(tol)
3838
end
3939

40-
#context("Rayleigh quotient iteration") do
41-
#XXX broken?
42-
#l = eigvals_rqi(A, eigvals_rand, 2000, √eps())[2]
43-
#@fact norm(eigvals_rand-l) --> less_than(tol)
44-
#end
45-
4640
end
4741
end
4842
end

0 commit comments

Comments
 (0)