From 4c9570d88013ee8fe8b85bc07e35a936ac08725a Mon Sep 17 00:00:00 2001 From: Christopher Rackauckas Date: Fri, 30 Mar 2018 22:59:38 -0700 Subject: [PATCH] LambaEM pass --- src/alg_utils.jl | 5 +++++ test/sde/sde_convergence_tests.jl | 6 ++++++ test/sde/sde_twodimlinear_tests.jl | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/src/alg_utils.jl b/src/alg_utils.jl index 7beb94881..8af2fecb8 100644 --- a/src/alg_utils.jl +++ b/src/alg_utils.jl @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/test/sde/sde_convergence_tests.jl b/test/sde/sde_convergence_tests.jl index f904c4fd6..0904162ed 100644 --- a/test/sde/sde_convergence_tests.jl +++ b/test/sde/sde_convergence_tests.jl @@ -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)) @@ -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)) @@ -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)) diff --git a/test/sde/sde_twodimlinear_tests.jl b/test/sde/sde_twodimlinear_tests.jl index 68e4e795d..2c914870c 100644 --- a/test/sde/sde_twodimlinear_tests.jl +++ b/test/sde/sde_twodimlinear_tests.jl @@ -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)) @@ -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