summaryrefslogtreecommitdiff
path: root/hadamard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'hadamard.cpp')
-rw-r--r--hadamard.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/hadamard.cpp b/hadamard.cpp
index 2f45dcc..d9e5bfd 100644
--- a/hadamard.cpp
+++ b/hadamard.cpp
@@ -35,19 +35,16 @@ public:
class MeasureTransitionRates : public ParallelMeasurement {
public:
std::vector<unsigned> nAccepted;
- unsigned total_steps;
+ std::vector<unsigned> total_steps;
- MeasureTransitionRates(unsigned n) : nAccepted(n - 1, 0) {
- total_steps = 0;
- }
+ MeasureTransitionRates(unsigned n) : nAccepted(n - 1, 0), total_steps(n - 1, 0) {}
void after_step(bool accepted, unsigned i, double, double, const MCMC&,
const MCMC&) override {
+ total_steps[i]++;
if (accepted)
nAccepted[i]++;
}
-
- void after_sweep(const std::vector<MCMC>&) override { total_steps++; }
};
int main(int argc, char* argv[]) {
@@ -139,7 +136,7 @@ int main(int argc, char* argv[]) {
file << std::endl;
for (unsigned i = 0; i < B.nAccepted.size(); i++) {
- file << std::fixed << B.nAccepted[i] / (double)B.total_steps << " ";
+ file << std::fixed << B.nAccepted[i] / (double)B.total_steps[i] << " ";
}
file << std::endl;