Managing state space

NumCME.StateSpaceSparseType
StateSpaceSparse{NS,NR,IntT<:Integer,SizeT<:Integer} <: AbstractStateSpaceSparse{NS,NR,IntT,SizeT}

Basic Sparse FSP State space.

Fields

stoich_matrix::Matrix{IntT}

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::SizeT

Number of sinks.

states::Vector{MVector{NS,IntT}}

Array of CME states included in the subspace.

state2idx::Dict{MVector{NS,IntT},SizeT}

Dictionary of states, containing pairs (x=>i) for (i,x) in enumerate(states). The implementation must ensure that each state in states is a key in state2idx and conversely every key in state2idx exists in states.

state_connectivity::Vector{MVector{NR,SizeT}}

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 that state_connectivity[i][k] = 0.

sink_connectivity::Vector{MVector{NR,SizeT}}

Matrix to store reaction events by which the included states transit to outside of the projected state space.

See also

expand!,deleteat!

source
NumCME.StateSpaceSparseMethod

StateSpaceSparse(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)

source
NumCME.StateSpaceSparseMethod

StateSpaceSparse(stoich_mat, states; index_type::Type{<:Integer}=UInt32)

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)
source
Base.deleteat!Method
deleteat!(statespace::StateSpaceSparse, ids::Vector{T}) where {T<:Integer}

Delete states with indices ids from the state space.

source
NumCME._addstates!Method

Helper function to add a state vector newstate to the current state space statespace. If newstate is already included in statespace, this function will return without modifying any of the input arguments.

source
NumCME._is_all_nonnegativeMethod
_is_all_nonnegative(x::AbstractVector) -> Bool

Helper function. Returns true if all elements of a vector is positive. Otherwise returns false.

source
NumCME.expand!Method

Expand the FSP state space to include all states that are reachable from the existing states in r or fewer reaction events, where r == num_reachable_steps. The optional keyword argument index_type allows for more customization on internal indexing representations.

source