Sha256: e09e41220094c39412b5427b0c3861623a1e5f984ca6330acadaa21b16e77340
Contents?: true
Size: 1001 Bytes
Versions: 17
Compression:
Stored size: 1001 Bytes
Contents
# encoding: utf-8 # A mixin for s (nonstoichiometric) transition representations. # class YPetri::Simulation::TransitionRepresentation module Type_s include Type_a # False for non-stoichiometric transitions. # def S? false end alias stoichiometric? S? # True for stoichiometric transitions. # def s? true end alias nonstoichiometric? s? # Initialization subroutine. # def init super end # Builds the s transition's function into a closure. Functions for s # transitions (nonstoichiometric transitions) have return value arity # equal to the codomain size. The returned closure here ensures that # the return value is always of Array type. # def build_closure mv, f = simulation.m_vector, function λ = "-> { Array f.( %s ) }" % domain_access_code( vector: :mv ) eval λ end end # module Type_s end # class YPetri::Simulation::TransitionRepresentation
Version data entries
17 entries across 17 versions & 1 rubygems