Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workaround for SymEngine types #410

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"


Expand Down
4 changes: 3 additions & 1 deletion src/Bracketing/alefeld_potra_shi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
# 1 is default, but this should be adjusted for different methods
fncalls_per_step(::AbstractAlefeldPotraShi) = 1

xtols(::ExactOptions,T) = eps(T)^3, eps(T)

Check warning on line 87 in src/Bracketing/alefeld_potra_shi.jl

View check run for this annotation

Codecov / codecov/patch

src/Bracketing/alefeld_potra_shi.jl#L87

Added line #L87 was not covered by tests
xtols(options::AbstractUnivariateZeroOptions, T) = (options.xabstol, options.xreltol)
function update_state(
M::AbstractAlefeldPotraShi,
F::Callable_Function,
Expand All @@ -92,7 +94,7 @@
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
Expand Down
4 changes: 2 additions & 2 deletions src/Bracketing/brent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/convergence.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Roots
using Test
using Aqua

using SpecialFunctions
import SpecialFunctions.erf

struct SomeInterval{T}
Expand Down Expand Up @@ -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)
Loading