Skip to content

Commit

Permalink
fixing type stability, running benchmarks.
Browse files Browse the repository at this point in the history
  • Loading branch information
weinbe58 committed Dec 22, 2023
1 parent 3df38f3 commit 04b834d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions benchmarks/rabi-diffeq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ u0 = ComplexF64[1.0, 0.0]
tspan = (0.0, 2π)
prob = ODEProblem(f, u0, tspan)
# get precompilation out of the way
sol = solve(prob, DP5(), reltol=1e-10, abstol=1e-10)
sol = solve(prob, DP8(), reltol=1e-10, abstol=1e-10)

# terminate benchmark after maximum of 5 minutes
@benchmark solve(prob, DP5(), reltol=1e-10, abstol=1e-10) samples=10000 evals=5 seconds=300
@benchmark solve(prob, DP8(), reltol=1e-10, abstol=1e-10) samples=10000 evals=5 seconds=300
6 changes: 3 additions & 3 deletions benchmarks/rabi-dormand-prince.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using BenchmarkTools
using DormandPrince:DP5Solver, integrate
using DormandPrince:DP5Solver, DP8Solver, integrate

function fcn(x, y, f)
g(x) = 2.2*2π*sin(2π*x)
Expand All @@ -8,12 +8,12 @@ function fcn(x, y, f)
f[2] = -1im * g(x)/2 * y[1]
end

solver = DP5Solver(
solver = DP8Solver(
fcn,
0.0,
ComplexF64[1.0, 0.0]
)

integrate(solver, 2π)

@benchmark integrate(clean_solver, 2π) setup=(clean_solver = DP5Solver(fcn, 0.0, ComplexF64[1.0, 0.0])) samples=10000 evals=5 seconds=500
@benchmark integrate(clean_solver, 2π) setup=(clean_solver = DP8Solver(fcn, 0.0, ComplexF64[1.0, 0.0])) samples=10000 evals=5 seconds=500
2 changes: 1 addition & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ struct DP5Solver{T, StateType , F, OptionsType, ConstsType, VarsType} <: Abstrac
consts = Consts(expo1, options)
vars = Vars{T}(;x=x, h=options.initial_step_size)

new{T, StateType, F, typeof(options), typeof(consts), typeof(varS)}(
new{T, StateType, F, typeof(options), typeof(consts), typeof(vars)}(
f, y, k1, k2, k3, k4, k5, k6, y1, ysti, options, consts, vars
)
end
Expand Down

0 comments on commit 04b834d

Please sign in to comment.