-
Notifications
You must be signed in to change notification settings - Fork 162
Description
stim.gate_data
is a very nice way to test against whole classes of gates in a clear way that's robust to future-new-gates:
if stim.gate_data(op.name).is_reset():
# handle all gates that reset the qubit: R, RX, RY, MR, MRX, MRY
The same concept is hard to apply to various groups of measurement gates because of some quirks of their implementation.
For instance, trying to case out the single qubit M gates [M, MX, MY, MR, MRX, MRY]
leads to conflicts with other gates.
HERALDED_ERASE
and HERALDED_PAULI_CHANNEL_1
have almost everything in common with the 1Q M gates: they are non-unitary, 1Q gates that produce measurement. M
gates support classical noise on their output, so they are 'noisy gates' as well.
{
n for n, gd in stim.gate_data().items()
if (
gd.is_single_qubit_gate
and gd.produces_measurements
)}
>>> {'HERALDED_ERASE', 'HERALDED_PAULI_CHANNEL_1', 'M', 'MR', 'MRX', 'MRY', 'MX', 'MY'}
{
n for n, gd in stim.gate_data().items()
if (
gd.is_single_qubit_gate
and gd.produces_measurements
and not gd.is_noisy_gate # sadly, measurements are also 'noisy'
)}
>>> set()
It would be nice to have some property to split these two.
Simplest for a reader might be is_measurement_gate
, where you define it by fiat to be just the 'measurement gates' [M, MZ, MY, MR, MRX, MRY, MZZ, MXX, MYY, MPP]
, which might be a more commonly wanted category than produces measurement
which includes MPAD and the heralded errors as well.
Another option could be adding something like is_quantumly_noisy
which gathers the noisy gates other than the measurement ones.