From 04b834d0037be0a13ebef485d90e3d8ff1e74b6d Mon Sep 17 00:00:00 2001 From: Phillip Weinberg <weinbe58@gmail.com> Date: Fri, 22 Dec 2023 15:59:29 -0500 Subject: [PATCH] fixing type stability, running benchmarks. --- benchmarks/rabi-diffeq.jl | 4 ++-- benchmarks/rabi-dormand-prince.jl | 6 +++--- src/types.jl | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/benchmarks/rabi-diffeq.jl b/benchmarks/rabi-diffeq.jl index 1c2de1a..77db13f 100644 --- a/benchmarks/rabi-diffeq.jl +++ b/benchmarks/rabi-diffeq.jl @@ -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 \ No newline at end of file +@benchmark solve(prob, DP8(), reltol=1e-10, abstol=1e-10) samples=10000 evals=5 seconds=300 \ No newline at end of file diff --git a/benchmarks/rabi-dormand-prince.jl b/benchmarks/rabi-dormand-prince.jl index 38b41f2..c6b0760 100644 --- a/benchmarks/rabi-dormand-prince.jl +++ b/benchmarks/rabi-dormand-prince.jl @@ -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) @@ -8,7 +8,7 @@ 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] @@ -16,4 +16,4 @@ solver = DP5Solver( 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 \ No newline at end of file +@benchmark integrate(clean_solver, 2π) setup=(clean_solver = DP8Solver(fcn, 0.0, ComplexF64[1.0, 0.0])) samples=10000 evals=5 seconds=500 \ No newline at end of file diff --git a/src/types.jl b/src/types.jl index 4622ac5..5e2149f 100644 --- a/src/types.jl +++ b/src/types.jl @@ -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