summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hadamard_pt.hpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/hadamard_pt.hpp b/hadamard_pt.hpp
index c658389..f101446 100644
--- a/hadamard_pt.hpp
+++ b/hadamard_pt.hpp
@@ -72,6 +72,8 @@ public:
std::vector<color> colors(Ms.size(), none);
std::vector<unsigned> nu(Ms.size(), 0);
std::vector<unsigned> nd(Ms.size(), 0);
+ colors.front() = down;
+ colors.back() = up;
for (unsigned i = 0; i < n; i++) {
#pragma omp parallel for
@@ -82,10 +84,16 @@ public:
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;
+ }
+ 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;
}
}
- colors.front() = down;
- colors.back() = up;
+
if (i > n / 2) {
for (unsigned j = 0; j < Ms.size(); j++) {
if (colors[j] == up) {
@@ -118,7 +126,7 @@ public:
std::vector<double> η(Ms.size() - 1);
for (unsigned i = 0; i < Ms.size() - 1; i++) {
- η[η.size() - i - 1] = sqrt((f[i + 1] - f[i]) / (1 / Ms[i].β - 1 / Ms[i+1].β));
+ η[η.size() - i - 1] = sqrt((f[i + 1] - f[i])) / (1 / Ms[i].β - 1 / Ms[i+1].β);
}
double C = 0;