|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Classes | |
| struct | Avalanche |
| Avalanche measurements for one BTW grain drop. More... | |
| class | BTW_Sandpile |
| Deterministic open-boundary Bak-Tang-Wiesenfeld sandpile. More... | |
| struct | Gray_Scott_Preset |
| One named Gray-Scott parameter preset. More... | |
| struct | Linear_Fit |
| Least-squares result for a log-log histogram. More... | |
| struct | Native_Png |
| Decoded subset of the dependency-free native PNG format. More... | |
Typedefs | |
| using | Gray_Scott_Cell = Reaction_Diffusion_Cell< double > |
| using | Gray_Scott_Lattice = Lattice< Dense_Cell_Storage< Gray_Scott_Cell, 2 >, NeumannBoundary > |
Functions | |
| Linear_Fit | fit_log_log_histogram (const std::vector< std::size_t > &samples, const std::size_t min_value, const std::size_t max_value, const std::size_t bins, const double sample_weight_power=0.0) |
| Fit a power-law exponent from logarithmically binned samples. | |
| void | write_histogram_csv (const std::filesystem::path &path, const std::vector< std::size_t > &samples) |
| Write an exact discrete histogram as CSV. | |
| template<typename Lattice > | |
| double | morans_i_binary (const Lattice &frame, const typename Lattice::state_type empty_state, const typename Lattice::state_type type_a, const typename Lattice::state_type type_b) |
| Compute Moran's I for two occupied Schelling cell types. | |
| Gray_Scott_Lattice | make_gray_scott_seed (const ca_size_t side, const std::uint64_t master_seed) |
| Build the deterministic finite-amplitude Gray-Scott perturbation. | |
| Gray_Scott_Lattice | run_gray_scott (const Gray_Scott_Preset &preset, const ca_size_t side, const std::size_t steps, const std::uint64_t master_seed) |
| Run one Gray-Scott preset from the shared deterministic seed. | |
| RGB8 | gray_scott_rgb (const Gray_Scott_Cell &cell) |
| Convert one Gray-Scott state to an RGB colour. | |
| void | write_gray_scott_png (const std::filesystem::path &path, const Gray_Scott_Lattice &frame) |
| Write a Gray-Scott frame as a native Aleph RGB PNG. | |
| Native_Png | decode_native_png (std::istream &in) |
Decode a PNG emitted by Aleph::CA::write_png. | |
| Native_Png | read_native_png (const std::filesystem::path &path) |
| Read and decode a native Aleph PNG. | |
| double | mean_channel_difference (const Native_Png &lhs, const Native_Png &rhs) |
| Compute normalized mean absolute per-channel PNG difference. | |
| template<typename F > | |
| void | for_each_gosper_gun_cell (F &&visitor, const std::int64_t offset_x=0, const std::int64_t offset_y=0) |
| Visit every live coordinate in the canonical Gosper gun. | |
Variables | |
| constexpr std::array< Gray_Scott_Preset, 3 > | gray_scott_presets |
| Canonical visual presets used by the weekly Gray-Scott reproduction. | |
| constexpr std::array< std::array< std::int64_t, 2 >, 36 > | gosper_gun_cells |
| Canonical 36-cell Gosper glider gun. | |
Definition at line 432 of file ca_reproduction_support.H.
| using Aleph::CA::Reproductions::Gray_Scott_Lattice = typedef Lattice<Dense_Cell_Storage<Gray_Scott_Cell, 2>, NeumannBoundary> |
Definition at line 433 of file ca_reproduction_support.H.
|
inline |
Decode a PNG emitted by Aleph::CA::write_png.
Only the dependency-free writer's filter-0, stored-deflate output is accepted. This keeps golden comparisons strict and avoids a PNG dependency.
| in | binary PNG stream. |
| std::runtime_error | if the stream is malformed or unsupported. |
Definition at line 528 of file ca_reproduction_support.H.
References ah_runtime_error_if, and Aleph::blossom_maximum_cardinality_matching().
Referenced by read_native_png(), and TEST().
|
inline |
Fit a power-law exponent from logarithmically binned samples.
Each populated bin contributes its geometric midpoint and probability density (count / width) to an ordinary least-squares fit in log space. The omitted global normalization does not affect the slope.
| samples | positive integral event sizes. |
| min_value | smallest sample included in the fit. |
| max_value | largest sample included in the fit. |
| bins | number of logarithmic bins. |
| sample_weight_power | weight each sample s by s^-sample_weight_power. The default 0.0 fits directly observed event probabilities. |
| std::domain_error | if the fit range is invalid or fewer than two logarithmic bins are requested. |
| std::runtime_error | if fewer than two populated bins remain. |
Definition at line 107 of file ca_reproduction_support.H.
References ah_domain_error_if, ah_runtime_error_if, Aleph::and, Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::density(), Aleph::CA::Reproductions::Linear_Fit::intercept, Aleph::max_value(), Aleph::min_value(), offset, Aleph::CA::Reproductions::Linear_Fit::points, Aleph::CA::Reproductions::Linear_Fit::r_squared, Aleph::CA::Reproductions::Linear_Fit::slope, and y.
| void Aleph::CA::Reproductions::for_each_gosper_gun_cell | ( | F && | visitor, |
| const std::int64_t | offset_x = 0, |
||
| const std::int64_t | offset_y = 0 |
||
| ) |
Visit every live coordinate in the canonical Gosper gun.
| F | callable accepting (x, y). |
| visitor | coordinate callback. |
| offset_x | horizontal offset. |
| offset_y | vertical offset. |
Definition at line 666 of file ca_reproduction_support.H.
References Aleph::blossom_maximum_cardinality_matching(), cell(), and gosper_gun_cells.
|
inline |
Convert one Gray-Scott state to an RGB colour.
| cell | concentration pair. |
Definition at line 484 of file ca_reproduction_support.H.
Referenced by TEST(), and write_gray_scott_png().
|
inline |
Build the deterministic finite-amplitude Gray-Scott perturbation.
| side | square lattice side length. |
| master_seed | seed for cell-local perturbations. |
| std::domain_error | if side < 8. |
Definition at line 441 of file ca_reproduction_support.H.
References ah_domain_error_if, Aleph::blossom_maximum_cardinality_matching(), h, and r.
Referenced by run_gray_scott().
|
inline |
Compute normalized mean absolute per-channel PNG difference.
| lhs | first decoded PNG. |
| rhs | second decoded PNG. |
[0, 1], where 0 is pixel-identical. | std::domain_error | if dimensions differ. |
Definition at line 625 of file ca_reproduction_support.H.
References ah_domain_error_if, ah_runtime_error_if, Aleph::blossom_maximum_cardinality_matching(), Aleph::CA::Reproductions::Native_Png::height, Aleph::CA::Reproductions::Native_Png::raw, row, and Aleph::CA::Reproductions::Native_Png::width.
| double Aleph::CA::Reproductions::morans_i_binary | ( | const Lattice & | frame, |
| const typename Lattice::state_type | empty_state, | ||
| const typename Lattice::state_type | type_a, | ||
| const typename Lattice::state_type | type_b | ||
| ) |
Compute Moran's I for two occupied Schelling cell types.
Empty cells are excluded. Occupied cells are encoded as +1 and -1; each occupied cell is connected to its four periodic Von-Neumann neighbours when those neighbours are occupied.
| Lattice | rank-2 lattice type. |
| frame | toroidal Schelling frame. |
| empty_state | value representing a vacancy. |
| type_a | value representing the first population. |
| type_b | value representing the second population. |
0.0 when the statistic is undefined.Definition at line 218 of file ca_reproduction_support.H.
References Aleph::CA::Lattice< Storage, Boundary >::at(), Aleph::blossom_maximum_cardinality_matching(), cols, k, Aleph::mean(), r, Aleph::CA::Lattice< Storage, Boundary >::rank, rows, Aleph::CA::Lattice< Storage, Boundary >::size(), Aleph::sum(), and value.
Referenced by main().
|
inline |
Read and decode a native Aleph PNG.
| path | input path. |
| std::runtime_error | if the file cannot be read or decoded. |
Definition at line 612 of file ca_reproduction_support.H.
References ah_runtime_error_if, Aleph::blossom_maximum_cardinality_matching(), and decode_native_png().
Referenced by main().
|
inline |
Run one Gray-Scott preset from the shared deterministic seed.
| preset | feed and kill rates. |
| side | square lattice side length. |
| steps | number of synchronous steps. |
| master_seed | perturbation seed. |
Definition at line 468 of file ca_reproduction_support.H.
References Aleph::blossom_maximum_cardinality_matching(), engine, make_gray_scott_seed(), and steps.
|
inline |
Write a Gray-Scott frame as a native Aleph RGB PNG.
| path | output path. |
| frame | frame to encode. |
| std::runtime_error | if the output cannot be written. |
Definition at line 501 of file ca_reproduction_support.H.
References ah_runtime_error_if, Aleph::blossom_maximum_cardinality_matching(), gray_scott_rgb(), out, and Aleph::CA::write_png().
Referenced by main().
|
inline |
Write an exact discrete histogram as CSV.
| path | output path. |
| samples | integral samples to count. |
| std::runtime_error | if the output cannot be written. |
Definition at line 184 of file ca_reproduction_support.H.
References ah_runtime_error_if, Aleph::blossom_maximum_cardinality_matching(), Aleph::count(), Aleph::histogram(), out, and Aleph::size().
Referenced by main().
|
inlineconstexpr |
Canonical 36-cell Gosper glider gun.
Definition at line 646 of file ca_reproduction_support.H.
Referenced by for_each_gosper_gun_cell().
|
inlineconstexpr |
Canonical visual presets used by the weekly Gray-Scott reproduction.
Definition at line 426 of file ca_reproduction_support.H.