diff --git a/.clang-format b/.clang-format index 92eae3968..923c3a234 100644 --- a/.clang-format +++ b/.clang-format @@ -11,12 +11,13 @@ AllowShortLoopsOnASingleLine: false AllowShortLambdasOnASingleLine: None BinPackArguments: false BinPackParameters: false - +PointerAlignment: Right +ReferenceAlignment: Right IncludeCategories: - - Regex: '^<.*>$' - Priority: 1 - - Regex: '^"gtest/.*"$' - Priority: 2 - - Regex: '^".*"$' - Priority: 3 + - Regex: "^<.*>$" + Priority: 1 + - Regex: '^"gtest/.*"$' + Priority: 2 + - Regex: '^".*"$' + Priority: 3 ... diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dd3a2363..6cd37a233 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ FetchContent_MakeAvailable(googletest) FetchContent_Declare(stim GIT_REPOSITORY https://github.com/quantumlib/Stim.git - GIT_TAG 1320ad7eac7de34d2e9c70daa44fbc6d84174450) + GIT_TAG v1.16.0) FetchContent_MakeAvailable(stim) if (NOT (MSVC)) target_compile_options(libstim PRIVATE -fno-strict-aliasing -fPIC ${ARCH_OPT}) diff --git a/src/pymatching/sparse_blossom/driver/user_graph.pybind.cc b/src/pymatching/sparse_blossom/driver/user_graph.pybind.cc index 7b227e5cc..a573fb5d6 100644 --- a/src/pymatching/sparse_blossom/driver/user_graph.pybind.cc +++ b/src/pymatching/sparse_blossom/driver/user_graph.pybind.cc @@ -612,4 +612,65 @@ void pm_pybind::pybind_user_graph_methods(py::module &m, py::class_(), t[1].cast()); + g.boundary_nodes = t[3].cast>(); + g.loaded_from_dem_without_correlations = t[4].cast(); + + for (const auto &edge_obj : t[2].cast()) { + auto et = edge_obj.cast(); + pm::UserEdge edge; + edge.node1 = et[0].cast(); + edge.node2 = et[1].cast(); + edge.observable_indices = et[2].cast>(); + edge.weight = et[3].cast(); + edge.error_probability = et[4].cast(); + + for (const auto &iw_obj : et[5].cast()) { + auto iw_tuple = iw_obj.cast(); + edge.implied_weights_for_other_edges.emplace_back( + iw_tuple[0].cast(), iw_tuple[1].cast(), iw_tuple[2].cast()); + } + + g.edges.push_back(edge); + auto edge_it = std::prev(g.edges.end()); + + g.nodes[edge.node1].neighbors.push_back({edge_it, 1}); + if (edge.node2 != SIZE_MAX && edge.node2 != edge.node1) + g.nodes[edge.node2].neighbors.push_back({edge_it, 0}); + } + + for (size_t i : g.boundary_nodes) + if (i < g.nodes.size()) + g.nodes[i].is_boundary = true; + + return g; + })); }