Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ModelingToolkit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ using DiffEqCallbacks
using Graphs
import ExprTools: splitdef, combinedef
import OrderedCollections
using DiffEqNoiseProcess: DiffEqNoiseProcess, WienerProcess
using DiffEqNoiseProcess: DiffEqNoiseProcess, WienerProcess, WienerProcess!

using SymbolicIndexingInterface
using LinearAlgebra, SparseArrays
Expand Down
2 changes: 1 addition & 1 deletion src/problems/sddeproblem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ end
end
end

noise, noise_rate_prototype = calculate_noise_and_rate_prototype(sys, u0; sparsenoise)
noise, noise_rate_prototype = calculate_noise_and_rate_prototype(sys, u0; sparsenoise, iip)
kwargs = process_kwargs(sys; callback, eval_expression, eval_module, op, kwargs...)

if expression == Val{true}
Expand Down
6 changes: 3 additions & 3 deletions src/problems/sdeproblem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ end
t = tspan !== nothing ? tspan[1] : tspan, check_length, eval_expression,
eval_module, check_compatibility, sparse, expression, kwargs...)

noise, noise_rate_prototype = calculate_noise_and_rate_prototype(sys, u0; sparsenoise)
noise, noise_rate_prototype = calculate_noise_and_rate_prototype(sys, u0; sparsenoise, iip)
kwargs = process_kwargs(sys; expression, callback, eval_expression, eval_module,
op, kwargs...)

Expand All @@ -97,7 +97,7 @@ function check_compatible_system(T::Union{Type{SDEFunction}, Type{SDEProblem}},
check_is_continuous(sys, T)
end

function calculate_noise_and_rate_prototype(sys::System, u0; sparsenoise = false)
function calculate_noise_and_rate_prototype(sys::System, u0; sparsenoise = false, iip = false)
noiseeqs = get_noise_eqs(sys)
if noiseeqs isa AbstractVector
# diagonal noise
Expand All @@ -106,7 +106,7 @@ function calculate_noise_and_rate_prototype(sys::System, u0; sparsenoise = false
elseif size(noiseeqs, 2) == 1
# scalar noise
noise_rate_prototype = nothing
noise = WienerProcess(0.0, 0.0, 0.0)
noise = iip ? WienerProcess!(0., 0., 0.) : WienerProcess(0., 0., 0.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scalar is always out of place, since scalars are just numbers

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah OK I just misunderstood then, will close since the original issue is fixed by the rng change

elseif sparsenoise
I, J, V = findnz(SparseArrays.sparse(noiseeqs))
noise_rate_prototype = SparseArrays.sparse(I, J, zero(eltype(u0)))
Expand Down
Loading