From bbc27302fa9ae20de0650154d5d479860cf000de Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Mon, 10 Oct 2022 17:44:58 +0200 Subject: A little more refactoring. --- uniform.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'uniform.cpp') diff --git a/uniform.cpp b/uniform.cpp index 519e6c0..c7d6367 100644 --- a/uniform.cpp +++ b/uniform.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "randutils/randutils.hpp" #include "pcg-cpp/include/pcg_random.hpp" @@ -18,16 +19,16 @@ using Face = std::array, 4>; class AztecDiamond { public: std::vector edges; - std::vector> faces; + std::vector> lattices; - AztecDiamond(unsigned n) : edges(pow(2 * n, 2)), faces(n) { + AztecDiamond(unsigned n) : edges(pow(2 * n, 2)), lattices(n) { for (unsigned i = 1; i <= n; i++) { - faces[n - i].reserve(pow(i, 2)); + lattices[n - i].reserve(pow(i, 2)); unsigned x0 = n - i; for (unsigned j = 0; j < pow(i, 2); j++) { unsigned x = 2 * (j % i); unsigned y = 2 * (j / i); - faces[n - i].push_back({ + lattices[n - i].push_back({ edges[2 * n * (x0 + y) + x0 + x], edges[2 * n * (x0 + y) + x0 + x + 1], edges[2 * n * (x0 + y + 1) + x0 + x], @@ -38,8 +39,8 @@ public: } void computeWeights() { - for (std::vector& fs : faces) { - for (Face& f : fs) { + for (std::vector& faces : lattices) { + for (Face& f : faces) { Real w = f[0].get().weights.back(); Real x = f[1].get().weights.back(); Real y = f[2].get().weights.back(); @@ -61,7 +62,7 @@ public: } void computeProbabilities() { - for (auto it = faces.rbegin(); it != faces.rend(); it++) { + for (auto it = lattices.rbegin(); it != lattices.rend(); it++) { for (Face& f : *it) { Real p = f[0].get().probability; Real q = f[1].get().probability; -- cgit v1.2.3-70-g09d2