diff --git a/symmer/operators/base.py b/symmer/operators/base.py index ba144337..3c853d4d 100644 --- a/symmer/operators/base.py +++ b/symmer/operators/base.py @@ -1130,11 +1130,12 @@ def is_noncontextual(self) -> bool: # check for overlap (array of ones == no overlap) return np.all(np.sum(clique_mask, axis=0) == 1) else: + gens = self.generators + if check_adjmat_noncontextual(gens.adjacency_matrix): + return True from symmer.utils import get_generators_including_xz_products gens_xyz = get_generators_including_xz_products(self) - gens = self.generators - return check_adjmat_noncontextual(gens.adjacency_matrix) or check_adjmat_noncontextual( - gens_xyz.adjacency_matrix) + return check_adjmat_noncontextual(gens_xyz.adjacency_matrix)