Skip to content

Commit

Permalink
Use qubit pauli tensor in is_measureable
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-mills-cqc committed Dec 10, 2024
1 parent b3c29a1 commit 1086f7c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions qermit/noise_model/qermit_pauli.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,12 @@ def is_measureable(self, qubit_list: List[Qubit]) -> bool:
:return: True if at least one Pauli on the given
qubits anticommutes with Z. False otherwise.
"""
if not all(qubit in self.qubit_list for qubit in qubit_list):
raise Exception(f"{qubit_list} is not a subset of {self.qubit_list}.")
return any(self.X_list[qubit] == 1 for qubit in qubit_list)
return any(
not self.qubit_pauli_tensor.commutes_with(
QubitPauliTensor(qubit=qubit, pauli=Pauli.Z)
)
for qubit in qubit_list
)

def reduce_qubits(self, qubit_list: List[Qubit]) -> QermitPauli:
"""Reduces Pauli onto given list of qubits. A new reduced
Expand Down

0 comments on commit 1086f7c

Please sign in to comment.