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.

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

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

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

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

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.

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

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

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.

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₀.

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.

DiffusionDefinition.BFunction
B

Compute matrix B of a linear diffusion out-of-place (should use StaticArrays).

DiffusionDefinition.B!Function
B!

Compute matrix B of a linear diffusion in-place (uses buffers to store temporary results).

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.

DiffusionDefinition.aFunction
a

Compute the diffusion function σσ' of a diffusion out-of-place (should use StaticArrays).

DiffusionDefinition.a!Function
a!

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

DiffusionDefinition.bFunction
b

Compute the drift of a diffusion out-of-place (should use StaticArrays).

DiffusionDefinition.b!Function
b!

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

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.

DiffusionDefinition.constdiffFunction
constdiff

Returns true if the diffusion coefficient does not depend on the state of the process or time.

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.

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)
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.

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.

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.

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.

DiffusionDefinition.ignore_for_cuMethod
ignore_for_cu(::Val{T}, P) where T

A flag to indicate that a parameter with name T has no contribution to the computation of conjugate updates.

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.

DiffusionDefinition.nonhypo_σMethod
nonhypo_σ(t::Float64, x, P)

Return a sub-matrix of the full volatility matrix σ that consists of non-zero rows of σ.

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.

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

Parse a line that defines additional information about a diffusion process.

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

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

Parse a line that defines the dimension of a diffusion process and the driving Brownian motion.

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

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.

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.

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.

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.

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.

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.

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.

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
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.

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.

DiffusionDefinition.βFunction
β

Compute vector β of a linear diffusion out-of-place (should use StaticArrays).

DiffusionDefinition.β!Function
β!

Compute vector β! of a linear diffusion in-place (uses buffers to store temporary results).

DiffusionDefinition.σFunction
σ

Compute the volatility coefficient of a diffusion out-of-place (should use StaticArrays).

DiffusionDefinition.σ!Function
σ!

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

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.

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.

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.