Skip to content

Commit

Permalink
Merge pull request #509 from ErikQQY/qqy/fix_remake
Browse files Browse the repository at this point in the history
Fix remake for SDEProblem constructor issues
  • Loading branch information
ChrisRackauckas authored Sep 28, 2023
2 parents 25c3d1c + cf9ded4 commit 5b127c5
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SciMLBase"
uuid = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
authors = ["Chris Rackauckas <[email protected]> and contributors"]
version = "2.0.3"
version = "2.0.4"

[deps]
ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b"
Expand Down
62 changes: 62 additions & 0 deletions src/remake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,68 @@ function remake(prob::ODEProblem; f = missing,
end
end

"""
remake(prob::SDEProblem; f = missing, u0 = missing, tspan = missing,
p = missing, noise = missing, noise_rate_prototype = missing,
seed = missing, kwargs = missing, _kwargs...)
Remake the given `SDEProblem`.
"""
function remake(prob::SDEProblem;
f = missing,
u0 = missing,
tspan = missing,
p = missing,
noise = missing,
noise_rate_prototype = missing,
seed = missing,
kwargs = missing,
_kwargs...)
if tspan === missing
tspan = prob.tspan
end

if p === missing
p = prob.p
end

if u0 === missing
u0 = prob.u0
end

if noise === missing
noise = prob.noise
end

if noise_rate_prototype === missing
noise_rate_prototype = prob.noise_rate_prototype
end

if seed === missing
seed = prob.seed
end

if f === missing #TODO: Need more features, e.g. remake `g`
f = prob.f
end

iip = isinplace(prob)

if kwargs === missing
SDEProblem{iip}(f,
u0,
tspan,
p;
noise,
noise_rate_prototype,
seed,
prob.kwargs...,
_kwargs...)
else
SDEProblem{iip}(f, u0, tspan, p; noise, noise_rate_prototype, seed, kwargs...)
end
end

"""
remake(prob::OptimizationProblem; f = missing, u0 = missing, p = missing,
lb = missing, ub = missing, int = missing, lcons = missing, ucons = missing,
Expand Down

0 comments on commit 5b127c5

Please sign in to comment.