|
6 | 6 | gtmp2::rateType
|
7 | 7 | nlsolver::N
|
8 | 8 | dW_cache::randType
|
| 9 | + k::uType |
| 10 | + dz::uType |
9 | 11 | end
|
10 | 12 |
|
11 |
| -function alg_cache(alg::ISSEM,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_prototype,jump_rate_prototype, |
12 |
| - ::Type{uEltypeNoUnits},::Type{uBottomEltypeNoUnits},::Type{tTypeNoUnits},uprev,f,t,dt,::Type{Val{true}}) where {uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits} |
13 |
| - γ, c = alg.theta,zero(t) |
14 |
| - nlsolver = OrdinaryDiffEq.build_nlsolver(alg,u,uprev,p,t,dt,f,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,γ,c,Val(true)) |
| 13 | +function alg_cache(alg::ISSEM, prob, u, ΔW, ΔZ, p, rate_prototype, noise_rate_prototype, jump_rate_prototype, |
| 14 | + ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, f, t, dt, ::Type{Val{true}}) where {uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits} |
| 15 | + γ, c = alg.theta, zero(t) |
| 16 | + nlsolver = OrdinaryDiffEq.build_nlsolver(alg, u, uprev, p, t, dt, f, rate_prototype, uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits, γ, c, Val(true)) |
15 | 17 | fsalfirst = zero(rate_prototype)
|
16 | 18 | gtmp = zero(noise_rate_prototype)
|
17 | 19 | if is_diagonal_noise(prob)
|
18 |
| - gtmp2 = gtmp |
| 20 | + gtmp2 = copy(gtmp) |
19 | 21 | dW_cache = nothing
|
20 | 22 | else
|
21 | 23 | gtmp2 = zero(rate_prototype)
|
22 | 24 | dW_cache = zero(ΔW)
|
23 | 25 | end
|
24 | 26 |
|
25 |
| - ISSEMCache(u,uprev,fsalfirst,gtmp,gtmp2,nlsolver,dW_cache) |
| 27 | + k = zero(u) |
| 28 | + dz = zero(u) |
| 29 | + |
| 30 | + ISSEMCache(u, uprev, fsalfirst, gtmp, gtmp2, nlsolver, dW_cache, k, dz) |
26 | 31 | end
|
27 | 32 |
|
28 | 33 | mutable struct ISSEMConstantCache{N} <: StochasticDiffEqConstantCache
|
29 | 34 | nlsolver::N
|
30 | 35 | end
|
31 | 36 |
|
32 |
| -function alg_cache(alg::ISSEM,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_prototype,jump_rate_prototype, |
33 |
| - ::Type{uEltypeNoUnits},::Type{uBottomEltypeNoUnits},::Type{tTypeNoUnits},uprev,f,t,dt,::Type{Val{false}}) where {uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits} |
34 |
| - γ, c = alg.theta,zero(t) |
35 |
| - nlsolver = OrdinaryDiffEq.build_nlsolver(alg,u,uprev,p,t,dt,f,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,γ,c,Val(false)) |
| 37 | +function alg_cache(alg::ISSEM, prob, u, ΔW, ΔZ, p, rate_prototype, noise_rate_prototype, jump_rate_prototype, |
| 38 | + ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, f, t, dt, ::Type{Val{false}}) where {uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits} |
| 39 | + γ, c = alg.theta, zero(t) |
| 40 | + nlsolver = OrdinaryDiffEq.build_nlsolver(alg, u, uprev, p, t, dt, f, rate_prototype, uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits, γ, c, Val(false)) |
36 | 41 | ISSEMConstantCache(nlsolver)
|
37 | 42 | end
|
38 | 43 |
|
|
45 | 50 | gtmp3::noiseRateType
|
46 | 51 | nlsolver::N
|
47 | 52 | dW_cache::randType
|
| 53 | + k::uType |
| 54 | + dz::uType |
48 | 55 | end
|
49 | 56 |
|
50 |
| -function alg_cache(alg::ISSEulerHeun,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_prototype,jump_rate_prototype, |
51 |
| - ::Type{uEltypeNoUnits},::Type{uBottomEltypeNoUnits},::Type{tTypeNoUnits},uprev,f,t,dt,::Type{Val{true}}) where {uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits} |
52 |
| - γ, c = alg.theta,zero(t) |
53 |
| - nlsolver = OrdinaryDiffEq.build_nlsolver(alg,u,uprev,p,t,dt,f,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,γ,c,Val(true)) |
| 57 | +function alg_cache(alg::ISSEulerHeun, prob, u, ΔW, ΔZ, p, rate_prototype, noise_rate_prototype, jump_rate_prototype, |
| 58 | + ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, f, t, dt, ::Type{Val{true}}) where {uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits} |
| 59 | + γ, c = alg.theta, zero(t) |
| 60 | + nlsolver = OrdinaryDiffEq.build_nlsolver(alg, u, uprev, p, t, dt, f, rate_prototype, uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits, γ, c, Val(true)) |
54 | 61 | fsalfirst = zero(rate_prototype)
|
55 | 62 |
|
56 | 63 | gtmp = zero(noise_rate_prototype)
|
57 | 64 | gtmp2 = zero(rate_prototype)
|
58 | 65 |
|
59 | 66 | if is_diagonal_noise(prob)
|
60 |
| - gtmp3 = gtmp2 |
61 |
| - dW_cache = nothing |
| 67 | + gtmp3 = copy(gtmp2) |
| 68 | + dW_cache = nothing |
62 | 69 | else
|
63 |
| - gtmp3 = zero(noise_rate_prototype) |
64 |
| - dW_cache = zero(ΔW) |
| 70 | + gtmp3 = zero(noise_rate_prototype) |
| 71 | + dW_cache = zero(ΔW) |
65 | 72 | end
|
66 | 73 |
|
67 |
| - ISSEulerHeunCache(u,uprev,fsalfirst,gtmp,gtmp2,gtmp3,nlsolver,dW_cache) |
| 74 | + k = zero(u) |
| 75 | + dz = zero(u) |
| 76 | + |
| 77 | + ISSEulerHeunCache(u, uprev, fsalfirst, gtmp, gtmp2, gtmp3, nlsolver, dW_cache, k, dz) |
68 | 78 | end
|
69 | 79 |
|
70 | 80 | mutable struct ISSEulerHeunConstantCache{N} <: StochasticDiffEqConstantCache
|
71 | 81 | nlsolver::N
|
72 | 82 | end
|
73 | 83 |
|
74 |
| -function alg_cache(alg::ISSEulerHeun,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_prototype,jump_rate_prototype, |
75 |
| - ::Type{uEltypeNoUnits},::Type{uBottomEltypeNoUnits},::Type{tTypeNoUnits},uprev,f,t,dt,::Type{Val{false}}) where {uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits} |
76 |
| - γ, c = alg.theta,zero(t) |
77 |
| - nlsolver = OrdinaryDiffEq.build_nlsolver(alg,u,uprev,p,t,dt,f,rate_prototype,uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits,γ,c,Val(false)) |
| 84 | +function alg_cache(alg::ISSEulerHeun, prob, u, ΔW, ΔZ, p, rate_prototype, noise_rate_prototype, jump_rate_prototype, |
| 85 | + ::Type{uEltypeNoUnits}, ::Type{uBottomEltypeNoUnits}, ::Type{tTypeNoUnits}, uprev, f, t, dt, ::Type{Val{false}}) where {uEltypeNoUnits,uBottomEltypeNoUnits,tTypeNoUnits} |
| 86 | + γ, c = alg.theta, zero(t) |
| 87 | + nlsolver = OrdinaryDiffEq.build_nlsolver(alg, u, uprev, p, t, dt, f, rate_prototype, uEltypeNoUnits, uBottomEltypeNoUnits, tTypeNoUnits, γ, c, Val(false)) |
78 | 88 | ISSEulerHeunConstantCache(nlsolver)
|
79 | 89 | end
|
0 commit comments