def pauli_string_to_z_ops( pauli_string: PauliString) -> Iterable[ops.Operation]: """Yields the single qubit operations to apply before a Pauli string of Zs (and apply the inverse of these operations after) to make it equivalent to the given pauli_string.""" for qubit, pauli in pauli_string.items(): yield CliffordGate.from_single_map({pauli: (Pauli.Z, False)})(qubit)
def test_items(qubit_pauli_map): pauli_string = PauliString(qubit_pauli_map) assert len(qubit_pauli_map.items()) == len(pauli_string.items()) assert set(qubit_pauli_map.items()) == set(pauli_string.items())