summaryrefslogtreecommitdiff
path: root/hadamard_pt.hpp
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-12-19 23:53:36 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-12-19 23:53:36 -0500
commit2a419c1324f6ffd59e92c0b63f0b890195bf5b1b (patch)
tree05fa6f9929f6b776026426dd2927e74bac6bb9c7 /hadamard_pt.hpp
parent9f83692c20d5c777000bb8d1eeb48ee66892bac8 (diff)
downloadcode-2a419c1324f6ffd59e92c0b63f0b890195bf5b1b.tar.gz
code-2a419c1324f6ffd59e92c0b63f0b890195bf5b1b.tar.bz2
code-2a419c1324f6ffd59e92c0b63f0b890195bf5b1b.zip
new conditions for stopping tuning
Diffstat (limited to 'hadamard_pt.hpp')
-rw-r--r--hadamard_pt.hpp8
1 files changed, 4 insertions, 4 deletions
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;