From 67edecc6c3721db32f24379b1ea982897870790a Mon Sep 17 00:00:00 2001 From: Tanuj Khattar Date: Fri, 24 Dec 2021 05:12:24 +0530 Subject: [PATCH] Move `optimizers/two_qubit_state_preparation.py` to `transformers/analytical_decompositions/two_qubit_state_preparation.py` (#4762) Part of #4722 This is safe to do without going through a deprecation cycle because `optimizers/two_qubit_state_preparation.py ` was recently introduced (#4707) in the current dev version and hasn't been released yet. --- cirq-core/cirq/__init__.py | 4 ++-- cirq-core/cirq/optimizers/__init__.py | 5 ----- cirq-core/cirq/transformers/__init__.py | 5 +++++ .../analytical_decompositions/__init__.py | 20 +++++++++++++++++++ .../two_qubit_state_preparation.py | 0 .../two_qubit_state_preparation_test.py | 0 6 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 cirq-core/cirq/transformers/analytical_decompositions/__init__.py rename cirq-core/cirq/{optimizers => transformers/analytical_decompositions}/two_qubit_state_preparation.py (100%) rename cirq-core/cirq/{optimizers => transformers/analytical_decompositions}/two_qubit_state_preparation_test.py (100%) diff --git a/cirq-core/cirq/__init__.py b/cirq-core/cirq/__init__.py index 1d94f2a5258..f14088475ab 100644 --- a/cirq-core/cirq/__init__.py +++ b/cirq-core/cirq/__init__.py @@ -345,8 +345,6 @@ MergeInteractions, MergeInteractionsToSqrtIswap, MergeSingleQubitGates, - 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, @@ -366,6 +364,8 @@ map_operations_and_unroll, merge_moments, merge_operations, + prepare_two_qubit_state_using_cz, + prepare_two_qubit_state_using_sqrt_iswap, unroll_circuit_op, unroll_circuit_op_greedy_earliest, unroll_circuit_op_greedy_frontier, diff --git a/cirq-core/cirq/optimizers/__init__.py b/cirq-core/cirq/optimizers/__init__.py index 48b52e18765..5b09423b70e 100644 --- a/cirq-core/cirq/optimizers/__init__.py +++ b/cirq-core/cirq/optimizers/__init__.py @@ -72,11 +72,6 @@ MergeSingleQubitGates, ) -from cirq.optimizers.two_qubit_state_preparation import ( - prepare_two_qubit_state_using_cz, - prepare_two_qubit_state_using_sqrt_iswap, -) - from cirq.optimizers.decompositions import ( is_negligible_turn, single_qubit_matrix_to_gates, diff --git a/cirq-core/cirq/transformers/__init__.py b/cirq-core/cirq/transformers/__init__.py index 305440e3358..134d61427d7 100644 --- a/cirq-core/cirq/transformers/__init__.py +++ b/cirq-core/cirq/transformers/__init__.py @@ -14,6 +14,11 @@ """Circuit transformation utilities.""" +from cirq.transformers.analytical_decompositions import ( + prepare_two_qubit_state_using_cz, + prepare_two_qubit_state_using_sqrt_iswap, +) + from cirq.transformers.transformer_primitives import ( map_moments, map_operations, diff --git a/cirq-core/cirq/transformers/analytical_decompositions/__init__.py b/cirq-core/cirq/transformers/analytical_decompositions/__init__.py new file mode 100644 index 00000000000..0ed5ca0bbe1 --- /dev/null +++ b/cirq-core/cirq/transformers/analytical_decompositions/__init__.py @@ -0,0 +1,20 @@ +# 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. + +"""Utilities for analytical decomposition of cirq gates.""" + +from cirq.transformers.analytical_decompositions.two_qubit_state_preparation import ( + prepare_two_qubit_state_using_cz, + prepare_two_qubit_state_using_sqrt_iswap, +) diff --git a/cirq-core/cirq/optimizers/two_qubit_state_preparation.py b/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_state_preparation.py similarity index 100% rename from cirq-core/cirq/optimizers/two_qubit_state_preparation.py rename to cirq-core/cirq/transformers/analytical_decompositions/two_qubit_state_preparation.py diff --git a/cirq-core/cirq/optimizers/two_qubit_state_preparation_test.py b/cirq-core/cirq/transformers/analytical_decompositions/two_qubit_state_preparation_test.py similarity index 100% rename from cirq-core/cirq/optimizers/two_qubit_state_preparation_test.py rename to cirq-core/cirq/transformers/analytical_decompositions/two_qubit_state_preparation_test.py