@@ -36,24 +36,45 @@ init_options(
3636 kwargs... ,
3737) where {T,S} = init_options (M, T, S; kwargs... )
3838
39+ # this function is an issue (#446) it is type unstable.
40+ # this is a fall back now, but in #446 more
41+ # specific choices based on M are made.
3942function init_options (M, T= Float64, S= Float64; kwargs... )
4043 d = kwargs
41-
4244 defs = default_tolerances (M, T, S)
4345 δₐ = get (d, :xatol , get (d, :xabstol , defs[1 ]))
4446 δᵣ = get (d, :xrtol , get (d, :xreltol , defs[2 ]))
4547 ϵₐ = get (d, :atol , get (d, :abstol , defs[3 ]))
4648 ϵᵣ = get (d, :rtol , get (d, :reltol , defs[4 ]))
47- M = get (d, :maxiters , get (d, :maxevals , get (d, :maxsteps , defs[5 ])))
49+ maxiters = get (d, :maxiters , get (d, :maxevals , get (d, :maxsteps , defs[5 ])))
4850 strict = get (d, :strict , defs[6 ])
4951
50- iszero (δₐ) && iszero (δᵣ) && iszero (ϵₐ) && iszero (ϵᵣ) && return ExactOptions (M , strict)
51- iszero (δₐ) && iszero (δᵣ) && return XExactOptions (ϵₐ, ϵᵣ, M , strict)
52- iszero (ϵₐ) && iszero (ϵᵣ) && return FExactOptions (δₐ, δᵣ, M , strict)
52+ iszero (δₐ) && iszero (δᵣ) && iszero (ϵₐ) && iszero (ϵᵣ) && return ExactOptions (maxiters , strict)
53+ iszero (δₐ) && iszero (δᵣ) && return XExactOptions (ϵₐ, ϵᵣ, maxiters , strict)
54+ iszero (ϵₐ) && iszero (ϵᵣ) && return FExactOptions (δₐ, δᵣ, maxiters , strict)
5355
54- return UnivariateZeroOptions (δₐ, δᵣ, ϵₐ, ϵᵣ, M , strict)
56+ return UnivariateZeroOptions (δₐ, δᵣ, ϵₐ, ϵᵣ, maxiters , strict)
5557end
5658
59+ function init_options (
60+ M:: AbstractNonBracketingMethod ,
61+ state:: AbstractUnivariateZeroState{T,S} ;
62+ kwargs... ,
63+ ) where {T,S}
64+
65+ d = kwargs
66+ defs = default_tolerances (M, T, S)
67+ δₐ = get (d, :xatol , get (d, :xabstol , defs[1 ]))
68+ δᵣ = get (d, :xrtol , get (d, :xreltol , defs[2 ]))
69+ ϵₐ = get (d, :atol , get (d, :abstol , defs[3 ]))
70+ ϵᵣ = get (d, :rtol , get (d, :reltol , defs[4 ]))
71+ maxiters = get (d, :maxiters , get (d, :maxevals , get (d, :maxsteps , defs[5 ])))
72+ strict = get (d, :strict , defs[6 ])
73+
74+ return UnivariateZeroOptions (δₐ, δᵣ, ϵₐ, ϵᵣ, maxiters, strict)
75+ end
76+
77+
5778# # --------------------------------------------------
5879
5980"""
@@ -309,6 +330,10 @@ function decide_convergence(
309330 # _is_f_approx_0(fxn1, xn1, options.abstol, options.reltol) && return xn1
310331 else
311332 if val == :x_converged
333+ # The XExact case isn't always spelled out in the type, so
334+ # we replicate a bit here
335+ δ, ϵ = options. abstol, options. reltol
336+ iszero (δ) && iszero (ϵ) && return xn1
312337 is_approx_zero_f (M, state, options, true ) && return xn1
313338 elseif val == :not_converged
314339 # this is the case where runaway can happen
0 commit comments