diff --git a/Project.toml b/Project.toml index 44ec8ea..35c20a7 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Roots" uuid = "f2b01f46-fcfa-551c-844a-d8ac1e96c665" -version = "2.0.22" +version = "2.0.23" [deps] ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" @@ -16,13 +16,25 @@ SymPy = "24249f21-da20-56a4-8eb1-6a02cf4ae2e6" SymPyPythonCall = "bc8888f7-b21e-4b7c-a06a-5d9c9496438c" [compat] +Aqua = "0.8" +BenchmarkTools = "1.4" ChainRulesCore = "1" +ChainRulesTestUtils = "1" CommonSolve = "0.1, 0.2" ForwardDiff = "0.10" +IntervalRootFinding = "0.5" +JSON = "0.21" +Polynomials = "1,2,3,4" +SpecialFunctions = "1,2" +Statistics = "1" SymPy = "1,2" SymPyPythonCall = "0.1, 0.2, 1" Setfield = "0.7, 0.8, 1" +Unitful = "1" +Zygote = "0.6" +Test = "<0.0.1, 1" Printf = "<0.0.1, 1" + julia = "1.0" diff --git a/src/Bracketing/alefeld_potra_shi.jl b/src/Bracketing/alefeld_potra_shi.jl index 18833a9..f78e43c 100644 --- a/src/Bracketing/alefeld_potra_shi.jl +++ b/src/Bracketing/alefeld_potra_shi.jl @@ -84,6 +84,8 @@ end # 1 is default, but this should be adjusted for different methods fncalls_per_step(::AbstractAlefeldPotraShi) = 1 +xtols(::ExactOptions,T) = eps(T)^3, eps(T) +xtols(options::AbstractUnivariateZeroOptions, T) = (options.xabstol, options.xreltol) function update_state( M::AbstractAlefeldPotraShi, F::Callable_Function, @@ -92,7 +94,7 @@ function update_state( l=NullTracks(), ) where {T,S} μ, λ = 0.5, 0.7 - atol, rtol = options.xabstol, options.xreltol + atol, rtol = xtols(options,T) tols = (; λ=λ, atol=atol, rtol=rtol) a::T, b::T, d::T, ee::T = o.xn0, o.xn1, o.d, o.ee diff --git a/src/Bracketing/brent.jl b/src/Bracketing/brent.jl index f2f264a..101e2c1 100644 --- a/src/Bracketing/brent.jl +++ b/src/Bracketing/brent.jl @@ -48,8 +48,8 @@ function update_state( fa, fb, fc = state.fxn0, state.fxn1, state.fc # next step depends on points; inverse quadratic - s::T = inverse_quadratic_step(a, b, c, fa, fb, fc) - (isnan(s) || isinf(s)) && (s = secant_step(a, b, fa, fb)) + s′ = inverse_quadratic_step(a, b, c, fa, fb, fc) + s::T = (isnan(s′) || isinf(s′)) ? secant_step(a, b, fa, fb) : s′ # guard step u, v = (3a + b) / 4, b diff --git a/src/convergence.jl b/src/convergence.jl index b8a50dd..209a52d 100644 --- a/src/convergence.jl +++ b/src/convergence.jl @@ -38,7 +38,6 @@ init_options( function init_options(M, T=Float64, S=Float64; kwargs...) d = kwargs - defs = default_tolerances(M, T, S) δₐ = get(d, :xatol, get(d, :xabstol, defs[1])) δᵣ = get(d, :xrtol, get(d, :xreltol, defs[2])) diff --git a/test/runtests.jl b/test/runtests.jl index 97d6b99..fadc97d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,7 +1,7 @@ using Roots using Test using Aqua - +using SpecialFunctions import SpecialFunctions.erf struct SomeInterval{T} @@ -37,4 +37,4 @@ VERSION >= v"1.9.0" && include("./test_extensions.jl") #include("./runbenchmarks.jl") #include("./test_derivative_free_interactive.jl") -Aqua.test_all(Roots; ambiguities=false, project_toml_formatting=false) +Aqua.test_all(Roots; ambiguities=false)