SciML / DiffEqNoiseProcess.jl

A library of noise processes for stochastic systems like stochastic differential equations (SDEs) and other systems that are present in scientific machine learning (SciML)
https://docs.sciml.ai/DiffEqNoiseProcess/stable/
Other
63 stars 29 forks source link

Add `reverse` dispatch for VBT #153

Closed frankschae closed 1 year ago

frankschae commented 1 year ago

See https://github.com/SciML/DiffEqNoiseProcess.jl/issues/152

(In contrast to all other noise processes), we don't need to reverse the noise values for the VBT.

f = (u, p, t) -> 1.01u
g = (u, p, t) -> 0.11u
W = VirtualBrownianTree(-2.0, 0.0; tree_depth=6, tend=2.0)
dt = 1 / 2^8
prob1 = SDEProblem(f, g, 1.0, (0.0, 1.0), noise=W)
sol1 = solve(prob1, EM(), dt=dt, save_noise=true)
prob2 = SDEProblem(f, g, sol1(1.0), (1.0, 0.0), noise=W)
sol2 = solve(prob2, EM(), dt=dt, save_noise=true)
@test sol1.W.W ≈ sol2.W.W
@test sol2.u ≈ reverse(sol1.u) rtol = 0.01

So, I think

Base.reverse(W::VirtualBrownianTree) = W

should fix it. @glatteis can you try if this will fix the issue with BacksolveAdjoint and InterpolatingAdjoint before we merge it?