summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-12-20 16:33:49 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-12-20 16:33:49 -0500
commit714140771d28f1d1ca43f23cb7b84fe5f95ddcf2 (patch)
tree48c4192d54ab96ae466bccf1f3f41ef936dbc763
parent5b3dabf5dccbecf2d081f3f194501440a7af2b63 (diff)
downloadcode-714140771d28f1d1ca43f23cb7b84fe5f95ddcf2.tar.gz
code-714140771d28f1d1ca43f23cb7b84fe5f95ddcf2.tar.bz2
code-714140771d28f1d1ca43f23cb7b84fe5f95ddcf2.zip
testing
-rw-r--r--hadamard_pt.hpp32
1 files changed, 11 insertions, 21 deletions
diff --git a/hadamard_pt.hpp b/hadamard_pt.hpp
index a1123d5..4cde211 100644
--- a/hadamard_pt.hpp
+++ b/hadamard_pt.hpp
@@ -81,33 +81,23 @@ public:
Ms[j].tune(m, ε);
}
- for (unsigned j = 0; j < Ms.size() / 2; j++) {
- unsigned k = 2 * j;
- if (this->step(k, k + 1, true)) {
- std::swap(colors[k], colors[k + 1]);
+ for (unsigned j = 0; j < Ms.size() - 1; j++) {
+ if (this->step(j, j + 1, true)) {
+ std::swap(colors[j], colors[j + 1]);
colors.front() = down;
colors.back() = up;
}
- }
-
- for (unsigned j = 0; j < Ms.size() / 2 - 1; j++) {
- unsigned k = 2 * j + 1;
- if (this->step(k, k + 1, true)) {
- std::swap(colors[k], colors[k + 1]);
- colors.front() = down;
- colors.back() = up;
- }
- }
-
- if (i > n / 2) {
- for (unsigned j = 0; j < Ms.size(); j++) {
- if (colors[j] == up) {
- nu[j]++;
- } else if (colors[j] == down) {
- nd[j]++;
+ if (i > n / 2) {
+ for (unsigned j = 0; j < Ms.size(); j++) {
+ if (colors[j] == up) {
+ nu[j]++;
+ } else if (colors[j] == down) {
+ nd[j]++;
+ }
}
}
}
+
}
std::vector<double> f(Ms.size());