From 340ef4c49c79e6d25c10efb585547ed966074d82 Mon Sep 17 00:00:00 2001 From: Shelly Garion Date: Thu, 28 Dec 2023 09:19:49 +0000 Subject: [PATCH] move qsd from qiskit/quantum_info/synthesis to qiskit/synthesis/unitary --- qiskit/circuit/library/generalized_gates/unitary.py | 2 +- qiskit/synthesis/__init__.py | 5 +++++ qiskit/synthesis/unitary/__init__.py | 13 +++++++++++++ .../synthesis => synthesis/unitary}/qsd.py | 0 .../passes/synthesis/unitary_synthesis.py | 2 +- test/python/synthesis/test_synthesis.py | 2 +- 6 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 qiskit/synthesis/unitary/__init__.py rename qiskit/{quantum_info/synthesis => synthesis/unitary}/qsd.py (100%) diff --git a/qiskit/circuit/library/generalized_gates/unitary.py b/qiskit/circuit/library/generalized_gates/unitary.py index 3b15e83196c6..6d0cdf0f949f 100644 --- a/qiskit/circuit/library/generalized_gates/unitary.py +++ b/qiskit/circuit/library/generalized_gates/unitary.py @@ -146,7 +146,7 @@ def _define(self): elif self.num_qubits == 2: self.definition = two_qubit_cnot_decompose(self.to_matrix()) else: - from qiskit.quantum_info.synthesis.qsd import ( # pylint: disable=cyclic-import + from qiskit.synthesis.unitary.qsd import ( # pylint: disable=cyclic-import qs_decomposition, ) diff --git a/qiskit/synthesis/__init__.py b/qiskit/synthesis/__init__.py index f4d6a73f2a70..c865464ca79c 100644 --- a/qiskit/synthesis/__init__.py +++ b/qiskit/synthesis/__init__.py @@ -89,6 +89,10 @@ .. autofunction:: synth_qft_line +Unitary Synthesis +================= + +.. autofunction:: qs_decomposition """ from .evolution import ( @@ -126,3 +130,4 @@ from .stabilizer import synth_stabilizer_layers, synth_stabilizer_depth_lnn from .discrete_basis import SolovayKitaevDecomposition, generate_basic_approximations from .qft import synth_qft_line +from .unitary.qsd import qs_decomposition diff --git a/qiskit/synthesis/unitary/__init__.py b/qiskit/synthesis/unitary/__init__.py new file mode 100644 index 000000000000..f19592ee8bdb --- /dev/null +++ b/qiskit/synthesis/unitary/__init__.py @@ -0,0 +1,13 @@ +# This code is part of Qiskit. +# +# (C) Copyright IBM 2017 - 2023. +# +# This code is licensed under the Apache License, Version 2.0. You may +# obtain a copy of this license in the LICENSE.txt file in the root directory +# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. +# +# Any modifications or derivative works of this code must retain this +# copyright notice, and modified files need to carry a notice indicating +# that they have been altered from the originals. + +"""Module containing unitary synthesis methods.""" diff --git a/qiskit/quantum_info/synthesis/qsd.py b/qiskit/synthesis/unitary/qsd.py similarity index 100% rename from qiskit/quantum_info/synthesis/qsd.py rename to qiskit/synthesis/unitary/qsd.py diff --git a/qiskit/transpiler/passes/synthesis/unitary_synthesis.py b/qiskit/transpiler/passes/synthesis/unitary_synthesis.py index f7f30fc284c7..5335a8251540 100644 --- a/qiskit/transpiler/passes/synthesis/unitary_synthesis.py +++ b/qiskit/transpiler/passes/synthesis/unitary_synthesis.py @@ -866,7 +866,7 @@ def run(self, unitary, **options): default=None, ) else: - from qiskit.quantum_info.synthesis.qsd import ( # pylint: disable=cyclic-import + from qiskit.synthesis.unitary.qsd import ( # pylint: disable=cyclic-import qs_decomposition, ) diff --git a/test/python/synthesis/test_synthesis.py b/test/python/synthesis/test_synthesis.py index bc460825807e..9216ee3a919d 100644 --- a/test/python/synthesis/test_synthesis.py +++ b/test/python/synthesis/test_synthesis.py @@ -78,7 +78,7 @@ ) from qiskit.circuit.library.standard_gates.equivalence_library import _cnot_rxx_decompose -from qiskit.quantum_info.synthesis import qsd +from qiskit.synthesis.unitary import qsd from qiskit.test import QiskitTestCase