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

Deprecate qiskit/transpiler/synthesis and move to qiskit/synthesis (backport #11426) #11623

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions docs/apidoc/synthesis_aqc.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. _qiskit-transpiler-synthesis-aqc:
.. _qiskit-synthesis-unitary-aqc:

.. automodule:: qiskit.transpiler.synthesis.aqc
.. automodule:: qiskit.synthesis.unitary.aqc
:no-members:
:no-inherited-members:
:no-special-members:
129 changes: 129 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,135 @@
requires = ["setuptools", "wheel", "setuptools-rust"]
build-backend = "setuptools.build_meta"

<<<<<<< HEAD
=======
[project]
name = "qiskit"
description = "An open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives."
requires-python = ">=3.8"
license = { file = "LICENSE.txt" }
authors = [
{ name = "Qiskit Development Team", email = "[email protected]" },
]
keywords = [
"qiskit",
"quantum circuit",
"quantum computing",
"quantum programming language",
"quantum",
"sdk",
]
classifiers = [
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering",
]
# These are configured in the `tool.setuptools.dynamic` table.
dynamic = ["version", "readme", "dependencies"]

# If modifying this table, be sure to sync with `requirements-optional.txt` and
# `qiskit.utils.optionals`.
[project.optional-dependencies]
qasm3-import = [
"qiskit-qasm3-import >= 0.1.0",
]
visualization = [
"matplotlib >= 3.3",
"pydot",
"Pillow >= 4.2.1",
"pylatexenc >= 1.4",
"seaborn >= 0.9.0",
]
crosstalk-pass = [
"z3-solver >= 4.7",
]
csp-layout-pass = [
"python-constraint >= 1.4",
]
# This will make the resolution work for installers from PyPI, but `pip install .[all]` will be
# unreliable because `qiskit` will resolve to the PyPI version, so local changes in the
# optionals won't be reflected.
all = ["qiskit[qasm3-import,visualization,crosstalk-pass,csp-layout-pass]"]

[project.urls]
Homepage = "https://qiskit.org"
Documentation = "https://qiskit.org/documentation"
Repository = "https://github.com/Qiskit/qiskit"
Issues = "https://github.com/Qiskit/qiskit/issues"
Changelog = "https://qiskit.org/documentation/release_notes.html"

[project.entry-points."qiskit.unitary_synthesis"]
default = "qiskit.transpiler.passes.synthesis.unitary_synthesis:DefaultUnitarySynthesis"
aqc = "qiskit.transpiler.passes.synthesis.aqc_plugin:AQCSynthesisPlugin"
sk = "qiskit.transpiler.passes.synthesis.solovay_kitaev_synthesis:SolovayKitaevSynthesis"

[project.entry-points."qiskit.synthesis"]
"clifford.default" = "qiskit.transpiler.passes.synthesis.high_level_synthesis:DefaultSynthesisClifford"
"clifford.ag" = "qiskit.transpiler.passes.synthesis.high_level_synthesis:AGSynthesisClifford"
"clifford.bm" = "qiskit.transpiler.passes.synthesis.high_level_synthesis:BMSynthesisClifford"
"clifford.greedy" = "qiskit.transpiler.passes.synthesis.high_level_synthesis:GreedySynthesisClifford"
"clifford.layers" = "qiskit.transpiler.passes.synthesis.high_level_synthesis:LayerSynthesisClifford"
"clifford.lnn" = "qiskit.transpiler.passes.synthesis.high_level_synthesis:LayerLnnSynthesisClifford"
"linear_function.default" = "qiskit.transpiler.passes.synthesis.high_level_synthesis:DefaultSynthesisLinearFunction"
"linear_function.kms" = "qiskit.transpiler.passes.synthesis.high_level_synthesis:KMSSynthesisLinearFunction"
"linear_function.pmh" = "qiskit.transpiler.passes.synthesis.high_level_synthesis:PMHSynthesisLinearFunction"
"permutation.default" = "qiskit.transpiler.passes.synthesis.high_level_synthesis:BasicSynthesisPermutation"
"permutation.kms" = "qiskit.transpiler.passes.synthesis.high_level_synthesis:KMSSynthesisPermutation"
"permutation.basic" = "qiskit.transpiler.passes.synthesis.high_level_synthesis:BasicSynthesisPermutation"
"permutation.acg" = "qiskit.transpiler.passes.synthesis.high_level_synthesis:ACGSynthesisPermutation"

[project.entry-points."qiskit.transpiler.init"]
default = "qiskit.transpiler.preset_passmanagers.builtin_plugins:DefaultInitPassManager"

[project.entry-points."qiskit.transpiler.translation"]
synthesis = "qiskit.transpiler.preset_passmanagers.builtin_plugins:UnitarySynthesisPassManager"
translator = "qiskit.transpiler.preset_passmanagers.builtin_plugins:BasisTranslatorPassManager"
unroller = "qiskit.transpiler.preset_passmanagers.builtin_plugins:UnrollerPassManager"

[project.entry-points."qiskit.transpiler.routing"]
basic = "qiskit.transpiler.preset_passmanagers.builtin_plugins:BasicSwapPassManager"
lookahead = "qiskit.transpiler.preset_passmanagers.builtin_plugins:LookaheadSwapPassManager"
none = "qiskit.transpiler.preset_passmanagers.builtin_plugins:NoneRoutingPassManager"
sabre = "qiskit.transpiler.preset_passmanagers.builtin_plugins:SabreSwapPassManager"
stochastic = "qiskit.transpiler.preset_passmanagers.builtin_plugins:StochasticSwapPassManager"

[project.entry-points."qiskit.transpiler.optimization"]
default = "qiskit.transpiler.preset_passmanagers.builtin_plugins:OptimizationPassManager"

[project.entry-points."qiskit.transpiler.layout"]
default = "qiskit.transpiler.preset_passmanagers.builtin_plugins:DefaultLayoutPassManager"
dense = "qiskit.transpiler.preset_passmanagers.builtin_plugins:DenseLayoutPassManager"
sabre = "qiskit.transpiler.preset_passmanagers.builtin_plugins:SabreLayoutPassManager"
trivial = "qiskit.transpiler.preset_passmanagers.builtin_plugins:TrivialLayoutPassManager"

[project.entry-points."qiskit.transpiler.scheduling"]
alap = "qiskit.transpiler.preset_passmanagers.builtin_plugins:AlapSchedulingPassManager"
asap = "qiskit.transpiler.preset_passmanagers.builtin_plugins:AsapSchedulingPassManager"
default = "qiskit.transpiler.preset_passmanagers.builtin_plugins:DefaultSchedulingPassManager"

[tool.setuptools]
include-package-data = true

[tool.setuptools.dynamic]
version = { file = "qiskit/VERSION.txt" }
readme = { file = "README.md", content-type = "text/markdown" }
dependencies = {file = "requirements.txt" }

[tool.setuptools.packages.find]
include = ["qiskit", "qiskit.*"]

>>>>>>> 937ca5b31 (Deprecate qiskit/transpiler/synthesis and move to qiskit/synthesis (#11426))
[tool.black]
line-length = 100
target-version = ['py38', 'py39', 'py310', 'py311']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LinearFunction(Gate):
as a n x n matrix of 0s and 1s in numpy array format.
A linear function can be synthesized into CX and SWAP gates using the Patel–Markov–Hayes
algorithm, as implemented in :func:`~qiskit.transpiler.synthesis.cnot_synth`
algorithm, as implemented in :func:`~qiskit.synthesis.synth_cnot_count_full_pmh`
based on reference [1].
For efficiency, the internal n x n matrix is stored in the format expected
Expand Down
2 changes: 2 additions & 0 deletions qiskit/circuit/library/standard_gates/u3.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ class CU3Gate(ControlledGate):

.. math::

\newcommand{\rotationangle}{\frac{\theta}{2}}

CU3(\theta, \phi, \lambda)\ q_1, q_0 =
|0\rangle\langle 0| \otimes I +
|1\rangle\langle 1| \otimes U3(\theta,\phi,\lambda) =
Expand Down
24 changes: 21 additions & 3 deletions qiskit/pulse/library/symbolic_pulses.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,10 @@ class Gaussian(metaclass=_PulseType):

.. math::

\begin{aligned}
f'(x) &= \exp\Bigl( -\frac12 \frac{{(x - \text{duration}/2)}^2}{\text{sigma}^2} \Bigr)\\
f(x) &= \text{A} \times \frac{f'(x) - f'(-1)}{1-f'(-1)}, \quad 0 \le x < \text{duration}
\end{aligned}

where :math:`f'(x)` is the gaussian waveform without lifting or amplitude scaling, and
:math:`\text{A} = \text{amp} \times \exp\left(i\times\text{angle}\right)`.
Expand Down Expand Up @@ -802,8 +804,10 @@ class GaussianSquare(metaclass=_PulseType):

.. math::

\\text{risefall} &= \\text{risefall_sigma_ratio} \\times \\text{sigma}\\\\
\\begin{aligned}
\\text{risefall} &= \\text{risefall\\_sigma\\_ratio} \\times \\text{sigma}\\\\
\\text{width} &= \\text{duration} - 2 \\times \\text{risefall}
\\end{aligned}

If ``width`` is not None and ``risefall_sigma_ratio`` is None:

Expand All @@ -813,6 +817,7 @@ class GaussianSquare(metaclass=_PulseType):

.. math::

\\begin{aligned}
f'(x) &= \\begin{cases}\
\\exp\\biggl(-\\frac12 \\frac{(x - \\text{risefall})^2}{\\text{sigma}^2}\\biggr)\
& x < \\text{risefall}\\\\
Expand All @@ -826,6 +831,7 @@ class GaussianSquare(metaclass=_PulseType):
\\end{cases}\\\\
f(x) &= \\text{A} \\times \\frac{f'(x) - f'(-1)}{1-f'(-1)},\
\\quad 0 \\le x < \\text{duration}
\\end{aligned}

where :math:`f'(x)` is the gaussian square waveform without lifting or amplitude scaling, and
:math:`\\text{A} = \\text{amp} \\times \\exp\\left(i\\times\\text{angle}\\right)`.
Expand Down Expand Up @@ -948,8 +954,10 @@ def GaussianSquareDrag(

.. math::

\\text{risefall} &= \\text{risefall_sigma_ratio} \\times \\text{sigma}\\\\
\\begin{aligned}
\\text{risefall} &= \\text{risefall\\_sigma\\_ratio} \\times \\text{sigma}\\\\
\\text{width} &= \\text{duration} - 2 \\times \\text{risefall}
\\end{aligned}

If ``width`` is not None and ``risefall_sigma_ratio`` is None:

Expand All @@ -960,8 +968,10 @@ def GaussianSquareDrag(

.. math::

\\begin{aligned}
g(x, c, σ) &= \\exp\\Bigl(-\\frac12 \\frac{(x - c)^2}{σ^2}\\Bigr)\\\\
g'(x, c, σ) &= \\frac{g(x, c, σ)-g(-1, c, σ)}{1-g(-1, c, σ)}
\\end{aligned}

From these, the lifted DRAG curve :math:`d'(x, c, σ, β)` can be written as

Expand All @@ -974,6 +984,7 @@ def GaussianSquareDrag(

.. math::

\\begin{aligned}
f'(x) &= \\begin{cases}\
\\text{A} \\times d'(x, \\text{risefall}, \\text{sigma}, \\text{beta})\
& x < \\text{risefall}\\\\
Expand All @@ -987,6 +998,7 @@ def GaussianSquareDrag(
)\
& \\text{risefall} + \\text{width} \\le x\
\\end{cases}\\\\
\\end{aligned}

where :math:`\\text{A} = \\text{amp} \\times
\\exp\\left(i\\times\\text{angle}\\right)`.
Expand Down Expand Up @@ -1093,12 +1105,14 @@ def gaussian_square_echo(

.. math::

\\begin{aligned}
g_e(x) &= \\begin{cases}\
f_{\\text{active}} + f_{\\text{echo}}(x)\
& x < \\frac{\\text{duration}}{2}\\\\
f_{\\text{active}} - f_{\\text{echo}}(x)\
& \\frac{\\text{duration}}{2} < x\
\\end{cases}\\\\
\\end{aligned}

One case where this pulse can be used is when implementing a direct CNOT gate with
a cross-resonance superconducting qubit architecture. When applying this pulse to
Expand All @@ -1111,8 +1125,10 @@ def gaussian_square_echo(

.. math::

\\text{risefall} &= \\text{risefall_sigma_ratio} \\times \\text{sigma}\\\\
\\begin{aligned}
\\text{risefall} &= \\text{risefall\\_sigma\\_ratio} \\times \\text{sigma}\\\\
\\text{width} &= \\text{duration} - 2 \\times \\text{risefall}
\\end{aligned}

If ``width`` is not None and ``risefall_sigma_ratio`` is None:

Expand Down Expand Up @@ -1347,11 +1363,13 @@ class Drag(metaclass=_PulseType):

.. math::

\\begin{aligned}
g(x) &= \\exp\\Bigl(-\\frac12 \\frac{(x - \\text{duration}/2)^2}{\\text{sigma}^2}\\Bigr)\\\\
g'(x) &= \\text{A}\\times\\frac{g(x)-g(-1)}{1-g(-1)}\\\\
f(x) &= g'(x) \\times \\Bigl(1 + 1j \\times \\text{beta} \\times\
\\Bigl(-\\frac{x - \\text{duration}/2}{\\text{sigma}^2}\\Bigr) \\Bigr),
\\quad 0 \\le x < \\text{duration}
\\end{aligned}

where :math:`g(x)` is a standard unlifted Gaussian waveform, :math:`g'(x)` is the lifted
:class:`~qiskit.pulse.library.Gaussian` waveform, and
Expand Down
8 changes: 5 additions & 3 deletions qiskit/quantum_info/operators/measures.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def process_fidelity(
require_tp (bool): check if input and target channels are
trace-preserving and if non-TP log warning
containing negative eigenvalues of partial
Choi-matrix :math:`Tr_{\mbox{out}}[\mathcal{E}] - I`
Choi-matrix :math:`Tr_{\text{out}}[\mathcal{E}] - I`
[Default: True].

Returns:
Expand Down Expand Up @@ -154,10 +154,12 @@ def average_gate_fidelity(
The average gate fidelity :math:`F_{\text{ave}}` is given by

.. math::
\begin{aligned}
F_{\text{ave}}(\mathcal{E}, U)
&= \int d\psi \langle\psi|U^\dagger
\mathcal{E}(|\psi\rangle\!\langle\psi|)U|\psi\rangle \\
&= \frac{d F_{\text{pro}}(\mathcal{E}, U) + 1}{d + 1}
\end{aligned}

where :math:`F_{\text{pro}}(\mathcal{E}, U)` is the
:meth:`~qiskit.quantum_info.process_fidelity` of the input quantum
Expand All @@ -175,7 +177,7 @@ def average_gate_fidelity(
require_tp (bool): check if input and target channels are
trace-preserving and if non-TP log warning
containing negative eigenvalues of partial
Choi-matrix :math:`Tr_{\mbox{out}}[\mathcal{E}] - I`
Choi-matrix :math:`Tr_{\text{out}}[\mathcal{E}] - I`
[Default: True].

Returns:
Expand Down Expand Up @@ -232,7 +234,7 @@ def gate_error(
require_tp (bool): check if input and target channels are
trace-preserving and if non-TP log warning
containing negative eigenvalues of partial
Choi-matrix :math:`Tr_{\mbox{out}}[\mathcal{E}] - I`
Choi-matrix :math:`Tr_{\text{out}}[\mathcal{E}] - I`
[Default: True].

Returns:
Expand Down
2 changes: 2 additions & 0 deletions qiskit/quantum_info/operators/symplectic/pauli.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ class initialization (``Pauli('-iXYZ')``). A ``Pauli`` object can be

.. math::

\begin{aligned}
P &= P_{n-1} \otimes ... \otimes P_{0} \\
P_k &= (-i)^{z[k] * x[k]} Z^{z[k]}\cdot X^{x[k]}
\end{aligned}

where ``z[k] = P.z[k]``, ``x[k] = P.x[k]`` respectively.

Expand Down
21 changes: 20 additions & 1 deletion qiskit/synthesis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017 - 2023.
# (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
Expand Down Expand Up @@ -43,6 +43,7 @@

.. autofunction:: synth_cz_depth_line_mr
.. autofunction:: synth_cx_cz_depth_line_my
.. autofunction:: synth_cnot_phase_aam

Permutation Synthesis
=====================
Expand Down Expand Up @@ -84,6 +85,19 @@

.. autofunction:: generate_basic_approximations

<<<<<<< HEAD
=======
Basis Change Synthesis
======================

.. autofunction:: synth_qft_line

Unitary Synthesis
=================

The Approximate Quantum Compiler is available here: :mod:`qiskit.synthesis.unitary.aqc`

>>>>>>> 937ca5b31 (Deprecate qiskit/transpiler/synthesis and move to qiskit/synthesis (#11426))
"""

from .evolution import (
Expand Down Expand Up @@ -120,3 +134,8 @@
)
from .stabilizer import synth_stabilizer_layers, synth_stabilizer_depth_lnn
from .discrete_basis import SolovayKitaevDecomposition, generate_basic_approximations
<<<<<<< HEAD
=======
from .qft import synth_qft_line
from .unitary import aqc
>>>>>>> 937ca5b31 (Deprecate qiskit/transpiler/synthesis and move to qiskit/synthesis (#11426))
13 changes: 13 additions & 0 deletions qiskit/synthesis/unitary/__init__.py
Original file line number Diff line number Diff line change
@@ -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."""
Loading
Loading