|
13 | 13 | // limitations under the License.
|
14 | 14 |
|
15 | 15 | #include "pymatching/sparse_blossom/driver/user_graph.h"
|
| 16 | +#include "pymatching/sparse_blossom/driver/mwpm_decoding.h" |
16 | 17 |
|
17 | 18 | #include <cmath>
|
18 | 19 | #include <gtest/gtest.h>
|
@@ -143,3 +144,25 @@ TEST(UserGraph, NodesAlongShortestPath) {
|
143 | 144 | ASSERT_EQ(nodes, nodes_expected);
|
144 | 145 | }
|
145 | 146 | }
|
| 147 | + |
| 148 | +TEST(UserGraph, DecodeUserGraphDetectionEventOnBoundaryNode) { |
| 149 | + { |
| 150 | + pm::UserGraph graph; |
| 151 | + graph.add_or_merge_edge(0, 1, {0}, 1.0, -1); |
| 152 | + graph.add_or_merge_edge(1, 2, {1}, 1.0, -1); |
| 153 | + graph.set_boundary({2}); |
| 154 | + auto& mwpm = graph.get_mwpm(); |
| 155 | + pm::ExtendedMatchingResult res(mwpm.flooder.graph.num_observables); |
| 156 | + pm::decode_detection_events(mwpm, {2}, res.obs_crossed.data(), res.weight); |
| 157 | + } |
| 158 | + |
| 159 | + { |
| 160 | + pm::UserGraph graph; |
| 161 | + graph.add_or_merge_edge(0, 1, {0}, -1.0, -1); |
| 162 | + graph.add_or_merge_edge(1, 2, {1}, 1.0, -1); |
| 163 | + graph.set_boundary({2}); |
| 164 | + auto& mwpm = graph.get_mwpm(); |
| 165 | + pm::ExtendedMatchingResult res(mwpm.flooder.graph.num_observables); |
| 166 | + pm::decode_detection_events(mwpm, {2}, res.obs_crossed.data(), res.weight); |
| 167 | + } |
| 168 | +} |
0 commit comments