diff options
-rw-r--r-- | percolation.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/percolation.cpp b/percolation.cpp index f012b07..fac04ec 100644 --- a/percolation.cpp +++ b/percolation.cpp @@ -189,7 +189,8 @@ int main(int argc, char* argv[]) { std::vector<Cluster> clusters = G.markClusters(activeEdges); Matrix laplacian = G.laplacian(activeEdges); - std::vector<Real> conductivities(L * L * D / 4); + std::vector<Real> conductivities((L * L * D) / 4); + std::vector<unsigned> probabilities((L * L * D) / 4); for (const Cluster& c : clusters) { std::vector<unsigned> inds; @@ -212,6 +213,7 @@ int main(int argc, char* argv[]) { double ΔV = std::abs(output(i) - output(j)); conductivities[G.squaredDistance(inds[i], inds[j]) - 1] += 1 / ΔV; + probabilities[G.squaredDistance(inds[i], inds[j]) - 1]++; } } } @@ -224,6 +226,14 @@ int main(int argc, char* argv[]) { } } std::cout << std::endl; + for (unsigned i = 0; i < probabilities.size(); i++) { + if (G.multiplicities[i] != 0) { + std::cout << ((Real)probabilities[i]) / G.multiplicities[i] << " "; + } else { + std::cout << 0 << " "; + } + } + std::cout << std::endl; } return 0; |