Skip to content
Open
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions cirq-core/cirq/ops/classically_controlled_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def with_qubits(self, *new_qubits) -> cirq.Operation:
*self._conditions
)

def _has_unitary_(self) -> bool:
return False

def _decompose_with_context_(self, *, context: cirq.DecompositionContext):
result = protocols.decompose_once(self._sub_operation, None, flatten=False, context=context)
if result is None:
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:
a: ───M───I───
║ ║
a: ═══@═══^═══
"""
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