Skip to content

Commit 9ffea56

Browse files
committed
add static
1 parent c91ce4e commit 9ffea56

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
2929
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
3030
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
3131
SciMLStructures = "53ae85a6-f571-4167-b2af-e1d143709226"
32+
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
3233
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
3334
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
3435
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
@@ -105,6 +106,7 @@ RuntimeGeneratedFunctions = "0.5.12"
105106
SciMLOperators = "1.3"
106107
SciMLStructures = "1.1"
107108
StableRNGs = "1.0"
109+
Static = "1"
108110
StaticArrays = "1.7"
109111
StaticArraysCore = "1.4"
110112
Statistics = "1.10"

ext/SciMLBaseForwardDiffExt.jl

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,15 @@ import SciMLBase:
77
wrapfun_oop, wrapfun_iip, isdualtype, value, DualEltypeChecker,
88
AbstractTimeseriesSolution, NonlinearProblem, NonlinearLeastSquaresProblem,
99
ODEProblem, SDEProblem, RODEProblem, DDEProblem, PDEProblem, DAEProblem,
10-
RecursiveArrayTools, totallength
10+
RecursiveArrayTools, totallength, sse, anyeltypedual
11+
12+
import Static: reduce_tup
1113

1214

1315

1416
eltypedual(x) = eltype(x) <: ForwardDiff.Dual
1517
isdualtype(::Type{<:ForwardDiff.Dual}) = true
1618

17-
# Copy of the other prob2dtmin dispatch, just for optionality
18-
function prob2dtmin(tspan, ::ForwardDiff.Dual, use_end_time)
19-
t1, t2 = tspan
20-
isfinite(t1) || throw(ArgumentError("t0 in the tspan `(t0, t1)` must be finite"))
21-
if use_end_time && isfinite(t2 - t1)
22-
return max(eps(t2), eps(t1))
23-
else
24-
return max(eps(typeof(t1)), eps(t1))
25-
end
26-
end
27-
2819
promote_dual(::Type{T}, ::Type{T2}) where {T <: ForwardDiff.Dual, T2} = T
2920
function promote_dual(::Type{T},
3021
::Type{T2}) where {T <: ForwardDiff.Dual, T2 <: ForwardDiff.Dual}
@@ -414,6 +405,7 @@ unitfulvalue(x::Type{ForwardDiff.Dual{T, V, N}}) where {T, V, N} = V
414405
unitfulvalue(x::ForwardDiff.Dual) = unitfulvalue(ForwardDiff.value(x))
415406

416407
sse(x::ForwardDiff.Dual) = sse(ForwardDiff.value(x)) + sum(sse, ForwardDiff.partials(x))
408+
417409
function SciMLBase.totallength(x::ForwardDiff.Dual)
418410
return SciMLBase.totallength(ForwardDiff.value(x)) +
419411
sum(SciMLBase.totallength, ForwardDiff.partials(x))

src/SciMLBase.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import Accessors: @set, @reset, @delete, @insert
2727
using Moshi.Data: @data
2828
using Moshi.Match: @match
2929
import Moshi.Derive: @derive
30+
import Static: reduce_tup
3031
import StaticArraysCore: StaticArraysCore, SArray
3132
import Adapt: adapt_structure, adapt
3233

0 commit comments

Comments
 (0)