Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove qiskit.quantum_info.synthesis for Qiskit 1.0 release #11592

Merged
merged 32 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
cdc35c4
remove deprecated code in clifford_decompose and cnotdihedral_decompose
ShellyGarion Dec 27, 2023
56e3d54
move tests from test/python/quantum_info to test/python/synthesis
ShellyGarion Dec 27, 2023
3e5f7ba
move the Quaternion class from quantum_info/synthesis to quantum_info
ShellyGarion Dec 28, 2023
133be57
deprecate cnot_rxx_decompose, and move to an internal code in the equ…
ShellyGarion Dec 28, 2023
70efcb2
deprecate cnot_rxx_decompose
ShellyGarion Dec 28, 2023
340ef4c
move qsd from qiskit/quantum_info/synthesis to qiskit/synthesis/unitary
ShellyGarion Dec 28, 2023
3daa862
handle lint and docs errors in qsd
ShellyGarion Dec 28, 2023
069a2bf
handle lint and docs errors in qsd
ShellyGarion Dec 28, 2023
ceeb96f
handle lint and docs errors in qsd
ShellyGarion Dec 28, 2023
2f23da3
handle lint and docs errors in qsd
ShellyGarion Dec 28, 2023
502118b
handle lint and docs errors in qsd
ShellyGarion Dec 28, 2023
671ad1e
handle cyclic imports in qsd
ShellyGarion Dec 28, 2023
5fe9353
minor
ShellyGarion Dec 28, 2023
e2a93ed
update qsd docs
ShellyGarion Dec 31, 2023
b410e58
move one_qubit_decompose from qiskit/quantum_info/synthesis to qiskit…
ShellyGarion Dec 31, 2023
b3f2e3e
move xx_decompose from qiskit/quantum_info/synthesis to qiskit/synthe…
ShellyGarion Dec 31, 2023
2ee51ff
handle cyclic imports
ShellyGarion Dec 31, 2023
209d95c
move two-qubit synthesis code from qiskit/quantum_info/synthesis to q…
ShellyGarion Dec 31, 2023
bbf40cb
update qsd docs
ShellyGarion Jan 1, 2024
7958c29
minor
ShellyGarion Jan 1, 2024
624ee28
add release notes
ShellyGarion Jan 1, 2024
1a8f17d
updates following review
ShellyGarion Jan 7, 2024
48ac742
add disable cyclic import to rv.py
ShellyGarion Jan 7, 2024
067f9ff
add deprecation warning in qiskit/quantum_info/__init__.py
ShellyGarion Jan 9, 2024
d9a2c91
fix links
ShellyGarion Jan 16, 2024
13e63a3
improve qsd docs following review
ShellyGarion Jan 18, 2024
551f24c
remove qiskit.quantum_info.synthesis
ShellyGarion Jan 18, 2024
665d64c
add release notes
ShellyGarion Jan 18, 2024
d4b609b
update qsd docs
ShellyGarion Jan 21, 2024
daf90a6
fix conflicts with main
ShellyGarion Jan 25, 2024
0e01d5f
update release notes
ShellyGarion Jan 25, 2024
6757550
update release notes
ShellyGarion Jan 29, 2024
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
23 changes: 0 additions & 23 deletions qiskit/quantum_info/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,26 +156,3 @@
negativity,
)
from .quaternion import Quaternion

_DEPRECATED_NAMES = {
"OneQubitEulerDecomposer": "qiskit.synthesis",
"TwoQubitBasisDecomposer": "qiskit.synthesis",
"XXDecomposer": "qiskit.synthesis",
"two_qubit_cnot_decompose": "qiskit.synthesis",
}


def __getattr__(name):
if name in _DEPRECATED_NAMES:
import importlib
import warnings

module_name = _DEPRECATED_NAMES[name]
warnings.warn(
f"Accessing '{name}' from '{__name__}' is deprecated since Qiskit 0.46"
f" and will be removed in 1.0. Import from '{module_name}' instead.",
DeprecationWarning,
stacklevel=2,
)
return getattr(importlib.import_module(module_name), name)
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
30 changes: 0 additions & 30 deletions qiskit/quantum_info/synthesis/__init__.py

This file was deleted.

57 changes: 0 additions & 57 deletions qiskit/quantum_info/synthesis/ion_decompose.py

This file was deleted.

13 changes: 13 additions & 0 deletions releasenotes/notes/remove_qinfo_synthesis-1917c7ccfcc62180.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
upgrade:
- |
Removed the ``qiskit.quantum_info.synthesis`` module, which has been deprecated since the 0.46 release.
The following objects have been moved to :mod:`qiskit.synthesis`:

* :class:`~.OneQubitEulerDecomposer` has been moved to :mod:`qiskit.synthesis.one_qubit`
* :class:`~.TwoQubitBasisDecomposer` has been moved to :mod:`qiskit.synthesis.two_qubits`
* :class:`~.XXDecomposer` has been moved to :mod:`qiskit.synthesis.two_qubits`
* :func:`~.two_qubit_cnot_decompose` has been moved to :mod:`qiskit.synthesis.two_qubits`

This function was removed, since it has already been deprecated in the 0.46 release:
* ``cnot_rxx_decompose``
38 changes: 0 additions & 38 deletions test/python/synthesis/test_synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@

from qiskit.synthesis.unitary import qsd
from qiskit.test import QiskitTestCase
from qiskit.quantum_info.synthesis.ion_decompose import cnot_rxx_decompose


def make_oneq_cliffords():
Expand Down Expand Up @@ -630,14 +629,6 @@ def test_float_input_angles(self):
self.assertAlmostEqual(phi, expected_phi)
self.assertAlmostEqual(lam, expected_lam)

def test_deprecation(self):
"""Assert that importing this class from quantum_info raises a deprecation warning."""
# pylint: disable = no-name-in-module
with self.assertWarns(DeprecationWarning):
from qiskit.quantum_info import OneQubitEulerDecomposer as old_OneQubitEulerDecomposer

_ = old_OneQubitEulerDecomposer(basis="PSX")


# FIXME: streamline the set of test cases
class TestTwoQubitWeylDecomposition(CheckDecompositions):
Expand Down Expand Up @@ -988,21 +979,6 @@ def test_weyl_specialize_general(self, aaa=0.456, bbb=0.345, ccc=0.123):
class TestTwoQubitDecompose(CheckDecompositions):
"""Test TwoQubitBasisDecomposer() for exact/approx decompositions"""

def test_cnot_rxx_decompose(self):
"""Verify CNOT decomposition into RXX gate is correct"""
cnot = Operator(CXGate())
# Assert that this class raises a deprecation warning
with self.assertWarns(DeprecationWarning):
decomps = [
cnot_rxx_decompose(),
cnot_rxx_decompose(plus_ry=True, plus_rxx=True),
cnot_rxx_decompose(plus_ry=True, plus_rxx=False),
cnot_rxx_decompose(plus_ry=False, plus_rxx=True),
cnot_rxx_decompose(plus_ry=False, plus_rxx=False),
]
for decomp in decomps:
self.assertTrue(cnot.equiv(decomp))

@combine(seed=range(10), name="test_exact_two_qubit_cnot_decompose_random_{seed}")
def test_exact_two_qubit_cnot_decompose_random(self, seed):
"""Verify exact CNOT decomposition for random Haar 4x4 unitary (seed={seed})."""
Expand Down Expand Up @@ -1253,20 +1229,6 @@ def test_euler_basis_selection(self, euler_bases, kak_gates, seed):
requested_basis = set(oneq_gates + [kak_gate_name])
self.assertTrue(decomposition_basis.issubset(requested_basis))

def test_deprecation(self):
"""Assert that importing these classes from quantum_info raises a deprecation warning."""
# pylint: disable = no-name-in-module
with self.assertWarns(DeprecationWarning):
unitary = random_unitary(4, seed=1234)
from qiskit.quantum_info import TwoQubitBasisDecomposer as old_TwoQubitBasisDecomposer

_ = old_TwoQubitBasisDecomposer(unitary)

with self.assertWarns(DeprecationWarning):
from qiskit.quantum_info import two_qubit_cnot_decompose as old_two_qubit_cnot_decompose

_ = old_two_qubit_cnot_decompose(unitary)


@ddt
class TestPulseOptimalDecompose(CheckDecompositions):
Expand Down
8 changes: 0 additions & 8 deletions test/python/synthesis/xx_decompose/test_decomposer.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,3 @@ def test_no_error_on_empty_basis_fidelity_trivial_target(self):
mat = Operator(qc).to_matrix()
dqc = decomposer(mat)
self.assertTrue(np.allclose(mat, Operator(dqc).to_matrix()))

def test_deprecation(self):
"""Assert that importing this class from quantum_info raises a deprecation warning."""
# pylint: disable = no-name-in-module
with self.assertWarns(DeprecationWarning):
from qiskit.quantum_info import XXDecomposer as old_XXDecomposer

_ = old_XXDecomposer(euler_basis="PSX")
Loading