Skip to content

Commit 7433b91

Browse files
Merge pull request #461 from jamesgardner1421/fix/baoab-tmp
Add `tmp` field to BAOAB to fix `saveat`
2 parents 43eaeb4 + 71d7fe0 commit 7433b91

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/caches/dynamical_caches.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ struct BAOABConstantCache{uType,uEltypeNoUnits} <: StochasticDiffEqConstantCache
55
c1::uEltypeNoUnits
66
c2::uEltypeNoUnits
77
end
8-
@cache struct BAOABCache{uType,uEltypeNoUnits,rateNoiseType} <: StochasticDiffEqMutableCache
8+
@cache struct BAOABCache{uType,uEltypeNoUnits,rateNoiseType,uTypeCombined} <: StochasticDiffEqMutableCache
99
utmp::uType
1010
dutmp::uType
1111
k::uType
@@ -14,6 +14,7 @@ end
1414
half::uEltypeNoUnits
1515
c1::uEltypeNoUnits
1616
c2::uEltypeNoUnits
17+
tmp::uTypeCombined
1718
end
1819

1920
function alg_cache(alg::BAOAB,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_prototype,jump_rate_prototype,::Type{uEltypeNoUnits},::Type{uBottomEltypeNoUnits},::Type{tTypeNoUnits},uprev,f,t,dt,::Type{Val{false}}) where {uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits}
@@ -35,5 +36,7 @@ function alg_cache(alg::BAOAB,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_prototy
3536
c1 = exp(-alg.gamma*dt)
3637
c2 = sqrt(1 - c1^2)
3738

38-
BAOABCache(utmp, dutmp, k, gtmp, noise, half, uEltypeNoUnits(c1), uEltypeNoUnits(c2))
39+
tmp = zero(u)
40+
41+
BAOABCache(utmp, dutmp, k, gtmp, noise, half, uEltypeNoUnits(c1), uEltypeNoUnits(c2), tmp)
3942
end

0 commit comments

Comments
 (0)