Skip to content

Commit

Permalink
SplitSDEProblem
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Dec 30, 2017
1 parent 38ef291 commit aacf5dc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/DiffEqBase.jl
Expand Up @@ -247,6 +247,7 @@ export ODEProblem, ODESolution
export AbstractDynamicalODEProblem, DynamicalODEFunction,
DynamicalODEProblem, SecondOrderODEProblem,
AbstractSplitODEProblem, SplitFunction, SplitODEProblem
export AbstractSplitSDEProblem, SplitSDEProblem
export RODEProblem, RODESolution, SDEProblem
export SecondOrderSDEProblem
export DAEProblem, DAESolution
Expand Down
17 changes: 16 additions & 1 deletion src/problems/sde_problems.jl
@@ -1,3 +1,5 @@
struct StandardSDEProblem end

struct SDEProblem{uType,tType,isinplace,NP,F,G,C,MM,ND} <: AbstractSDEProblem{uType,tType,isinplace,ND}
f::F
g::G
Expand All @@ -8,7 +10,7 @@ struct SDEProblem{uType,tType,isinplace,NP,F,G,C,MM,ND} <: AbstractSDEProblem{uT
mass_matrix::MM
noise_rate_prototype::ND
seed::UInt64
function SDEProblem{iip}(f,g,u0,tspan;
function SDEProblem{iip}(f,g,u0,tspan,problem_type=StandardSDEProblem();
noise_rate_prototype = nothing,
noise= nothing, seed = UInt64(0),
callback = nothing,mass_matrix=I) where {iip}
Expand All @@ -32,3 +34,16 @@ function SDEProblem(f,g,u0,tspan;kwargs...)
iip = typeof(f)<: Tuple ? isinplace(f[2],3) : isinplace(f,3)
SDEProblem{iip}(f,g,u0,tspan;kwargs...)
end

abstract type AbstractSplitSDEProblem end
struct SplitSDEProblem{iip} <: AbstractSplitSDEProblem end
# u' = Au + f
function SplitSDEProblem(f1,f2,g,u0,tspan;kwargs...)
iip = isinplace(f2,3)
SplitSDEProblem{iip}(f1,f2,g,u0,tspan;kwargs...)
end
function SplitSDEProblem{iip}(f1,f2,g,u0,tspan;
func_cache=nothing,kwargs...) where iip
iip ? _func_cache = similar(u0) : _func_cache = nothing
SDEProblem{iip}(SplitFunction{iip}(f1,f2,_func_cache),g,u0,tspan,SplitSDEProblem{iip}();kwargs...)
end

0 comments on commit aacf5dc

Please sign in to comment.