Skip to content

Commit

Permalink
throw exception from pybind
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarhiggott committed Jul 24, 2024
1 parent 716174b commit bf70853
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pymatching/sparse_blossom/driver/user_graph.pybind.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ void pm_pybind::pybind_user_graph_methods(py::module &m, py::class_<pm::UserGrap
}
std::cout << std::endl;
std::cout << "mwpm.flooder.negative_weight_sum: " << mwpm.flooder.negative_weight_sum << std::endl;
if (mwpm.flooder.negative_weight_sum != 0) {
throw std::invalid_argument(
"Decoding to matched detection events not supported for graphs containing edges with negative weights.");
}
pm::decode_detection_events_to_match_edges(mwpm, detection_events_vec);
std::cout << "B3" << std::endl;
py::ssize_t num_edges = (py::ssize_t)(mwpm.flooder.match_edges.size());
Expand Down

0 comments on commit bf70853

Please sign in to comment.