|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Free metric helpers for cellular automata frames. More...
#include <cmath>#include <cstddef>#include <cstdint>#include <type_traits>#include <ah-errors.H>#include <tpl_array.H>#include <ca-traits.H>#include <tpl_ca_concepts.H>Go to the source code of this file.
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
| namespace | Aleph::CA |
| namespace | Aleph::CA::ca_metrics_detail |
Concepts | |
| concept | Aleph::CA::ca_metrics_detail::HasAtNode |
Detect whether L exposes a graph-style at_node(size_t) accessor. | |
Variables | |
| constexpr std::uint64_t | Aleph::CA::ca_metrics_detail::fnv_basis = 14695981039346656037ull |
| FNV-1a 64-bit basis and prime constants. | |
| constexpr std::uint64_t | Aleph::CA::ca_metrics_detail::fnv_prime = 1099511628211ull |
Free metric helpers for cellular automata frames.
Provides allocation-free utilities to compute simple aggregate statistics over any LatticeLike lattice without coupling them to a particular boundary policy or storage type. Used both by the Phase-7 observers (ca-observer.H) and by user code that needs to evaluate a metric ad-hoc on a frame.
Catalogue:
for_each_cell(lat, f) — generic cell visitor for ranks 1, 2 and 3, plus the rank-1 graph lattice.count_state(lat, s) — number of cells in state s.count_alive(lat) — count_state(lat, T{}, true), i.e., number of cells whose value differs from state_type{}.density(lat, s) — alive ratio in [0, 1].state_histogram(lat, max) — array of counts per integer state in [0, max).shannon_entropy(lat, max) — Shannon entropy in nats over the state distribution; 0 for empty or constant lattices.frame_hash(lat) — deterministic 64-bit FNV-1a hash of the cell sequence in row-major order. Stable across runs and across builds (no random seed, no implementation- defined hashing).frames_equal(a, b) — bit-for-bit comparison.cell_diff_count(a, b) — number of cells that differ.All helpers are header-only inline templates and do not allocate (state_histogram allocates one buffer that the caller may pre-size).
Definition in file ca-metrics.H.