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

Prepare 0.20.0 release #7828

Merged
merged 22 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from 21 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: 3 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ stages:
pool: {vmImage: 'macOS-10.15'}
variables:
python.version: '3.7'
CIBW_ARCHS_MACOS: universal2
CIBW_BEFORE_ALL: rustup target add aarch64-apple-darwin
CIBW_ARCHS_MACOS: arm64 universal2
CIBW_ENVIRONMENT: CARGO_BUILD_TARGET="aarch64-apple-darwin" PYO3_CROSS_LIB_DIR="/Library/Frameworks/Python.framework/Versions/$(python -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')/lib/python$(python -c 'import sys; print(str(sys.version_info[0])+"."+str(sys.version_info[1]))')"
TWINE_USERNAME: qiskit
steps:
- task: UsePythonVersion@0
Expand Down
6 changes: 6 additions & 0 deletions docs/apidocs/qasm3.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. _qiskit-qasm3:

.. automodule:: qiskit.qasm3
:no-members:
:no-inherited-members:
:no-special-members:
1 change: 1 addition & 0 deletions docs/apidocs/terra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Qiskit Terra API Reference
scheduler
synthesis
primitives
qasm3
qasm
qobj
qpy
Expand Down
1 change: 1 addition & 0 deletions qiskit/circuit/library/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
RZZGate
RZXGate
XXPlusYYGate
XXMinusYYGate
ECRGate
SGate
SdgGate
Expand Down
3 changes: 3 additions & 0 deletions qiskit/primitives/base_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
r"""

.. estimator-desc:

=====================
Overview of Estimator
=====================
Expand Down
1 change: 1 addition & 0 deletions qiskit/transpiler/passes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
ALAPScheduleAnalysis
ASAPScheduleAnalysis
PadDynamicalDecoupling
PadDelay
ConstrainedReschedule
AlignMeasures
ValidatePulseGates
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
features:
- |
Added a new constructor method for the :class:`.Operator` class,
:meth:`.Operator.from_circuit` for creating a new :class`.Operator`
:meth:`.Operator.from_circuit` for creating a new :class:`.Operator`
object from a :class:`.QuantumCircuit`. While this was possible normally
using the default constructor, the :meth:`.Operator.from_circuit` method
provides additional options to adjust how the operator is created. Primarily
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
features:
- |
Added a new method :meth:`.DAGCircuit.copy_empty_like`
to the :class:`~.DAGCircuit` class. This method is used to create a new
copy of an existing :class:`.DAGCircuit` object with the
same structure but empty of any instructions. This method is the same as
the private method ``_copy_circuit_metadata()``, but instead is now
part of the public API of the class.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
feature:
- |
The fake backend and fake provider classes which were previously available
in ``qiskit.test.mock`` are now also accessible in a new module:
``qiskit.providers.fake_provider``. This new module supersedes the previous
module ``qiskit.test.mock`` which will be deprecated in Qiskit 0.21.0.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
Added a missing entry from the standard session equivalence library
between :class:`.CXGate` and :class:`.CPhaseGate` as well as between
:class:`~.CXGate` and :class:`~.CRZGate`.
24 changes: 24 additions & 0 deletions releasenotes/notes/0.20/add-linear-functions-904c8403ef7ab464.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---

features:
- |
Added a new gate class, :class:`.LinearFunction`, that efficiently encodes
a linear function (i.e. a function that can be represented by a sequence
of :class:`.CXGate` and :class:`.SwapGate` gates).
- |
Added a new transpiler pass :class:`.CollectLinearFunctions` that collects
blocks of consecutive :class:`.CXGate` and :class:`.SwapGate` gates in a
circuit, and replaces each block with a :class:`.LinearFunction` gate.
- |
Added a new transpiler pass :class:`.LinearFunctionsSynthesis`
that synthesizes any :class:`.LinearFunction` gates in using the
`Patel-Markov-Hayes algorithm <https://arxiv.org/abs/quant-ph/0302002>`__.
When combined with the :class:`.CollectLinearFunctions` transpiler pass
this enables to collect blocks of consecutive :class:`.CXGate` and
:class:`.SwapGate` gates in a circuit, and re-synthesize them using the
`Patel-Markov-Hayes algorithm <https://arxiv.org/abs/quant-ph/0302002>`__.
- |
Added a new transpiler pass :class:`.LinearFunctionsToPermutations` that
replaces a :class:`.LinearFunction` gate by a :class:`.Permutation` circuit
whenever possible.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

features:
- |
:class:`~.FlowController` classes (such as :class:`~.ConditionalController`)
can now be nested inside a :class:`~.PassManager` instance when using the
:meth:`.PassManager.append` method. This enables the use of nested logic to
control the execution of passes in the :class:`~.PassManager`. For example::

from qiskit.transpiler import ConditionalController, PassManager
from qiskit.transpiler.passes import (
BasisTranslator, GatesInBasis, Optimize1qGatesDecomposition, FixedPoint, Depth
)
from qiskit.circuit.equivalence_library import SessionEquivalenceLibrary as sel

pm = PassManager()

def opt_control(property_set):
return not property_set["depth_fixed_point"]

def unroll_condition(property_set):
return not property_set["all_gates_in_basis"]

depth_check = [Depth(), FixedPoint("depth")]
opt = [Optimize1qGatesDecomposition(['rx', 'ry', 'rz', 'rxx'])]
unroll = [BasisTranslator(sel, ['rx', 'ry', 'rz', 'rxx'])]
unroll_check = [GatesInBasis(['rx', 'ry', 'rz', 'rxx'])]
flow_unroll = [ConditionalController(unroll, condition=unroll_condition)]

pm.append(depth_check + opt + unroll_check + flow_unroll, do_while=opt_control)

The ``pm`` :class:`~.PassManager` object will only execute the
:class:`.BasisTranslator` pass (in the ``unroll`` step) in each loop
iteration if the ``unroll_condition`` is met.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
features:
- |
The constructors for the :class:`~qiskit.circuit.library.ZFeatureMap` and
:class:`~qiskit.circuit.library.ZZFeatureMap` classes have a new keyword
argument ``parameter_prefix``. This new argument is used to set the prefix
of parameters of the data encoding circuit. For example:

.. jupyter-execute::

from qiskit.circuit.library import ZFeatureMap

feature_map = ZFeatureMap(feature_dimension=4, parameter_prefix="my_prefix")
feature_map.decompose().draw('mpl')

the generated :class:`~qiskit.circuit.library.ZFeatureMap` circuit has
prefixed all its internal parameters with the prefix ``"my_prefix"``.
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
---
features:
- |
The :class:`.ParameterExpression` class is now allowed in the
template optimization transpiler pass. An illustrative example
of using :class:`.Parameter`\s is the following:

.. code-block::
The :class:`.TemplateOptimization` transpiler pass can now work
with :class:`~.Gate` objects that have :class:`.ParameterExpression`
parameters. An illustrative example of using :class:`.Parameter`\s
with :class:`.TemplateOptimization` is the following::

from qiskit import QuantumCircuit, transpile, schedule
from qiskit.circuit import Parameter
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
features:
- |
The :class:`.DAGOpNode`, :class:`.DAGInNode` and :class:`.DAGOutNode`
classes now define a custom ``__repr__`` method which outputs a
representation. Per the
`Python documentation <https://docs.python.org/3/library/functions.html#repr>`__
the output is a string representation that is roughly equivalent to the
Python string used to create an equivalent object.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
features:
- |
The performance of the :meth:`.SparsePauliOp.simplify` method has
greatly improved by replacing the use of ``numpy.unique`` to compute unique
elements of an array by a new similar function implemented in Rust that
doesn't pre-sort the array.
- |
Added a new method :meth:`~qiskit.quantum_info.SparsePauliOp.equiv` to the
:class:`~.SparsePauliOp` class for testing the equivalence of a
:class:`~.SparsePauliOp` with another :class:`.SparsePauliOp` object.
Unlike the ``==`` operator which compares operartors element-wise,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Unlike the ``==`` operator which compares operartors element-wise,
Unlike the ``==`` operator which compares operators element-wise,

:meth:`~qiskit.quantum_info.SparsePauliOp.equiv` compares whether two
operators are equivalent or not. For example::

op = SparsePauliOp.from_list([("X", 1), ("Y", 1)])
op2 = SparsePauliOp.from_list([("X", 1), ("Y", 1), ("Z", 0)])
op3 = SparsePauliOp.from_list([("Y", 1), ("X", 1)])

print(op == op2) # False
print(op == op3) # False
print(op.equiv(op2)) # True
print(op.equiv(op3)) # True

fixes:
- |
Fixed an issue where running the ``==`` operator between two
:class:`~.SparsePauliOp` objects would raise an error when the two operators
had different numbers of coefficients. For example::

op = SparsePauliOp.from_list([("X", 1), ("Y", 1)])
op2 = SparsePauliOp.from_list([("X", 1), ("Y", 1), ("Z", 0)])
print(op == op2)

This would previously raise a ``ValueError`` instead of returning ``False``.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
fixes:
- |
Fixed support in :func:`~qiskit.compiler.transpile` for passing a
:class:`~.InstructionScheduleMap` to object to the underlying
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:class:`~.InstructionScheduleMap` to object to the underlying
:class:`~.InstructionScheduleMap` object to the underlying

:class:`~qiskit.transpiler.PassManager` based on the
:class:`~qiskit.transpiler.Target` for
:class:`~qiskit.providers.backend.BackendV2` based backends. Previously,
the :func:`~qiskit.compiler.transpile` function would not do this
processing and any transpiler passes which do not support working with
a :class:`~.Target` object yet would not have access to the default
pulse calibrations for the instructions from a
:class:`~qiskit.providers.backend.BackendV2` backend.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
features:
- |
Added new fake backend classes from snapshots of the IBM Quantum systems
based on the :class:`~.BackendV2` interface and provided a
:class:`~qiskit.transpiler.Target` for each backend. :class:`~.BackendV2`
based versions of all the existing backends are added except for three old
backends ``FakeRueschlikon``, ``FakeTenerife`` and ``FakeTokyo`` as they
do not have snapshots files available which are required for creating
a new fake backend class based on :class:`~.BackendV2`.

These new V2 fake backends will enable testing and development of new
features introduced by :class:`~qiskit.providers.backend.BackendV2` and
:class:`~qiskit.transpiler.Target` such as improving the transpiler.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
features:
- |
Added a new gate gate class :class:`~qiskit.circuit.library.XXMinusYYGate`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Added a new gate gate class :class:`~qiskit.circuit.library.XXMinusYYGate`
Added a new gate class :class:`~qiskit.circuit.library.XXMinusYYGate`

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Added a new gate gate class :class:`~qiskit.circuit.library.XXMinusYYGate`
Added a new gate class :class:`~qiskit.circuit.library.XXMinusYYGate`

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I just saw Kevin beat me to this correction 😄

to the circuit library (:mod:`qiskit.circuit.library`) for the XX-YY
interaction. This gate can be used to implement the
`bSwap gate <https://arxiv.org/abs/1208.1287>`__ and its powers. It also
arises in the simulation of superconducting fermionic models.
8 changes: 8 additions & 0 deletions releasenotes/notes/0.20/add-xy-gate-e3ac32084273136a.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---

features:
- |
Added new gate class, :class:`~qiskit.circuit.library.XXPlusYYGate`, to
the circuit library (:mod:`qiskit.circuit.library`). This gate is a
2-qubit parameterized XX+YY interaction, also known as an XY gate, and is
based on the gate described in https://arxiv.org/abs/1912.04424.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
upgrade:
- |
The classes :class:`.Qubit`, :class:`.Clbit` and :class:`.AncillaQubit` now
the ``__slots__`` attribute. This is to reduce their memory usage. As a
have the ``__slots__`` attribute. This is to reduce their memory usage. As a
side effect, they can no longer have arbitrary data attached as attributes
to them. This is very unlikely to have any effect on downstream code other
than performance benefits.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
features:
- |
The ``FakeBogota``, ``FakeManila``, ``FakeRome``, and ``FakeSantiago`` fake
backends which can be found in the ``qiskit.providers.fake_provider`` module can now be
used as backends in Pulse experiments as they now include a
:class:`~qiskit.providers.models.PulseDefaults` created from a snapshot of
the equivalent IBM Quantum machine's properties.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ upgrade:
- |
The default value of ``QISKIT_PARALLEL`` when running with Python 3.9 on
Linux is now set to ``TRUE``. This means when running :func:`.parallel_map`
or functions that call it internally such as :func:`.transpile` and
:func:`.assemble` the function will be executed in multiple processes and
or functions that call it internally, such as :func:`.transpile` and
:func:`.assemble`, the function will be executed in multiple processes and
should have better run time performance. This change was made because the
issues with reliability of parallel dispatch appear to have been resolved
(see `#6188 <https://github.com/Qiskit/qiskit-terra/issues/6188>`__ for
more details). If you still encounter issues because of this you can disable
multiprocessing and revert to the previous default behavior by setting the
``QISKIT_PARALLEL`` environment variable to ``FALSE`` or setting the
``QISKIT_PARALLEL`` environment variable to ``FALSE``, or setting the
``parallel`` option to ``False`` in your user config file (also please file
an issue so we can track any issues related to multiprocessing).
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
upgrade:
- |
The previously deprecated ``MSGate`` gate class previously found in
:mod:`qiskit.circuit.library` has been removed. It was originally deprecated in the
0.16.0 release. Instead the :class:`~qiskit.circuit.library.GMS` class should be used, as
this allows you to create an equivalent 2 qubit MS gate in addition to
an MSGate for any number of qubits.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
an MSGate for any number of qubits.
an ``MSGate`` for any number of qubits.

- |
The previously deprecated ``mirror()`` method of the :class:`~qiskit.circuit.Instruction`
class has been removed. It was originally deprecated in 0.15.0 release. Instead you should
use :meth:`.Instruction.reverse_ops`.
- |
The previously deprecated ``num_ancilla_qubits()`` method of the
:class:`qiskit.circuit.library.PiecewiseLinearPauliRotations` and
:class:`qiskit.circuit.library.WeightedAdder` classes has been removed. It was originally
deprecated in the 0.16.0 release. Instead the
:meth:`.PiecewiseLinearPauliRotations.num_ancillas` and :meth:`.WeightedAdder.num_ancillas`
methods should be used.
- |
The previously deprecated ``reverse`` argument on the constructor for the
:class:`~qiskit.circuit.library.PolynomialPauliRotations` class has been removed. It
was originally deprecated in the 0.15.0 release. Instead you should use the
:meth:`.QuantumCircuit.reverse_bits` method to reverse the
:class:`~qiskit.circuit.library.PolynomialPauliRotations` circuit if needed.
- |
The previously deprecated ``angle`` argument on the constructors for the
:class:`~qiskit.circuit.library.C3SXGate` and :class:`~qiskit.circuit.library.C3XGate`
gate classes has been removed. It was originally deprecated in the 0.17.0 release. Instead
for fractional 3-controlled X gates you can use the :meth:`.C3XGate.power` method.
- |
Support for using ``np.ndarray`` objects as part of the :attr:`~qiskit.circuit.Gate.params` attribute
of a :class:`~qiskit.circuit.Gate` object has been removed. This has been deprecated
since Qiskit Terra 0.16.0 and now will no longer work. Instead one should create a new subclass
of :class:`~qiskit.circuit.Gate` and explicitly allow a ``np.ndarray`` input by overloading the
:meth:`~.Gate.validate_parameter` method.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---

features:
- |
The :class:`~qiskit.transpiler.passes.ConsolidateBlocks` pass has a new
keyword argument on its constructor, ``target``. This argument is used to
specify a :class:`~qiskit.transpiler.Target` object representing the
compilation target for the pass. If it is specified it supersedes the
``basis_gates`` kwarg. If a target is specified, the pass will respect the
gates and qubits for the instructions defined in the
:class:`~qiskit.transpiler.Target` when deciding which gates to consolidate
into a unitary.
- |
The :class:`~qiskit.transpiler.Target` class has a new method,
:meth:`~qiskit.transpiler.Target.instruction_supported` which is used
to query the target to see if an instruction (the combination of an
operation and the qubit(s) it is executed on) is supported on the backend
modelled by the :class:`~qiskit.transpiler.Target`.
Loading