Skip to content
Merged
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
1 change: 0 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
[extensions]
DiffEqBaseCUDAExt = "CUDA"
DiffEqBaseChainRulesCoreExt = "ChainRulesCore"
DiffEqBaseDistributionsExt = "Distributions"
DiffEqBaseEnzymeExt = ["ChainRulesCore", "Enzyme"]
DiffEqBaseForwardDiffExt = ["ForwardDiff"]
DiffEqBaseGTPSAExt = "GTPSA"
Expand Down
8 changes: 0 additions & 8 deletions ext/DiffEqBaseDistributionsExt.jl

This file was deleted.

431 changes: 17 additions & 414 deletions ext/DiffEqBaseForwardDiffExt.jl

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion ext/DiffEqBaseGTPSAExt.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module DiffEqBaseGTPSAExt

using DiffEqBase
import DiffEqBase: value, ODE_DEFAULT_NORM
import DiffEqBase: ODE_DEFAULT_NORM
import SciMLBase: value, unitfulvalue
using GTPSA

value(x::TPS) = scalar(x)
Expand Down
12 changes: 0 additions & 12 deletions ext/DiffEqBaseMeasurementsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@ using DiffEqBase
import DiffEqBase: value
using Measurements

function DiffEqBase.promote_u0(u0::AbstractArray{<:Measurements.Measurement},
p::AbstractArray{<:Measurements.Measurement}, t0)
u0
end
DiffEqBase.promote_u0(u0, p::AbstractArray{<:Measurements.Measurement}, t0) = eltype(p).(u0)

value(x::Type{Measurements.Measurement{T}}) where {T} = T
value(x::Measurements.Measurement) = Measurements.value(x)

unitfulvalue(x::Type{Measurements.Measurement{T}}) where {T} = T
unitfulvalue(x::Measurements.Measurement) = Measurements.value(x)

# Support adaptive steps should be errorless
@inline function DiffEqBase.ODE_DEFAULT_NORM(
u::AbstractArray{
Expand Down
28 changes: 0 additions & 28 deletions ext/DiffEqBaseMonteCarloMeasurementsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,6 @@ using DiffEqBase
import DiffEqBase: value
using MonteCarloMeasurements

function DiffEqBase.promote_u0(
u0::AbstractArray{
<:MonteCarloMeasurements.AbstractParticles,
},
p::AbstractArray{<:MonteCarloMeasurements.AbstractParticles},
t0)
u0
end
function DiffEqBase.promote_u0(u0,
p::AbstractArray{<:MonteCarloMeasurements.AbstractParticles},
t0)
eltype(p).(u0)
end

function DiffEqBase.promote_u0(::Nothing,
p::AbstractArray{<:MonteCarloMeasurements.AbstractParticles},
t0)
return nothing
end

DiffEqBase.value(x::Type{MonteCarloMeasurements.AbstractParticles{T, N}}) where {T, N} = T
DiffEqBase.value(x::MonteCarloMeasurements.AbstractParticles) = mean(x.particles)
function DiffEqBase.unitfulvalue(x::Type{MonteCarloMeasurements.AbstractParticles{
T, N}}) where {T, N}
T
end
DiffEqBase.unitfulvalue(x::MonteCarloMeasurements.AbstractParticles) = mean(x.particles)

# Support adaptive steps should be errorless
@inline function DiffEqBase.ODE_DEFAULT_NORM(
u::AbstractArray{
Expand Down
14 changes: 0 additions & 14 deletions ext/DiffEqBaseMooncakeExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,4 @@ import Mooncake: rrule!!, CoDual, zero_fcodual, @is_primitive,
},
true,)

@zero_adjoint MinimalCtx Tuple{typeof(DiffEqBase.numargs), Any}
@is_primitive MinimalCtx Tuple{
typeof(DiffEqBase.set_mooncakeoriginator_if_mooncake), SciMLBase.ChainRulesOriginator
}

@mooncake_overlay DiffEqBase.set_mooncakeoriginator_if_mooncake(x::SciMLBase.ADOriginator) = SciMLBase.MooncakeOriginator()

function rrule!!(
f::CoDual{typeof(DiffEqBase.set_mooncakeoriginator_if_mooncake)},
X::CoDual{SciMLBase.ChainRulesOriginator}
)
return zero_fcodual(SciMLBase.MooncakeOriginator()), NoPullback(f, X)
end

end
51 changes: 0 additions & 51 deletions ext/DiffEqBaseReverseDiffExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,6 @@ import DiffEqBase: value
import ReverseDiff
import DiffEqBase.ArrayInterface

function DiffEqBase.anyeltypedual(::Type{T},
::Type{Val{counter}} = Val{0}) where {counter} where {
V, D, N, VA, DA, T <: ReverseDiff.TrackedArray{V, D, N, VA, DA}}
DiffEqBase.anyeltypedual(V, Val{counter})
end

DiffEqBase.value(x::Type{ReverseDiff.TrackedReal{V, D, O}}) where {V, D, O} = V
function DiffEqBase.value(x::Type{
ReverseDiff.TrackedArray{V, D, N, VA, DA},
}) where {V, D,
N, VA,
DA}
Array{V, N}
end
DiffEqBase.value(x::ReverseDiff.TrackedReal) = x.value
DiffEqBase.value(x::ReverseDiff.TrackedArray) = x.value

DiffEqBase.unitfulvalue(x::Type{ReverseDiff.TrackedReal{V, D, O}}) where {V, D, O} = V
function DiffEqBase.unitfulvalue(x::Type{
ReverseDiff.TrackedArray{V, D, N, VA, DA},
}) where {V, D,
N, VA,
DA}
Array{V, N}
end
DiffEqBase.unitfulvalue(x::ReverseDiff.TrackedReal) = x.value
DiffEqBase.unitfulvalue(x::ReverseDiff.TrackedArray) = x.value

# Force TrackedArray from TrackedReal when reshaping W\b
DiffEqBase._reshape(v::AbstractVector{<:ReverseDiff.TrackedReal}, siz) = reduce(vcat, v)

DiffEqBase.promote_u0(u0::ReverseDiff.TrackedArray, p::ReverseDiff.TrackedArray, t0) = u0
function DiffEqBase.promote_u0(u0::AbstractArray{<:ReverseDiff.TrackedReal},
p::ReverseDiff.TrackedArray, t0)
u0
end
function DiffEqBase.promote_u0(u0::ReverseDiff.TrackedArray,
p::AbstractArray{<:ReverseDiff.TrackedReal}, t0)
u0
end
function DiffEqBase.promote_u0(u0::AbstractArray{<:ReverseDiff.TrackedReal},
p::AbstractArray{<:ReverseDiff.TrackedReal}, t0)
u0
end
DiffEqBase.promote_u0(u0, p::ReverseDiff.TrackedArray, t0) = ReverseDiff.track(u0)
function DiffEqBase.promote_u0(
u0, p::ReverseDiff.TrackedArray{T}, t0) where {T <: ReverseDiff.ForwardDiff.Dual}
ReverseDiff.track(T.(u0))
end
DiffEqBase.promote_u0(u0, p::AbstractArray{<:ReverseDiff.TrackedReal}, t0) = eltype(p).(u0)

# Support adaptive with non-tracked time
@inline function DiffEqBase.ODE_DEFAULT_NORM(u::ReverseDiff.TrackedArray, t)
sqrt(sum(abs2, DiffEqBase.value(u)) / length(u))
Expand Down
30 changes: 0 additions & 30 deletions ext/DiffEqBaseTrackerExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,6 @@ using DiffEqBase
import DiffEqBase: value
import Tracker

DiffEqBase.value(x::Type{Tracker.TrackedReal{T}}) where {T} = T
DiffEqBase.value(x::Type{Tracker.TrackedArray{T, N, A}}) where {T, N, A} = Array{T, N}
DiffEqBase.value(x::Tracker.TrackedReal) = x.data
DiffEqBase.value(x::Tracker.TrackedArray) = x.data

DiffEqBase.unitfulvalue(x::Type{Tracker.TrackedReal{T}}) where {T} = T
function DiffEqBase.unitfulvalue(x::Type{Tracker.TrackedArray{T, N, A}}) where {T, N, A}
Array{T, N}
end
DiffEqBase.unitfulvalue(x::Tracker.TrackedReal) = x.data
DiffEqBase.unitfulvalue(x::Tracker.TrackedArray) = x.data

DiffEqBase.promote_u0(u0::Tracker.TrackedArray, p::Tracker.TrackedArray, t0) = u0
function DiffEqBase.promote_u0(u0::AbstractArray{<:Tracker.TrackedReal},
p::Tracker.TrackedArray, t0)
u0
end
function DiffEqBase.promote_u0(u0::Tracker.TrackedArray,
p::AbstractArray{<:Tracker.TrackedReal}, t0)
u0
end
function DiffEqBase.promote_u0(u0::AbstractArray{<:Tracker.TrackedReal},
p::AbstractArray{<:Tracker.TrackedReal}, t0)
u0
end
DiffEqBase.promote_u0(u0, p::Tracker.TrackedArray, t0) = Tracker.track(u0)
DiffEqBase.promote_u0(u0, p::AbstractArray{<:Tracker.TrackedReal}, t0) = eltype(p).(u0)

@inline Base.any(f::Function, x::Tracker.TrackedArray) = any(f, Tracker.data(x))

# Support adaptive with non-tracked time
@inline function DiffEqBase.ODE_DEFAULT_NORM(u::Tracker.TrackedArray, t)
sqrt(sum(abs2, DiffEqBase.value(u)) / length(u))
Expand Down
2 changes: 1 addition & 1 deletion ext/DiffEqBaseUnitfulExt.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module DiffEqBaseUnitfulExt

using DiffEqBase
import DiffEqBase: value
import SciMLBase: unitfulvalue, value
using Unitful

# Support adaptive errors should be errorless for exponentiation
Expand Down
18 changes: 11 additions & 7 deletions src/DiffEqBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,17 @@ using SciMLBase: @def, DEIntegrator, AbstractDEProblem,

import SciMLBase: solve, init, step!, solve!, __init, __solve, update_coefficients!,
update_coefficients, isadaptive, wrapfun_oop, wrapfun_iip,
unwrap_fw, promote_tspan, set_u!, set_t!, set_ut!
unwrap_fw, promote_tspan, set_u!, set_t!, set_ut!,
extract_alg, checkkwargs, has_kwargs, _concrete_solve_adjoint, _concrete_solve_forward,
eltypedual, get_updated_symbolic_problem, get_concrete_p, get_concrete_u0, promote_u0,
isconcreteu0, isconcretedu0, get_concrete_du0, _reshape, value, unitfulvalue, anyeltypedual, allowedkeywords,
sse, totallength, __sum, DualEltypeChecker, KeywordArgError, KeywordArgWarn, KeywordArgSilent, KWARGWARN_MESSAGE, KWARGERROR_MESSAGE,
CommonKwargError, IncompatibleInitialConditionError, NO_DEFAULT_ALGORITHM_MESSAGE, NoDefaultAlgorithmError, NO_TSPAN_MESSAGE, NoTspanError,
NAN_TSPAN_MESSAGE, NaNTspanError, NON_SOLVER_MESSAGE, NonSolverError, NOISE_SIZE_MESSAGE, NoiseSizeIncompatabilityError, PROBSOLVER_PAIRING_MESSAGE,
ProblemSolverPairingError, compatible_problem_types, DIRECT_AUTODIFF_INCOMPATABILITY_MESSAGE, DirectAutodiffError, NONNUMBER_ELTYPE_MESSAGE, NonNumberEltypeError,
GENERIC_NUMBER_TYPE_ERROR_MESSAGE, GenericNumberTypeError, COMPLEX_SUPPORT_ERROR_MESSAGE, ComplexSupportError, COMPLEX_TSPAN_ERROR_MESSAGE, ComplexTspanError,
TUPLE_STATE_ERROR_MESSAGE, TupleStateError, MASS_MATRIX_ERROR_MESSAGE, IncompatibleMassMatrixError, LATE_BINDING_TSTOPS_ERROR_MESSAGE, LateBindingTstopsNotSupportedError,
NONCONCRETE_ELTYPE_MESSAGE, NonConcreteEltypeError, _vec

import SciMLStructures

Expand All @@ -107,10 +117,6 @@ import SymbolicIndexingInterface as SII

## Extension Functions

eltypedual(x) = false
promote_u0(::Nothing, p, t0) = nothing
isdualtype(::Type{T}) where {T} = false

## Types

"""
Expand Down Expand Up @@ -167,6 +173,4 @@ export initialize!, finalize!

export SensitivityADPassThrough

export KeywordArgError, KeywordArgWarn, KeywordArgSilent

end # module
Loading
Loading