Skip to content

Commit

Permalink
fix zeroing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Apr 7, 2018
1 parent f12b090 commit f5c1cd2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
20 changes: 10 additions & 10 deletions src/caches/basic_method_caches.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
struct EMConstantCache <: StochasticDiffEqConstantCache end
struct EMCache{uType,rateType,rateNoiseType,rateNoiseCollectionType} <: StochasticDiffEqMutableCache
struct EMCache{uType,rateType,rateNoiseType,rateNoiseCollectionType,randType} <: StochasticDiffEqMutableCache
u::uType
uprev::uType
tmp::uType
tmp::randType
rtmp1::rateType
rtmp2::rateNoiseType
rtmp3::rateNoiseCollectionType
Expand All @@ -25,10 +25,10 @@ function alg_cache(alg::EM,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_prototype,
end

struct SplitEMConstantCache <: StochasticDiffEqConstantCache end
struct SplitEMCache{uType,rateType,rateNoiseType,rateNoiseCollectionType} <: StochasticDiffEqMutableCache
struct SplitEMCache{uType,rateType,rateNoiseType,rateNoiseCollectionType,randType} <: StochasticDiffEqMutableCache
u::uType
uprev::uType
tmp::uType
tmp::randType
rtmp1::rateType
rtmp2::rateNoiseType
rtmp3::rateNoiseCollectionType
Expand All @@ -51,10 +51,10 @@ function alg_cache(alg::SplitEM,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_proto
end

struct EulerHeunConstantCache <: StochasticDiffEqConstantCache end
struct EulerHeunCache{uType,rateType,rateNoiseType,rateNoiseCollectionType} <: StochasticDiffEqMutableCache
struct EulerHeunCache{uType,rateType,rateNoiseType,rateNoiseCollectionType,randType} <: StochasticDiffEqMutableCache
u::uType
uprev::uType
tmp::uType
tmp::randType
ftmp1::rateType
ftmp2::rateType
nrtmp::rateNoiseCollectionType
Expand All @@ -75,10 +75,10 @@ function alg_cache(alg::EulerHeun,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_pro
end

struct RandomEMConstantCache <: StochasticDiffEqConstantCache end
struct RandomEMCache{uType,rateType} <: StochasticDiffEqMutableCache
struct RandomEMCache{uType,rateType,randType} <: StochasticDiffEqMutableCache
u::uType
uprev::uType
tmp::uType
tmp::randType
rtmp::rateType
end

Expand All @@ -93,13 +93,13 @@ function alg_cache(alg::RandomEM,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_prot
end

struct RKMilConstantCache <: StochasticDiffEqConstantCache end
struct RKMilCache{uType,rateType} <: StochasticDiffEqMutableCache
struct RKMilCache{uType,rateType,randType} <: StochasticDiffEqMutableCache
u::uType
uprev::uType
du1::rateType
du2::rateType
K::rateType
tmp::uType
tmp::randType
L::rateType
end

Expand Down
6 changes: 3 additions & 3 deletions src/caches/iif_caches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ end

function alg_cache(alg::IIF1M,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_prototype,uEltypeNoUnits,uBottomEltype,tTypeNoUnits,uprev,f,t,::Type{Val{true}})

tmp = zeros(u,indices(u)); rtmp1 = zeros(rate_prototype)
tmp = similar(u,indices(u)); rtmp1 = zeros(rate_prototype)
dual_cache = DiffCache(u,Val{determine_chunksize(u,get_chunksize(alg.nlsolve))})
uhold = vec(u) # this makes uhold the same values as integrator.u
rhs = RHS_IIF1(f,tmp,t,t,dual_cache,size(u),p)
Expand Down Expand Up @@ -85,7 +85,7 @@ end

function alg_cache(alg::IIF2M,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_prototype,uEltypeNoUnits,uBottomEltype,tTypeNoUnits,uprev,f,t,::Type{Val{true}})

tmp = zeros(u,indices(u)); rtmp1 = zeros(rate_prototype)
tmp = similar(u,indices(u)); rtmp1 = zeros(rate_prototype)
dual_cache = DiffCache(u,Val{determine_chunksize(u,get_chunksize(alg.nlsolve))})
uhold = vec(u) # this makes uhold the same values as integrator.u
rhs = RHS_IIF2(f,tmp,t,t,dual_cache,size(u),p)
Expand Down Expand Up @@ -136,7 +136,7 @@ function alg_cache(alg::IIF1Mil,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_proto
end

function alg_cache(alg::IIF1Mil,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_prototype,uEltypeNoUnits,uBottomEltype,tTypeNoUnits,uprev,f,t,::Type{Val{true}})
tmp = zeros(u,indices(u)); rtmp1 = zeros(rate_prototype)
tmp = similar(u,indices(u)); rtmp1 = zeros(rate_prototype)
dual_cache = DiffCache(u,Val{determine_chunksize(u,get_chunksize(alg.nlsolve))})
uhold = vec(u) # this makes uhold the same values as integrator.u
rhs = RHS_IIF1(f,tmp,t,t,dual_cache,size(u))
Expand Down
12 changes: 6 additions & 6 deletions src/caches/kencarp_caches.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ function alg_cache(alg::SKenCarp,prob,u,ΔW,ΔZ,p,rate_prototype,noise_rate_prot
du1 = zeros(rate_prototype)
J = zeros(uEltypeNoUnits,length(u),length(u)) # uEltype?
W = zeros(J)
z₁ = zeros(u,indices(u)); z₂ = zeros(u,indices(u))
z₃ = zeros(u,indices(u)); z₄ = zeros(u,indices(u))
dz = zeros(u,indices(u))
z₁ = similar(u,indices(u)); z₂ = similar(u,indices(u))
z₃ = similar(u,indices(u)); z₄ = similar(u,indices(u))
dz = similar(u,indices(u))
fsalfirst = zeros(rate_prototype)
k = zeros(rate_prototype)
tmp = zeros(ΔW); b = zeros(u,indices(u));
tmp = zeros(ΔW); b = similar(u,indices(u));
atmp = zeros(u,uEltypeNoUnits,indices(u))

if typeof(f) <: SplitFunction
k1 = zeros(u,indices(u)); k2 = zeros(u,indices(u))
k3 = zeros(u,indices(u)); k4 = zeros(u,indices(u))
k1 = zeros(u); k2 = zeros(u)
k3 = zeros(u); k4 = zeros(u)
uf = DiffEqDiffTools.UJacobianWrapper(f.f1,t,p)
else
k1 = nothing; k2 = nothing
Expand Down

0 comments on commit f5c1cd2

Please sign in to comment.