Skip to content

Commit c6f7e74

Browse files
author
oscarddssmith
committed
fix interpolation type stability
1 parent 34ec99d commit c6f7e74

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/OrdinaryDiffEqCore/src/dense/generic_dense.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ ode_interpolation(tvals,ts,timeseries,ks)
553553
Get the value at tvals where the solution is known at the
554554
times ts (sorted), with values timeseries and derivatives ks
555555
"""
556-
function ode_interpolation(tvals, id::I, idxs, deriv::Type{deriv}, p,
556+
function ode_interpolation(tvals, id::I, idxs, ::Type{deriv}, p,
557557
continuity::Symbol = :left) where {I, deriv}
558558
@unpack ts, timeseries, ks, f, cache, differential_vars = id
559559
@inbounds tdir = sign(ts[end] - ts[1])

test/interface/inplace_interpolation.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ out_VMF = vecarrzero(ntt, size(prob_ode_2Dlinear.u0)) # Vector{Matrix{Float64}
1818
sol_ODE = solve(prob_ode_linear, alg; kwargs...)
1919
sol_ODE_2D = solve(prob_ode_2Dlinear, alg; kwargs...)
2020

21-
sol_ODE_interp = sol_ODE(tt)
22-
sol_ODE_2D_interp = sol_ODE_2D(tt)
21+
sol_ODE_interp = @inferred sol_ODE(tt)
22+
sol_ODE_2D_interp = @inferred sol_ODE_2D(tt)
2323

2424
@testset "1D" begin
2525
@test_throws MethodError sol_ODE(out_VF, tt; idxs = 1:1)
26-
@test sol_ODE(out_VF, tt) isa Vector{Float64}
27-
@test sol_ODE(out_VVF_1, tt) isa Vector{Vector{Float64}}
26+
@inferred Vector{Float64} sol_ODE(out_VF, tt)
27+
@inferred Vector{Vector{Float64}} sol_ODE(out_VVF_1, tt)
2828
@test sol_ODE_interp.u out_VF
2929
end
3030

3131
@testset "2D" begin
3232
@test_throws MethodError sol_ODE_2D(out_VF, tt; idxs = 3:3)
33-
@test sol_ODE_2D(out_VF, tt; idxs = 3) isa Vector{Float64}
34-
@test sol_ODE_2D(out_VVF_1, tt; idxs = 3) isa Vector{Vector{Float64}}
35-
@test sol_ODE_2D(out_VVF_1, tt; idxs = 3:3) isa Vector{Vector{Float64}}
36-
@test sol_ODE_2D(out_VVF_2, tt; idxs = 2:3) isa Vector{Vector{Float64}}
37-
@test sol_ODE_2D(out_VMF, tt) isa Vector{Matrix{Float64}}
33+
@inferred Vector{Float64} sol_ODE_2D(out_VF, tt; idxs = 3)
34+
@inferred Vector{Vector{Float64}} sol_ODE_2D(out_VVF_1, tt; idxs = 3)
35+
@inferred Vector{Vector{Float64}} sol_ODE_2D(out_VVF_1, tt; idxs = 3:3)
36+
@inferred Vector{Vector{Float64}} sol_ODE_2D(out_VVF_2, tt; idxs = 2:3)
37+
@inferred Vector{Matrix{Float64}} sol_ODE_2D(out_VMF, tt)
3838
@test sol_ODE_2D_interp.u out_VMF
3939
end
4040
end

0 commit comments

Comments
 (0)