75 lat.set({static_cast<ca_index_t>(i), static_cast<ca_index_t>(j)},
84 s +=
lat.at({static_cast<ca_index_t>(i), static_cast<ca_index_t>(j)});
85 return static_cast<double>(s)
86 /
static_cast<double>(
lat.size(0) *
lat.size(1));
94 os << (
lat.at({static_cast<ca_index_t>(i),
95 static_cast<ca_index_t>(j)}) > 0 ?
'+' :
'-');
100std::string
bar(
double absolute, std::size_t width = 40)
103 = std::min(width,
static_cast<std::size_t
>(
absolute
104 *
static_cast<double>(width)));
105 return std::string(
k,
'|') + std::string(width -
k,
' ');
110 double avg_abs_m = 0.0;
116 std::uint64_t master_seed,
143 constexpr std::uint64_t master_seed = 0xCAFEBABEull;
144 constexpr std::size_t
burn_in = 200;
147 std::cout <<
"Ising / Glauber dynamics on a 32x32 toroidal lattice\n";
148 std::cout <<
" J = 1.0 H = 0.0 Von-Neumann radius 1 (degree 4)\n";
149 std::cout <<
" initial bias = 60/40 up/down (breaks Z2 symmetry)\n";
150 std::cout <<
" exact 2-D critical temperature T_c ~ 2.269\n";
151 std::cout <<
" master_seed = 0x" << std::hex << master_seed << std::dec
158 const std::array<double, 5>
Ts = {1.0, 2.0, 2.269, 2.5, 4.0};
160 std::cout <<
"Temperature sweep:\n";
161 std::cout <<
" T |<m>| magnetisation curve\n";
162 std::cout <<
" ----- ----- ----------------------------------------\n";
165 for (std::size_t
k = 0;
k <
Ts.size(); ++
k)
167 const double T =
Ts[
k];
170 std::cout <<
" " << std::setw(5) << std::fixed << std::setprecision(3) <<
T
171 <<
" " << std::setw(5) << std::fixed << std::setprecision(3)
173 <<
" [" <<
bar(
r.avg_abs_m) <<
"]\n";
176 else if (
k ==
Ts.size() - 1)
hot =
r;
178 std::cout << std::defaultfloat;
180 std::cout <<
"\n--- Final spin configurations ---\n";
181 std::cout <<
"\nT = 1.0 (ordered, |<m>| ~ 1)\n";
183 std::cout <<
"\nT = 2.269 (~T_c, critical fluctuations)\n";
185 std::cout <<
"\nT = 4.0 (disordered, |<m>| ~ 0)\n";
188 std::cout <<
"\nNote: the same `master_seed` reproduces every value\n"
189 " bit-for-bit on any thread count via cell_seed().\n";
Reproducible random-number support for stochastic CA rules (Phase 8).
Common typedefs and tag types for the Cellular Automata module.
Ising rule with Glauber single-spin-flip dynamics.
Lattice that adds boundary-aware access on top of a storage.
Synchronous double-buffered engine.
Von Neumann (L1) neighborhood of radius R in N dimensions.
static void bar(int val, int scale=1)
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
std::size_t ca_size_t
Unsigned size component used for extents and counts.
Main namespace for Aleph-w library functions.
std::decay_t< typename HeadC::Item_Type > T
The lattice wraps around on every axis.
Synchronous double-buffered engine for cellular automata.
Cellular automata lattice with pluggable boundary policies.
Neighborhoods catalogue for Aleph::CA.
Reproducible stochastic CA rules (Phase 8).
Dense, contiguous storage for cellular automata cells (1D/2D/3D).