diff options
Diffstat (limited to 'rbmp.hpp')
-rw-r--r-- | rbmp.hpp | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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; } }; |