Skip to content

Commit b27e061

Browse files
authored
Merge branch 'master' into move_scale
2 parents b8493bb + 5e417c6 commit b27e061

File tree

7 files changed

+42
-39
lines changed

7 files changed

+42
-39
lines changed

Project.toml

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

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/ensemble/basic_ensemble_solve.jl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,20 @@ function solve_batch(prob,alg,ensemblealg::EnsembleDistributed,II,pmap_batch_siz
182182
tighten_container_eltype(batch_data)
183183
end
184184

185-
function solve_batch(prob,alg,::EnsembleSerial,II,pmap_batch_size;kwargs...)
186-
batch_data = map(II) do i
187-
batch_func(i,prob,alg;kwargs...)
185+
function responsible_map(f,II...)
186+
batch_data = []
187+
sizehint!(batch_data,length(II[1]))
188+
for i in 1:length(II[1])
189+
@inbounds push!(batch_data, f(getindex.(II,i)...))
188190
end
189-
tighten_container_eltype(batch_data)
191+
identity.(batch_data)
192+
end
193+
194+
function SciMLBase.solve_batch(prob,alg,::EnsembleSerial,II,pmap_batch_size;kwargs...)
195+
batch_data = responsible_map(II) do i
196+
SciMLBase.batch_func(i,prob,alg;kwargs...)
197+
end
198+
SciMLBase.tighten_container_eltype(batch_data)
190199
end
191200

192201
function solve_batch(prob,alg,ensemblealg::EnsembleThreads,II,pmap_batch_size;kwargs...)

src/ensemble/ensemble_solutions.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@ end
9595

9696
Base.summary(io::IO, A::AbstractEnsembleSolution) =
9797
print(io,"EnsembleSolution Solution of length ",length(A.u)," with uType:\n",eltype(A.u))
98-
function Base.show(io::IO, A::AbstractEnsembleSolution)
99-
summary(io,A)
100-
end
10198
function Base.show(io::IO, m::MIME"text/plain", A::AbstractEnsembleSolution)
10299
summary(io,A)
103100
end

src/operators/common_defaults.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ for op in (:*, :/, :\)
1818
end
1919
LinearAlgebra.mul!(Y::AbstractArray, L::AbstractDiffEqLinearOperator, B::AbstractArray) =
2020
mul!(Y, convert(AbstractMatrix,L), B)
21+
LinearAlgebra.mul!(Y::AbstractArray, L::AbstractDiffEqLinearOperator, B::AbstractArray, α::Number, β::Number) =
22+
mul!(Y, convert(AbstractMatrix,L), B, α, β)
2123
for pred in (:isreal, :issymmetric, :ishermitian, :isposdef)
2224
@eval LinearAlgebra.$pred(L::AbstractDiffEqLinearOperator) = $pred(convert(AbstractArray, L))
2325
end

src/problems/problem_utils.jl

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ function Base.summary(io::IO, prob::AbstractLinearProblem)
3737
type_color,isinplace(prob),
3838
no_color)
3939
end
40-
function Base.show(io::IO, A::AbstractLinearProblem)
40+
function Base.show(io::IO, mime::MIME"text/plain", A::AbstractLinearProblem)
4141
summary(io,A)
4242
println(io)
4343
print(io,"b: ")
44-
show(io, A.b)
44+
show(io, mime, A.b)
4545
end
4646

4747
function Base.summary(io::IO, prob::AbstractNonlinearProblem{uType,iip}) where {uType,iip}
@@ -54,11 +54,11 @@ function Base.summary(io::IO, prob::AbstractNonlinearProblem{uType,iip}) where {
5454
type_color,isinplace(prob),
5555
no_color)
5656
end
57-
function Base.show(io::IO, A::AbstractNonlinearProblem)
57+
function Base.show(io::IO, mime::MIME"text/plain", A::AbstractNonlinearProblem)
5858
summary(io,A)
5959
println(io)
6060
print(io,"u0: ")
61-
show(io, A.u0)
61+
show(io, mime, A.u0)
6262
end
6363

6464
function Base.summary(io::IO, prob::AbstractOptimizationProblem)
@@ -69,11 +69,11 @@ function Base.summary(io::IO, prob::AbstractOptimizationProblem)
6969
type_color,isinplace(prob),
7070
no_color)
7171
end
72-
function Base.show(io::IO, A::AbstractOptimizationProblem)
72+
function Base.show(io::IO, mime::MIME"text/plain", A::AbstractOptimizationProblem)
7373
summary(io,A)
7474
println(io)
7575
print(io,"u0: ")
76-
show(io, A.u0)
76+
show(io, mime, A.u0)
7777
end
7878

7979
function Base.summary(io::IO, prob::AbstractQuadratureProblem)
@@ -84,7 +84,7 @@ function Base.summary(io::IO, prob::AbstractQuadratureProblem)
8484
type_color,isinplace(prob),
8585
no_color)
8686
end
87-
function Base.show(io::IO, A::AbstractQuadratureProblem)
87+
function Base.show(io::IO, mime::MIME"text/plain", A::AbstractQuadratureProblem)
8888
summary(io,A)
8989
println(io)
9090
end
@@ -93,33 +93,33 @@ function Base.summary(io::IO, prob::AbstractNoiseProblem)
9393
print(io,
9494
nameof(typeof(prob))," with WType ",typeof(prob.noise.W[1])," and tType ",typeof(prob.tspan[1]),". In-place: ",isinplace(prob))
9595
end
96-
function Base.show(io::IO, A::DEProblem)
96+
function Base.show(io::IO, mime::MIME"text/plain", A::DEProblem)
9797
summary(io,A)
9898
println(io)
9999
print(io,"timespan: ")
100-
show(io,A.tspan)
100+
show(io,mime,A.tspan)
101101
println(io)
102102
print(io,"u0: ")
103-
show(io, A.u0)
103+
show(io, mime, A.u0)
104104
end
105-
function Base.show(io::IO, A::AbstractNoiseProblem)
105+
function Base.show(io::IO, mime::MIME"text/plain", A::AbstractNoiseProblem)
106106
summary(io,A)
107107
println(io)
108108
print(io,"timespan: ")
109-
show(io,A.tspan)
109+
show(io,mime,A.tspan)
110110
println(io)
111111
end
112-
function Base.show(io::IO, A::AbstractDAEProblem)
112+
function Base.show(io::IO, mime::MIME"text/plain", A::AbstractDAEProblem)
113113
summary(io,A)
114114
println(io)
115115
print(io,"timespan: ")
116-
show(io,A.tspan)
116+
show(io,mime,A.tspan)
117117
println(io)
118118
print(io,"u0: ")
119-
show(io, A.u0)
119+
show(io, mime, A.u0)
120120
println(io)
121121
print(io,"du0: ")
122-
show(io, A.du0)
122+
show(io, mime, A.du0)
123123
end
124124

125125
function Base.summary(io::IO, prob::AbstractEnsembleProblem)
@@ -129,7 +129,7 @@ function Base.summary(io::IO, prob::AbstractEnsembleProblem)
129129
" with problem ",
130130
nameof(typeof(prob.prob)))
131131
end
132-
Base.show(io::IO, A::AbstractEnsembleProblem) = summary(io,A)
132+
Base.show(io::IO, mime::MIME"text/plain", A::AbstractEnsembleProblem) = summary(io,A)
133133
TreeViews.hastreeview(x::DEProblem) = true
134134
function TreeViews.treelabel(io::IO,x::DEProblem,
135135
mime::MIME"text/plain" = MIME"text/plain"())
@@ -140,10 +140,9 @@ struct NullParameters end
140140
Base.getindex(::NullParameters,i...) = error("Parameters were indexed but the parameters are `nothing`. You likely forgot to pass in parameters to the DEProblem!")
141141
Base.iterate(::NullParameters) = error("Parameters were indexed but the parameters are `nothing`. You likely forgot to pass in parameters to the DEProblem!")
142142

143-
function Base.show(io::IO, A::AbstractPDEProblem)
143+
function Base.show(io::IO, mime::MIME"text/plain", A::AbstractPDEProblem)
144144
summary(io,A.prob)
145145
println(io)
146-
println(io)
147146
end
148147
function Base.summary(io::IO, prob::AbstractPDEProblem)
149148
print(io,

src/solutions/solution_interface.jl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ Base.setindex!(A::AbstractNoTimeSolution, v, i::Int) = (A.u[i] = v)
1111
Base.setindex!(A::AbstractNoTimeSolution, v, I::Vararg{Int, N}) where {N} = (A.u[I] = v)
1212
Base.size(A::AbstractNoTimeSolution) = size(A.u)
1313

14-
Base.summary(io::IO, A::AbstractNoTimeSolution) = print(io,nameof(typeof(A))," with uType ",eltype(A.u))
15-
Base.show(io::IO, A::AbstractNoTimeSolution) = (print(io,"u: ");show(io, A.u))
1614
Base.show(io::IO, m::MIME"text/plain", A::AbstractNoTimeSolution) = (print(io,"u: ");show(io,m,A.u))
1715

1816
# Symbol Handling
@@ -113,15 +111,6 @@ function Base.summary(io::IO, A::AbstractTimeseriesSolution)
113111
type_color, eltype(A.t), no_color)
114112
end
115113

116-
function Base.show(io::IO, A::AbstractTimeseriesSolution)
117-
println(io,string("retcode: ",A.retcode))
118-
println(io,string("Interpolation: "),interp_summary(A.interp))
119-
print(io,"t: ")
120-
show(io, A.t)
121-
println(io)
122-
print(io,"u: ")
123-
show(io, A.u)
124-
end
125114
function Base.show(io::IO, m::MIME"text/plain", A::AbstractTimeseriesSolution)
126115
println(io,string("retcode: ",A.retcode))
127116
println(io,string("Interpolation: "),interp_summary(A.interp))

test/downstream/ensemble_zero_length.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using OrdinaryDiffEq, Test
1+
using OrdinaryDiffEq, Test, LinearAlgebra
22
prob = ODEProblem((u,p,t)->1.01u,0.5,(0.0,1.0), save_start=false, save_end=false)
33
function prob_func(prob,i,repeat)
44
remake(prob,u0=rand()*prob.u0)
@@ -12,3 +12,10 @@ ts = 0.0:0.1:1.0
1212
using SciMLBase.EnsembleAnalysis
1313
sim = solve(ensemble_prob,Tsit5(),EnsembleThreads(),trajectories=10,saveat=0.1)
1414
timeseries_point_meancov(sim,ts)
15+
16+
function prob_sol(_p)
17+
prob = ODEProblem((u,p,t)->p.*u, _p, (0.0,1.0), _p, save_start=false, save_end=false)
18+
sim = solve(prob,Tsit5())
19+
end
20+
mapres = SciMLBase.responsible_map(prob_sol, [0.5, diagm([1.0, 1.0])])
21+
@test length(mapres) == 2

0 commit comments

Comments
 (0)