@@ -8,28 +8,35 @@ type StochasticCompositeCache{T,F} <: StochasticDiffEqCache
88 current:: Int
99end
1010
11- function alg_cache {T,algType<:StochasticCompositeAlgorithm} (alg:: algType ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{T}} )
12- caches = map ((x)-> alg_cache (x,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,Val{T}),alg. algs)
11+ function alg_cache {T,algType<:StochasticCompositeAlgorithm} (alg:: algType ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{T}} )
12+ caches = map ((x)-> alg_cache (x,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,Val{T}),alg. algs)
1313 StochasticCompositeCache (caches,alg. choice_function,1 )
1414end
1515
1616immutable EMConstantCache <: StochasticDiffEqConstantCache end
17- immutable EMCache{uType,rateType} <: StochasticDiffEqMutableCache
17+ immutable EMCache{uType,rateType,rateNoiseType,rateNoiseCollectionType } <: StochasticDiffEqMutableCache
1818 u:: uType
1919 uprev:: uType
2020 tmp:: uType
2121 rtmp1:: rateType
22- rtmp2:: rateType
22+ rtmp2:: rateNoiseType
23+ rtmp3:: rateNoiseCollectionType
2324end
2425
2526u_cache (c:: EMCache ) = ()
2627du_cache (c:: EMCache ) = (c. rtmp1,c. rtmp2)
2728
28- alg_cache (alg:: EM ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} ) = EMConstantCache ()
29+ alg_cache (alg:: EM ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} ) = EMConstantCache ()
2930
30- function alg_cache (alg:: EM ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
31- tmp = similar (u); rtmp1 = zeros (rate_prototype); rtmp2 = zeros (rate_prototype)
32- EMCache (u,uprev,tmp,rtmp1,rtmp2)
31+ function alg_cache (alg:: EM ,prob,u,ΔW,ΔZ,rate_prototype,noise_rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
32+ tmp = similar (u); rtmp1 = zeros (rate_prototype);
33+ rtmp2 = zeros (noise_rate_prototype)
34+ if is_diagonal_noise (prob)
35+ rtmp3 = rtmp2
36+ else
37+ rtmp3 = zeros (rate_prototype)
38+ end
39+ EMCache (u,uprev,tmp,rtmp1,rtmp2,rtmp3)
3340end
3441
3542immutable EulerHeunConstantCache <: StochasticDiffEqConstantCache end
4653u_cache (c:: EulerHeunCache ) = ()
4754du_cache (c:: EulerHeunCache ) = (c. rtmp1,c. rtmp2,c. rtmp3,c. rtmp4)
4855
49- alg_cache (alg:: EulerHeun ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} ) = EulerHeunConstantCache ()
56+ alg_cache (alg:: EulerHeun ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} ) = EulerHeunConstantCache ()
5057
51- function alg_cache (alg:: EulerHeun ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
58+ function alg_cache (alg:: EulerHeun ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
5259 tmp = similar (u); rtmp1 = zeros (rate_prototype); rtmp2 = zeros (rate_prototype)
5360 rtmp3 = zeros (rate_prototype); rtmp4 = zeros (rate_prototype)
5461 EulerHeunCache (u,uprev,tmp,rtmp1,rtmp2,rtmp3,rtmp4)
6572u_cache (c:: RandomEMCache ) = ()
6673du_cache (c:: RandomEMCache ) = (c. rtmp1,c. rtmp2)
6774
68- alg_cache (alg:: RandomEM ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} ) = RandomEMConstantCache ()
75+ alg_cache (alg:: RandomEM ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} ) = RandomEMConstantCache ()
6976
70- function alg_cache (alg:: RandomEM ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
77+ function alg_cache (alg:: RandomEM ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
7178 tmp = similar (u); rtmp = zeros (rate_prototype)
7279 RandomEMCache (u,uprev,tmp,rtmp)
7380end
8693u_cache (c:: RKMilCache ) = ()
8794du_cache (c:: RKMilCache ) = (c. du1,c. du2,c. K,c. L)
8895
89- alg_cache (alg:: RKMil ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} ) = RKMilConstantCache ()
96+ alg_cache (alg:: RKMil ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} ) = RKMilConstantCache ()
9097
91- function alg_cache (alg:: RKMil ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
98+ function alg_cache (alg:: RKMil ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
9299 du1 = zeros (rate_prototype); du2 = zeros (rate_prototype)
93100 K = zeros (rate_prototype); tmp = similar (u); L = zeros (rate_prototype)
94101 RKMilCache (u,uprev,du1,du2,K,tmp,L)
95102end
96103
97104immutable SRA1ConstantCache <: StochasticDiffEqConstantCache end
98- alg_cache (alg:: SRA1 ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} ) = SRA1ConstantCache ()
105+ alg_cache (alg:: SRA1 ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} ) = SRA1ConstantCache ()
99106
100107immutable SRA1Cache{randType,rateType,uType} <: StochasticDiffEqMutableCache
101108 u:: uType
@@ -115,7 +122,7 @@ u_cache(c::SRA1Cache) = ()
115122du_cache (c:: SRA1Cache ) = (c. chi2,c. E₁,c. E₂,c. gt,c. k₁,c. k₂,c. gpdt)
116123user_cache (c:: SRA1Cache ) = (c. u,c. uprev,c. tmp,c. tmp1)
117124
118- function alg_cache (alg:: SRA1 ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
125+ function alg_cache (alg:: SRA1 ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
119126 chi2 = similar (ΔW)
120127 tmp1 = zeros (u)
121128 E₁ = zeros (rate_prototype); gt = zeros (rate_prototype); gpdt = zeros (rate_prototype)
@@ -143,7 +150,7 @@ function SRAConstantCache(tableau,rate_prototype)
143150 SRAConstantCache (c₀,c₁,A₀' ,B₀' ,α,β₁,β₂,stages,H0)
144151end
145152
146- function alg_cache (alg:: SRA ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} )
153+ function alg_cache (alg:: SRA ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} )
147154 SRAConstantCache (alg. tableau,rate_prototype)
148155end
149156
@@ -170,7 +177,7 @@ du_cache(c::SRACache) = (c.A0temp,c.B0temp,c.ftmp,c.gtmp,c.chi2,c.chi2,c.atemp,
170177 c. btemp,c. E₁,c. E₁temp,c. E₂)
171178user_cache (c:: SRACache ) = (c. u,c. uprev,c. tmp,c. H0... )
172179
173- function alg_cache (alg:: SRA ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
180+ function alg_cache (alg:: SRA ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
174181 H0 = Vector {typeof(u)} (0 )
175182 tab = SRAConstantCache (alg. tableau,rate_prototype)
176183 for i = 1 : tab. stages
@@ -210,7 +217,7 @@ function SRIConstantCache(tableau,rate_prototype,error_terms)
210217 SRIConstantCache (c₀,c₁,A₀' ,A₁' ,B₀' ,B₁' ,α,β₁,β₂,β₃,β₄,stages,H0,H1,error_terms)
211218end
212219
213- function alg_cache (alg:: SRI ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} )
220+ function alg_cache (alg:: SRI ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} )
214221 SRIConstantCache (alg. tableau,rate_prototype,alg. error_terms)
215222end
216223
@@ -247,7 +254,7 @@ du_cache(c::SRICache) = (c.A0temp,c.A1temp,c.B0temp,c.B1temp,c.A0temp2,c.A1temp2
247254 c. ftemp,c. gtemp,c. chi1,c. chi2,c. chi3)
248255user_cache (c:: SRICache ) = (c. u,c. uprev,c. tmp,c. H0... ,c. H1... )
249256
250- function alg_cache (alg:: SRI ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
257+ function alg_cache (alg:: SRI ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
251258 H0 = Vector {typeof(u)} (0 )
252259 H1 = Vector {typeof(u)} (0 )
253260 tab = SRIConstantCache (alg. tableau,rate_prototype,alg. error_terms)
@@ -270,7 +277,7 @@ function alg_cache(alg::SRI,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits
270277end
271278
272279immutable SRIW1ConstantCache <: StochasticDiffEqConstantCache end
273- alg_cache (alg:: SRIW1 ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} ) = SRIW1ConstantCache ()
280+ alg_cache (alg:: SRIW1 ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{false}} ) = SRIW1ConstantCache ()
274281
275282immutable SRIW1Cache{randType,uType,rateType} <: StochasticDiffEqMutableCache
276283 u:: uType
@@ -305,7 +312,7 @@ du_cache(c::SRIW1Cache) = (c.chi1,c.chi2,c.chi3,c.fH01o4,c.g₁o2,c.g₂o3,c.Fg
305312 c. E₁,c. E₂,c. fH01,c. fH02,c. g₁,c. g₂,c. g₃,c. g₄)
306313user_cache (c:: SRIW1Cache ) = (c. u,c. uprev,c. tmp,c. H0,c. H11,c. H12,c. H13)
307314
308- function alg_cache (alg:: SRIW1 ,u,ΔW,ΔZ,rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
315+ function alg_cache (alg:: SRIW1 ,prob, u,ΔW,ΔZ,rate_prototype,noise_rate_prototype ,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,:: Type{Val{true}} )
309316 chi1 = similar (ΔW)
310317 chi2 = similar (ΔW)
311318 chi3 = similar (ΔW)
0 commit comments