Skip to content

Commit

Permalink
feat: run remake_initialization_data when remaking SDEProblem
Browse files Browse the repository at this point in the history
  • Loading branch information
AayushSabharwal committed Dec 3, 2024
1 parent 85909bc commit 0992a41
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/remake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,20 @@ function remake(prob::SDEProblem;
use_defaults = false,
seed = missing,
kwargs = missing,
build_initializeprob = true,
_kwargs...)
if tspan === missing
tspan = prob.tspan
end

u0, p = updated_u0_p(prob, u0, p, tspan[1]; interpret_symbolicmap, use_defaults)
newu0, newp = updated_u0_p(prob, u0, p, tspan[1]; interpret_symbolicmap, use_defaults)

if build_initializeprob
initialization_data = remake_initialization_data(
prob.f.sys, prob.f, u0, tspan[1], p, newu0, newp)
else
initialization_data = nothing
end

if noise === missing
noise = prob.noise
Expand Down Expand Up @@ -345,21 +353,21 @@ function remake(prob::SDEProblem;
f = SDEFunction(f, g; sys = prob.f.sys)
end
end

f = remake(f; initialization_data)
iip = isinplace(prob)

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

Expand Down

0 comments on commit 0992a41

Please sign in to comment.