Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 8e0a9af

Browse files
committed
Resolve ambiguities
1 parent e56a659 commit 8e0a9af

File tree

5 files changed

+4
-34
lines changed

5 files changed

+4
-34
lines changed

src/SimpleNonlinearSolve.jl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,6 @@ function SciMLBase.solve(prob::NonlinearProblem, alg::AbstractSimpleNonlinearSol
6565
return SciMLBase.__solve(prob, alg, args...; kwargs...)
6666
end
6767

68-
function SciMLBase.solve(prob::NonlinearProblem{<:Union{<:Number, <:SArray}},
69-
alg::AbstractSimpleNonlinearSolveAlgorithm, args...; abstol = nothing,
70-
reltol = nothing, kwargs...)
71-
_abstol = __get_tolerance(prob.u0, abstol, eltype(prob.u0))
72-
_reltol = __get_tolerance(prob.u0, reltol, eltype(prob.u0))
73-
return SciMLBase.__solve(prob, alg, args...; abstol = _abstol, reltol = _reltol,
74-
kwargs...)
75-
end
76-
7768
@setup_workload begin
7869
for T in (Float32, Float64)
7970
prob_no_brack_scalar = NonlinearProblem{false}((u, p) -> u .* u .- p, T(0.1), T(2))

src/ad.jl

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,6 @@ function SciMLBase.solve(prob::NonlinearProblem{<:Union{Number, <:AbstractArray}
77
sol.original)
88
end
99

10-
# Handle Ambiguities
11-
for algType in (SimpleNewtonRaphson, SimpleDFSane, SimpleTrustRegion, SimpleBroyden,
12-
SimpleLimitedMemoryBroyden, SimpleKlement, SimpleHalley)
13-
@eval begin
14-
function SciMLBase.solve(prob::NonlinearProblem{uType, iip,
15-
<:Union{<:Dual{T, V, P}, <:AbstractArray{<:Dual{T, V, P}}}},
16-
alg::$(algType), args...; kwargs...) where {uType, T, V, P, iip}
17-
sol, partials = __nlsolve_ad(prob, alg, args...; kwargs...)
18-
dual_soln = __nlsolve_dual_soln(sol.u, partials, prob.p)
19-
return SciMLBase.build_solution(prob, alg, dual_soln, sol.resid; sol.retcode,
20-
sol.stats, sol.original)
21-
end
22-
end
23-
end
24-
2510
for algType in (Bisection, Brent, Alefeld, Falsi, ITP, Ridder)
2611
@eval begin
2712
function SciMLBase.solve(prob::IntervalNonlinearProblem{uType, iip,

src/nlsolve/broyden.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ and static array problems.
66
77
### Keyword Arguments
88
9-
* `linesearch`: If `linesearch` is `Val(true)`, then we use the `LiFukushimaLineSearch`
9+
- `linesearch`: If `linesearch` is `Val(true)`, then we use the `LiFukushimaLineSearch`
1010
[1] line search else no line search is used. For advanced customization of the line
1111
search, use the [`Broyden`](@ref) algorithm in `NonlinearSolve.jl`.
12-
* `alpha`: Scale the initial jacobian initialization with `alpha`. If it is `nothing`, we
12+
- `alpha`: Scale the initial jacobian initialization with `alpha`. If it is `nothing`, we
1313
will compute the scaling using `2 * norm(fu) / max(norm(u), true)`.
1414
1515
### References

src/nlsolve/lbroyden.jl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ function SimpleLimitedMemoryBroyden(; threshold::Union{Val, Int} = Val(27),
3535
return SimpleLimitedMemoryBroyden{_unwrap_val(threshold), _unwrap_val(linesearch)}(alpha)
3636
end
3737

38-
# Don't resolve the `abstol` and `reltol` here
39-
function SciMLBase.solve(prob::NonlinearProblem{<:Union{<:Number, <:SArray}},
40-
alg::SimpleLimitedMemoryBroyden, args...; kwargs...)
41-
return SciMLBase.__solve(prob, alg, args...; kwargs...)
42-
end
43-
4438
function SciMLBase.__solve(prob::NonlinearProblem, alg::SimpleLimitedMemoryBroyden,
4539
args...; termination_condition = nothing, kwargs...)
4640
if prob.u0 isa SArray

src/utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ function init_termination_cache(abstol, reltol, du, u, ::Nothing)
282282
end
283283
function init_termination_cache(abstol, reltol, du, u, tc::AbstractNonlinearTerminationMode)
284284
T = promote_type(eltype(du), eltype(u))
285-
abstol !== nothing && (abstol = T(abstol))
286-
reltol !== nothing && (reltol = T(reltol))
285+
abstol = __get_tolerance(u, abstol, T)
286+
reltol = __get_tolerance(u, reltol, T)
287287
tc_cache = init(du, u, tc; abstol, reltol)
288288
return DiffEqBase.get_abstol(tc_cache), DiffEqBase.get_reltol(tc_cache), tc_cache
289289
end

0 commit comments

Comments
 (0)