diff options
-rw-r--r-- | hadamard.cpp | 2 | ||||
-rw-r--r-- | hadamard_pt.hpp | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/hadamard.cpp b/hadamard.cpp index fef5af2..5154677 100644 --- a/hadamard.cpp +++ b/hadamard.cpp @@ -116,7 +116,7 @@ int main(int argc, char* argv[]) { std::cout << "Beginning simulation of " << n << ".\n"; std::cout << "Beginning " << n_tuning << " tuning tempering updates of " << M << " sweeps each.\n"; - std::vector<double> f = p.tune(n_tuning, M, ε, ε2); + p.tune(n_tuning, M, ε, ε2); std::cout << "Finished tuning, beginning " << m << " measurement tempering updates of " << M << " sweeps each.\n"; p.run(m, M); diff --git a/hadamard_pt.hpp b/hadamard_pt.hpp index 5500f57..812186d 100644 --- a/hadamard_pt.hpp +++ b/hadamard_pt.hpp @@ -64,7 +64,7 @@ public: } } - std::vector<double> tune(unsigned n0, unsigned m, double ε, double ε2) { + void tune(unsigned n0, unsigned m, double ε, double ε2) { unsigned n = n0; @@ -148,12 +148,12 @@ public: } for (unsigned i = 0; i < T1.size(); i++) { - err += fabs(T1[i] - 1/ Ms[Ms.size() - i - 2].β) / T1[i]; + err += fabs(T1[i] - 1/ Ms[Ms.size() - i - 2].β); Ms[Ms.size() - i - 2].β = 1 / T1[i]; } - if (err / T1.size() < ε2) { - return f; + if (err / T1.size() * Ms.size() / (1/Ms.front().β - 1/Ms.back().β) < ε2) { + break; } n *= 2; |