Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion cirq-core/cirq/transformers/dynamical_decoupling.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ def _is_single_qubit_gate_moment(moment: Moment) -> bool:


def _is_clifford_op(op: ops.Operation) -> bool:
return has_unitary(op) and has_stabilizer_effect(op)
if op.gate:
return has_unitary(op.gate) and has_stabilizer_effect(op.gate)
return False


def _calc_busy_moment_range_of_each_qubit(circuit: FrozenCircuit) -> dict[ops.Qid, list[int]]:
Expand Down
18 changes: 17 additions & 1 deletion cirq-core/cirq/transformers/dynamical_decoupling_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import pytest

import cirq
from cirq import add_dynamical_decoupling, CNOT, CZ, CZPowGate, H, X, Y, Z
from cirq import add_dynamical_decoupling, CNOT, CZ, CZPowGate, H, I, measure, X, Y, Z


def assert_sim_eq(circuit1: cirq.AbstractCircuit, circuit2: cirq.AbstractCircuit):
Expand Down Expand Up @@ -53,6 +53,22 @@ def assert_dd(
assert_sim_eq(input_circuit, transformed_circuit)


def test_classically_controlled_no_update_succeeds():
"""Test case diagrams.
Input:
0: ───M───I───
║ ║
c: ═══@═══^═══
"""
a = cirq.NamedQubit('a')

add_dynamical_decoupling(
cirq.Circuit(
cirq.Moment(measure(a, key="a")), cirq.Moment(I(a).with_classical_controls("a"))
)
)


def test_no_insertion():
"""Test case diagrams.
Input:
Expand Down