Skip to content

Commit 1876e4a

Browse files
fix benchmarks
1 parent 3d21637 commit 1876e4a

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

src/benchmark.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ function WorkPrecision(prob,alg,abstols,reltols,dts=nothing;
196196
t = t/numruns
197197

198198
if appxsol != nothing
199-
errsol = calculate_errsol(prob,sol,approxsol)
199+
errsol = calculate_errsol(prob,sol,appxsol)
200200
errors[i] = mean(errsol.errors[error_estimate])
201201
else
202202
errors[i] = mean(sol.errors[error_estimate])
@@ -254,7 +254,7 @@ function WorkPrecision(prob::Union{AbstractRODEProblem,AbstractSDEProblem},
254254
dense_errors = dense_errors)
255255
end
256256
if appxsol != nothing
257-
errsol = calculate_errsol(prob,sol,approxsol)
257+
errsol = calculate_errsol(prob,sol,appxsol)
258258
local_errors[j] = errsol.errors[error_estimate]
259259
else
260260
local_errors[j] = sol.errors[error_estimate]
@@ -268,22 +268,22 @@ function WorkPrecision(prob::Union{AbstractRODEProblem,AbstractSDEProblem},
268268
return WorkPrecision(prob,abstols,reltols,errors,times,name,N)
269269
end
270270

271-
function calculate_errsol(prob,sol::AbstractODESolution,approxsol_setup::Dict)
272-
true_sol = solve(prob,approxsol_setup[i][:alg];approxsol_setup[i]...)
271+
function calculate_errsol(prob,sol::AbstractODESolution,appxsol_setup::Dict)
272+
true_sol = solve(prob,appxsol_setup[i][:alg];appxsol_setup[i]...)
273273
appxtrue(sol,true_sol)
274274
end
275275

276-
function calculate_errsol(prob::AbstractSDEProblem,sol::AbstractRODESolution,approxsol_setup::Dict)
276+
function calculate_errsol(prob::AbstractSDEProblem,sol::AbstractRODESolution,appxsol_setup::Dict)
277277
prob2 = SDEProblem(prob.f,prob.g,prob.u0,prob.tspan,noise=NoiseWrapper(sol.W))
278-
true_sol = solve(prob2,approxsol_setup[i][:alg];approxsol_setup[i]...)
278+
true_sol = solve(prob2,appxsol_setup[i][:alg];appxsol_setup[i]...)
279279
appxtrue(sol,true_sol)
280280
end
281281

282-
function calculate_errsol(prob,sol::AbstractODESolution,approxsol_setup::AbstractTimeseriesSolution)
282+
function calculate_errsol(prob,sol::AbstractODESolution,true_sol::AbstractTimeseriesSolution)
283283
appxtrue(sol,true_sol)
284284
end
285285

286-
function calculate_errsol(prob::MonteCarloProblem,sol,approxsol_setup)
286+
function calculate_errsol(prob::MonteCarloProblem,sol,true_sol)
287287
appxtrue(sol,true_sol)
288288
end
289289

src/ode_tableaus.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ end
8181
Euler's method.
8282
"""
8383
function constructEuler(T::Type = Float64)
84-
A = [0]
84+
A = Matrix{T}(1,1)
85+
A[1] = 0
8586
c = [0]
8687
α = [1]
8788
A = map(T,A)
@@ -141,7 +142,8 @@ end
141142
Implicit Euler Method
142143
"""
143144
function constructImplicitEuler(T::Type = Float64)
144-
A = [1]
145+
A = Matrix{T}(1,1)
146+
A[1] = 1
145147
c = [1]
146148
α = [1]
147149
A = map(T,A)
@@ -154,7 +156,8 @@ end
154156
Order 2 Midpoint Method
155157
"""
156158
function constructMidpointRule(T::Type = Float64)
157-
A = [1//2]
159+
A = Matrix{T}(1,1)
160+
A[1] = 1//2
158161
c = [1//2]
159162
α = [1]
160163
A = map(T,A)

src/test_solution.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,20 @@ type TestSolution{T,N,hasinterp,tType,uType,iType} <: AbstractTimeseriesSolution
77
u::uType
88
interp::iType
99
dense::Bool
10+
retcode::Symbol
1011
end
1112
(T::TestSolution)(t) = T.interp(t)
1213
function TestSolution(t,u)
1314
T = eltype(eltype(u))
1415
N = length((size(u[1])..., length(u)))
15-
TestSolution{T,N,false,typeof(t),typeof(u),Void}(t,u,nothing,false)
16+
TestSolution{T,N,false,typeof(t),typeof(u),Void}(t,u,nothing,false,:Success)
1617
end
1718
function TestSolution(t,u,interp)
1819
T = eltype(eltype(u))
1920
N = length((size(u[1])..., length(u)))
20-
TestSolution{T,N,true,typeof(t),typeof(u),typeof(interp)}(t,u,interp,true)
21+
TestSolution{T,N,true,typeof(t),typeof(u),typeof(interp)}(t,u,interp,true,:Success)
2122
end
22-
TestSolution(interp::DESolution) = TestSolution{Void,0,true,Void,Void,typeof(interp)}(nothing,nothing,interp,true)
23+
TestSolution(interp::DESolution) = TestSolution{Void,0,true,Void,Void,typeof(interp)}(nothing,nothing,interp,true,:Success)
2324
hasinterp{T,N,hi,tType,uType,iType}(::TestSolution{T,N,hi,tType,uType,iType}) = hi
2425
"""
2526
`appxtrue(sol::AbstractODESolution,sol2::TestSolution)`

0 commit comments

Comments
 (0)