Skip to content

Commit

Permalink
move one_qubit_decompose from qiskit/quantum_info/synthesis to qiskit…
Browse files Browse the repository at this point in the history
…/synthesis/one_qubit
  • Loading branch information
ShellyGarion committed Dec 31, 2023
1 parent e2a93ed commit b410e58
Show file tree
Hide file tree
Showing 16 changed files with 49 additions and 15 deletions.
4 changes: 2 additions & 2 deletions qiskit/circuit/library/generalized_gates/rv.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def __init__(self, v_x, v_y, v_z, basis="U"):
v_y (float): y-component
v_z (float): z-component
basis (str, optional): basis (see
:class:`~qiskit.quantum_info.synthesis.one_qubit_decompose.OneQubitEulerDecomposer`)
:class:`~qiskit.synthesis.one_qubit.one_qubit_decompose.OneQubitEulerDecomposer`)
"""
# pylint: disable=cyclic-import
from qiskit.quantum_info.synthesis.one_qubit_decompose import OneQubitEulerDecomposer
from qiskit.synthesis.one_qubit.one_qubit_decompose import OneQubitEulerDecomposer

super().__init__("rv", 1, [v_x, v_y, v_z])
self._decomposer = OneQubitEulerDecomposer(basis=basis)
Expand Down
2 changes: 1 addition & 1 deletion qiskit/circuit/library/generalized_gates/uc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from qiskit.exceptions import QiskitError

# pylint: disable=cyclic-import
from qiskit.quantum_info.synthesis.one_qubit_decompose import OneQubitEulerDecomposer
from qiskit.synthesis.one_qubit.one_qubit_decompose import OneQubitEulerDecomposer

from .diagonal import Diagonal

Expand Down
2 changes: 1 addition & 1 deletion qiskit/circuit/library/generalized_gates/unitary.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from qiskit.quantum_info.operators.predicates import is_unitary_matrix

# pylint: disable=cyclic-import
from qiskit.quantum_info.synthesis.one_qubit_decompose import OneQubitEulerDecomposer
from qiskit.synthesis.one_qubit.one_qubit_decompose import OneQubitEulerDecomposer
from qiskit.quantum_info.synthesis.two_qubit_decompose import two_qubit_cnot_decompose

from .isometry import Isometry
Expand Down
2 changes: 0 additions & 2 deletions qiskit/quantum_info/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
.. autosummary::
:toctree: ../stubs/
OneQubitEulerDecomposer
TwoQubitBasisDecomposer
XXDecomposer
Expand Down Expand Up @@ -167,7 +166,6 @@
negativity,
)
from .synthesis import (
OneQubitEulerDecomposer,
TwoQubitBasisDecomposer,
XXDecomposer,
two_qubit_cnot_decompose,
Expand Down
10 changes: 9 additions & 1 deletion qiskit/quantum_info/synthesis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
"""State and Unitary synthesis methods."""

from __future__ import annotations
import warnings
from qiskit.synthesis.one_qubit import OneQubitEulerDecomposer
from .two_qubit_decompose import TwoQubitBasisDecomposer, two_qubit_cnot_decompose
from .one_qubit_decompose import OneQubitEulerDecomposer
from .xx_decompose.decomposer import XXDecomposer

warnings.warn(
"The qiskit.quantum_info.synthesis module is pending deprecation since Qiskit 0.46.0."
"It will be deprecated in a following release, no sooner than 3 months after the 0.46.0 release.",
stacklevel=2,
category=PendingDeprecationWarning,
)
2 changes: 1 addition & 1 deletion qiskit/quantum_info/synthesis/two_qubit_decompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from qiskit.exceptions import QiskitError
from qiskit.quantum_info.operators import Operator
from qiskit.quantum_info.synthesis.weyl import weyl_coordinates, transform_to_magic_basis
from qiskit.quantum_info.synthesis.one_qubit_decompose import (
from qiskit.synthesis.one_qubit.one_qubit_decompose import (
OneQubitEulerDecomposer,
DEFAULT_ATOL,
)
Expand Down
2 changes: 1 addition & 1 deletion qiskit/quantum_info/synthesis/xx_decompose/decomposer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from qiskit.circuit.library.standard_gates import RXXGate, RZXGate
from qiskit.exceptions import QiskitError
from qiskit.quantum_info.operators import Operator
from qiskit.quantum_info.synthesis.one_qubit_decompose import ONE_QUBIT_EULER_BASIS_GATES
from qiskit.synthesis.one_qubit.one_qubit_decompose import ONE_QUBIT_EULER_BASIS_GATES
from qiskit.quantum_info.synthesis.two_qubit_decompose import TwoQubitWeylDecomposition

from .circuits import apply_reflection, apply_shift, canonical_xx_circuit
Expand Down
12 changes: 12 additions & 0 deletions qiskit/synthesis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@
.. autofunction:: qs_decomposition
One-qubit Synthesis
===================
.. autosummary::
:toctree: ../stubs/
OneQubitEulerDecomposer
Two-qubits Synthesis
====================
"""

from .evolution import (
Expand Down Expand Up @@ -132,3 +143,4 @@
from .discrete_basis import SolovayKitaevDecomposition, generate_basic_approximations
from .qft import synth_qft_line
from .unitary.qsd import qs_decomposition
from .one_qubit import OneQubitEulerDecomposer
15 changes: 15 additions & 0 deletions qiskit/synthesis/one_qubit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# 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 one qubit unitary synthesis methods."""

from .one_qubit_decompose import OneQubitEulerDecomposer
3 changes: 2 additions & 1 deletion qiskit/synthesis/unitary/qsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
import scipy
import numpy as np
from qiskit.circuit.quantumcircuit import QuantumCircuit, QuantumRegister
from qiskit.quantum_info.synthesis import two_qubit_decompose, one_qubit_decompose
from qiskit.quantum_info.synthesis import two_qubit_decompose
from qiskit.synthesis.one_qubit import one_qubit_decompose
from qiskit.quantum_info.operators.predicates import is_hermitian_matrix
from qiskit.circuit.library.generalized_gates.uc_pauli_rot import UCPauliRotGate, _EPS
from qiskit.circuit.library.generalized_gates.ucry import UCRYGate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from qiskit.transpiler.basepasses import TransformationPass
from qiskit.transpiler.passes.utils import control_flow
from qiskit.quantum_info.synthesis import one_qubit_decompose
from qiskit.synthesis.one_qubit import one_qubit_decompose
from qiskit._accelerate import euler_one_qubit_decomposer
from qiskit.circuit.library.standard_gates import (
UGate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from qiskit.circuit.library.standard_gates import IGate, UGate, U3Gate
from qiskit.dagcircuit import DAGOpNode, DAGInNode
from qiskit.quantum_info.operators.predicates import matrix_equal
from qiskit.quantum_info.synthesis import OneQubitEulerDecomposer
from qiskit.synthesis.one_qubit import OneQubitEulerDecomposer
from qiskit.transpiler.passes.optimization import Optimize1qGates
from qiskit.transpiler.basepasses import TransformationPass
from qiskit.transpiler.exceptions import TranspilerError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from qiskit.circuit.reset import Reset
from qiskit.dagcircuit import DAGCircuit, DAGNode, DAGInNode, DAGOpNode
from qiskit.quantum_info.operators.predicates import matrix_equal
from qiskit.quantum_info.synthesis import OneQubitEulerDecomposer
from qiskit.synthesis.one_qubit import OneQubitEulerDecomposer
from qiskit.transpiler.exceptions import TranspilerError
from qiskit.transpiler.instruction_durations import InstructionDurations
from qiskit.transpiler.passes.optimization import Optimize1qGates
Expand Down
2 changes: 1 addition & 1 deletion qiskit/transpiler/passes/synthesis/unitary_synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from qiskit.transpiler.basepasses import TransformationPass
from qiskit.transpiler.exceptions import TranspilerError
from qiskit.dagcircuit.dagcircuit import DAGCircuit
from qiskit.quantum_info.synthesis import one_qubit_decompose
from qiskit.synthesis.one_qubit import one_qubit_decompose
from qiskit.quantum_info.synthesis.xx_decompose import XXDecomposer, XXEmbodiments
from qiskit.quantum_info.synthesis.two_qubit_decompose import (
TwoQubitBasisDecomposer,
Expand Down
2 changes: 1 addition & 1 deletion test/python/synthesis/test_synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
from qiskit.providers.basicaer import UnitarySimulatorPy
from qiskit.quantum_info.operators import Operator
from qiskit.quantum_info.random import random_unitary
from qiskit.quantum_info.synthesis.one_qubit_decompose import OneQubitEulerDecomposer
from qiskit.synthesis.one_qubit.one_qubit_decompose import OneQubitEulerDecomposer
from qiskit.quantum_info.synthesis.two_qubit_decompose import (
TwoQubitWeylDecomposition,
TwoQubitWeylIdEquiv,
Expand Down

0 comments on commit b410e58

Please sign in to comment.