From 6308773c0b6b745d49d20dc2afd6ab7ec63cb996 Mon Sep 17 00:00:00 2001 From: Jaron Kent-Dobias Date: Tue, 11 Oct 2022 14:25:11 +0200 Subject: Refactoring. --- aztec.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 aztec.cpp (limited to 'aztec.cpp') diff --git a/aztec.cpp b/aztec.cpp new file mode 100644 index 0000000..12197d9 --- /dev/null +++ b/aztec.cpp @@ -0,0 +1,18 @@ +#include "aztec.hpp" + +PerfectMatching findGroundState(const AztecDiamond& a) { + PerfectMatching pm(a.vertices.size(), a.edges.size()); + + for (const AztecDiamond::Edge& e : a.edges) { + pm.AddEdge(e.head->index, e.tail->index, e.weight); + } + + pm.options.verbose = false; + pm.Solve(); + + return pm; +} + +bool edgeMatched(PerfectMatching& pm, const AztecDiamond::Edge& e) { + return e.tail->index == pm.GetMatch(e.head->index); +} -- cgit v1.2.3-70-g09d2