From 27efccd705a36510a02054ddd27ad80826321a21 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 3 Dec 2019 12:35:56 -0500 Subject: ran clang-format with correct config file --- space_wolff.hpp | 113 ++++++++++++++++++++------------------------------------ 1 file changed, 41 insertions(+), 72 deletions(-) diff --git a/space_wolff.hpp b/space_wolff.hpp index a78116d..02c544d 100644 --- a/space_wolff.hpp +++ b/space_wolff.hpp @@ -30,16 +30,13 @@ const std::array, 16> smiley = { {{0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0}}, {{0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0}}}}; -template -using Vector = Eigen::Matrix; +template using Vector = Eigen::Matrix; -template -using Matrix = Eigen::Matrix; +template using Matrix = Eigen::Matrix; /** brief diff - periodic subtraction of vectors */ -template -Vector diff(T L, Vector v1, Vector v2) { +template Vector diff(T L, Vector v1, Vector v2) { Vector v; for (unsigned i = 0; i < D; i++) { @@ -52,19 +49,17 @@ Vector diff(T L, Vector v1, Vector v2) { return v; } -template -class Spin { - public: +template class Spin { +public: Vector x; S s; }; -template -class Euclidean { - private: +template class Euclidean { +private: T L; - public: +public: Vector t; Matrix r; @@ -85,8 +80,7 @@ class Euclidean { r = r0; } - template - Spin act(const Spin& s) const { + template Spin act(const Spin& s) const { Spin s_new; s_new.x = t + r * s.x; @@ -122,14 +116,13 @@ class Euclidean { } }; -template -class Octree { - private: +template class Octree { +private: T L; unsigned N; std::vector*>> data; - public: +public: Octree(T L, unsigned depth) : L(L), N(pow(2, depth)), data(pow(N, D)){}; unsigned ind(Vector x) const { @@ -148,16 +141,14 @@ class Octree { void remove(Spin* s) { data[ind(s->x)].erase(s); }; - std::set*> neighbors(const Vector& x, - unsigned depth) const { + std::set*> neighbors(const Vector& x, unsigned depth) const { std::set*> ns; std::set seen; nearest_neighbors_of(ind(x), depth, ns, seen); return ns; }; - void nearest_neighbors_of(unsigned ind, unsigned depth, - std::set*>& ns, + void nearest_neighbors_of(unsigned ind, unsigned depth, std::set*>& ns, std::set& seen) const { ns.insert(data[ind].begin(), data[ind].end()); seen.insert(ind); @@ -165,9 +156,8 @@ class Octree { if (depth > 0) { for (unsigned i = 0; i < D; i++) { for (signed j : {-1, 1}) { - unsigned nind = - pow(N, i + 1) * (ind / ((unsigned)pow(N, i + 1))) + - fmod(pow(N, i + 1) + ind + j * pow(N, i), pow(N, i + 1)); + unsigned nind = pow(N, i + 1) * (ind / ((unsigned)pow(N, i + 1))) + + fmod(pow(N, i + 1) + ind + j * pow(N, i), pow(N, i + 1)); if (!seen.contains(nind)) { seen.insert(nind); @@ -180,13 +170,13 @@ class Octree { }; class quantity { - private: +private: double total; double total2; std::vector C; unsigned wait; - public: +public: unsigned n; std::list hist; @@ -246,8 +236,7 @@ class quantity { } double σ() const { - return 2.0 / (n - wait) * this->τ()[0] * - (C[0] / (n - wait) - pow(this->avg(), 2)); + return 2.0 / (n - wait) * this->τ()[0] * (C[0] / (n - wait) - pow(this->avg(), 2)); } double serr() const { return sqrt(this->σ()); } @@ -255,32 +244,25 @@ class quantity { unsigned num_added() const { return n - wait; } }; -template -class Model; +template class Model; -template -class measurement { - public: - virtual void pre_cluster(const Model&, unsigned, - const Euclidean&){}; - virtual void plain_bond_visited(const Model&, const Spin*, - const Spin*, const Spin&, - double){}; - virtual void plain_site_transformed(const Model&, - const Spin*, +template class measurement { +public: + virtual void pre_cluster(const Model&, unsigned, const Euclidean&){}; + virtual void plain_bond_visited(const Model&, const Spin*, const Spin*, + const Spin&, double){}; + virtual void plain_site_transformed(const Model&, const Spin*, const Spin&){}; - virtual void ghost_bond_visited(const Model&, const Spin&, - const Spin&, double){}; - virtual void ghost_site_transformed(const Model&, - const Euclidean&){}; + virtual void ghost_bond_visited(const Model&, const Spin&, const Spin&, + double){}; + virtual void ghost_site_transformed(const Model&, const Euclidean&){}; virtual void post_cluster(const Model&){}; }; -template -class Model { - public: +template class Model { +public: U L; Euclidean s0; std::vector> s; @@ -294,8 +276,7 @@ class Model { double E; measurement& A; - void one_sequences(std::list>& sequences, - unsigned level) { + void one_sequences(std::list>& sequences, unsigned level) { if (level > 0) { unsigned new_level = level - 1; unsigned old_length = sequences.size(); @@ -308,18 +289,10 @@ class Model { } } - Model(U L, - std::function&, const Spin&)> Z, - std::function&)> B, unsigned dDepth, - unsigned nDepth, measurement& A) - : L(L), - s0(L), - dict(L, dDepth), - Z(Z), - B(B), - dDepth(dDepth), - nDepth(nDepth), - A(A) { + Model(U L, std::function&, const Spin&)> Z, + std::function&)> B, unsigned dDepth, unsigned nDepth, + measurement& A) + : L(L), s0(L), dict(L, dDepth), Z(Z), B(B), dDepth(dDepth), nDepth(nDepth), A(A) { std::array ini_sequence; ini_sequence.fill(1); std::list> sequences; @@ -327,7 +300,7 @@ class Model { one_sequences(sequences, D); - sequences.pop_front(); // don't want the identity matrix! + sequences.pop_front(); // don't want the identity matrix! for (std::array sequence : sequences) { Matrix m; @@ -421,13 +394,10 @@ class Model { } else { Spin si_new = r.act(*si); std::set*> all_neighbors; - std::set*> current_neighbors = - dict.neighbors(si->x, nDepth); - std::set*> new_neighbors = - dict.neighbors(si_new.x, nDepth); + std::set*> current_neighbors = dict.neighbors(si->x, nDepth); + std::set*> new_neighbors = dict.neighbors(si_new.x, nDepth); - all_neighbors.insert(current_neighbors.begin(), - current_neighbors.end()); + all_neighbors.insert(current_neighbors.begin(), current_neighbors.end()); all_neighbors.insert(new_neighbors.begin(), new_neighbors.end()); all_neighbors.insert(NULL); for (Spin* sj : all_neighbors) { @@ -461,8 +431,7 @@ class Model { std::uniform_real_distribution t_dist(0, L); std::uniform_int_distribution r_dist(0, D - 1); std::uniform_int_distribution ind_dist(0, s.size() - 1); - std::uniform_int_distribution coin( - 0, mats.size() + steps.size() - 1); + std::uniform_int_distribution coin(0, mats.size() + steps.size() - 1); for (unsigned i = 0; i < N; i++) { Vector t; -- cgit v1.2.3-54-g00ecf