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. --- Makefile | 2 +- compile_flags.txt | 2 +- uniform.cpp | 15 ++++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 31d3891..e7b1f6c 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ BLOSSOM_DIRS := $(BLOSSOM_DIR) $(BLOSSOM_DIR)/MinCost $(BLOSSOM_DIR)/GEOM BLOSSOM_SOURCES := $(filter-out $(BLOSSOM_DIR)/example.cpp, $(foreach dir, $(BLOSSOM_DIRS), $(wildcard $(dir)/*.cpp))) BLOSSOM_OBJS := $(patsubst %.cpp, %.o, $(BLOSSOM_SOURCES)) -CFLAGS := -flto -fopenmp -O3 -Os -march=native -mtune=native -D_NDEBUG -DPERFECT_MATCHING_DOUBLE +CFLAGS := -std=c++20 -stdlib=libc++ -flto -fopenmp -O3 -Os -march=native -mtune=native -D_NDEBUG -DPERFECT_MATCHING_DOUBLE CXX = clang++ LD = ld.lld LIBS := -lrt diff --git a/compile_flags.txt b/compile_flags.txt index 0f75b87..10ac621 100644 --- a/compile_flags.txt +++ b/compile_flags.txt @@ -1,2 +1,2 @@ -std=c++20 --O3 +-stdlib=libc++ 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