Skip to content

Commit

Permalink
move the type to SciMLBase
Browse files Browse the repository at this point in the history
  • Loading branch information
prbzrg committed Aug 31, 2024
1 parent ef189b8 commit c1f29d6
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 74 deletions.
2 changes: 0 additions & 2 deletions src/StochasticDiffEq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ end
seed_multiplier() = 1
end

EnumX.@enumx AlgorithmInterpretation Ito Stratonovich

include("misc_utils.jl")
include("algorithms.jl")
include("options_type.jl")
Expand Down
18 changes: 9 additions & 9 deletions src/alg_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,22 @@ beta1_default(alg::Union{StochasticDiffEqAlgorithm,StochasticDiffEqRODEAlgorithm

isdtchangeable(alg::Union{StochasticDiffEqAlgorithm,StochasticDiffEqRODEAlgorithm}) = true

SciMLBase.alg_interpretation(alg::StochasticDiffEqAlgorithm) = AlgorithmInterpretation.Ito
SciMLBase.alg_interpretation(alg::EulerHeun) = AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::LambaEulerHeun) = AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::KomBurSROCK2) = AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::StochasticDiffEqAlgorithm) = SciMLBase.AlgorithmInterpretation.Ito
SciMLBase.alg_interpretation(alg::EulerHeun) = SciMLBase.AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::LambaEulerHeun) = SciMLBase.AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::KomBurSROCK2) = SciMLBase.AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::RKMil{interpretation}) where {interpretation} = interpretation
SciMLBase.alg_interpretation(alg::SROCK1{interpretation,E}) where {interpretation,E} = interpretation
SciMLBase.alg_interpretation(alg::RKMilCommute) = alg.interpretation
SciMLBase.alg_interpretation(alg::RKMilGeneral) = alg.interpretation
SciMLBase.alg_interpretation(alg::ImplicitRKMil{CS,AD,F,P,FDT,ST,CJ,N,T2,Controller,interpretation}) where {CS,AD,F,P,FDT,ST,CJ,N,T2,Controller,interpretation} = interpretation

SciMLBase.alg_interpretation(alg::RS1) = AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::RS2) = AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::RS1) = SciMLBase.AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::RS2) = SciMLBase.AlgorithmInterpretation.Stratonovich

SciMLBase.alg_interpretation(alg::NON) = AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::COM) = AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::NON2) = AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::NON) = SciMLBase.AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::COM) = SciMLBase.AlgorithmInterpretation.Stratonovich
SciMLBase.alg_interpretation(alg::NON2) = SciMLBase.AlgorithmInterpretation.Stratonovich

alg_compatible(prob, alg::Union{StochasticDiffEqAlgorithm,StochasticDiffEqRODEAlgorithm}) = true
alg_compatible(prob, alg::StochasticDiffEqAlgorithm) = false
Expand Down
26 changes: 13 additions & 13 deletions src/algorithms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,49 +77,49 @@ Springer. Berlin Heidelberg (2011)
RKMil: Nonstiff Method
An explicit Runge-Kutta discretization of the strong order 1.0 Milstein method.
Defaults to solving the Ito problem, but RKMil(interpretation=AlgorithmInterpretation.Stratonovich) makes it solve the Stratonovich problem.
Defaults to solving the Ito problem, but RKMil(interpretation=SciMLBase.AlgorithmInterpretation.Stratonovich) makes it solve the Stratonovich problem.
Only handles scalar and diagonal noise.
"""
struct RKMil{interpretation} <: StochasticDiffEqAdaptiveAlgorithm end
RKMil(;interpretation=AlgorithmInterpretation.Ito) = RKMil{interpretation}()
RKMil(;interpretation=SciMLBase.AlgorithmInterpretation.Ito) = RKMil{interpretation}()

"""
Kloeden, P.E., Platen, E., Numerical Solution of Stochastic Differential Equations.
Springer. Berlin Heidelberg (2011)
RKMilCommute: Nonstiff Method
An explicit Runge-Kutta discretization of the strong order 1.0 Milstein method for commutative noise problems.
Defaults to solving the Ito problem, but RKMilCommute(interpretation=AlgorithmInterpretation.Stratonovich) makes it solve the Stratonovich problem.
Defaults to solving the Ito problem, but RKMilCommute(interpretation=SciMLBase.AlgorithmInterpretation.Stratonovich) makes it solve the Stratonovich problem.
Uses a 1.5/2.0 error estimate for adaptive time stepping.
Default: ii_approx=IICommutative() does not approximate the Levy area.
"""
struct RKMilCommute{T} <: StochasticDiffEqAdaptiveAlgorithm
interpretation::AlgorithmInterpretation.T
interpretation::SciMLBase.AlgorithmInterpretation.T
ii_approx::T
end
RKMilCommute(;interpretation=AlgorithmInterpretation.Ito, ii_approx=IICommutative()) = RKMilCommute(interpretation,ii_approx)
RKMilCommute(;interpretation=SciMLBase.AlgorithmInterpretation.Ito, ii_approx=IICommutative()) = RKMilCommute(interpretation,ii_approx)

"""
Kloeden, P.E., Platen, E., Numerical Solution of Stochastic Differential Equations.
Springer. Berlin Heidelberg (2011)
RKMilGeneral: Nonstiff Method
RKMilGeneral(;interpretation=AlgorithmInterpretation.Ito, ii_approx=IILevyArea()
RKMilGeneral(;interpretation=SciMLBase.AlgorithmInterpretation.Ito, ii_approx=IILevyArea()
An explicit Runge-Kutta discretization of the strong order 1.0 Milstein method for general non-commutative noise problems.
Allows for a choice of interpretation between AlgorithmInterpretation.Ito and AlgorithmInterpretation.Stratonovich.
Allows for a choice of interpretation between SciMLBase.AlgorithmInterpretation.Ito and SciMLBase.AlgorithmInterpretation.Stratonovich.
Allows for a choice of iterated integral approximation.
Default: ii_approx=IILevyArea() uses LevyArea.jl to choose optimal algorithm. See
Kastner, F. and Rößler, A., arXiv: 2201.08424
Kastner, F. and Rößler, A., LevyArea.jl, 10.5281/ZENODO.5883748, https://github.com/stochastics-uni-luebeck/LevyArea.jl
"""
struct RKMilGeneral{T, TruncationType} <: StochasticDiffEqAdaptiveAlgorithm
interpretation::AlgorithmInterpretation.T
interpretation::SciMLBase.AlgorithmInterpretation.T
ii_approx::T
c::Int
p::TruncationType
end

function RKMilGeneral(;interpretation=AlgorithmInterpretation.Ito,ii_approx=IILevyArea(), c=1, p=nothing, dt=nothing)
function RKMilGeneral(;interpretation=SciMLBase.AlgorithmInterpretation.Ito,ii_approx=IILevyArea(), c=1, p=nothing, dt=nothing)
γ = 1//1
p==true && (p = Int(floor(c*dt^(1//1-2//1*γ)) + 1))
RKMilGeneral{typeof(ii_approx), typeof(p)}(interpretation, ii_approx, c, p)
Expand Down Expand Up @@ -160,13 +160,13 @@ struct WangLi3SMil_F <: StochasticDiffEqAlgorithm end
"""
SROCK1: S-ROCK Method
Is a fixed step size stabilized explicit method for stiff problems.
Defaults to solving th Ito problem but SROCK1(interpretation=AlgorithmInterpretation.Stratonovich) can make it solve the Stratonovich problem.
Defaults to solving th Ito problem but SROCK1(interpretation=SciMLBase.AlgorithmInterpretation.Stratonovich) can make it solve the Stratonovich problem.
Strong order of convergence is 0.5 and weak order 1, but is optimised to get order 1 in case os scalar/diagonal noise.
"""
struct SROCK1{interpretation,E} <: StochasticDiffEqAlgorithm
eigen_est::E
end
SROCK1(;interpretation=AlgorithmInterpretation.Ito,eigen_est=nothing) = SROCK1{interpretation,typeof(eigen_est)}(eigen_est)
SROCK1(;interpretation=SciMLBase.AlgorithmInterpretation.Ito,eigen_est=nothing) = SROCK1{interpretation,typeof(eigen_est)}(eigen_est)

# Weak Order 2
for Alg in [:SROCK2, :KomBurSROCK2, :SROCKC2]
Expand Down Expand Up @@ -701,7 +701,7 @@ ImplicitEulerHeun(;chunk_size=0,autodiff=true,diff_type=Val{:central},
ImplicitRKMil: Stiff Method
An order 1.0 drift-implicit method.
This is a theta method which defaults to theta=1 or the Trapezoid method on the drift term.
Defaults to solving the Ito problem, but ImplicitRKMil(interpretation=AlgorithmInterpretation.Stratonovich) makes it solve the Stratonovich problem.
Defaults to solving the Ito problem, but ImplicitRKMil(interpretation=SciMLBase.AlgorithmInterpretation.Stratonovich) makes it solve the Stratonovich problem.
This method defaults to symplectic=false, but when true and theta=1/2 this is the implicit Midpoint method on the drift term and is symplectic in distribution.
Handles diagonal and scalar noise. Uses a 1.5/2.0 heuristic for adaptive time stepping.
"""
Expand All @@ -721,7 +721,7 @@ ImplicitRKMil(;chunk_size=0,autodiff=true,diff_type=Val{:central},
extrapolant=:constant,
theta = 1,symplectic = false,
new_jac_conv_bound = 1e-3,
controller = :Predictive,interpretation=AlgorithmInterpretation.Ito) =
controller = :Predictive,interpretation=SciMLBase.AlgorithmInterpretation.Ito) =
ImplicitRKMil{chunk_size,autodiff,
typeof(linsolve),typeof(precs),diff_type,
OrdinaryDiffEq._unwrap_val(standardtag),
Expand Down
12 changes: 6 additions & 6 deletions src/perform_step/SROCK_perform_step.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
cosh_inv = log(ω₀ + Sqrt_ω) # arcosh(ω₀)
ω₁ = (Sqrt_ω*cosh(mdeg*cosh_inv))/(mdeg*sinh(mdeg*cosh_inv))

if SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Stratonovich
if SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Stratonovich
α = cosh(mdeg*cosh_inv)/(2*ω₀*cosh((mdeg-1)*cosh_inv))
γ = 1/(2*α)
β = -γ
Expand Down Expand Up @@ -42,7 +42,7 @@
k = integrator.f(uᵢ₋₁,p,tᵢ₋₁)

u = dt*μ*k + ν*uᵢ₋₁ + κ*uᵢ₋₂
if (i > mdeg - 2) && SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Stratonovich
if (i > mdeg - 2) && SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Stratonovich
if i == mdeg - 1
gₘ₋₂ = integrator.g(uᵢ₋₁,p,tᵢ₋₁)
if W.dW isa Number || !is_diagonal_noise(integrator.sol.prob)
Expand All @@ -58,7 +58,7 @@
u .+=.* gₘ₋₂ .+ γ .* gₘ₋₁) .* W.dW
end
end
elseif (i == mdeg) && SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Ito
elseif (i == mdeg) && SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Ito
if W.dW isa Number
gₘ₋₂ = integrator.g(uᵢ₋₁,p,tᵢ₋₁)
uᵢ₋₂ = uᵢ₋₁ + sqrt(abs(dt))*gₘ₋₂
Expand Down Expand Up @@ -105,7 +105,7 @@ end
cosh_inv = log(ω₀ + Sqrt_ω) # arcosh(ω₀)
ω₁ = (Sqrt_ω*cosh(mdeg*cosh_inv))/(mdeg*sinh(mdeg*cosh_inv))

if SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Stratonovich
if SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Stratonovich
α = cosh(mdeg*cosh_inv)/(2*ω₀*cosh((mdeg-1)*cosh_inv))
γ = 1/(2*α)
β = -γ
Expand All @@ -132,7 +132,7 @@ end
κ = - Tᵢ₋₂/Tᵢ
integrator.f(k,uᵢ₋₁,p,tᵢ₋₁)
@.. u = dt*μ*k + ν*uᵢ₋₁ + κ*uᵢ₋₂
if (i > mdeg - 2) && SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Stratonovich
if (i > mdeg - 2) && SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Stratonovich
if i == mdeg - 1
integrator.g(gₘ₋₂,uᵢ₋₁,p,tᵢ₋₁)
if W.dW isa Number || is_diagonal_noise(integrator.sol.prob)
Expand All @@ -152,7 +152,7 @@ end
@.. u += γ*k
end
end
elseif (i == mdeg) && SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Ito
elseif (i == mdeg) && SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Ito
if W.dW isa Number || is_diagonal_noise(integrator.sol.prob)
integrator.g(gₘ₋₂,uᵢ₋₁,p,tᵢ₋₁)
@.. uᵢ₋₂ = uᵢ₋₁ + sqrt(abs(dt))*gₘ₋₂
Expand Down
28 changes: 14 additions & 14 deletions src/perform_step/low_order.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,16 @@ end
K = @.. uprev + dt * du1
L = integrator.g(uprev,p,t)
mil_correction = zero(u)
if SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Ito
if SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Ito
utilde = K + L*integrator.sqdt
ggprime = (integrator.g(utilde,p,t).-L)./(integrator.sqdt)
mil_correction = ggprime.*(W.dW.^2 .- abs(dt))./2
elseif SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Stratonovich
elseif SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Stratonovich
utilde = uprev + L*integrator.sqdt
ggprime = (integrator.g(utilde,p,t).-L)./(integrator.sqdt)
mil_correction = ggprime.*(W.dW.^2)./2
else
error("Algorithm interpretation invalid. Use either AlgorithmInterpretation.Ito or AlgorithmInterpretation.Stratonovich")
error("Algorithm interpretation invalid. Use either SciMLBase.AlgorithmInterpretation.Ito or SciMLBase.AlgorithmInterpretation.Stratonovich")
end
u = K+L.*W.dW+mil_correction

Expand All @@ -241,16 +241,16 @@ end
integrator.g(L,uprev,p,t)
@.. K = uprev + dt * du1
@.. du2 = zero(eltype(u)) # This makes it safe to re-use the array
if SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Ito
if SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Ito
@.. tmp = K + integrator.sqdt * L
integrator.g(du2,tmp,p,t)
@.. tmp = (du2-L)/(2integrator.sqdt)*(W.dW.^2 - abs(dt))
elseif SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Stratonovich
elseif SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Stratonovich
@.. tmp = uprev + integrator.sqdt * L
integrator.g(du2,tmp,p,t)
@.. tmp = (du2-L)/(2integrator.sqdt)*(W.dW.^2)
else
error("Algorithm interpretation invalid. Use either AlgorithmInterpretation.Ito or AlgorithmInterpretation.Stratonovich")
error("Algorithm interpretation invalid. Use either SciMLBase.AlgorithmInterpretation.Ito or SciMLBase.AlgorithmInterpretation.Stratonovich")
end
@.. u = K+L*W.dW + tmp
if integrator.opts.adaptive
Expand All @@ -275,7 +275,7 @@ end
J = get_iterated_I(dt, dW, W.dZ, Jalg)

mil_correction = zero(u)
if SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Ito
if SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Ito
if dW isa Number || is_diagonal_noise(integrator.sol.prob)
J = J .- 1//2 .* abs(dt)
else
Expand All @@ -289,7 +289,7 @@ end
K = uprev + dt*du1

if is_diagonal_noise(integrator.sol.prob)
tmp = (SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Ito ? K : uprev) .+ integrator.sqdt .* L
tmp = (SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Ito ? K : uprev) .+ integrator.sqdt .* L
gtmp = integrator.g(tmp,p,t)
Dgj = (gtmp - L)/sqdt
ggprime_norm = integrator.opts.internalnorm(Dgj,t)
Expand Down Expand Up @@ -343,7 +343,7 @@ end
J = Jalg.J

@.. mil_correction = zero(u)
if SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Ito
if SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Ito
if dW isa Number || is_diagonal_noise(integrator.sol.prob)
@.. J -= 1 // 2 * abs(dt)
else
Expand All @@ -357,7 +357,7 @@ end
@.. K = uprev + dt*du1

if is_diagonal_noise(integrator.sol.prob)
tmp .= (SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Ito ? K : uprev) .+ integrator.sqdt .* L
tmp .= (SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Ito ? K : uprev) .+ integrator.sqdt .* L
integrator.g(gtmp,tmp,p,t)
@.. Dgj = (gtmp - L)/sqdt
ggprime_norm = integrator.opts.internalnorm(Dgj,t)
Expand Down Expand Up @@ -397,7 +397,7 @@ end

J = get_iterated_I(dt, dW, W.dZ, Jalg, integrator.alg.p, integrator.alg.c, alg_order(integrator.alg))

if SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Ito
if SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Ito
if dW isa Number || is_diagonal_noise(integrator.sol.prob)
J = J .- 1//2 .* abs(dt)
else
Expand All @@ -413,7 +413,7 @@ end

if dW isa Number || is_diagonal_noise(integrator.sol.prob)
K = @.. uprev + dt*du₁
utilde = (SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Ito ? K : uprev) + L*integrator.sqdt
utilde = (SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Ito ? K : uprev) + L*integrator.sqdt
ggprime = (integrator.g(utilde,p,t) .- L) ./ (integrator.sqdt)
mil_correction = ggprime .* J
u = K + L .* dW + mil_correction
Expand Down Expand Up @@ -467,7 +467,7 @@ end
@.. mil_correction = zero(eltype(u))
ggprime_norm = zero(eltype(ggprime))

if SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Ito
if SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Ito
if dW isa Number || is_diagonal_noise(integrator.sol.prob)
@.. J -= 1 // 2 * abs(dt)
else
Expand All @@ -478,7 +478,7 @@ end
if dW isa Number || is_diagonal_noise(integrator.sol.prob)
@.. K = uprev + dt*du₁
@.. du₂ = zero(eltype(u))
tmp .= (SciMLBase.alg_interpretation(integrator.alg) == AlgorithmInterpretation.Ito ? K : uprev) .+ integrator.sqdt .* L
tmp .= (SciMLBase.alg_interpretation(integrator.alg) == SciMLBase.AlgorithmInterpretation.Ito ? K : uprev) .+ integrator.sqdt .* L
integrator.g(du₂,tmp,p,t)
@.. ggprime = (du₂ - L)/sqdt
ggprime_norm = integrator.opts.internalnorm(ggprime,t)
Expand Down
12 changes: 6 additions & 6 deletions src/perform_step/sdirk.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@
end

if cache isa ImplicitRKMilConstantCache || integrator.opts.adaptive == true
if SciMLBase.alg_interpretation(alg) == AlgorithmInterpretation.Ito ||
if SciMLBase.alg_interpretation(alg) == SciMLBase.AlgorithmInterpretation.Ito ||
cache isa ImplicitEMConstantCache
K = @.. uprev + dt * ftmp
utilde = K + L*integrator.sqdt
ggprime = (integrator.g(utilde,p,t).-L)./(integrator.sqdt)
mil_correction = ggprime .* (integrator.W.dW.^2 .- abs(dt))./2
gtmp += mil_correction
elseif SciMLBase.alg_interpretation(alg) == AlgorithmInterpretation.Stratonovich ||
elseif SciMLBase.alg_interpretation(alg) == SciMLBase.AlgorithmInterpretation.Stratonovich ||
cache isa ImplicitEulerHeunConstantCache
utilde = uprev + L*integrator.sqdt
ggprime = (integrator.g(utilde,p,t).-L)./(integrator.sqdt)
mil_correction = ggprime.*(integrator.W.dW.^2)./2
gtmp += mil_correction
else
error("Algorithm interpretation invalid. Use either AlgorithmInterpretation.Ito or AlgorithmInterpretation.Stratonovich")
error("Algorithm interpretation invalid. Use either SciMLBase.AlgorithmInterpretation.Ito or SciMLBase.AlgorithmInterpretation.Stratonovich")
end
end

Expand Down Expand Up @@ -154,18 +154,18 @@ end

if cache isa ImplicitRKMilCache
gtmp3 = cache.gtmp3
if SciMLBase.alg_interpretation(alg) == AlgorithmInterpretation.Ito
if SciMLBase.alg_interpretation(alg) == SciMLBase.AlgorithmInterpretation.Ito
@.. z = uprev + dt * tmp + integrator.sqdt * gtmp
integrator.g(gtmp3,z,p,t)
@.. gtmp3 = (gtmp3-gtmp)/(integrator.sqdt) # ggprime approximation
@.. gtmp2 += gtmp3*(dW.^2 - abs(dt))/2
elseif SciMLBase.alg_interpretation(alg) == AlgorithmInterpretation.Stratonovich
elseif SciMLBase.alg_interpretation(alg) == SciMLBase.AlgorithmInterpretation.Stratonovich
@.. z = uprev + integrator.sqdt * gtmp
integrator.g(gtmp3,z,p,t)
@.. gtmp3 = (gtmp3-gtmp)/(integrator.sqdt) # ggprime approximation
@.. gtmp2 += gtmp3*(dW.^2)/2
else
error("Algorithm interpretation invalid. Use either AlgorithmInterpretation.Ito or AlgorithmInterpretation.Stratonovich")
error("Algorithm interpretation invalid. Use either SciMLBase.AlgorithmInterpretation.Ito or SciMLBase.AlgorithmInterpretation.Stratonovich")
end
end

Expand Down
Loading

0 comments on commit c1f29d6

Please sign in to comment.