Sha256: 92a5efd9d4b5eb7685a8068abe5787ed29d7b6a13203eebe85edf25c97453fd2

Contents?: true

Size: 1.09 KB

Versions: 49

Compression:

Stored size: 1.09 KB

Contents

# encoding: utf-8

# Mixin for collections of TS transitions.
#
class YPetri::Simulation::Transitions
  module Type_TS
    include Type_T
    include Type_S

    # Rate (flux, propensity) closures.
    # 
    def rate_closures
      map &:rate_closure
    end

    # Rate (flux/propensity) vector.
    # 
    def rate_vector
      to_rate_closure.call
    end
    alias flux_vector rate_vector
    alias propensity_vector rate_vector

    # Firing vector (rate vector * Δtime).
    # 
    def firing_vector Δt
      rate_vector * Δt
    end

    # Gradient contribution to free places.
    # 
    def gradient
      stoichiometry_matrix * rate_vector
    end

    # Gradient contribution to all places.
    # 
    def ∇
      SM() * rate_vector
    end
    alias gradient_all ∇

    # Builds the rate vector closure, that outputs the rate vector based on
    # the system state when called.
    # 
    def to_rate_closure
      rc = rate_closures
      -> { rc.map( &:call ).to_column_vector }
    end
    alias rate_closure to_rate_closure
  end # module Type_TS
end # class YPetri::Simulation::Transitions

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
y_petri-2.4.9 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.4.8 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.4.6 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.4.4 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.4.3 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.4.2 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.4.0 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.3.12 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.3.11 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.3.10 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.3.9 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.3.8 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.3.6 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.3.5 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.3.4 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.3.3 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.3.2 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.2.4 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.2.3 lib/y_petri/simulation/transitions/TS.rb
y_petri-2.2.2 lib/y_petri/simulation/transitions/TS.rb