Skip to content

Commit 258202c

Browse files
committed
add static
1 parent 8ae57b9 commit 258202c

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
@@ -28,6 +28,7 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
2828
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
2929
SciMLOperators = "c0aeaf25-5076-4817-a8d5-81caf7dfa961"
3030
SciMLStructures = "53ae85a6-f571-4167-b2af-e1d143709226"
31+
Static = "aedffcd0-7271-4cad-89d0-dc628f76c6d3"
3132
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
3233
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
3334
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
@@ -103,6 +104,7 @@ RuntimeGeneratedFunctions = "0.5.12"
103104
SciMLOperators = "1.3"
104105
SciMLStructures = "1.1"
105106
StableRNGs = "1.0"
107+
Static = "1"
106108
StaticArrays = "1.7"
107109
StaticArraysCore = "1.4"
108110
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
@@ -26,6 +26,7 @@ import Accessors: @set, @reset, @delete, @insert
2626
using Moshi.Data: @data
2727
using Moshi.Match: @match
2828
import Moshi.Derive: @derive
29+
import Static: reduce_tup
2930
import StaticArraysCore: StaticArraysCore, SArray
3031
import Adapt: adapt_structure, adapt
3132

0 commit comments

Comments
 (0)