49#include <gtest/gtest.h>
106 lat.set({i, i},
static_cast<int>(i % 3));
127 lat.set({i, j}, ((i + j) & 1) != 0 ? 1 : 0);
161 lat.set({i, j}, ((i * 4 + j) % 3 == 0) ? 1 : 0);
189 a.set({i},
static_cast<int>(i));
190 std::vector<int>
seen;
Free metric helpers for cellular automata frames.
Common typedefs and tag types for the Cellular Automata module.
Graph lattice: one cell per node + precomputed adjacency.
void set_node(std::size_t n, const T &v)
Direct write at node id n.
Lattice that adds boundary-aware access on top of a storage.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
double shannon_entropy(const Lattice &lat, std::size_t max_state)
Shannon entropy in nats of the [0, max_state) distribution.
Array< ca_size_t > state_histogram(const Lattice &lat, std::size_t max_state)
Count occurrences of every integer state in [0, max_state).
std::ptrdiff_t ca_index_t
Signed coordinate component used by lattices and neighborhoods.
std::uint64_t frame_hash(const Lattice &lat)
Deterministic 64-bit FNV-1a hash of the lattice cells.
void for_each_cell(const Lattice &lat, F &&f)
Visit every cell of a lattice in canonical row-major order.
double density(const Lattice &lat, const typename Lattice::state_type &s)
bool frames_equal(const Lattice &a, const Lattice &b)
Array< Array< std::size_t > > make_path_graph_adjacency(std::size_t n, bool cycle=false)
Build the adjacency of a path graph with n nodes.
ca_size_t count_state(const Lattice &lat, const typename Lattice::state_type &s)
ca_size_t count_alive(const Lattice &lat)
double alive_density(const Lattice &lat)
std::size_t ca_size_t
Unsigned size component used for extents and counts.
ca_size_t cell_diff_count(const Lattice &a, const Lattice &b)
Main namespace for Aleph-w library functions.
Out-of-range neighbours behave as if the lattice ended.
C++20 concepts for the Cellular Automata module.
CA whose underlying topology is an arbitrary undirected graph.
Cellular automata lattice with pluggable boundary policies.
Dense, contiguous storage for cellular automata cells (1D/2D/3D).