summaryrefslogtreecommitdiff
path: root/space_wolff.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'space_wolff.hpp')
-rw-r--r--space_wolff.hpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/space_wolff.hpp b/space_wolff.hpp
index 1335f07..b542fbb 100644
--- a/space_wolff.hpp
+++ b/space_wolff.hpp
@@ -271,7 +271,7 @@ void one_sequences(std::list<std::array<double, D>>& sequences, unsigned level)
new_sequence[new_level] = -1;
sequences.push_front(new_sequence);
}
- one_sequences(sequences, new_level);
+ one_sequences<D>(sequences, new_level);
}
}
@@ -282,6 +282,7 @@ std::vector<Vector<U, D>> torus_vecs(U L) {
ini_sequence.fill(1);
std::list<std::array<double, D>> sequences;
sequences.push_back(ini_sequence);
+ one_sequences<D>(sequences, D);
sequences.pop_front(); // don't want the identity matrix!
for (std::array<double, D> sequence : sequences) {
@@ -309,7 +310,7 @@ std::vector<Matrix<U, D>> torus_mats() {
std::list<std::array<double, D>> sequences;
sequences.push_back(ini_sequence);
- one_sequences(sequences, D);
+ one_sequences<D>(sequences, D);
sequences.pop_front(); // don't want the identity matrix!
@@ -375,7 +376,6 @@ public:
void step(double T, unsigned ind, Euclidean<U, D> r) {
unsigned cluster_size = 0;
- std::uniform_real_distribution<double> dist(0.0, 1.0);
std::queue<Spin<U, D, S>*> queue;
queue.push(&(s[ind]));
@@ -396,7 +396,7 @@ public:
Spin<U, D, S> s0s_new = s0_new.inverse().act(ss);
double p = 1.0 - exp(-(B(s0s_new) - B(s0s_old)) / T);
A.ghost_bond_visited(*this, s0s_old, s0s_new, p);
- if (dist(rng) < p) {
+ if (rng.uniform(0.0, 1.0) < p) {
queue.push(&ss);
}
}
@@ -423,7 +423,7 @@ public:
p = 1.0 - exp(-(Z(*si, *sj) - Z(si_new, *sj)) / T);
A.plain_bond_visited(*this, si, sj, si_new, p);
}
- if (dist(rng) < p) {
+ if (rng.uniform(0.0, 1.0) < p) {
queue.push(sj);
}
}
@@ -439,15 +439,13 @@ public:
}
void wolff(double T, unsigned N) {
- std::uniform_int_distribution<unsigned> ind_dist(0, s.size() - 1);
-
for (unsigned i = 0; i < N; i++) {
- R g = g(*this, rng);
- unsigned ind = ind_dist(rng);
+ R r = g(*this, rng);
+ unsigned ind = rng.uniform((unsigned)0, (unsigned)(s.size() - 1));
- A.pre_cluster(*this, ind, g);
+ A.pre_cluster(*this, ind, r);
- this->step(T, ind, g, rng);
+ this->step(T, ind, r);
A.post_cluster(*this);
}