From 778eb610ef0920714dcfdce1aa4132ded11ee5fe Mon Sep 17 00:00:00 2001 From: Kai Ott <34843954+kaiott@users.noreply.github.com> Date: Mon, 4 Mar 2024 23:55:21 +0100 Subject: [PATCH] add missing include statement in distance.h (#423) * add missing include statement in distance.h * weight syntax change * fix prob assignment --------- Co-authored-by: James Wootton --- src/qiskit_qec/analysis/distance.h | 1 + src/qiskit_qec/analysis/distance.py | 6 ++---- src/qiskit_qec/decoders/decoding_graph.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/qiskit_qec/analysis/distance.h b/src/qiskit_qec/analysis/distance.h index abd99083..9970b916 100644 --- a/src/qiskit_qec/analysis/distance.h +++ b/src/qiskit_qec/analysis/distance.h @@ -5,6 +5,7 @@ #include #include #include +#include #include "linear.h" #include "combinations.h" diff --git a/src/qiskit_qec/analysis/distance.py b/src/qiskit_qec/analysis/distance.py index 3b484a4d..08f65b2d 100644 --- a/src/qiskit_qec/analysis/distance.py +++ b/src/qiskit_qec/analysis/distance.py @@ -113,14 +113,12 @@ def _minimum_distance_2_python(stabilizer: np.ndarray, gauge: np.ndarray, max_we for row in range(xl.shape[0]): for w in range(1, max_weight + 1): if _distance_test(stabilizer.astype(int), xl[row].astype(int), w): - if w < weight: - weight = w + weight = min(weight, w) break for row in range(zl.shape[0]): for w in range(1, max_weight + 1): if _distance_test(stabilizer.astype(int), zl[row].astype(int), w): - if w < weight: - weight = w + weight = min(weight, w) break if weight < max_weight + 1: return weight diff --git a/src/qiskit_qec/decoders/decoding_graph.py b/src/qiskit_qec/decoders/decoding_graph.py index 69ef9599..f4037414 100644 --- a/src/qiskit_qec/decoders/decoding_graph.py +++ b/src/qiskit_qec/decoders/decoding_graph.py @@ -322,7 +322,7 @@ def weight_syndrome_graph(self, counts, method: str = METHOD_SPITZ): boundary_nodes = [] for n, node in enumerate(self.graph.nodes()): - if node.is_boundary: + if node.is_logical: boundary_nodes.append(n) for edge in self.graph.edge_list():