Skip to content

Commit

Permalink
no recompile mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Jan 16, 2017
1 parent 265fb11 commit 9ed67c7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/initdt.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function sde_determine_initdt(u0,t,tdir,dtmax,abstol,reltol,internalnorm,f,g,order)
function sde_determine_initdt(u0,t,tdir,dtmax,abstol,reltol,internalnorm,prob,order)
f = prob.f
g = prob.g
d₀ = norm(u0./(abstol+abs.(u0)*reltol),2)
if typeof(u0) <: Number
f₀ = f(t,u0)
Expand Down
8 changes: 4 additions & 4 deletions src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
@inline ODE_DEFAULT_PROG_MESSAGE(dt,t,u) = "dt="*string(dt)*"\nt="*string(t)*"\nmax u="*string(maximum(abs.(u)))
@inline ODE_DEFAULT_UNSTABLE_CHECK(dt,t,u) = any(isnan,u)

function solve{uType,tType,isinplace,NoiseClass,F,F2,F3,algType<:AbstractSDEAlgorithm}(
function solve{uType,tType,isinplace,NoiseClass,F,F2,F3,algType<:AbstractSDEAlgorithm,recompile_flag}(
prob::AbstractSDEProblem{uType,tType,isinplace,NoiseClass,F,F2,F3},
alg::algType;
alg::algType,timeseries=[],ts=[],ks=[],recompile::Type{Val{recompile_flag}}=Val{true};
dt::Number=0.0,save_timeseries::Bool = true,
timeseries_steps::Int = 1,adaptive=true=2.0,alg_hint=nothing,
abstol=1e-2,reltol=1e-2,qmax=1.125=1/6,maxiters::Int = round(Int,1e9),
Expand Down Expand Up @@ -67,7 +67,7 @@ function solve{uType,tType,isinplace,NoiseClass,F,F2,F3,algType<:AbstractSDEAlgo
else
order = 1.5
end
dt = sde_determine_initdt(u0,float(tspan[1]),tdir,dtmax,abstol,reltol,internalnorm,f,g,order)
dt = sde_determine_initdt(u0,float(tspan[1]),tdir,dtmax,abstol,reltol,internalnorm,prob,order)
end

T = tType(tspan[2])
Expand Down Expand Up @@ -122,7 +122,7 @@ function solve{uType,tType,isinplace,NoiseClass,F,F2,F3,algType<:AbstractSDEAlgo

#@code_warntype sde_solve(SDEIntegrator{typeof(alg),typeof(u),eltype(u),ndims(u),ndims(u)+1,typeof(dt),typeof(tableau)}(f,g,u,t,dt,T,maxiters,timeseries,Ws,ts,timeseries_steps,save_timeseries,adaptive,adaptivealg,δ,γ,abstol,reltol,qmax,dtmax,dtmin,internalnorm,discard_length,progress,atomloaded,progress_steps,rands,sqdt,W,Z,tableau))

u,t,W,timeseries,ts,Ws,maxstacksize,maxstacksize2 = sde_solve(SDEIntegrator{typeof(alg),uType,uEltype,ndims(u),ndims(u)+1,tType,tableauType,uEltypeNoUnits,randType,rateType,typeof(internalnorm),typeof(progress_message),typeof(unstable_check),typeof(f),typeof(g)}(f,g,u,t,dt,T,alg,maxiters,timeseries,Ws,ts,timeseries_steps,save_timeseries,adaptive,adaptivealg,δ,γ,abstol,reltol,qmax,dtmax,dtmin,internalnorm,discard_length,progress,progress_name,progress_steps,progress_message,unstable_check,rands,sqdt,W,Z,tableau))
u,t,W,timeseries,ts,Ws,maxstacksize,maxstacksize2 = sde_solve(SDEIntegrator{typeof(alg),uType,uEltype,ndims(u),ndims(u)+1,tType,tableauType,uEltypeNoUnits,randType,rateType,typeof(internalnorm),typeof(progress_message),typeof(unstable_check),F,F2}(f,g,u,t,dt,T,alg,maxiters,timeseries,Ws,ts,timeseries_steps,save_timeseries,adaptive,adaptivealg,δ,γ,abstol,reltol,qmax,dtmax,dtmin,internalnorm,discard_length,progress,progress_name,progress_steps,progress_message,unstable_check,rands,sqdt,W,Z,tableau))

build_solution(prob,alg,ts,timeseries,W=Ws,
timeseries_errors = timeseries_errors,
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using StochasticDiffEq, DiffEqDevTools, DiffEqProblemLibrary
using Base.Test

tic()
const TEST_PLOT = false
const LONGER_TESTS = false
#SDE
Expand All @@ -19,3 +20,4 @@ LONGER_TESTS && @time @testset "Weak Convergence Tests" begin include("weak_conv
@time @testset "Multiple Dimension Linear Adaptive Test" begin include("adaptive/sde_twodimlinearadaptive_tests.jl") end
@time @testset "Autostepsize Test" begin include("adaptive/sde_autostepsize_test.jl") end
@time @testset "Additive Lorenz Attractor Test" begin include("adaptive/sde_lorenzattractor_tests.jl") end
toc()

0 comments on commit 9ed67c7

Please sign in to comment.