Managing state space
NumCME.AbstractStateSpace
โ TypeAbstract type for FSP state space. This is the supertype of all concrete FSP state space implementations.
NumCME.AbstractStateSpaceSparse
โ Typeabstract type AbstractStateSpaceSparse{NS, NR, IntT<:Integer, SizeT<:Integer} <: AbstractStateSpace
NumCME.StateSpaceSparse
โ Typemutable struct StateSpaceSparse{NS, NR, IntT<:Integer, SizeT<:Integer} <: AbstractStateSpaceSparse{NS, NR, IntT<:Integer, SizeT<:Integer}
Basic Sparse FSP State space.
Fields
stoich_matrix
: Stoichiometry matrix S = [sโ ... sโ] of size N x M where N is the number of species, M the number of the reactions.sink_count
: Number of sinksstates
: Array of CME states included in the subspacestate2idx
: Dictionary of states, containing pairs(x=>i)
for (i,x) in enumerate(states). The implementation must ensure that each state instates
is a key instate2idx
and conversely every key instate2idx
exists instates
.state_connectivity
: List of state connectivity information.state_connectivity[i][k] = j
if xแตข = xโฑผ + sโ, that is,states[i] = states[j] + stoich_mat[:, k]
. If there is no existing state that can reach xแตข via reaction k, the implementation must ensure thatstate_connectivity[i][k] = 0
.sink_connectivity
: Matrix to store reaction events by which the included states transit to outside of the projected state space
See also
expand!
,deleteat!
NumCME.StateSpaceSparse
โ MethodStateSpaceSparse(stoich_mat::Matrix{IntT}, init_state::Vector{IntT}; index_type::Type{<:Integer}=UInt32)
Construct a basic FSP state space with stoichiometry matrix stoich_mat
and a single state init_state
with their integer entries being stored in type IntT <: Integer
. The optional keyword argument index_type
allows for more customization on internal indexing representations.
Examples
jldoctest julia> S = [[1,0] [-1,0] [0,1] [0,-1]] 2ร4 Matrix{Int64}: 1 -1 0 0 0 0 1 -1 julia> x0 = [0,1] julia> StateSpaceSparse(S, states)
`
NumCME.StateSpaceSparse
โ Methodmutable struct StateSpaceSparse{NS, NR, IntT<:Integer, SizeT<:Integer} <: AbstractStateSpaceSparse{NS, NR, IntT<:Integer, SizeT<:Integer}
Construct a basic FSP state space with stoichiometry matrix stoich_mat
and initial list of states initstates
with their integer entries being stored in type IntT <: Integer
.
Examples
julia> S = [[1,0] [-1,0] [0,1] [0,-1]]
2ร4 Matrix{Int64}:
1 -1 0 0
0 0 1 -1
julia> states = [[0,1], [10, 1], [0, 10]]
3-element Vector{Vector{Int64}}:
[0, 1]
[10, 1]
[0, 10]
julia> StateSpaceSparse(S, states)
Base.deleteat!
โ Methoddeleteat!(
statespace::StateSpaceSparse,
ids::Array{T<:Integer, 1}
)
Delete states with indices ids
from the state space.
NumCME.expand!
โ Methodexpand!(
statespace::StateSpaceSparse{NS, NR, IntT<:Integer, SizeT<:Integer},
expansionlevel::Integer;
onlyreactions
)
Expand the FSP state space to include all states that are reachable from the existing states in expansionlevel
or fewer reaction events. State exploration direction is restricted to only reaction channels within onlyreactions
if this argument is non-empty.
NumCME.get_sink_count
โ Methodget_sink_count(statespace::StateSpaceSparse) -> Integer
Return number of sinks.
NumCME.get_state_count
โ Methodget_state_count(statespace::StateSpaceSparse) -> Int64
Return number of states.
NumCME.get_statedict
โ Methodget_statedict(
statespace::StateSpaceSparse
) -> Dict{StaticArraysCore.MVector{NS, IntT}, SizeT} where {NS, IntT<:Integer, SizeT<:Integer}
Return state dictionary.
NumCME.get_states
โ Methodget_states(
statespace::StateSpaceSparse
) -> Array{StaticArraysCore.MVector{NS, IntT}, 1} where {NS, IntT<:Integer}
Return list of states.
NumCME.get_stoich_matrix
โ Methodget_stoich_matrix(
space::StateSpaceSparse
) -> Matrix{IntT} where IntT<:Integer
Return the stoichiometry matrix.