#include #include #include #include "rbmp.hpp" int main(int argc, char* argv[]) { unsigned n = 100; unsigned m = 100; Real T = 1; int opt; while ((opt = getopt(argc, argv, "n:m:T:")) != -1) { switch (opt) { case 'n': n = atoi(optarg); break; case 'm': m = (unsigned)atof(optarg); break; case 'T': T = atof(optarg); break; default: exit(1); } } std::string filename = "order_" + std::to_string(n) + "_" + std::to_string(T) + ".dat"; Rng r; AztecDiamond a(n, r); std::vector avgProbabilities(a.edges.size()); for (unsigned i = 0; i < m; i++) { for (AztecDiamond::Edge& e : a.edges) { e.weights.push(exp(- r.variate(1) / T)); e.probability = 0; } a.computeWeights(); a.computeProbabilities(); for (unsigned j = 0; j < a.edges.size(); j++) { avgProbabilities[j] += a.edges[j].probability; } } std::vector data_x(a.vertices.size()); std::vector data_y(a.vertices.size()); for (unsigned i = 0; i < a.edges.size(); i++) { const AztecDiamond::Edge& e = a.edges[i]; const AztecDiamond::Vertex& vt = *e.tail; const AztecDiamond::Vertex& vh = *e.head; data_x[vt.index] += avgProbabilities[i] * (vt.coordinate[0] - vh.coordinate[0]); data_y[vt.index] += avgProbabilities[i] * (vt.coordinate[1] - vh.coordinate[1]); data_x[vh.index] += avgProbabilities[i] * (vt.coordinate[0] - vh.coordinate[0]); data_y[vh.index] += avgProbabilities[i] * (vt.coordinate[1] - vh.coordinate[1]); } std::ofstream output(filename); for (unsigned i = 0; i < a.vertices.size(); i++) { output << data_x[i] << " " << data_y[i] << std::endl; } output.close(); return 0; }