summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-12-12 11:12:35 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-12-12 11:12:35 -0500
commit342d83d6f24d5b063864f883ec05e7c9fff1301c (patch)
treeeddfb140f3a982816bfd513bdaf959a55d2e4826
parent22f0e9aee93c724209ee0c8b0d079b0d191e767c (diff)
downloadcode-342d83d6f24d5b063864f883ec05e7c9fff1301c.tar.gz
code-342d83d6f24d5b063864f883ec05e7c9fff1301c.tar.bz2
code-342d83d6f24d5b063864f883ec05e7c9fff1301c.zip
bug fix: parallel measurements recorded during dry runs
-rw-r--r--hadamard_pt.hpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/hadamard_pt.hpp b/hadamard_pt.hpp
index bddd8b7..a3d4657 100644
--- a/hadamard_pt.hpp
+++ b/hadamard_pt.hpp
@@ -48,7 +48,7 @@ public:
}
}
- bool step(unsigned i, unsigned j) {
+ bool step(unsigned i, unsigned j, bool dry = false) {
double Δβ = Ms[i].β - Ms[j].β;
double ΔE = Ms[i].E - Ms[j].E;
@@ -57,14 +57,16 @@ public:
if (accepted)
swap(Ms[i], Ms[j]);
- B.after_step(accepted, i, j, Δβ, ΔE, Ms[i], Ms[j]);
+ if (!dry) {
+ B.after_step(accepted, i, j, Δβ, ΔE, Ms[i], Ms[j]);
+ }
return accepted;
}
- void sweep() {
+ void sweep(bool dry = false) {
for (unsigned i = 0; i < Ms.size() - 1; i++) {
for (unsigned j = i + 1; j < Ms.size(); j++) {
- this->step(i, j);
+ this->step(i, j, dry);
}
}
}
@@ -75,7 +77,7 @@ public:
for (unsigned j = 0; j < Ms.size(); j++) {
Ms[j].run(m, dry);
}
- this->sweep();
+ this->sweep(dry);
if (!dry) {
B.after_sweep(this->Ms);
}