Index Handlers

The task of an index handler is to provide a mapping between the system state and the way it is stored in memory, usually as a multidimensional array. The standard approach is to represent the states of a system with $s$ reactions as an $s$-dimensional array and have the index $(i_1, \ldots, i_s)$ correspond to the state $(n_1 = i_1, \ldots, n_s = i_s)$. This is implemented by the class DefaultIndexHandler, which accepts an offset argument to deal with Julia's 1-based indexing (so the Julia index $(1,\ldots,1)$ corresponds to the state with no molecules).

See the internal API on how to define your own IndexHandler type.

FiniteStateProjection.DefaultIndexHandlerType
struct DefaultIndexHandler{N} <: AbstractIndexHandler
    offset::Int
    perm::NTuple{N,Int}
end

Basic index handler that stores the state of a system with s species in an s-dimensional array. The offset parameter denotes the offset by which the array is indexed (defaults to 1 in Julia). The order of the species is given by the tuple perm.

This is the simplest index handler, but it will not be optimal if some states cannot be reached from the initial state, e.g. due to the presence of conservation laws. In these cases one should use try to remove redundant species where possible.

Constructors: DefaultIndexHandler([sys::FSPSystem, offset::Int=1])