Skip to content
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
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
SciMLStructures = "53ae85a6-f571-4167-b2af-e1d143709226"
SimpleNonlinearSolve = "727e6d20-b764-4bd8-a329-72de5adea6c7"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
Expand Down Expand Up @@ -97,6 +98,7 @@ ReverseDiff = "1"
SciMLBase = "2.115.0"
SciMLOperators = "1"
SciMLStructures = "1.5"
SimpleNonlinearSolve = "2.7"
Setfield = "1"
SparseArrays = "1.9"
Static = "1"
Expand Down
10 changes: 5 additions & 5 deletions ext/DiffEqBaseForwardDiffExt.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module DiffEqBaseForwardDiffExt

using DiffEqBase, ForwardDiff
using SimpleNonlinearSolve: ITP
using DiffEqBase.ArrayInterface
using DiffEqBase: Void, FunctionWrappersWrappers, OrdinaryDiffEqTag,
AbstractTimeseriesSolution,
RecursiveArrayTools, reduce_tup, _promote_tspan, has_continuous_callback
import DiffEqBase: hasdualpromote, wrapfun_oop, wrapfun_iip, prob2dtmin,
promote_tspan, ODE_DEFAULT_NORM,
InternalITP, nextfloat_tdir
promote_tspan, ODE_DEFAULT_NORM
import SciMLBase: isdualtype, DualEltypeChecker, sse, __sum

const dualT = ForwardDiff.Dual{ForwardDiff.Tag{OrdinaryDiffEqTag, Float64}, Float64, 1}
Expand Down Expand Up @@ -153,7 +153,7 @@ end

# Differentiation of internal solver

function scalar_nlsolve_ad(prob, alg::InternalITP, args...; kwargs...)
function scalar_nlsolve_ad(prob, alg::ITP, args...; kwargs...)
f = prob.f
p = value(prob.p)

Expand Down Expand Up @@ -186,7 +186,7 @@ end
function SciMLBase.solve(
prob::IntervalNonlinearProblem{uType, iip,
<:ForwardDiff.Dual{T, V, P}},
alg::InternalITP, args...;
alg::ITP, args...;
kwargs...) where {uType, iip, T, V, P}
sol, partials = scalar_nlsolve_ad(prob, alg, args...; kwargs...)
return SciMLBase.build_solution(prob, alg, ForwardDiff.Dual{T, V, P}(sol.u, partials),
Expand All @@ -202,7 +202,7 @@ function SciMLBase.solve(
V,
P},
}},
alg::InternalITP, args...;
alg::ITP, args...;
kwargs...) where {uType, iip, T, V, P}
sol, partials = scalar_nlsolve_ad(prob, alg, args...; kwargs...)

Expand Down
3 changes: 2 additions & 1 deletion src/DiffEqBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ using SciMLBase

using SciMLOperators: AbstractSciMLOperator, AbstractSciMLScalarOperator

using SimpleNonlinearSolve: ITP

using SciMLBase: @def, DEIntegrator, AbstractDEProblem,
AbstractDiffEqInterpolation,
DECallback, AbstractDEOptions, DECache, AbstractContinuousCallback,
Expand Down Expand Up @@ -140,7 +142,6 @@ include("utils.jl")
include("stats.jl")
include("calculate_residuals.jl")
include("tableaus.jl")
include("internal_itp.jl")

include("callbacks.jl")
include("common_defaults.jl")
Expand Down
6 changes: 3 additions & 3 deletions src/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -358,17 +358,17 @@ end
# rough implementation, needs multiple type handling
# always ensures that if r = bisection(f, (x0, x1))
# then either f(nextfloat(r)) == 0 or f(nextfloat(r)) * f(r) < 0
# note: not really using bisection - uses the ITP method
# note: not really using bisection - uses the ITP method
function bisection(
f, tup, t_forward::Bool, rootfind::SciMLBase.RootfindOpt, abstol, reltol;
maxiters = 1000)
if rootfind == SciMLBase.LeftRootFind
solve(IntervalNonlinearProblem{false}(f, tup),
InternalITP(), abstol = abstol,
ITP(), abstol = abstol,
reltol = reltol).left
else
solve(IntervalNonlinearProblem{false}(f, tup),
InternalITP(), abstol = abstol,
ITP(), abstol = abstol,
reltol = reltol).right
end
end
Expand Down
87 changes: 0 additions & 87 deletions src/internal_itp.jl

This file was deleted.

5 changes: 3 additions & 2 deletions test/internal_rootfinder.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using DiffEqBase
using DiffEqBase: InternalITP, IntervalNonlinearProblem
using DiffEqBase: IntervalNonlinearProblem
using SimpleNonlinearSolve: ITP
using ForwardDiff

for Rootfinder in (InternalITP,)
for Rootfinder in (ITP,)
rf = Rootfinder()
# From SimpleNonlinearSolve
f = (u, p) -> u * u - p
Expand Down
Loading