summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2019-12-20 15:03:34 -0500
committerJaron Kent-Dobias <jaron@kent-dobias.com>2019-12-20 15:03:34 -0500
commit5b3dabf5dccbecf2d081f3f194501440a7af2b63 (patch)
tree22f74f70ed4de8be3846a68430afe288867f6d92
parent0d4bda66c7c6f92409b41459208287dc47bc6d98 (diff)
downloadcode-5b3dabf5dccbecf2d081f3f194501440a7af2b63.tar.gz
code-5b3dabf5dccbecf2d081f3f194501440a7af2b63.tar.bz2
code-5b3dabf5dccbecf2d081f3f194501440a7af2b63.zip
maybe now
-rw-r--r--hadamard_pt.hpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/hadamard_pt.hpp b/hadamard_pt.hpp
index f101446..a1123d5 100644
--- a/hadamard_pt.hpp
+++ b/hadamard_pt.hpp
@@ -81,16 +81,21 @@ public:
Ms[j].tune(m, ε);
}
- 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; j++) {
+ unsigned k = 2 * j;
+ if (this->step(k, k + 1, true)) {
+ std::swap(colors[k], colors[k + 1]);
+ colors.front() = down;
+ colors.back() = up;
}
- if (this->step(Ms.size() - 2 - j, Ms.size() - 1 - j, true)) {
- std::swap(colors[Ms.size() - 2 - j], colors[Ms.size() - 1 - j]);
- 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;
}
}