Skip to content

Commit

Permalink
LambaEM pass
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Mar 31, 2018
1 parent 147755f commit 4c9570d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/alg_utils.jl
Expand Up @@ -6,6 +6,7 @@ isadaptive(alg::Union{StochasticDiffEqAdaptiveAlgorithm,StochasticDiffEqRODEAdap
isadaptive(alg::Union{StochasticDiffEqCompositeAlgorithm,StochasticDiffEqRODECompositeAlgorithm}) = isadaptive(alg.algs[1])

alg_order(alg::EM) = 1//2
alg_order(alg::LambaEM) = 1//2
alg_order(alg::ImplicitEM) = 1//2
alg_order(alg::ImplicitEulerHeun) = 1//2
alg_order(alg::ImplicitRKMil) = 1//1
Expand All @@ -15,6 +16,7 @@ alg_order(alg::IIF1M) = 1//2
alg_order(alg::IIF2M) = 1//2
alg_order(alg::IIF1Mil) = 1//1
alg_order(alg::EulerHeun) = 1//2
alg_order(alg::LambaEulerHeun) = 1//2
alg_order(alg::RandomEM) = 1//2
alg_order(alg::RKMil) = 1//1
alg_order(alg::RKMilCommute) = 1//1
Expand All @@ -39,6 +41,7 @@ isdtchangeable(alg::Union{StochasticDiffEqAlgorithm,StochasticDiffEqRODEAlgorith

alg_interpretation(alg::StochasticDiffEqAlgorithm) = :Ito
alg_interpretation(alg::EulerHeun) = :Stratonovich
alg_interpretation(alg::LambaEulerHeun) = :Stratonovich
alg_interpretation(alg::RKMil{interpretation}) where {interpretation} = interpretation
alg_interpretation(alg::RKMilCommute{interpretation}) where {interpretation} = interpretation
alg_interpretation(alg::ImplicitRKMil{CS,AD,F,S,K,T,T2,Controller,interpretation}) where {CS,AD,F,S,K,T,T2,Controller,interpretation} = interpretation
Expand All @@ -59,7 +62,9 @@ alg_compatible(prob,alg::SOSRA) = true
alg_compatible(prob,alg::SOSRA2) = true
alg_compatible(prob,alg::SKenCarp) = true
alg_compatible(prob,alg::EM) = true
alg_compatible(prob,alg::LambaEM) = true
alg_compatible(prob,alg::EulerHeun) = true
alg_compatible(prob,alg::LambaEulerHeun) = true
alg_compatible(prob,alg::SplitEM) = true
alg_compatible(prob,alg::PCEuler) = true
alg_compatible(prob,alg::ImplicitEM) = true
Expand Down
6 changes: 6 additions & 0 deletions test/sde/sde_convergence_tests.jl
Expand Up @@ -9,6 +9,8 @@ sim = test_convergence(dts,prob,ImplicitRKMil(),numMonte=Int(1e2))
@test abs(sim.𝒪est[:l2]-1) < 0.2
sim = test_convergence(dts,prob,EM(),numMonte=Int(1e2))
@test abs(sim.𝒪est[:l2]-.5) < 0.2
sim = test_convergence(dts,prob,LambaEM(),numMonte=Int(1e2))
@test abs(sim.𝒪est[:l2]-.5) < 0.2
sim2 = test_convergence(dts,prob,RKMil(),numMonte=Int(2e2))
@test abs(sim2.𝒪est[:l∞]-1) < 0.2
sim3 = test_convergence(dts,prob,SRI(),numMonte=Int(1e1))
Expand All @@ -25,6 +27,8 @@ sim7 = test_convergence(dts,prob,SOSRI2(),numMonte=Int(1e1))
prob = prob_sde_cubic
sim = test_convergence(dts,prob,EM(),numMonte=Int(1e1))
@test abs(sim.𝒪est[:l2]-.5) < 0.2
sim = test_convergence(dts,prob,LambaEM(),numMonte=Int(1e1))
@test abs(sim.𝒪est[:l2]-.5) < 0.2
sim = test_convergence(dts,prob,ImplicitEM(),numMonte=Int(1e2))
@test abs(sim.𝒪est[:l2]-.5) < 0.2
sim = test_convergence(dts,prob,ImplicitRKMil(),numMonte=Int(1e2))
Expand All @@ -45,6 +49,8 @@ sim7 = test_convergence(dts,prob,SOSRI2(),numMonte=Int(1e1))
prob = prob_sde_additive
sim = test_convergence(dts,prob,EM(),numMonte=Int(1e1))
@test abs(sim.𝒪est[:l2]-1) < 0.2
sim = test_convergence(dts,prob,LambaEM(),numMonte=Int(1e1))
@test abs(sim.𝒪est[:l2]-1) < 0.2
sim = test_convergence(dts,prob,ImplicitEM(),numMonte=Int(1e1))
@test abs(sim.𝒪est[:l2]-1.5) < 0.2
sim = test_convergence(dts,prob,ImplicitRKMil(),numMonte=Int(1e1))
Expand Down
5 changes: 5 additions & 0 deletions test/sde/sde_twodimlinear_tests.jl
Expand Up @@ -5,6 +5,8 @@ prob = prob_sde_2Dlinear
## Solve and plot
println("Solve and Plot")
sol = solve(prob,EM(),dt=1/2^(3))
sol = solve(prob,LambaEM(),dt=1/2^(3))
sol = solve(prob,LambaEulerHeun(),dt=1/2^(3))
sol = solve(prob,RKMil(),dt=1/2^(3))
sol = solve(prob,SRI(),dt=1/2^(3))
sol = solve(prob,SRIW1(),dt=1/2^(3))
Expand Down Expand Up @@ -33,6 +35,9 @@ dts = 1./2.^(7:-1:4) #14->7 good plot
sim = test_convergence(dts,prob,EM(),numMonte=1000)
@test abs(sim.𝒪est[:l2]-.5) < 0.1

sim = test_convergence(dts,prob,LambaEM(),numMonte=1000)
@test abs(sim.𝒪est[:l2]-.5) < 0.1

sim = test_convergence(dts,prob,ImplicitEM(),numMonte=100)
@test abs(sim.𝒪est[:l2]-.5) < 0.1

Expand Down

0 comments on commit 4c9570d

Please sign in to comment.