diff --git a/cirq-core/cirq/__init__.py b/cirq-core/cirq/__init__.py index 3a21830e208..7f2fe05ebc5 100644 --- a/cirq-core/cirq/__init__.py +++ b/cirq-core/cirq/__init__.py @@ -42,7 +42,6 @@ # Core circuits, # Optimize and run - optimizers, work, sim, vis, @@ -327,8 +326,6 @@ ZZPowGate, ) -from cirq.optimizers import AlignLeft, AlignRight, ConvertToCzAndSingleGates - from cirq.transformers import ( align_left, align_right, diff --git a/cirq-core/cirq/optimizers/__init__.py b/cirq-core/cirq/optimizers/__init__.py deleted file mode 100644 index 174383300b1..00000000000 --- a/cirq-core/cirq/optimizers/__init__.py +++ /dev/null @@ -1,110 +0,0 @@ -# Copyright 2018 The Cirq Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Classes and methods that optimize quantum circuits.""" - -from cirq.optimizers.align_left import AlignLeft - -from cirq.optimizers.align_right import AlignRight - -from cirq.optimizers.convert_to_cz_and_single_gates import ConvertToCzAndSingleGates - -from cirq.transformers.analytical_decompositions import ( - compute_cphase_exponents_for_fsim_decomposition, - decompose_cphase_into_two_fsim, - decompose_clifford_tableau_to_operations, - decompose_multi_controlled_x, - decompose_multi_controlled_rotation, - decompose_two_qubit_interaction_into_four_fsim_gates, - is_negligible_turn, - prepare_two_qubit_state_using_cz, - prepare_two_qubit_state_using_sqrt_iswap, - single_qubit_matrix_to_gates, - single_qubit_matrix_to_pauli_rotations, - single_qubit_matrix_to_phased_x_z, - single_qubit_matrix_to_phxz, - single_qubit_op_to_framed_phase_form, - three_qubit_matrix_to_operations, - two_qubit_matrix_to_cz_operations, - two_qubit_matrix_to_diagonal_and_cz_operations, - two_qubit_matrix_to_sqrt_iswap_operations, -) - -from cirq import _compat - -_compat.deprecated_submodule( - new_module_name="cirq.transformers.analytical_decompositions.clifford_decomposition", - old_parent="cirq.optimizers", - old_child="clifford_decomposition", - deadline="v0.16", - create_attribute=True, -) - -_compat.deprecated_submodule( - new_module_name="cirq.transformers.analytical_decompositions.cphase_to_fsim", - old_parent="cirq.optimizers", - old_child="cphase_to_fsim", - deadline="v0.16", - create_attribute=True, -) - -_compat.deprecated_submodule( - new_module_name="cirq.transformers.analytical_decompositions.controlled_gate_decomposition", - old_parent="cirq.optimizers", - old_child="controlled_gate_decomposition", - deadline="v0.16", - create_attribute=True, -) - -_compat.deprecated_submodule( - new_module_name="cirq.transformers.analytical_decompositions.single_qubit_decompositions", - old_parent="cirq.optimizers", - old_child="decompositions", - deadline="v0.16", - create_attribute=True, -) - -_compat.deprecated_submodule( - new_module_name="cirq.transformers.analytical_decompositions.three_qubit_decomposition", - old_parent="cirq.optimizers", - old_child="three_qubit_decomposition", - deadline="v0.16", - create_attribute=True, -) - -_compat.deprecated_submodule( - new_module_name="cirq.transformers.analytical_decompositions.two_qubit_to_cz", - old_parent="cirq.optimizers", - old_child="two_qubit_decompositions", - deadline="v0.16", - create_attribute=True, -) - - -_compat.deprecated_submodule( - new_module_name="cirq.transformers.analytical_decompositions.two_qubit_to_fsim", - old_parent="cirq.optimizers", - old_child="two_qubit_to_fsim", - deadline="v0.16", - create_attribute=True, -) - - -_compat.deprecated_submodule( - new_module_name="cirq.transformers.analytical_decompositions.two_qubit_to_sqrt_iswap", - old_parent="cirq.optimizers", - old_child="two_qubit_to_sqrt_iswap", - deadline="v0.16", - create_attribute=True, -) diff --git a/cirq-core/cirq/optimizers/align_left.py b/cirq-core/cirq/optimizers/align_left.py deleted file mode 100644 index 7c223475153..00000000000 --- a/cirq-core/cirq/optimizers/align_left.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 The Cirq Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""An optimization pass that aligns gates to the left of the circuit.""" - -from cirq import circuits -from cirq.circuits.insert_strategy import InsertStrategy -from cirq._compat import deprecated_class - - -@deprecated_class(deadline='v1.0', fix='Use cirq.align_left(circuit, context) instead.') -class AlignLeft: - """Aligns gates to the left of the circuit.""" - - def __call__(self, circuit: circuits.Circuit): - self.optimize_circuit(circuit) - - def optimize_circuit(self, circuit: circuits.Circuit): - circuit[:] = circuits.Circuit(circuit.all_operations(), strategy=InsertStrategy.EARLIEST) diff --git a/cirq-core/cirq/optimizers/align_left_test.py b/cirq-core/cirq/optimizers/align_left_test.py deleted file mode 100644 index e456b6dc403..00000000000 --- a/cirq-core/cirq/optimizers/align_left_test.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2021 The Cirq Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import cirq - - -def assert_optimizes(before, after): - with cirq.testing.assert_deprecated("Use cirq.align_left", deadline='v1.0'): - opt = cirq.AlignLeft() - opt(before) - assert before == after - - -def test_align_left(): - q1 = cirq.NamedQubit('q1') - q2 = cirq.NamedQubit('q2') - assert_optimizes( - before=cirq.Circuit( - [ - cirq.Moment([cirq.X(q1)]), - cirq.Moment([cirq.Y(q1), cirq.X(q2)]), - cirq.Moment([cirq.X(q1), cirq.Y(q2)]), - cirq.Moment([cirq.Y(q1)]), - cirq.measure(*[q1, q2], key='a'), - ] - ), - after=cirq.Circuit( - [ - cirq.Moment([cirq.X(q1), cirq.X(q2)]), - cirq.Moment([cirq.Y(q1), cirq.Y(q2)]), - cirq.Moment([cirq.X(q1)]), - cirq.Moment([cirq.Y(q1)]), - cirq.measure(*[q1, q2], key='a'), - ] - ), - ) diff --git a/cirq-core/cirq/optimizers/align_right.py b/cirq-core/cirq/optimizers/align_right.py deleted file mode 100644 index 22b0e597521..00000000000 --- a/cirq-core/cirq/optimizers/align_right.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 The Cirq Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""An optimization pass that aligns gates to the right of the circuit.""" - -from cirq import circuits -from cirq.circuits.insert_strategy import InsertStrategy -from cirq._compat import deprecated_class - - -@deprecated_class(deadline='v1.0', fix='Use cirq.align_right(circuit, context) instead') -class AlignRight: - """Aligns gates to the right of the circuit.""" - - def __call__(self, circuit: circuits.Circuit): - self.optimize_circuit(circuit) - - def optimize_circuit(self, circuit: circuits.Circuit): - backwards = list(circuit.all_operations())[::-1] - circuit[:] = circuits.Circuit(backwards, strategy=InsertStrategy.EARLIEST)[::-1] diff --git a/cirq-core/cirq/optimizers/align_right_test.py b/cirq-core/cirq/optimizers/align_right_test.py deleted file mode 100644 index ab4de6baae0..00000000000 --- a/cirq-core/cirq/optimizers/align_right_test.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2021 The Cirq Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import cirq - - -def assert_optimizes(before, after): - with cirq.testing.assert_deprecated("Use cirq.align_right", deadline='v1.0'): - opt = cirq.AlignRight() - opt(before) - assert before == after - - -def test_align_right(): - q1 = cirq.NamedQubit('q1') - q2 = cirq.NamedQubit('q2') - assert_optimizes( - before=cirq.Circuit( - [ - cirq.Moment([cirq.X(q1)]), - cirq.Moment([cirq.Y(q1), cirq.X(q2)]), - cirq.Moment([cirq.X(q1), cirq.Y(q2)]), - cirq.Moment([cirq.Y(q1)]), - cirq.measure(*[q1, q2], key='a'), - ] - ), - after=cirq.Circuit( - [ - cirq.Moment([cirq.X(q1)]), - cirq.Moment([cirq.Y(q1)]), - cirq.Moment([cirq.X(q1), cirq.X(q2)]), - cirq.Moment([cirq.Y(q1), cirq.Y(q2)]), - cirq.measure(*[q1, q2], key='a'), - ] - ), - ) diff --git a/cirq-core/cirq/optimizers/convert_to_cz_and_single_gates.py b/cirq-core/cirq/optimizers/convert_to_cz_and_single_gates.py deleted file mode 100644 index ea51b987286..00000000000 --- a/cirq-core/cirq/optimizers/convert_to_cz_and_single_gates.py +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright 2018 The Cirq Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from typing import Optional - -from cirq import circuits, ops, protocols, _compat -from cirq.transformers.analytical_decompositions import two_qubit_to_cz - - -@_compat.deprecated_class( - deadline='v1.0', fix='Use cirq.optimize_for_target_gateset and cirq.CZTargetGateset instead.' -) -class ConvertToCzAndSingleGates(circuits.PointOptimizer): - """Attempts to convert strange multi-qubit gates into CZ and single qubit - gates. - - First, checks if the operation has a unitary effect. If so, and the gate is - a 1-qubit or 2-qubit gate, then performs circuit synthesis of the - operation. - - Second, attempts to `cirq.decompose` to the operation. - - Third, if ignore_failures is set, gives up and returns the gate unchanged. - Otherwise raises a TypeError. - """ - - def __init__(self, ignore_failures: bool = False, allow_partial_czs: bool = False) -> None: - """Inits ConvertToCzAndSingleGates. - - Args: - ignore_failures: If set, gates that fail to convert are forwarded - unchanged. If not set, conversion failures raise a TypeError. - allow_partial_czs: If set, the decomposition is permitted to use - gates of the form `cirq.CZ**t`, instead of only `cirq.CZ`. - """ - super().__init__() - self.ignore_failures = ignore_failures - self.allow_partial_czs = allow_partial_czs - self.gateset = ops.Gateset( - ops.CZPowGate if allow_partial_czs else ops.CZ, - ops.MeasurementGate, - ops.AnyUnitaryGateFamily(1), - ops.GlobalPhaseGate, - ) - - def _decompose_two_qubit_unitaries(self, op: ops.Operation) -> ops.OP_TREE: - # Known matrix? - if len(op.qubits) == 2: - mat = protocols.unitary(op, None) - if mat is not None: - return two_qubit_to_cz.two_qubit_matrix_to_cz_operations( - op.qubits[0], op.qubits[1], mat, allow_partial_czs=self.allow_partial_czs - ) - return NotImplemented - - def _on_stuck_raise(self, op: ops.Operation): - raise TypeError( - "Don't know how to work with {!r}. " - "It isn't composite or an operation with a " - "known unitary effect on 1 or 2 qubits.".format(op) - ) - - def optimization_at( - self, circuit: circuits.Circuit, index: int, op: ops.Operation - ) -> Optional[circuits.PointOptimizationSummary]: - converted = protocols.decompose( - op, - intercepting_decomposer=self._decompose_two_qubit_unitaries, - keep=self.gateset._validate_operation, - on_stuck_raise=(None if self.ignore_failures else self._on_stuck_raise), - ) - if converted == [op]: - return None - - return circuits.PointOptimizationSummary( - clear_span=1, new_operations=converted, clear_qubits=op.qubits - ) diff --git a/cirq-core/cirq/optimizers/convert_to_cz_and_single_gates_test.py b/cirq-core/cirq/optimizers/convert_to_cz_and_single_gates_test.py deleted file mode 100644 index 2c8f9f7e6ef..00000000000 --- a/cirq-core/cirq/optimizers/convert_to_cz_and_single_gates_test.py +++ /dev/null @@ -1,176 +0,0 @@ -# Copyright 2018 The Cirq Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import numpy as np - -import cirq - - -def test_avoids_decompose_when_matrix_available(): - class OtherXX(cirq.testing.TwoQubitGate): - # coverage: ignore - def _unitary_(self) -> np.ndarray: - m = np.array([[0, 1], [1, 0]]) - return np.kron(m, m) - - def _decompose_(self, qubits): - assert False - - class OtherOtherXX(cirq.testing.TwoQubitGate): - # coverage: ignore - def _unitary_(self) -> np.ndarray: - m = np.array([[0, 1], [1, 0]]) - return np.kron(m, m) - - def _decompose_(self, qubits): - assert False - - a, b = cirq.LineQubit.range(2) - c = cirq.Circuit(OtherXX()(a, b), OtherOtherXX()(a, b)) - with cirq.testing.assert_deprecated("Use cirq.optimize_for_target_gateset", deadline='v1.0'): - cirq.ConvertToCzAndSingleGates().optimize_circuit(c) - assert len(c) == 2 - - -def test_kak_decomposes_unknown_two_qubit_gate(): - q0, q1 = cirq.LineQubit.range(2) - circuit = cirq.Circuit(cirq.ISWAP(q0, q1)) - c_orig = cirq.Circuit(circuit) - with cirq.testing.assert_deprecated("Use cirq.optimize_for_target_gateset", deadline='v1.0'): - cirq.ConvertToCzAndSingleGates().optimize_circuit(circuit) - - assert sum(1 for op in circuit.all_operations() if len(op.qubits) > 1) == 2 - assert sum(1 for op in circuit.all_operations() if isinstance(op.gate, cirq.CZPowGate)) == 2 - assert all( - op.gate.exponent == 1 - for op in circuit.all_operations() - if isinstance(op.gate, cirq.CZPowGate) - ) - cirq.testing.assert_allclose_up_to_global_phase(circuit.unitary(), c_orig.unitary(), atol=1e-7) - - -def test_composite_gates_without_matrix(): - class CompositeDummy(cirq.testing.SingleQubitGate): - def _decompose_(self, qubits): - yield cirq.X(qubits[0]) - yield cirq.Y(qubits[0]) ** 0.5 - - class CompositeDummy2(cirq.testing.TwoQubitGate): - def _decompose_(self, qubits): - yield cirq.CZ(qubits[0], qubits[1]) - yield CompositeDummy()(qubits[1]) - - q0, q1 = cirq.LineQubit.range(2) - circuit = cirq.Circuit(CompositeDummy()(q0), CompositeDummy2()(q0, q1)) - expected = cirq.Circuit( - cirq.X(q0), cirq.Y(q0) ** 0.5, cirq.CZ(q0, q1), cirq.X(q1), cirq.Y(q1) ** 0.5 - ) - c_orig = cirq.Circuit(circuit) - with cirq.testing.assert_deprecated("Use cirq.optimize_for_target_gateset", deadline='v1.0'): - cirq.ConvertToCzAndSingleGates().optimize_circuit(circuit) - - cirq.testing.assert_allclose_up_to_global_phase( - circuit.unitary(), expected.unitary(), atol=1e-7 - ) - cirq.testing.assert_allclose_up_to_global_phase(circuit.unitary(), c_orig.unitary(), atol=1e-7) - - -def test_ignore_unsupported_gate(): - class UnsupportedDummy(cirq.testing.TwoQubitGate): - pass - - q0, q1 = cirq.LineQubit.range(2) - circuit = cirq.Circuit(UnsupportedDummy()(q0, q1)) - c_orig = cirq.Circuit(circuit) - with cirq.testing.assert_deprecated("Use cirq.optimize_for_target_gateset", deadline='v1.0'): - cirq.ConvertToCzAndSingleGates(ignore_failures=True).optimize_circuit(circuit) - - assert circuit == c_orig - - -def test_fail_unsupported_gate(): - class UnsupportedDummy(cirq.testing.TwoQubitGate): - pass - - q0, q1 = cirq.LineQubit.range(2) - circuit = cirq.Circuit(UnsupportedDummy()(q0, q1)) - with pytest.raises(TypeError): - with cirq.testing.assert_deprecated( - "Use cirq.optimize_for_target_gateset", deadline='v1.0' - ): - cirq.ConvertToCzAndSingleGates().optimize_circuit(circuit) - - -def test_passes_through_measurements(): - q0, q1, q2 = cirq.LineQubit.range(3) - circuit = cirq.Circuit( - cirq.measure(q0, key='m0'), cirq.measure(q1, q2, key='m1', invert_mask=(True, False)) - ) - c_orig = cirq.Circuit(circuit) - with cirq.testing.assert_deprecated("Use cirq.optimize_for_target_gateset", deadline='v1.0'): - cirq.ConvertToCzAndSingleGates().optimize_circuit(circuit) - assert circuit == c_orig - - -def test_allow_partial_czs(): - q0, q1 = cirq.LineQubit.range(2) - circuit = cirq.Circuit( - cirq.CZ(q0, q1) ** 0.5, cirq.CZPowGate(exponent=0.5, global_shift=-0.5).on(q0, q1) - ) - c_orig = cirq.Circuit(circuit) - with cirq.testing.assert_deprecated("Use cirq.optimize_for_target_gateset", deadline='v1.0'): - cirq.ConvertToCzAndSingleGates(allow_partial_czs=True).optimize_circuit(circuit) - - assert circuit == c_orig - - # yapf: disable - circuit2 = cirq.Circuit( - cirq.MatrixGate((np.array([[1, 0, 0, 0], - [0, 1, 0, 0], - [0, 0, 1, 0], - [0, 0, 0, 1j]]))).on(q0, q1)) - # yapf: enable - with cirq.testing.assert_deprecated("Use cirq.optimize_for_target_gateset", deadline='v1.0'): - cirq.ConvertToCzAndSingleGates(allow_partial_czs=True).optimize_circuit(circuit2) - two_qubit_ops = list(circuit2.findall_operations(lambda e: len(e.qubits) == 2)) - assert len(two_qubit_ops) == 1 - gate = two_qubit_ops[0][1].gate - assert isinstance(gate, cirq.ops.CZPowGate) and gate.exponent == 0.5 - - -def test_dont_allow_partial_czs(): - q0, q1 = cirq.LineQubit.range(2) - circuit = cirq.Circuit( - cirq.CZ(q0, q1), cirq.CZPowGate(exponent=1, global_shift=-0.5).on(q0, q1) - ) - c_orig = cirq.Circuit(circuit) - with cirq.testing.assert_deprecated("Use cirq.optimize_for_target_gateset", deadline='v1.0'): - cirq.ConvertToCzAndSingleGates().optimize_circuit(circuit) - assert circuit == c_orig - - circuit = cirq.Circuit(cirq.CZ(q0, q1) ** 0.5) - c_orig = cirq.Circuit(circuit) - with cirq.testing.assert_deprecated("Use cirq.optimize_for_target_gateset", deadline='v1.0'): - cirq.ConvertToCzAndSingleGates(ignore_failures=True).optimize_circuit(circuit) - - assert sum(1 for op in circuit.all_operations() if len(op.qubits) > 1) == 2 - assert sum(1 for op in circuit.all_operations() if isinstance(op.gate, cirq.CZPowGate)) == 2 - assert all( - op.gate.exponent % 2 == 1 - for op in circuit.all_operations() - if isinstance(op.gate, cirq.CZPowGate) - ) - cirq.testing.assert_allclose_up_to_global_phase(circuit.unitary(), c_orig.unitary(), atol=1e-7) diff --git a/cirq-core/cirq/protocols/json_test_data/spec.py b/cirq-core/cirq/protocols/json_test_data/spec.py index 1094020e13d..644a73d563a 100644 --- a/cirq-core/cirq/protocols/json_test_data/spec.py +++ b/cirq-core/cirq/protocols/json_test_data/spec.py @@ -86,9 +86,6 @@ 'TwoQubitCompilationTargetGateset', # Circuit optimizers are function-like. Only attributes # are ignore_failures, tolerance, and other feature flags - 'AlignLeft', - 'AlignRight', - 'ConvertToCzAndSingleGates', 'ConvertToIonGates', 'MEASUREMENT_KEY_SEPARATOR', 'PointOptimizer', diff --git a/cirq-core/cirq/transformers/analytical_decompositions/clifford_decomposition_test.py b/cirq-core/cirq/transformers/analytical_decompositions/clifford_decomposition_test.py index 29b3f4b43e1..ab1ee65b967 100644 --- a/cirq-core/cirq/transformers/analytical_decompositions/clifford_decomposition_test.py +++ b/cirq-core/cirq/transformers/analytical_decompositions/clifford_decomposition_test.py @@ -18,16 +18,6 @@ import cirq from cirq.testing import assert_allclose_up_to_global_phase -ALLOW_DEPRECATION_IN_TEST = 'ALLOW_DEPRECATION_IN_TEST' - - -def test_deprecated_submodule(): - with cirq.testing.assert_deprecated( - "Use cirq.transformers.analytical_decompositions.clifford_decomposition instead", - deadline="v0.16", - ): - _ = cirq.optimizers.clifford_decomposition.decompose_clifford_tableau_to_operations - def test_misaligned_qubits(): qubits = cirq.LineQubit.range(1) diff --git a/cirq-core/cirq/transformers/analytical_decompositions/controlled_gate_decomposition_test.py b/cirq-core/cirq/transformers/analytical_decompositions/controlled_gate_decomposition_test.py index 92bf8e31b63..f7286c58bbd 100644 --- a/cirq-core/cirq/transformers/analytical_decompositions/controlled_gate_decomposition_test.py +++ b/cirq-core/cirq/transformers/analytical_decompositions/controlled_gate_decomposition_test.py @@ -17,16 +17,6 @@ import cirq -ALLOW_DEPRECATION_IN_TEST = 'ALLOW_DEPRECATION_IN_TEST' - - -def test_deprecated_submodule(): - with cirq.testing.assert_deprecated( - "Use cirq.transformers.analytical_decompositions.controlled_gate_decomposition instead", - deadline="v0.16", - ): - _ = cirq.optimizers.controlled_gate_decomposition.decompose_multi_controlled_rotation - def test_decompose_x(): """Verifies correctness of multi-controlled X decomposition.""" diff --git a/cirq-core/cirq/transformers/analytical_decompositions/cphase_to_fsim_test.py b/cirq-core/cirq/transformers/analytical_decompositions/cphase_to_fsim_test.py index c650d29058f..0baa8284b04 100644 --- a/cirq-core/cirq/transformers/analytical_decompositions/cphase_to_fsim_test.py +++ b/cirq-core/cirq/transformers/analytical_decompositions/cphase_to_fsim_test.py @@ -21,15 +21,6 @@ import cirq -ALLOW_DEPRECATION_IN_TEST = 'ALLOW_DEPRECATION_IN_TEST' - - -def test_deprecated_submodule(): - with cirq.testing.assert_deprecated( - "Use cirq.transformers.analytical_decompositions.cphase_to_fsim instead", deadline="v0.16" - ): - _ = cirq.optimizers.cphase_to_fsim.decompose_cphase_into_two_fsim - def test_symbols(): with pytest.raises(ValueError, match='Symbolic arguments'): diff --git a/cirq-core/cirq/transformers/analytical_decompositions/single_qubit_decompositions_test.py b/cirq-core/cirq/transformers/analytical_decompositions/single_qubit_decompositions_test.py index 8ba7490cd3d..532a3b97f28 100644 --- a/cirq-core/cirq/transformers/analytical_decompositions/single_qubit_decompositions_test.py +++ b/cirq-core/cirq/transformers/analytical_decompositions/single_qubit_decompositions_test.py @@ -21,16 +21,6 @@ import cirq -ALLOW_DEPRECATION_IN_TEST = 'ALLOW_DEPRECATION_IN_TEST' - - -def test_deprecated_submodule(): - with cirq.testing.assert_deprecated( - "Use cirq.transformers.analytical_decompositions.single_qubit_decompositions instead", - deadline="v0.16", - ): - _ = cirq.optimizers.decompositions.single_qubit_matrix_to_phxz - def assert_gates_implement_unitary( gates: Sequence[cirq.testing.SingleQubitGate], intended_effect: np.ndarray, atol: float diff --git a/cirq-core/cirq/transformers/analytical_decompositions/three_qubit_decomposition_test.py b/cirq-core/cirq/transformers/analytical_decompositions/three_qubit_decomposition_test.py index 491fc182ded..dce301acae9 100644 --- a/cirq-core/cirq/transformers/analytical_decompositions/three_qubit_decomposition_test.py +++ b/cirq-core/cirq/transformers/analytical_decompositions/three_qubit_decomposition_test.py @@ -28,16 +28,6 @@ _two_qubit_multiplexor_to_ops, ) -ALLOW_DEPRECATION_IN_TEST = 'ALLOW_DEPRECATION_IN_TEST' - - -def test_deprecated_submodule(): - with cirq.testing.assert_deprecated( - "Use cirq.transformers.analytical_decompositions.three_qubit_decomposition instead", - deadline="v0.16", - ): - _ = cirq.optimizers.three_qubit_decomposition.three_qubit_matrix_to_operations - def _skip_if_scipy(*, version_is_greater_than_1_5_0: bool) -> Callable[[Callable], Callable]: def decorator(func): diff --git a/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_cz_test.py b/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_cz_test.py index 597f4dc6529..3a2eacd80df 100644 --- a/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_cz_test.py +++ b/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_cz_test.py @@ -27,15 +27,6 @@ ) from cirq.testing import random_two_qubit_circuit_with_czs -ALLOW_DEPRECATION_IN_TEST = 'ALLOW_DEPRECATION_IN_TEST' - - -def test_deprecated_submodule(): - with cirq.testing.assert_deprecated( - "Use cirq.transformers.analytical_decompositions.two_qubit_to_cz instead", deadline="v0.16" - ): - _ = cirq.optimizers.two_qubit_decompositions.two_qubit_matrix_to_cz_operations - @pytest.mark.parametrize( 'rad,expected', diff --git a/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_fsim_test.py b/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_fsim_test.py index d32695c5f83..0263e077e03 100644 --- a/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_fsim_test.py +++ b/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_fsim_test.py @@ -28,16 +28,6 @@ _B, ) -ALLOW_DEPRECATION_IN_TEST = 'ALLOW_DEPRECATION_IN_TEST' - - -def test_deprecated_submodule(): - with cirq.testing.assert_deprecated( - "Use cirq.transformers.analytical_decompositions.two_qubit_to_fsim instead", - deadline="v0.16", - ): - _ = cirq.optimizers.two_qubit_to_fsim.decompose_two_qubit_interaction_into_four_fsim_gates - UNITARY_OBJS = [ cirq.IdentityGate(2), diff --git a/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_sqrt_iswap_test.py b/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_sqrt_iswap_test.py index b8d4cb8212a..eff61f43d6e 100644 --- a/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_sqrt_iswap_test.py +++ b/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_to_sqrt_iswap_test.py @@ -19,16 +19,6 @@ import cirq import sympy -ALLOW_DEPRECATION_IN_TEST = 'ALLOW_DEPRECATION_IN_TEST' - - -def test_deprecated_submodule(): - with cirq.testing.assert_deprecated( - "Use cirq.transformers.analytical_decompositions.two_qubit_to_sqrt_iswap instead", - deadline="v0.16", - ): - _ = cirq.optimizers.two_qubit_to_sqrt_iswap.two_qubit_matrix_to_sqrt_iswap_operations - def random_unitary(seed): return cirq.testing.random_unitary(4, random_state=seed)