Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::CA::TM_Gas_Rule Class Reference

Toffoli–Margolus (TM) lattice-gas block rule. More...

#include <tpl_ca_block_rule.H>

Public Member Functions

template<typename State >
constexpr Block_2x2< State > operator() (const Block_2x2< State > &in) const noexcept
 Apply the TM lattice-gas block rule.
 

Detailed Description

Toffoli–Margolus (TM) lattice-gas block rule.

A close cousin of BBM that conserves particle count while exposing a different mobility pattern: particles bounce off horizontal walls instead of moving diagonally. For each 2×2 block:

  • 1 or 3 alive → swap horizontally (NW ↔ NE, SW ↔ SE), modelling a horizontal-axis reflection.
  • 2 alive on the same row → swap to the other row (vertical reflection).
  • 2 alive on the same column → swap to the other column (horizontal reflection).
  • 2 alive on a diagonal → swap to the other diagonal.
  • 0 or 4 alive → unchanged.

Each branch is an involution and the resulting CA conserves the particle count exactly, making the Margolus update reversible bit-for-bit (forward(N) ∘ backward(N) = identity).

Definition at line 254 of file tpl_ca_block_rule.H.

Member Function Documentation

◆ operator()()

template<typename State >
constexpr Block_2x2< State > Aleph::CA::TM_Gas_Rule::operator() ( const Block_2x2< State > &  in) const
inlineconstexprnoexcept

Apply the TM lattice-gas block rule.

Template Parameters
Statebinary cell state.
Parameters
[in]incurrent 2×2 block.
Returns
next 2×2 block.
Exceptions
Thisfunction does not throw.

Definition at line 264 of file tpl_ca_block_rule.H.

References Aleph::and, Aleph::blossom_maximum_cardinality_matching(), and out.


The documentation for this class was generated from the following file: