Skip to content

Commit 0525143

Browse files
author
Hadrien
committed
Allow Dynamical problem to have non diagonal noise
1 parent 0eaf97b commit 0525143

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/solve.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,13 @@ function DiffEqBase.__init(
210210
end
211211
rateType = typeof(rate_prototype) ## Can be different if united
212212

213-
if prob.f isa DynamicalSDEFunction
214-
noise_rate_prototype = rate_prototype.x[1]
215-
elseif is_diagonal_noise(prob)
216-
noise_rate_prototype = rate_prototype
213+
214+
if is_diagonal_noise(prob)
215+
if prob.f isa DynamicalSDEFunction
216+
noise_rate_prototype = rate_prototype.x[1]
217+
else
218+
noise_rate_prototype = rate_prototype
219+
end
217220
elseif prob isa DiffEqBase.AbstractRODEProblem
218221
if prob isa DiffEqBase.AbstractSDEProblem
219222
noise_rate_prototype = copy(prob.noise_rate_prototype)
@@ -287,7 +290,7 @@ function DiffEqBase.__init(
287290
else
288291
randElType = uBottomEltypeNoUnits # Strip units and type info
289292
if prob.f isa DynamicalSDEFunction
290-
rand_prototype = copy(noise_rate_prototype)
293+
rand_prototype = copy(rate_prototype.x[1]) # Noise is a vector of the same size than the number of variables
291294
elseif is_diagonal_noise(prob)
292295
if typeof(u) <: SArray
293296
rand_prototype = zero(u) # TODO: Array{randElType} for units

0 commit comments

Comments
 (0)