31#ifndef ALEPH_REPRODUCTIONS_SOURCE_DIR
32# define ALEPH_REPRODUCTIONS_SOURCE_DIR "reproductions"
40 constexpr std::uint64_t
seed = 0x4254571987ull;
48 std::vector<std::size_t> sizes;
55 if (avalanche.
size != 0)
57 sizes.push_back(avalanche.
size);
67 std::ofstream
summary(
root /
"results" /
"btw_summary.csv");
70 std::cerr <<
"Cannot write BTW summary\n";
73 summary <<
"side,warmup_drops,measured_drops,nonzero_avalanches,slope,r_squared,fit_points\n"
75 << sizes.size() <<
',' << std::setprecision(12) << fit.
slope <<
','
78 std::cout <<
"BTW sandpile: slope=" << std::fixed << std::setprecision(4)
80 <<
" nonzero_avalanches=" << sizes.size() <<
'\n';
83 std::cerr <<
"BTW avalanche-size slope outside [-1.2, -0.8]\n";
#define ALEPH_REPRODUCTIONS_SOURCE_DIR
Internal helpers shared by the cellular-automata reproductions.
Deterministic open-boundary Bak-Tang-Wiesenfeld sandpile.
__gmp_expr< T, __gmp_binary_expr< __gmp_expr< T, U >, unsigned long int, __gmp_root_function > > root(const __gmp_expr< T, U > &expr, unsigned long int l)
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
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.
std::size_t ca_size_t
Unsigned size component used for extents and counts.
Avalanche measurements for one BTW grain drop.
std::size_t duration
number of non-empty row-major sweeps.
std::size_t size
number of topplings.
Least-squares result for a log-log histogram.
double slope
fitted exponent.
std::size_t points
populated bins included in the fit.
double r_squared
coefficient of determination.
static constexpr bool requires_double_buffer
Operates in place, no second buffer needed.