Skip to content

Commit

Permalink
updates following review
Browse files Browse the repository at this point in the history
  • Loading branch information
ShellyGarion committed Feb 8, 2023
1 parent 3b20578 commit f6ea486
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions qiskit/quantum_info/states/stabilizerstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,12 @@ def equiv(self, other):
Returns:
bool: True if other has a generating set that generates the same StabilizerState.
Raises:
QiskitError: if other is not a StabilizerState.
"""
if not isinstance(other, StabilizerState):
raise QiskitError("Other is not a StabilizerState.")
try:
other = StabilizerState(other)
except QiskitError:
return False

num_qubits = self.num_qubits
if other.num_qubits != num_qubits:
Expand All @@ -294,7 +294,7 @@ def equiv(self, other):

# Check that each stabilizer from the original set commutes with each stabilizer
# from the other set
if not (pauli_orig.commutes(pauli_other)).all():
if not np.all([pauli.commutes(pauli_other) for pauli in pauli_orig]):
return False

# Compute the expected value of each stabilizer from the original set on the stabilizer state
Expand Down

0 comments on commit f6ea486

Please sign in to comment.