summaryrefslogtreecommitdiff
path: root/rbmp.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbmp.hpp')
-rw-r--r--rbmp.hpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/rbmp.hpp b/rbmp.hpp
index aefa046..4cd6605 100644
--- a/rbmp.hpp
+++ b/rbmp.hpp
@@ -21,7 +21,7 @@ public:
typedef struct Edge {
Vertex* tail;
Vertex* head;
- double weight;
+ Real weight;
std::stack<Real> weights;
Real probability = 0;
} Edge;
@@ -99,10 +99,10 @@ public:
for (Edge& e : edges) {
e.probability = 0;
}
- Real partitionFunction = 1;
+ Real logPartitionFunction = 0;
for (unsigned i = 1; i <= n; i++) {
-#pragma omp parallel for
+#pragma omp parallel for reduction(+:logPartitionFunction)
for (unsigned j = 0; j < pow(i, 2); j++) {
auto [e1, e2, e3, e4] = face(i, j);
@@ -129,10 +129,10 @@ public:
e3.weights.pop();
e4.weights.pop();
- partitionFunction *= cellFactor;
+ logPartitionFunction += log(cellFactor);
}
}
- return partitionFunction;
+ return logPartitionFunction;
}
};