Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion glue/cirq/stimcirq/_measure_and_or_reset_gate.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


@cirq.value_equality
class MeasureAndOrResetGate(cirq.SingleQubitGate):
class MeasureAndOrResetGate(cirq.Gate):
"""Handles explaining stim's MX/MY/MZ/MRX/MRY/MRZ/RX/RY/RZ gates to cirq."""

def __init__(
Expand All @@ -24,6 +24,9 @@ def __init__(
self.key = key
self.measure_flip_probability = measure_flip_probability

def _num_qubits_(self) -> int:
return 1

def _circuit_diagram_info_(self, args: cirq.CircuitDiagramInfoArgs) -> str:
return str(self)

Expand Down
17 changes: 12 additions & 5 deletions glue/cirq/stimcirq/_stim_sampler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,28 @@ def test_custom_gates():
s = stimcirq.StimSampler()
a, b, c, d = cirq.LineQubit.range(4)

class GoodGate(cirq.SingleQubitGate):
class GoodGate(cirq.Gate):
def _num_qubits_(self) -> int:
return 1

def _decompose_(self, qubits):
return [cirq.X.on_each(*qubits)]

class IndirectlyGoodGate(cirq.SingleQubitGate):
class IndirectlyGoodGate(cirq.Gate):
def _num_qubits_(self) -> int:
return 1

def _decompose_(self, qubits):
return [GoodGate().on_each(*qubits)]

class BadGate(cirq.SingleQubitGate):
pass
class BadGate(cirq.Gate):
def _num_qubits_(self) -> int:
return 1

class IndirectlyBadGate(cirq.Gate):
def _num_qubits_(self) -> int:
return 1

class IndirectlyBadGate(cirq.SingleQubitGate):
def _decompose_(self):
return [BadGate()]

Expand Down