From d3086767eff0279a212443a540076ef7e44133cc Mon Sep 17 00:00:00 2001 From: Tanuj Khattar Date: Thu, 17 Mar 2022 07:25:08 +0530 Subject: [PATCH] Add support for decompositions of parameterized `cirq.CCZPowGate` (#5087) * Add support for decompositions of parameterized cirq.CCZPowGate * Add test for parameterized decomposition of CCZ --- cirq-core/cirq/ops/three_qubit_gates.py | 3 --- cirq-core/cirq/ops/three_qubit_gates_test.py | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cirq-core/cirq/ops/three_qubit_gates.py b/cirq-core/cirq/ops/three_qubit_gates.py index fc48391c4c8..25e583f1f73 100644 --- a/cirq-core/cirq/ops/three_qubit_gates.py +++ b/cirq-core/cirq/ops/three_qubit_gates.py @@ -95,9 +95,6 @@ def _decompose_(self, qubits): where p = T**self._exponent """ - if protocols.is_parameterized(self): - return NotImplemented - a, b, c = qubits # Hacky magic: avoid the non-adjacent edge. diff --git a/cirq-core/cirq/ops/three_qubit_gates_test.py b/cirq-core/cirq/ops/three_qubit_gates_test.py index 61d29a1a322..bf9e3f4b7f4 100644 --- a/cirq-core/cirq/ops/three_qubit_gates_test.py +++ b/cirq-core/cirq/ops/three_qubit_gates_test.py @@ -192,6 +192,7 @@ def test_identity_multiplication(): (cirq.CCZ(*cirq.LineQubit.range(3)), 8), (cirq.CCX(*cirq.LineQubit.range(3)), 8), (cirq.CCZ(cirq.LineQubit(0), cirq.LineQubit(2), cirq.LineQubit(1)), 8), + (cirq.CCZ(cirq.LineQubit(0), cirq.LineQubit(2), cirq.LineQubit(1)) ** sympy.Symbol("s"), 8), (cirq.CSWAP(*cirq.LineQubit.range(3)), 9), (cirq.CSWAP(*reversed(cirq.LineQubit.range(3))), 9), (cirq.CSWAP(cirq.LineQubit(1), cirq.LineQubit(0), cirq.LineQubit(2)), 12),