Skip to content

Commit 093f3a6

Browse files
committed
add reduce_tup, rm Static
1 parent 25a5ff2 commit 093f3a6

File tree

4 files changed

+38
-16
lines changed

4 files changed

+38
-16
lines changed

Project.toml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SciMLBase"
22
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
3-
authors = ["Chris Rackauckas <[email protected]> and contributors"]
43
version = "2.111.0"
4+
authors = ["Chris Rackauckas <[email protected]> and contributors"]
55

66
[deps]
77
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
@@ -29,7 +29,6 @@ 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"
3332
StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
3433
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
3534
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"
@@ -54,19 +53,19 @@ Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
5453

5554
[extensions]
5655
SciMLBaseChainRulesCoreExt = "ChainRulesCore"
56+
SciMLBaseDistributionsExt = "Distributions"
57+
SciMLBaseForwardDiffExt = "ForwardDiff"
5758
SciMLBaseMLStyleExt = "MLStyle"
5859
SciMLBaseMakieExt = "Makie"
60+
SciMLBaseMonteCarloMeasurementsExt = "MonteCarloMeasurements"
61+
SciMLBaseMooncakeExt = "Mooncake"
5962
SciMLBasePartialFunctionsExt = "PartialFunctions"
6063
SciMLBasePyCallExt = "PyCall"
6164
SciMLBasePythonCallExt = "PythonCall"
6265
SciMLBaseRCallExt = "RCall"
63-
SciMLBaseZygoteExt = ["Zygote", "ChainRulesCore"]
64-
SciMLBaseDistributionsExt = "Distributions"
65-
SciMLBaseMonteCarloMeasurementsExt = "MonteCarloMeasurements"
66-
SciMLBaseMooncakeExt = "Mooncake"
6766
SciMLBaseReverseDiffExt = "ReverseDiff"
6867
SciMLBaseTrackerExt = "Tracker"
69-
SciMLBaseForwardDiffExt = "ForwardDiff"
68+
SciMLBaseZygoteExt = ["Zygote", "ChainRulesCore"]
7069

7170
[compat]
7271
ADTypes = "0.2.5,1.0.0"
@@ -89,10 +88,10 @@ Logging = "1.10"
8988
MLStyle = "0.4.17"
9089
Makie = "0.20, 0.21, 0.22, 0.23, 0.24"
9190
Markdown = "1.10"
92-
Moshi = "0.3"
93-
Mooncake = "0.4"
9491
Measurements = "2"
9592
MonteCarloMeasurements = "1"
93+
Mooncake = "0.4"
94+
Moshi = "0.3"
9695
PartialFunctions = "1.1"
9796
PreallocationTools = "0.4.31"
9897
PrecompileTools = "1.2"
@@ -109,7 +108,6 @@ RuntimeGeneratedFunctions = "0.5.12"
109108
SciMLOperators = "1.3"
110109
SciMLStructures = "1.1"
111110
StableRNGs = "1.0"
112-
Static = "1"
113111
StaticArrays = "1.7"
114112
StaticArraysCore = "1.4"
115113
Statistics = "1.10"
@@ -137,4 +135,4 @@ UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
137135
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
138136

139137
[targets]
140-
test = ["Aqua", "ForwardDiff", "MLStyle", "PartialFunctions", "Pkg", "SafeTestsets", "Serialization", "StableRNGs", "StaticArrays", "Tables", "Test", "UnicodePlots", "Zygote", "Distributions", "MonteCarloMeasurements", "Measurements", "ReverseDiff", "Tracker"]
138+
test = ["Aqua", "ForwardDiff", "MLStyle", "PartialFunctions", "Pkg", "SafeTestsets", "Serialization", "StableRNGs", "StaticArrays", "Tables", "Test", "UnicodePlots", "Zygote"]

ext/SciMLBaseForwardDiffExt.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ import SciMLBase:
99
ODEProblem, SDEProblem, RODEProblem, DDEProblem, PDEProblem, DAEProblem,
1010
RecursiveArrayTools, totallength, sse, anyeltypedual
1111

12-
import Static: reduce_tup
13-
14-
15-
1612
eltypedual(x) = eltype(x) <: ForwardDiff.Dual
1713
isdualtype(::Type{<:ForwardDiff.Dual}) = true
1814

src/SciMLBase.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ 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
3130
import StaticArraysCore: StaticArraysCore, SArray
3231
import Adapt: adapt_structure, adapt
3332

src/solve.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,3 +487,32 @@ _reshape(v::Number, siz) = v
487487
_reshape(v::AbstractSciMLScalarOperator, siz) = v
488488

489489
set_mooncakeoriginator_if_mooncake(x::SciMLBase.ADOriginator) = x
490+
491+
# Copied from Static.jl https://github.com/SciML/Static.jl/blob/b50279cc9b33741fd60f382c789fbaef8622d964/src/Static.jl#L743
492+
@generated function reduce_tup(f::F, inds::Tuple{Vararg{Any, N}}) where {F, N}
493+
q = Expr(:block, Expr(:meta, :inline, :propagate_inbounds))
494+
if N == 1
495+
push!(q.args, :(inds[1]))
496+
return q
497+
end
498+
syms = Vector{Symbol}(undef, N)
499+
i = 0
500+
for n in 1:N
501+
syms[n] = iₙ = Symbol(:i_, (i += 1))
502+
push!(q.args, Expr(:(=), iₙ, Expr(:ref, :inds, n)))
503+
end
504+
W = 1 << (8sizeof(N) - 2 - leading_zeros(N))
505+
while W > 0
506+
_N = length(syms)
507+
for _ in (2W):W:_N
508+
for w in 1:W
509+
new_sym = Symbol(:i_, (i += 1))
510+
push!(q.args, Expr(:(=), new_sym, Expr(:call, :f, syms[w], syms[w + W])))
511+
syms[w] = new_sym
512+
end
513+
deleteat!(syms, (1 + W):(2W))
514+
end
515+
W >>>= 1
516+
end
517+
q
518+
end

0 commit comments

Comments
 (0)