Skip to content

Commit

Permalink
depend directly on DiffEqNoiseProcess
Browse files Browse the repository at this point in the history
  • Loading branch information
MasonProtter authored and ChrisRackauckas committed Jul 22, 2024
1 parent 033f0cd commit dc284af
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def"
DiffEqNoiseProcess = "77a26b50-5914-5dd7-bc55-306e6241c503"
DiffRules = "b552c78f-8df3-52c6-915a-8e097449b14b"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Expand Down Expand Up @@ -56,12 +57,10 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
[weakdeps]
BifurcationKit = "0f109fa4-8a5d-4b75-95aa-f515264e7665"
DeepDiffs = "ab62b9b5-e342-54a8-a765-a90f495de1a6"
DiffEqNoiseProcess = "77a26b50-5914-5dd7-bc55-306e6241c503"

[extensions]
MTKBifurcationKitExt = "BifurcationKit"
MTKDeepDiffsExt = "DeepDiffs"
MTKDiffEqNoiseProcess = "DiffEqNoiseProcess"

[compat]
AbstractTrees = "0.3, 0.4"
Expand All @@ -74,6 +73,7 @@ DataStructures = "0.17, 0.18"
DeepDiffs = "1"
DiffEqBase = "6.103.0"
DiffEqCallbacks = "2.16, 3"
DiffEqNoiseProcess = "5"
DiffRules = "0.1, 1.0"
Distributed = "1"
Distributions = "0.23, 0.24, 0.25"
Expand Down
8 changes: 0 additions & 8 deletions ext/MTKDiffEqNoiseProcess.jl

This file was deleted.

1 change: 1 addition & 0 deletions src/ModelingToolkit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ using DiffEqCallbacks
using Graphs
import ExprTools: splitdef, combinedef
import OrderedCollections
using DiffEqNoiseProcess: DiffEqNoiseProcess, WienerProcess

using SymbolicIndexingInterface
using LinearAlgebra, SparseArrays, LabelledArrays
Expand Down
10 changes: 6 additions & 4 deletions src/systems/diffeqs/sdesystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -615,8 +615,6 @@ function SDEFunctionExpr(sys::SDESystem, args...; kwargs...)
SDEFunctionExpr{true}(sys, args...; kwargs...)
end

function scalar_noise end # defined in ../ext/MTKDiffEqNoiseProcess.jl

function DiffEqBase.SDEProblem{iip, specialize}(
sys::SDESystem, u0map = [], tspan = get_tspan(sys),
parammap = DiffEqBase.NullParameters();
Expand All @@ -636,7 +634,7 @@ function DiffEqBase.SDEProblem{iip, specialize}(
if noiseeqs isa AbstractVector
noise_rate_prototype = nothing
if is_scalar_noise
noise = scalar_noise()
noise = WienerProcess(0.0, 0.0, 0.0)
else
noise = nothing
end
Expand Down Expand Up @@ -721,14 +719,18 @@ function SDEProblemExpr{iip}(sys::SDESystem, u0map, tspan,
if noiseeqs isa AbstractVector
noise_rate_prototype = nothing
if is_scalar_noise
noise = scalar_noise()
noise = WienerProcess(0.0, 0.0, 0.0)
else
noise = nothing
end
elseif sparsenoise
I, J, V = findnz(SparseArrays.sparse(noiseeqs))
noise_rate_prototype = SparseArrays.sparse(I, J, zero(eltype(u0)))
noise = nothing
else
T = u0 === nothing ? Float64 : eltype(u0)
noise_rate_prototype = zeros(T, size(get_noiseeqs(sys)))
noise = nothing
end
ex = quote
f = $f
Expand Down

0 comments on commit dc284af

Please sign in to comment.