From 53d8155a785eb401410ba350d7a3ce721b62add6 Mon Sep 17 00:00:00 2001 From: TimWeaving Date: Fri, 26 Apr 2024 09:16:50 +0100 Subject: [PATCH] IndependentOp now respects term ordering under rotation onto single-qubit Paulis --- symmer/operators/independent_op.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/symmer/operators/independent_op.py b/symmer/operators/independent_op.py index afaa2a1f..9be1f1ce 100644 --- a/symmer/operators/independent_op.py +++ b/symmer/operators/independent_op.py @@ -1,5 +1,6 @@ import numpy as np import warnings +from functools import reduce from typing import Dict, List, Tuple, Union from symmer import process from symmer.operators.utils import _rref_binary, _cref_binary, check_independent @@ -307,7 +308,12 @@ def rotate_onto_single_qubit_paulis(self) -> "IndependentOp": """ self.generate_stabilizer_rotations() if self.stabilizer_rotations != []: - return self.perform_rotations(self.stabilizer_rotations) + return IndependentOp.from_PauliwordOp( + reduce( + lambda x,y:x.append(y), + [s.perform_rotations(self.stabilizer_rotations) for s in self] + ) + ) # ensures stabilizer ordering is correct else: return self