Internal API

Index Handlers

Index Handler Interface

User-defined index handlers should inherit from AbstractIndexHandler and implement the following methods:

For matrix conversions they should additionally implement:

FiniteStateProjection.singleindicesFunction
singleindices(idxhandler::AbstractIndexHandler, arr)

Returns all indices I in arr. Defaults to CartesianIndices, but can be overloaded for arbitrary index handlers.

source
FiniteStateProjection.getsubstitutionsFunction
getsubstitutions(idxhandler::AbstractIndexHandler, rs::ReactionSystem; state_sym::Symbol)

Returns a dict of the form S_i => f_i(state_sym), where each f_i is an expression for the abundance of species S_i in terms of the state variable state_sym.

source
Base.LinearIndicesType
LinearIndices(idxhandler::AbstractIndexHandler, arr)

Returns an object lind which converts indices returned from singleindices and pairedindices to linear indices compatible with vec via lind[idx_cart] = idx_lin. The indices are related via

arr[idx_cart] == vec(idxhandler, arr)[idx_lin]

See also: vec

source

Built-in implementations

Function Building

FiniteStateProjection.build_rhsFunction
build_rhs(sys::FSPSystem)

Builds the function f(du,u,p,t) that defines the right-hand side of the CME for use with DifferentialEquations.jl.

source
FiniteStateProjection.build_rhs_firstpassFunction
build_rhs_firstpass(sys::FSPSystem)

Return code for the first pass of the RHS function, for the time-dependent FSP. Goes through all reactions and computes the negative part of the CME (probability flowing out of states). This is a simple array traversal and can be done in one go for all reactions.

See also: build_rhs

source
FiniteStateProjection.build_rhs_secondpassFunction
build_rhs_secondpass(sys::FSPSystem)

Return code for the second pass of the RHS function. Goes through all reactions and computes the positive part of the CME (probability flowing into states). This requires accessing du and u at different locations depending on the net stoichiometries. In order to reduce random memory access reactions are processed one by one.

See also: build_rhs

source

Steady-State Functions