Skip to content

Commit

Permalink
Fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
femtocleaner[bot] committed Aug 8, 2017
1 parent b9a9d98 commit 131471e
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 65 deletions.
2 changes: 1 addition & 1 deletion src/alg_utils.jl
Expand Up @@ -26,7 +26,7 @@ isdtchangeable(alg::Union{StochasticDiffEqAlgorithm,StochasticDiffEqRODEAlgorith

alg_interpretation(alg::StochasticDiffEqAlgorithm) = :Ito
alg_interpretation(alg::EulerHeun) = :Stratonovich
alg_interpretation{interpretation}(alg::RKMil{interpretation}) = interpretation
alg_interpretation(alg::RKMil{interpretation}) where {interpretation} = interpretation

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

Expand Down
26 changes: 13 additions & 13 deletions src/algorithms.jl
Expand Up @@ -6,42 +6,42 @@
@compat abstract type StochasticDiffEqRODEAdaptiveAlgorithm <: StochasticDiffEqRODEAlgorithm end
@compat abstract type StochasticDiffEqRODECompositeAlgorithm <: StochasticDiffEqRODEAlgorithm end

immutable EM <: StochasticDiffEqAlgorithm end
immutable SplitEM <: StochasticDiffEqAlgorithm end
struct EM <: StochasticDiffEqAlgorithm end
struct SplitEM <: StochasticDiffEqAlgorithm end

immutable IIF1M{F} <: StochasticDiffEqAlgorithm
struct IIF1M{F} <: StochasticDiffEqAlgorithm
nlsolve::F
end
Base.@pure IIF1M(;nlsolve=NLSOLVEJL_SETUP()) = IIF1M{typeof(nlsolve)}(nlsolve)

immutable IIF2M{F} <: StochasticDiffEqAlgorithm
struct IIF2M{F} <: StochasticDiffEqAlgorithm
nlsolve::F
end
Base.@pure IIF2M(;nlsolve=NLSOLVEJL_SETUP()) = IIF2M{typeof(nlsolve)}(nlsolve)

immutable IIF1Mil{F} <: StochasticDiffEqAlgorithm
struct IIF1Mil{F} <: StochasticDiffEqAlgorithm
nlsolve::F
end
Base.@pure IIF1Mil(;nlsolve=NLSOLVEJL_SETUP()) = IIF1Mil{typeof(nlsolve)}(nlsolve)

immutable EulerHeun <: StochasticDiffEqAlgorithm end
immutable RKMil{interpretation} <: StochasticDiffEqAlgorithm end
struct EulerHeun <: StochasticDiffEqAlgorithm end
struct RKMil{interpretation} <: StochasticDiffEqAlgorithm end
Base.@pure RKMil(;interpretation=:Ito) = RKMil{interpretation}()

@with_kw immutable SRA{TabType} <: StochasticDiffEqAdaptiveAlgorithm
@with_kw struct SRA{TabType} <: StochasticDiffEqAdaptiveAlgorithm
tableau::TabType = constructSRA1()
end
@with_kw immutable SRI{TabType} <: StochasticDiffEqAdaptiveAlgorithm
@with_kw struct SRI{TabType} <: StochasticDiffEqAdaptiveAlgorithm
tableau::TabType = constructSRIW1()
error_terms = 4
end

immutable SRIW1 <: StochasticDiffEqAdaptiveAlgorithm end
immutable SRA1 <: StochasticDiffEqAdaptiveAlgorithm end
struct SRIW1 <: StochasticDiffEqAdaptiveAlgorithm end
struct SRA1 <: StochasticDiffEqAdaptiveAlgorithm end

immutable StochasticCompositeAlgorithm{T,F} <: StochasticDiffEqCompositeAlgorithm
struct StochasticCompositeAlgorithm{T,F} <: StochasticDiffEqCompositeAlgorithm
algs::T
choice_function::F
end

immutable RandomEM <: StochasticDiffEqRODEAlgorithm end
struct RandomEM <: StochasticDiffEqRODEAlgorithm end
2 changes: 1 addition & 1 deletion src/caches.jl
Expand Up @@ -8,7 +8,7 @@ mutable struct StochasticCompositeCache{T,F} <: StochasticDiffEqCache
current::Int
end

function alg_cache{T,algType<:StochasticCompositeAlgorithm}(alg::algType,prob,u,ΔW,ΔZ,rate_prototype,noise_rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,::Type{Val{T}})
function alg_cache(alg::algType,prob,u,ΔW,ΔZ,rate_prototype,noise_rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,::Type{Val{T}}) where {T,algType<:StochasticCompositeAlgorithm}
caches = map((x)->alg_cache(x,prob,u,ΔW,ΔZ,rate_prototype,noise_rate_prototype,uEltypeNoUnits,tTypeNoUnits,uprev,f,t,Val{T}),alg.algs)
StochasticCompositeCache(caches,alg.choice_function,1)
end
Expand Down
2 changes: 1 addition & 1 deletion src/initdt.jl
@@ -1,4 +1,4 @@
function sde_determine_initdt{tType,uType}(u0::uType,t::tType,tdir,dtmax,abstol,reltol,internalnorm,prob,order)
function sde_determine_initdt(u0::uType,t::tType,tdir,dtmax,abstol,reltol,internalnorm,prob,order) where {tType,uType}
f = prob.f
g = prob.g
d₀ = internalnorm(u0./(abstol.+abs.(u0).*reltol))
Expand Down
8 changes: 4 additions & 4 deletions src/integrators/iif.jl
@@ -1,4 +1,4 @@
type RHS_IIF1M_Scalar{F,CType,tType} <: Function
mutable struct RHS_IIF1M_Scalar{F,CType,tType} <: Function
f::F
t::tType
dt::tType
Expand All @@ -9,7 +9,7 @@ function (p::RHS_IIF1M_Scalar)(u,resid)
resid[1] .= u[1] .- p.tmp .- p.dt.*p.f[2](p.t+p.dt,u[1])[1]
end

type RHS_IIF2M_Scalar{F,CType,tType} <: Function
mutable struct RHS_IIF2M_Scalar{F,CType,tType} <: Function
f::F
t::tType
dt::tType
Expand Down Expand Up @@ -49,7 +49,7 @@ end
@pack integrator = t,dt,u
end

type RHS_IIF1{F,uType,tType,DiffCacheType,SizeType} <: Function
mutable struct RHS_IIF1{F,uType,tType,DiffCacheType,SizeType} <: Function
f::F
tmp::uType
t::tType
Expand All @@ -66,7 +66,7 @@ function (p::RHS_IIF1)(u,resid)
end
end

type RHS_IIF2{F,uType,tType,DiffCacheType,SizeType} <: Function
mutable struct RHS_IIF2{F,uType,tType,DiffCacheType,SizeType} <: Function
f::F
tmp::uType
t::tType
Expand Down
2 changes: 1 addition & 1 deletion src/integrators/integrator_interface.jl
@@ -1,4 +1,4 @@
@inline function change_t_via_interpolation!{T}(integrator,t,modify_save_endpoint::Type{Val{T}}=Val{false})
@inline function change_t_via_interpolation!(integrator,t,modify_save_endpoint::Type{Val{T}}=Val{false}) where T
# Can get rid of an allocation here with a function
# get_tmp_arr(integrator.cache) which gives a pointer to some
# cache array which can be modified.
Expand Down
14 changes: 7 additions & 7 deletions src/misc_utils.jl
@@ -1,17 +1,17 @@
immutable DiffCache{T, S}
struct DiffCache{T, S}
du::Vector{T}
dual_du::Vector{S}
end

Base.@pure function DiffCache{chunk_size}(T, length, ::Type{Val{chunk_size}})
Base.@pure function DiffCache(T, length, ::Type{Val{chunk_size}}) where chunk_size
DiffCache(zeros(T, length), zeros(Dual{:DiffEqNLSolve,T,chunk_size}, length))
end

Base.@pure DiffCache(u::AbstractArray) = DiffCache(eltype(u),length(u),Val{ForwardDiff.pickchunksize(length(u))})
Base.@pure DiffCache(u::AbstractArray,nlsolve) = DiffCache(eltype(u),length(u),Val{get_chunksize(nlsolve)})
Base.@pure DiffCache{CS}(u::AbstractArray,T::Type{Val{CS}}) = DiffCache(eltype(u),length(u),T)
Base.@pure DiffCache(u::AbstractArray,T::Type{Val{CS}}) where {CS} = DiffCache(eltype(u),length(u),T)

get_du{T<:Dual}(dc::DiffCache, ::Type{T}) = dc.dual_du
get_du(dc::DiffCache, ::Type{T}) where {T<:Dual} = dc.dual_du
get_du(dc::DiffCache, T) = dc.du

# Default nlsolve behavior, should move to DiffEqDiffTools.jl
Expand All @@ -25,7 +25,7 @@ Base.@pure function determine_chunksize(u,CS)
end
end

function autodiff_setup{CS}(f!, initial_x::Vector,chunk_size::Type{Val{CS}})
function autodiff_setup(f!, initial_x::Vector,chunk_size::Type{Val{CS}}) where CS

permf! = (fx, x) -> f!(x, fx)

Expand All @@ -46,7 +46,7 @@ function non_autodiff_setup(f!, initial_x::Vector)
DifferentiableMultivariateFunction(f!)
end

immutable NLSOLVEJL_SETUP{CS,AD} end
struct NLSOLVEJL_SETUP{CS,AD} end
Base.@pure NLSOLVEJL_SETUP(;chunk_size=0,autodiff=true) = NLSOLVEJL_SETUP{chunk_size,autodiff}()
(p::NLSOLVEJL_SETUP)(f,u0) = (res=NLsolve.nlsolve(f,u0); res.zero)
function (p::NLSOLVEJL_SETUP{CS,AD}){CS,AD}(::Type{Val{:init}},f,u0_prototype)
Expand All @@ -58,4 +58,4 @@ function (p::NLSOLVEJL_SETUP{CS,AD}){CS,AD}(::Type{Val{:init}},f,u0_prototype)
end

get_chunksize(x) = 0
get_chunksize{CS,AD}(x::NLSOLVEJL_SETUP{CS,AD}) = CS
get_chunksize(x::NLSOLVEJL_SETUP{CS,AD}) where {CS,AD} = CS
74 changes: 37 additions & 37 deletions src/solve.jl
@@ -1,48 +1,48 @@
function solve{algType<:Union{AbstractRODEAlgorithm,AbstractSDEAlgorithm},recompile_flag}(
function solve(
prob::AbstractRODEProblem,
alg::algType,timeseries=[],ts=[],ks=[],recompile::Type{Val{recompile_flag}}=Val{true};
kwargs...)
alg::algType,timeseries=[],ts=[],ks=[],recompile::Type{Val{recompile_flag}}=Val{true};
kwargs...) where {algType<:Union{AbstractRODEAlgorithm,AbstractSDEAlgorithm},recompile_flag}

integrator = init(prob,alg,timeseries,ts,ks,recompile;kwargs...)
solve!(integrator)
integrator.sol
end

function init{uType,tType,isinplace,algType<:Union{AbstractRODEAlgorithm,AbstractSDEAlgorithm},ND,recompile_flag}(
function init(
prob::AbstractRODEProblem{uType,tType,isinplace,ND},
alg::algType,timeseries_init=uType[],ts_init=tType[],ks_init=[],
recompile::Type{Val{recompile_flag}}=Val{true};
dt = tType(0),
timeseries_steps::Int = 1,
save_noise = true,
saveat = tType[],tstops = tType[],d_discontinuities= tType[],
save_timeseries = nothing,
save_everystep = isempty(saveat),
save_idxs = nothing,
save_start = true,
dense = save_everystep,
calck = (!isempty(setdiff(saveat,tstops)) || dense),
adaptive=isadaptive(alg),gamma=9//10,
abstol=1e-2,reltol=1e-2,
qmax=qmax_default(alg),qmin=qmin_default(alg),
qoldinit=1//10^4, fullnormalize=true,
beta2=beta2_default(alg),
beta1=beta1_default(alg,beta2),
delta=1//6,maxiters = 1e9,
dtmax=tType((prob.tspan[end]-prob.tspan[1])),
dtmin=tType <: AbstractFloat ? tType(10)*eps(tType) : tType(1//10^(10)),
internalnorm=ODE_DEFAULT_NORM,
unstable_check = ODE_DEFAULT_UNSTABLE_CHECK,
isoutofdomain = ODE_DEFAULT_ISOUTOFDOMAIN,
verbose = true,force_dtmin = false,
advance_to_tstop = false,stop_at_next_tstop=false,
progress_steps=1000,
progress=false, progress_message = ODE_DEFAULT_PROG_MESSAGE,
progress_name="SDE",
userdata=nothing,callback=nothing,
timeseries_errors = true, dense_errors=false,
initialize_integrator=true,
kwargs...)
alg::algType,timeseries_init=uType[],ts_init=tType[],ks_init=[],
recompile::Type{Val{recompile_flag}}=Val{true};
dt = tType(0),
timeseries_steps::Int = 1,
save_noise = true,
saveat = tType[],tstops = tType[],d_discontinuities= tType[],
save_timeseries = nothing,
save_everystep = isempty(saveat),
save_idxs = nothing,
save_start = true,
dense = save_everystep,
calck = (!isempty(setdiff(saveat,tstops)) || dense),
adaptive=isadaptive(alg),gamma=9//10,
abstol=1e-2,reltol=1e-2,
qmax=qmax_default(alg),qmin=qmin_default(alg),
qoldinit=1//10^4, fullnormalize=true,
beta2=beta2_default(alg),
beta1=beta1_default(alg,beta2),
delta=1//6,maxiters = 1e9,
dtmax=tType((prob.tspan[end]-prob.tspan[1])),
dtmin=tType <: AbstractFloat ? tType(10)*eps(tType) : tType(1//10^(10)),
internalnorm=ODE_DEFAULT_NORM,
unstable_check = ODE_DEFAULT_UNSTABLE_CHECK,
isoutofdomain = ODE_DEFAULT_ISOUTOFDOMAIN,
verbose = true,force_dtmin = false,
advance_to_tstop = false,stop_at_next_tstop=false,
progress_steps=1000,
progress=false, progress_message = ODE_DEFAULT_PROG_MESSAGE,
progress_name="SDE",
userdata=nothing,callback=nothing,
timeseries_errors = true, dense_errors=false,
initialize_integrator=true,
kwargs...) where {uType,tType,isinplace,algType<:Union{AbstractRODEAlgorithm,AbstractSDEAlgorithm},ND,recompile_flag}

if save_timeseries != nothing
warn("save_timeseries is deprecated. Use save_everystep instead")
Expand Down

0 comments on commit 131471e

Please sign in to comment.