Index

DiffusionDefinition.WienerType
struct Wiener{D,Tdevice}
end

A struct defining the Wiener process. D indicates the dimension of the process if it cannot be inferred from the DataType of the Trajectory. If the dimension can be inferred then it takes precedence over the value of D.

source
Trajectories.trajectoryMethod
Trajectories.trajectory(tt, v::Type, D::Number)

Create a Trajectory with mutable states of dimension D along the time collection tt.

source
Trajectories.trajectoryMethod
Trajectories.trajectory(tt, v::Type)

Create a Trajectory with immutable states along the time collection tt.

source
DiffusionDefinition.@conjugate_gaussianMacro
@conjugate_gaussian DIFFUSION_NAME begin
    BODY
end

Define helper functions for the conjugate gaussian updates of diffusion DIFFUSION_NAME. In BODY information can be passed as a list with elements of the form:

:entry-name --> entry-value

The following entry names have special meaning: :inplace, :nonhypo, :hypo_a_inv. Any other name is interpreted as a parameter name for which function phi is defined. More precisely, the following can be defined:

:inplace

:inplace --> true

to indicate that compmutations are to be done in-place. Otherwise, by default they are assumed to be done out-of-place.

:nonhypo

:nonhypo --> list-of-indices-with-non-degenerate-noise

e.g.

:nonhypo --> [1,3,5]

to indicate which coordinates have non-degenerate (i.e. non-zero) Wiener term Wiener term. It automatically defines num_non_hypo for the user.

Warning

If no flag :inplace --> true is passed, then it will be assumed that computations are done out-of-place by default and then no matter what subset you passed it will be internally saved as an SVector so as to work as a static way of accessing a subset of parameters. Otherwise, no change will be made to list-of-indices-with-non-degenerate-noise.

hypo_a_inv

:hypo_a_inv --> f(t,x,P)

where f is a function that uses time variable t, state variable x and a struct with the target diffusion law P.

phi and ignore_for_cu

:name-of-parameter --> (φ₁(t,x,P), φ₂(t,x,P), ...)

where φ₁(t,x,P) corresponds to all terms from the drift that are in the first non-degenerate coordinate and that are multiplied by the parameter with the name name-of-parameter, etc. Any parameters of P for which φ is not defined will have a function ignore_for_cu defined for them automatically and returning true.

source
DiffusionDefinition.@diffusion_processMacro
diffusion_process(name, ex::Expr, p...)

Defines a diffusion process according to a template described in the documentation of the github repository: https://github.com/mmider/DiffusionDefinition.jl

source
DiffusionDefinition.DiffusionProcessType
DiffusionProcess{T,DP,DW,SS,EI}

Types inheriting from DiffusionProcess define Ito diffusions. T denotes the datatype of each coordinate, DP the dimension of the stochastic process, DW the dimension of the Wiener process, SS lists the state space restrictions

source
DiffusionDefinition.EulerMaruyamaType
struct EulerMaruyama <: AbstractSDESolver end

Flag for indicating use of the Euler-Maruyama scheme for sampling diffusions. IMPORTANT: this is the only diffusion path sampler implemented in this package. There are no plans for implementing any other SDE solver in the forseeable future.

source
DiffusionDefinition.LinearDiffusionType
LinearDiffusion{T,DP,DW,SS} <: DiffusionProcess{T,DP,DW,SS}

Types inheriting from LinearDiffusion define a linear Ito-type diffusion, i.e. solutions to stochastic differential equations of the form: dXₜ = (BₜXₜ + βₜ)dt + σₜdWₜ, t∈[0,T], X₀=x₀.

source
Base.randFunction
Base.rand(w::Wiener, tt, y1)

Samples Wiener process on tt, started from y1 and returns a new object with a sampled trajectory.

source
DiffusionDefinition._is_datatypeMethod
_is_datatype(sym, p)

Utility function that checks whether sym is a datatype. It returns true if sym is either an in-built datatype (say float, StaticArray etc.) or if it is a template argument.

source
DiffusionDefinition.a!Function
a!

Compute the diffusion function σσ' of a diffusion in-place (uses buffers to store temporary results).

source
DiffusionDefinition.cloneMethod
clone(P::T, θ::AbstractDict) where T <: DiffusionProcess

Simplified cloning of diffusion law P. Substitute relevant parameters with new values. θ must be a dict corresponding to parameters returned after a call to var_parameters.

source
DiffusionDefinition.fill_unspecified_with_defaultsMethod
fill_unspecified_with_defaults(::Val{:additional}, p)

If unspecified, there are no restriction on a state space, the volatility coefficient is assumed constant, the diffusion is not linear and the datatype of each coordinate is set to Float64.

source
DiffusionDefinition.get_curlyMethod
get_curly(::Type{K}) where K

Utility function that returns a tuple with all type-specifiers listed in the curly brackets.

Examples

julia> remove_curly(Array{Float64,1})
(:Float64, 1)
source
DiffusionDefinition.get_name_stemMethod
get_name_stem(name_stem::Symbol, parameters)

Get the stem of a name for a parameters and then add a disambiguation index. Underscore _ used in place of name is defaulted to p.

source
DiffusionDefinition.grad_y1Method
grad_y1(y1, W, X, P, f)

Compute ∇f with respect to the starting position y1 for a fixed Wiener path W. X is a container where the the trajectory computed for the Wiener path W under the law P will be stored.

source
DiffusionDefinition.grad_θMethod
grad_θ(θ, y1, W, X, Law, f)

Compute ∇f with respect to parameters θ for a fixed Wiener path W. X is a container where the the trajectory computed for the Wiener path W under the law Law(θ) will be stored. y1 is the starting position.

source
DiffusionDefinition.hypo_a_invMethod
hypo_a_inv(t, x, P)

Similar to $a^{-1}:=(σσ^T)^{-1}$, with the only exception that all of the zero rows of $σ$ are first removed to yield $\hat{σ}$, and then, $(\hat{σ} \hat{σ}^T)^{-1}$ is computed.

source
DiffusionDefinition.nonhypoMethod
nonhypo(x, P)

Return the diffusion's coordinates that have direct contribution from some non-degenerate Wiener terms, i.e. leave out coordinates whose Wiener term is zero.

source
DiffusionDefinition.num_non_hypoMethod
num_non_hypo(Ptype::Type{T}) where T <: DiffusionProcess

Return a total number of coordinates of the diffusion process that have non-degenerate noise structure. I.e. it is equal to the total number of coordinates of the process minus the number of coordinates that have no direct Wiener contribution.

source
DiffusionDefinition.parse_line!Method
parse_line!(::Val{:aux_info}, line, p)

Parse a line that defines parameters of the diffusion. The line must be in a format: name –> parameter-description

source
DiffusionDefinition.parse_line!Method
parse_line!(::Val{:parameters}, line, p)

Parse a line that defines parameters of the diffusion. The line must be in a format: name –> parameter-description

source
DiffusionDefinition.parse_lines!Method
parse_lines!(ex::Expr, p, condition)

Parse all lines of the expression ex, but process only those which satisfy condition. p is a passed-around structure that accumulates processed information.

source
DiffusionDefinition.parse_param_multi_namesFunction
parse_param_multi_names(line, p)

Parse a line that defines parameters of the diffusion. The line must be in one of the formats: (pname1, pname2, ...) –> (numberofparameters, datatype) (pname1, pname2, ...) –> datatype (pname1, pname2, ...) –> (datatype1, datatype2, ...) In the former two cases defines number_of_parameters-many parameters, with names p_name1, p_name2, ... and of datatype type. In the last case the datatypes differ from parameter to parameter.

source
DiffusionDefinition.parse_param_single_nameFunction
parse_param_single_name(line, p)

Parse a line that defines parameters of the diffusion. The line must be in one of the formats: parametername –> (numberofparameters, datatype) parametername –> datatype In the former case defines number_of_parameters-many parameters, with names parameter_namei and of datatype type. In the latter case defines a single parameters with name parameter_name and of type datatype.

source
DiffusionDefinition.parse_processMethod
parse_process(name , ex::Expr, ::Any)

Parse a template defining a diffusion process, create a corresponding struct and specified functions, evaluate them in the environment of a package and then import the struct name to Main scope, in which the package has been imported to.

source
DiffusionDefinition.phiMethod
phi(::Val{T}, t, x, P) where T

If the drift can be written in a form:

\[b_θ(t, x) = θ^Tφ(t,x)+ϕ(t,x)\]

for parameters $θ$ that are being updated, then phi is a row of the matrix $φ(t,x)$ that get's multiplied by the coordinate of a θ vector with a name T.

source
DiffusionDefinition.prepare_abstract_typeMethod
prepare_abstract_type(stem, dims, data_type, state_restr)

Create a string defining a parent, abstract type from its stem, the dimensions dims of the process and the driving Brownian motion, the datatype data_type of each coordinate and the restrictions on the state space state_restr.

source
DiffusionDefinition.process_nameFunction
process_name

Process the name of a struct by returning the pure name (without template arguments), the name with template arguments and a list of template arguments.

source
DiffusionDefinition.remove_curlyMethod
remove_curly(::Type{K}) where K

Utility function that removes all type-specifiers listed in the curly brackets.

Examples

julia> remove_curly(Array{Float64,1})
Array
source
DiffusionDefinition.set_parameters!Method
set_parameters!(P::DiffusionProcess, θ, entries)

Set parameters of a diffusion law P in-place. entries should be a collection of pairs Pair{Int64,Symbol} that list the relevant entries in θ for reparameterization, together with the corresponding parameter names.

source
DiffusionDefinition.update_labelMethod
update_label(line, current_label)

Update the label, which signifies what type of information a given line in a template is supposed to be encoding.

source
DiffusionDefinition.σ!Function
σ!

Compute the volatility coefficient of a diffusion in-place (uses buffers to store temporary results).

source
Random.rand!Method
Random.rand!(
    w::Wiener{D},
    path::Trajectory{T,Vector{K}},
    y1=zero(K,D,ismutable(K))
) where {T,K,D}

Samples Wiener process started from y1 and saves the data in path. Uses a default random number generator.

source
Random.rand!Method
Random.rand!(
    rng::Random.AbstractRNG,
    ::Wiener{D},
    path::Trajectory{T,Vector{Vector{K}}},
    y1=zeros(K,D)
) where {K,T,D}

Samples Wiener process with mutable states, started from y1 and saves the data in path. rng is used as a random number generator.

source
Random.rand!Method
Random.rand!(
    rng::Random.AbstractRNG,
    ::Wiener,
    path::Trajectory{T,Vector{K}},
    y1=zero(K)
) where {T,K}

Samples Wiener process with immutable states, started from y1 and saves the data in path. rng is used as a random number generator.

source