Module: YPetri::Simulation::TransitionRepresentation::Type_S
- Includes:
- Type_a
- Defined in:
- lib/y_petri/simulation/transition_representation/S.rb
Instance Attribute Summary collapse
-
#sparse_stoichiometry_vector ⇒ Object
readonly
Sparse stoichiometry vector corresponding to the free places.
-
#sparse_sv ⇒ Object
readonly
Sparse stoichiometry vector corresponding to all the places.
-
#stoichiometry ⇒ Object
readonly
Returns the value of attribute stoichiometry.
Instance Method Summary collapse
-
#build_closure ⇒ Object
Builds the S transition’s function into a closure.
-
#init ⇒ Object
Initialization subroutine.
-
#s? ⇒ Boolean
(also: #nonstoichiometric?)
False for stoichiometric transitions.
-
#S? ⇒ Boolean
(also: #stoichiometric?)
True for stoichiometric transitions.
Methods included from Type_a
Instance Attribute Details
#sparse_stoichiometry_vector ⇒ Object (readonly)
Sparse stoichiometry vector corresponding to the free places.
13 14 15 |
# File 'lib/y_petri/simulation/transition_representation/S.rb', line 13 def sparse_stoichiometry_vector @sparse_stoichiometry_vector end |
#sparse_sv ⇒ Object (readonly)
Sparse stoichiometry vector corresponding to all the places.
17 18 19 |
# File 'lib/y_petri/simulation/transition_representation/S.rb', line 17 def sparse_sv @sparse_sv end |
#stoichiometry ⇒ Object (readonly)
Returns the value of attribute stoichiometry.
9 10 11 |
# File 'lib/y_petri/simulation/transition_representation/S.rb', line 9 def stoichiometry @stoichiometry end |
Instance Method Details
#build_closure ⇒ Object
Builds the S transition’s function into a closure. Functions of S transitions return only a single number (flux for TS, firing for tS).
49 50 51 52 53 |
# File 'lib/y_petri/simulation/transition_representation/S.rb', line 49 def build_closure mv, f = simulation.m_vector, function λ = "-> { f.( %s ) }" % domain_access_code( vector: :mv ) eval λ end |
#init ⇒ Object
Initialization subroutine.
35 36 37 38 39 40 41 42 43 |
# File 'lib/y_petri/simulation/transition_representation/S.rb', line 35 def init super @stoichiometry = source.stoichiometry @sparse_stoichiometry_vector = Matrix.correspondence_matrix( codomain, free_places ) * stoichiometry.to_column_vector @sparse_sv = Matrix.correspondence_matrix( codomain, places ) * stoichiometry.to_column_vector end |
#s? ⇒ Boolean Also known as: nonstoichiometric?
False for stoichiometric transitions.
28 29 30 |
# File 'lib/y_petri/simulation/transition_representation/S.rb', line 28 def s? false end |
#S? ⇒ Boolean Also known as: stoichiometric?
True for stoichiometric transitions.
21 22 23 |
# File 'lib/y_petri/simulation/transition_representation/S.rb', line 21 def S? true end |