Skip to content

Commit

Permalink
No more depwarns for 0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
haampie committed Dec 25, 2020
1 parent bf52848 commit 90d4241
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 104 deletions.
14 changes: 0 additions & 14 deletions src/bicgstabl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ function bicgstabl_iterator!(x, A, b, l::Int = 2;
max_mv_products = size(A, 2),
abstol::Real = zero(real(eltype(b))),
reltol::Real = sqrt(eps(real(eltype(b)))),
tol = nothing, # TODO: Deprecations introduced in v0.8
initial_zero = false)
T = eltype(x)
n = size(A, 1)
Expand All @@ -42,12 +41,6 @@ function bicgstabl_iterator!(x, A, b, l::Int = 2;

residual = view(rs, :, 1)

# TODO: Deprecations introduced in v0.8
if tol !== nothing
Base.depwarn("The keyword argument `tol` is deprecated, use `reltol` instead.", :bicgstabl_iterator!)
reltol = tol
end

# Compute the initial residual rs[:, 1] = b - A * x
# Avoid computing A * 0.
if initial_zero
Expand Down Expand Up @@ -188,7 +181,6 @@ For BiCGStab(l) this is a less dubious term than "number of iterations";
function bicgstabl!(x, A, b, l = 2;
abstol::Real = zero(real(eltype(b))),
reltol::Real = sqrt(eps(real(eltype(b)))),
tol = nothing, # TODO: Deprecations introduced in v0.8
max_mv_products::Int = size(A, 2),
log::Bool = false,
verbose::Bool = false,
Expand All @@ -201,12 +193,6 @@ function bicgstabl!(x, A, b, l = 2;
# This doesn't yet make sense: the number of iters is smaller.
log && reserve!(history, :resnorm, max_mv_products)

# TODO: Deprecations introduced in v0.8
if tol !== nothing
Base.depwarn("The keyword argument `tol` is deprecated, use `reltol` instead.", :bicgstabl!)
reltol = tol
end

# Actually perform iterative solve
iterable = bicgstabl_iterator!(x, A, b, l; Pl = Pl,
abstol = abstol, reltol = reltol,
Expand Down
14 changes: 0 additions & 14 deletions src/cg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ end
function cg_iterator!(x, A, b, Pl = Identity();
abstol::Real = zero(real(eltype(b))),
reltol::Real = sqrt(eps(real(eltype(b)))),
tol = nothing, # TODO: Deprecations introduced in v0.8
maxiter::Int = size(A, 2),
statevars::CGStateVariables = CGStateVariables(zero(x), similar(x), similar(x)),
initially_zero::Bool = false)
Expand All @@ -130,12 +129,6 @@ function cg_iterator!(x, A, b, Pl = Identity();
u .= zero(eltype(x))
copyto!(r, b)

# TODO: Deprecations introduced in v0.8
if tol !== nothing
Base.depwarn("The keyword argument `tol` is deprecated, use `reltol` instead.", :cg_iterator!)
reltol = tol
end

# Compute r with an MV-product or not.
if initially_zero
mv_products = 0
Expand Down Expand Up @@ -213,7 +206,6 @@ cg(A, b; kwargs...) = cg!(zerox(A, b), A, b; initially_zero = true, kwargs...)
function cg!(x, A, b;
abstol::Real = zero(real(eltype(b))),
reltol::Real = sqrt(eps(real(eltype(b)))),
tol = nothing, # TODO: Deprecations introduced in v0.8
maxiter::Int = size(A, 2),
log::Bool = false,
statevars::CGStateVariables = CGStateVariables(zero(x), similar(x), similar(x)),
Expand All @@ -225,12 +217,6 @@ function cg!(x, A, b;
history[:reltol] = reltol
log && reserve!(history, :resnorm, maxiter + 1)

# TODO: Deprecations introduced in v0.8
if tol !== nothing
Base.depwarn("The keyword argument `tol` is deprecated, use `reltol` instead.", :cg!)
reltol = tol
end

# Actually perform CG
iterable = cg_iterator!(x, A, b, Pl; abstol = abstol, reltol = reltol, maxiter = maxiter,
statevars = statevars, kwargs...)
Expand Down
14 changes: 0 additions & 14 deletions src/chebyshev.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ end
function chebyshev_iterable!(x, A, b, λmin::Real, λmax::Real;
abstol::Real = zero(real(eltype(b))),
reltol::Real = sqrt(eps(real(eltype(b)))),
tol = nothing, # TODO: Deprecations introduced in v0.8
maxiter = size(A, 2),
Pl = Identity(),
initially_zero = false)
Expand All @@ -73,12 +72,6 @@ function chebyshev_iterable!(x, A, b, λmin::Real, λmax::Real;
u = zero(x)
c = similar(x)

# TODO: Deprecations introduced in v0.8
if tol !== nothing
Base.depwarn("The keyword argument `tol` is deprecated, use `reltol` instead.", :chebyshev_iterable!)
reltol = tol
end

# One MV product less
if initially_zero
mv_products = 0
Expand Down Expand Up @@ -148,7 +141,6 @@ Solve Ax = b for symmetric, definite matrices A using Chebyshev iteration.
function chebyshev!(x, A, b, λmin::Real, λmax::Real;
abstol::Real = zero(real(eltype(b))),
reltol::Real = sqrt(eps(real(eltype(b)))),
tol = nothing, # TODO: Deprecations introduced in v0.8
Pl = Identity(),
maxiter::Int=size(A, 2),
log::Bool=false,
Expand All @@ -161,12 +153,6 @@ function chebyshev!(x, A, b, λmin::Real, λmax::Real;

verbose && @printf("=== chebyshev ===\n%4s\t%7s\n","iter","resnorm")

# TODO: Deprecations introduced in v0.8
if tol !== nothing
Base.depwarn("The keyword argument `tol` is deprecated, use `reltol` instead.", :chebyshev!)
reltol = tol
end

iterable = chebyshev_iterable!(x, A, b, λmin, λmax; abstol=abstol, reltol=reltol,
maxiter=maxiter, Pl=Pl, initially_zero=initially_zero)
history.mvps = iterable.mv_products
Expand Down
14 changes: 0 additions & 14 deletions src/gmres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,11 @@ function gmres_iterable!(x, A, b;
Pr = Identity(),
abstol::Real = zero(real(eltype(b))),
reltol::Real = sqrt(eps(real(eltype(b)))),
tol = nothing, # TODO: Deprecations introduced in v0.8
restart::Int = min(20, size(A, 2)),
maxiter::Int = size(A, 2),
initially_zero::Bool = false)
T = eltype(x)

# TODO: Deprecations introduced in v0.8
if tol !== nothing
Base.depwarn("The keyword argument `tol` is deprecated, use `reltol` instead.", :gmres_iterable!)
reltol = tol
end

# Approximate solution
arnoldi = ArnoldiDecomp(A, restart, T)
residual = Residual(restart, T)
Expand Down Expand Up @@ -187,7 +180,6 @@ function gmres!(x, A, b;
Pr = Identity(),
abstol::Real = zero(real(eltype(b))),
reltol::Real = sqrt(eps(real(eltype(b)))),
tol = nothing, # TODO: Deprecations introduced in v0.8
restart::Int = min(20, size(A, 2)),
maxiter::Int = size(A, 2),
log::Bool = false,
Expand All @@ -198,12 +190,6 @@ function gmres!(x, A, b;
history[:reltol] = reltol
log && reserve!(history, :resnorm, maxiter)

# TODO: Deprecations introduced in v0.8
if tol !== nothing
Base.depwarn("The keyword argument `tol` is deprecated, use `reltol` instead.", :gmres!)
reltol = tol
end

iterable = gmres_iterable!(x, A, b; Pl = Pl, Pr = Pr,
abstol = abstol, reltol = reltol, maxiter = maxiter,
restart = restart, initially_zero = initially_zero)
Expand Down
8 changes: 0 additions & 8 deletions src/idrs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,13 @@ function idrs!(x, A, b;
s = 8,
abstol::Real = zero(real(eltype(b))),
reltol::Real = sqrt(eps(real(eltype(b)))),
tol = nothing, # TODO: Deprecations introduced in v0.8
maxiter=size(A, 2),
log::Bool=false,
kwargs...)
history = ConvergenceHistory(partial=!log)
history[:abstol] = abstol
history[:reltol] = reltol
log && reserve!(history, :resnorm, maxiter)

# TODO: Deprecations introduced in v0.8
if tol !== nothing
Base.depwarn("The keyword argument `tol` is deprecated, use `reltol` instead.", :idrs!)
reltol = tol
end

idrs_method!(history, x, A, b, s, abstol, reltol, maxiter; kwargs...)
log && shrink!(history)
log ? (x, history) : x
Expand Down
14 changes: 0 additions & 14 deletions src/minres.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ function minres_iterable!(x, A, b;
skew_hermitian::Bool = false,
abstol::Real = zero(real(eltype(b))),
reltol::Real = sqrt(eps(real(eltype(b)))),
tol = nothing, # TODO: Deprecations introduced in v0.8
maxiter = size(A, 2))
T = eltype(x)
HessenbergT = skew_hermitian ? T : real(T)
Expand All @@ -54,12 +53,6 @@ function minres_iterable!(x, A, b;
w_curr = similar(x)
w_next = similar(x)

# TODO: Deprecations introduced in v0.8
if tol !== nothing
Base.depwarn("The keyword argument `tol` is deprecated, use `reltol` instead.", :minres_iterable!)
reltol = tol
end

mv_products = 0

# For nonzero x's, we must do an MV for the initial residual vec
Expand Down Expand Up @@ -212,20 +205,13 @@ function minres!(x, A, b;
log::Bool = false,
abstol::Real = zero(real(eltype(b))),
reltol::Real = sqrt(eps(real(eltype(b)))),
tol = nothing, # TODO: Deprecations introduced in v0.8
maxiter::Int = size(A, 2),
initially_zero::Bool = false)
history = ConvergenceHistory(partial = !log)
history[:abstol] = abstol
history[:reltol] = reltol
log && reserve!(history, :resnorm, maxiter)

# TODO: Deprecations introduced in v0.8
if tol !== nothing
Base.depwarn("The keyword argument `tol` is deprecated, use `reltol` instead.", :minres!)
reltol = tol
end

iterable = minres_iterable!(x, A, b;
skew_hermitian = skew_hermitian,
abstol = abstol, reltol = reltol,
Expand Down
14 changes: 0 additions & 14 deletions src/qmr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,11 @@ end
function qmr_iterable!(x, A, b;
abstol::Real = zero(real(eltype(b))),
reltol::Real = sqrt(eps(real(eltype(b)))),
tol = nothing, # TODO: Deprecations introduced in v0.8
maxiter::Int = size(A, 2),
initially_zero::Bool = false,
lookahead::Bool = false)
T = eltype(x)

# TODO: Deprecations introduced in v0.8
if tol !== nothing
Base.depwarn("The keyword argument `tol` is deprecated, use `reltol` instead.", :qmr_iterable!)
reltol = tol
end

lanczos = LanczosDecomp(x, A, b, initially_zero = initially_zero)

resnorm = lanczos.resnorm
Expand Down Expand Up @@ -272,7 +265,6 @@ Solves the problem ``Ax = b`` with the Quasi-Minimal Residual (QMR) method.
function qmr!(x, A, b;
abstol::Real = zero(real(eltype(b))),
reltol::Real = sqrt(eps(real(eltype(b)))),
tol = nothing, # TODO: Deprecations introduced in v0.8
maxiter::Int = size(A, 2),
lookahead::Bool = false,
log::Bool = false,
Expand All @@ -283,12 +275,6 @@ function qmr!(x, A, b;
history[:reltol] = reltol
log && reserve!(history, :resnorm, maxiter)

# TODO: Deprecations introduced in v0.8
if tol !== nothing
Base.depwarn("The keyword argument `tol` is deprecated, use `reltol` instead.", :qmr!)
reltol = tol
end

iterable = qmr_iterable!(x, A, b; abstol = abstol, reltol = reltol,
maxiter = maxiter, initially_zero = initially_zero)

Expand Down
14 changes: 2 additions & 12 deletions test/deprecations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,7 @@ module TestDeprecations
using IterativeSolvers
using Test

@testset "Test depwarn for tol" begin
A = rand(2, 2)
b = rand(2)

@test_deprecated cg(A, b, tol=1.0, maxiter=1)
@test_deprecated bicgstabl(A, b, 1, tol=1.0, max_mv_products=1)
@test_deprecated chebyshev(A, b, 0.0, 1.0, tol=1.0, maxiter=1)
@test_deprecated gmres(A, b, tol=1.0, maxiter=1)
@test_deprecated idrs(A, b, tol=1.0, maxiter=1)
@test_deprecated minres(A, b, tol=1.0, maxiter=1)
@test_deprecated qmr(A, b, tol=1.0, maxiter=1)
end
# Currently nothing here.
@test true

end # module

0 comments on commit 90d4241

Please sign in to comment.