From 93e368ceca26f00bde1b1a1e2f9c3cf03831b7dd Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 8 May 2024 15:44:31 +0200 Subject: [PATCH 01/37] draft 1.1.0 --- docs/conf.py | 2 +- docs/release_notes.rst | 2 +- qiskit/VERSION.txt | 2 +- ...ract-commutation-analysis-3518129e91a33599.yaml | 14 +++++++------- ...dd-annotated-arg-to-power-4afe90e89fa50f5a.yaml | 7 ++++--- .../add-backend-estimator-v2-26cf14a3612bb81a.yaml | 2 +- .../add-backend-sampler-v2-5e40135781eebc7f.yaml | 2 +- ...-ctrl_state-mcp-parameter-b23562aa7047665a.yaml | 4 ++-- ...-permutations-to-pipeline-077dad03bd55ab9c.yaml | 2 +- .../1.1/add-elide-swaps-b0a4c373c9af1efd.yaml | 2 +- ...add-linear-plugin-options-b8a0ffe70dfe1676.yaml | 2 +- ...dd-run-all-plugins-option-ba8806a269e5713c.yaml | 4 ++-- .../notes/prepare-1.1.0-732e167b70ab4d01.yaml | 14 ++++++++++++++ 13 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 releasenotes/notes/prepare-1.1.0-732e167b70ab4d01.yaml diff --git a/docs/conf.py b/docs/conf.py index 7081b7d4ed9..f2b16b77f22 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -32,7 +32,7 @@ # The short X.Y version version = "1.1" # The full version, including alpha/beta/rc tags -release = "1.1.0rc1" +release = "1.1.0" language = "en" diff --git a/docs/release_notes.rst b/docs/release_notes.rst index fddd907195f..37e1127c5d8 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -10,4 +10,4 @@ Qiskit |version| release notes `:earliest-version:` should be set to the rc1 release for the current minor release series. For example, the stable/1.1 branch should set it to 1.1.0rc1. If on `main`, set to the prior minor version's rc1, like `1.0.0rc1`. .. release-notes:: - :earliest-version: 1.0.0rc1 + :earliest-version: 1.1.0rc1 diff --git a/qiskit/VERSION.txt b/qiskit/VERSION.txt index 686366e4bb8..9084fa2f716 100644 --- a/qiskit/VERSION.txt +++ b/qiskit/VERSION.txt @@ -1 +1 @@ -1.1.0rc1 +1.1.0 diff --git a/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml b/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml index eee58d4305a..15f4137b1cf 100644 --- a/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml +++ b/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml @@ -1,12 +1,12 @@ --- -features: +upgrade_transpiler: - | - Extended the commutation analysis performed by :class:`.CommutationChecker` to only operate on - hardware circuits to also work with abstract circuits, i.e. each operation in - the input quantum circuit is now checked for its matrix representation before proceeding to the - analysis. In addition, the operation is now checked for its ability to be cached in the session - commutation library. For example, this now enables computing whether :class:`.AnnotatedOperation` - commute. This enables transpiler passes that rely on :class:`.CommutationChecker` internally, + Extended the commutation analysis performed by :class:`.CommutationChecker` to also work with + abstract circuits, i.e. each operation in the input quantum circuit is now checked for its matrix + representation before proceeding to the analysis step. Previously, the commutation analysis was only + performed on physical circuits. In addition, each operation is now checked for its ability to be + cached in the session commutation library. For example, this now enables computing + whether :class:`.AnnotatedOperation` commute. This enables transpiler passes that rely on :class:`.CommutationChecker` internally, such as :class:`.CommutativeCancellation`, during earlier stages of a default transpilation pipeline (prior to basis translation). diff --git a/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml b/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml index 95537833b6d..2910e6508cc 100644 --- a/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml +++ b/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml @@ -1,5 +1,5 @@ --- -features: +upgrade_circuit: - | The methods :meth:`~qiskit.circuit.QuantumCircuit.power`, :meth:`~qiskit.circuit.Gate.power`, as well as the similar methods @@ -8,10 +8,11 @@ features: argument ``annotated``. The default value of ``False`` corresponds to the existing behavior. Furthermore, for standard gates with an explicitly defined ``power`` method, - the argument ``annotated`` has no effect, for example both + the argument ``annotated`` has no effect. + For example, both ``SGate().power(1.5, annotated=False)`` and ``SGate().power(1.5, annotated=True)`` return a ``PhaseGate``. - The difference manifests for gates without an explicitly defined + A difference in the value of ``annotated`` manifests for gates without an explicitly defined power method. The value of ``False`` returns a :class:`~.library.UnitaryGate`, just as before, while the value of ``True`` returns an :class:`~.AnnotatedOperation` that represents the instruction diff --git a/releasenotes/notes/1.1/add-backend-estimator-v2-26cf14a3612bb81a.yaml b/releasenotes/notes/1.1/add-backend-estimator-v2-26cf14a3612bb81a.yaml index c8ac782f4ba..e032e3ddd16 100644 --- a/releasenotes/notes/1.1/add-backend-estimator-v2-26cf14a3612bb81a.yaml +++ b/releasenotes/notes/1.1/add-backend-estimator-v2-26cf14a3612bb81a.yaml @@ -1,5 +1,5 @@ --- -features: +features_primitives: - | The implementation :class:`~.BackendEstimatorV2` of :class:`~.BaseEstimatorV2` was added. This estimator supports :class:`~.BackendV1` and :class:`~.BackendV2`. diff --git a/releasenotes/notes/1.1/add-backend-sampler-v2-5e40135781eebc7f.yaml b/releasenotes/notes/1.1/add-backend-sampler-v2-5e40135781eebc7f.yaml index 9cd9002a77b..bb5147c2dce 100644 --- a/releasenotes/notes/1.1/add-backend-sampler-v2-5e40135781eebc7f.yaml +++ b/releasenotes/notes/1.1/add-backend-sampler-v2-5e40135781eebc7f.yaml @@ -1,5 +1,5 @@ --- -features: +features_primitives: - | The implementation :class:`~.BackendSamplerV2` of :class:`~.BaseSamplerV2` was added. This sampler supports :class:`~.BackendV1` and :class:`~.BackendV2` that allow diff --git a/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml b/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml index 10a5e106518..e1a687b1de7 100644 --- a/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml +++ b/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml @@ -1,5 +1,5 @@ --- -features: +features_circuit: - | Added ``ctrl_state`` parameter to :func:`QuantumCircuit.mcp()` and :class:`MCPhaseGate()`. @@ -15,6 +15,6 @@ features: .. code-block:: python from qiskit import QuantumCircuit - + qc = QuantumCircuit(4) qc.mcp(0.2,[0,1,2],3,ctrl_state=2) diff --git a/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml b/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml index ddc35ddcb98..6f9e8dbb4f0 100644 --- a/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml +++ b/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml @@ -1,5 +1,5 @@ --- -features: +features_transpiler: - | The transpiler pass :class:`~.ElidePermutations` runs by default with optimization level 2 and 3. Intuitively, removing diff --git a/releasenotes/notes/1.1/add-elide-swaps-b0a4c373c9af1efd.yaml b/releasenotes/notes/1.1/add-elide-swaps-b0a4c373c9af1efd.yaml index a8da2921990..ec3d599abc5 100644 --- a/releasenotes/notes/1.1/add-elide-swaps-b0a4c373c9af1efd.yaml +++ b/releasenotes/notes/1.1/add-elide-swaps-b0a4c373c9af1efd.yaml @@ -1,5 +1,5 @@ --- -features: +features_transpiler: - | Added a new optimization transpiler pass, :class:`~.ElidePermutations`, which is designed to run prior to the :ref:`layout_stage` and will diff --git a/releasenotes/notes/1.1/add-linear-plugin-options-b8a0ffe70dfe1676.yaml b/releasenotes/notes/1.1/add-linear-plugin-options-b8a0ffe70dfe1676.yaml index efd0453ca46..22930d6a0aa 100644 --- a/releasenotes/notes/1.1/add-linear-plugin-options-b8a0ffe70dfe1676.yaml +++ b/releasenotes/notes/1.1/add-linear-plugin-options-b8a0ffe70dfe1676.yaml @@ -1,5 +1,5 @@ --- -features: +upgrade_synthesis: - | The :class:`.KMSSynthesisLinearFunction` plugin for synthesizing :class:`~qiskit.circuit.library.LinearFunction` objects now accepts diff --git a/releasenotes/notes/1.1/add-run-all-plugins-option-ba8806a269e5713c.yaml b/releasenotes/notes/1.1/add-run-all-plugins-option-ba8806a269e5713c.yaml index 2ab34c61fb3..d634436f06c 100644 --- a/releasenotes/notes/1.1/add-run-all-plugins-option-ba8806a269e5713c.yaml +++ b/releasenotes/notes/1.1/add-run-all-plugins-option-ba8806a269e5713c.yaml @@ -1,5 +1,5 @@ --- -features: +features_transpiler: - | The :class:`~.HLSConfig` now has two additional optional arguments. The argument ``plugin_selection`` can be set either to ``"sequential"`` or to ``"all"``. @@ -15,7 +15,7 @@ features: that it contains). The following example illustrates the new functionality:: - + .. code-block:: python from qiskit import QuantumCircuit from qiskit.circuit.library import LinearFunction from qiskit.synthesis.linear import random_invertible_binary_matrix diff --git a/releasenotes/notes/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/prepare-1.1.0-732e167b70ab4d01.yaml new file mode 100644 index 00000000000..5e0a00c3ce2 --- /dev/null +++ b/releasenotes/notes/prepare-1.1.0-732e167b70ab4d01.yaml @@ -0,0 +1,14 @@ +--- +prelude: > + The Qiskit 1.1.0 release is a minor feature release that includes a myriad of new feature and bugfixes. + The highlights for this release are: + + * V2 primitives + + * Synthesis-Decomposition in rust + + * New transpiler passes: ElidePermutations, StarPreRouting, OptimizeAnnotated, RemoveFinalReset + + * Improvements to (the organization of) default passmanagers, i.e. new passes, fine-tuning of params + + * Improvements to QuantumVolume From a40f79b9c75fe77220d32a695b95fa0ca5a62c5f Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Mon, 13 May 2024 17:53:29 +0200 Subject: [PATCH 02/37] fixes text/typos --- qiskit/primitives/containers/shape.py | 3 + ...notated-arg-to-power-4afe90e89fa50f5a.yaml | 2 +- ..._state-mcp-parameter-b23562aa7047665a.yaml | 4 +- ...utations-to-pipeline-077dad03bd55ab9c.yaml | 2 +- .../1.1/add-elide-swaps-b0a4c373c9af1efd.yaml | 2 +- ...n-all-plugins-option-ba8806a269e5713c.yaml | 56 ++++++++++--------- ...meter-ctrl_state-mcx-816dcd80e459a5ed.yaml | 4 +- ...n-preset-passmanager-c137ce516a10eae5.yaml | 4 +- ...databin-construction-72ec041075410cb2.yaml | 22 ++++---- ...deprecate_providerV1-ba17d7b4639d1cc5.yaml | 2 +- .../faster-lie-trotter-ba8f6dd84fe4cae4.yaml | 4 +- ...-parameter-formatter-2ee3fb91efb2794c.yaml | 2 +- .../1.1/fixes_10852-e197344c5f44b4f1.yaml | 4 +- .../1.1/fixes_11212-d6de3c007ce6d697.yaml | 2 +- .../1.1/layout-compose-0b9a9a72359638d8.yaml | 2 +- .../notes/1.1/numpy-2.0-2f3e35bd42c48518.yaml | 4 +- .../obs-array-coerce-0d-28b192fb3d004d4a.yaml | 6 +- ...-conjugate-reduction-656438d3642f27dc.yaml | 2 +- ..._for_pulse_schedules-3a27bbbbf235fb9e.yaml | 4 +- .../pauli-apply-layout-cdcbc1bce724a150.yaml | 56 ++++++++++--------- .../1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 22 ++++++++ .../remove-final-reset-488247c01c4e147d.yaml | 2 +- ...nst-durations-passes-28c78401682e22c0.yaml | 12 ++-- .../1.1/spo-to-matrix-26445a791e24f62a.yaml | 2 +- .../1.1/star-prerouting-0998b59880c20cef.yaml | 4 +- .../notes/prepare-1.1.0-732e167b70ab4d01.yaml | 14 ----- 26 files changed, 130 insertions(+), 113 deletions(-) create mode 100644 releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml delete mode 100644 releasenotes/notes/prepare-1.1.0-732e167b70ab4d01.yaml diff --git a/qiskit/primitives/containers/shape.py b/qiskit/primitives/containers/shape.py index 6d893f46c13..bb200c64af7 100644 --- a/qiskit/primitives/containers/shape.py +++ b/qiskit/primitives/containers/shape.py @@ -60,14 +60,17 @@ def __repr__(self): @property def shape(self): + """shape (tuple[int]): The leading shape of every entry in the instance.""" return self._shape @property def ndim(self): + """ndim (int): The length of the shape attribute.""" return len(self._shape) @property def size(self): + """size (int): The product of the entries in the shape attribute.""" return int(np.prod(self._shape, dtype=int)) diff --git a/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml b/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml index 2910e6508cc..bd454228c69 100644 --- a/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml +++ b/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml @@ -1,5 +1,5 @@ --- -upgrade_circuit: +upgrade_circuits: - | The methods :meth:`~qiskit.circuit.QuantumCircuit.power`, :meth:`~qiskit.circuit.Gate.power`, as well as the similar methods diff --git a/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml b/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml index e1a687b1de7..97bf76b742d 100644 --- a/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml +++ b/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml @@ -1,5 +1,5 @@ --- -features_circuit: +features_circuits: - | Added ``ctrl_state`` parameter to :func:`QuantumCircuit.mcp()` and :class:`MCPhaseGate()`. @@ -8,7 +8,7 @@ features_circuit: The :func:`QuantumCircuit.mcp()` function and :class:`MCPhaseGate()` have been updated to include a ``ctrl_state`` parameter. This enhancement allows users to specify the control state of the multi-controlled phase gate. The - parameter can accept either a decimal value or a bitstring and defaults to + parameter can accept either an integer value or a bitstring and defaults to controlling the '1' state if not provided. diff --git a/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml b/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml index 6f9e8dbb4f0..a7219dcc316 100644 --- a/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml +++ b/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml @@ -5,5 +5,5 @@ features_transpiler: runs by default with optimization level 2 and 3. Intuitively, removing :class:`~.SwapGate`\s and :class:`~qiskit.circuit.library.PermutationGate`\s in a virtual circuit is almost always beneficial, as it makes the circuit shorter - and easier to route. As :class:`~.OptimizeSwapBeforeMeasure` is a special case + and easier to route. As :class:`~qiskit.transpiler.passes.optimization.optimize_swap_before_measure.OptimizeSwapBeforeMeasure` is a special case of :class:`~.ElidePermutations`, it has been removed from optimization level 3. diff --git a/releasenotes/notes/1.1/add-elide-swaps-b0a4c373c9af1efd.yaml b/releasenotes/notes/1.1/add-elide-swaps-b0a4c373c9af1efd.yaml index ec3d599abc5..fbf1e5f75a6 100644 --- a/releasenotes/notes/1.1/add-elide-swaps-b0a4c373c9af1efd.yaml +++ b/releasenotes/notes/1.1/add-elide-swaps-b0a4c373c9af1efd.yaml @@ -38,4 +38,4 @@ features_transpiler: ElidePermutations()(qc).draw("mpl") The pass also sets the ``virtual_permutation_layout`` property set, storing - the permutation of the virtual qubits that was optimized away. + the permutation of the virtual qubits at the end of the circuit that was optimized away. diff --git a/releasenotes/notes/1.1/add-run-all-plugins-option-ba8806a269e5713c.yaml b/releasenotes/notes/1.1/add-run-all-plugins-option-ba8806a269e5713c.yaml index d634436f06c..7beab3fefbe 100644 --- a/releasenotes/notes/1.1/add-run-all-plugins-option-ba8806a269e5713c.yaml +++ b/releasenotes/notes/1.1/add-run-all-plugins-option-ba8806a269e5713c.yaml @@ -14,37 +14,39 @@ features_transpiler: set to ``None``, the quality of the circuit is its size (i.e. the number of gates that it contains). - The following example illustrates the new functionality:: + The following example illustrates the new functionality: + .. code-block:: python - from qiskit import QuantumCircuit - from qiskit.circuit.library import LinearFunction - from qiskit.synthesis.linear import random_invertible_binary_matrix - from qiskit.transpiler.passes import HighLevelSynthesis, HLSConfig - # Create a circuit with a linear function - mat = random_invertible_binary_matrix(7, seed=37) - qc = QuantumCircuit(7) - qc.append(LinearFunction(mat), [0, 1, 2, 3, 4, 5, 6]) + from qiskit import QuantumCircuit + from qiskit.circuit.library import LinearFunction + from qiskit.synthesis.linear import random_invertible_binary_matrix + from qiskit.transpiler.passes import HighLevelSynthesis, HLSConfig + + # Create a circuit with a linear function + mat = random_invertible_binary_matrix(7, seed=37) + qc = QuantumCircuit(7) + qc.append(LinearFunction(mat), [0, 1, 2, 3, 4, 5, 6]) - # Run different methods with different parameters, - # choosing the best result in terms of depth. - hls_config = HLSConfig( - linear_function=[ - ("pmh", {}), - ("pmh", {"use_inverted": True}), - ("pmh", {"use_transposed": True}), - ("pmh", {"use_inverted": True, "use_transposed": True}), - ("pmh", {"section_size": 1}), - ("pmh", {"section_size": 3}), - ("kms", {}), - ("kms", {"use_inverted": True}), - ], - plugin_selection="all", - plugin_evaluation_fn=lambda circuit: circuit.depth(), - ) + # Run different methods with different parameters, + # choosing the best result in terms of depth. + hls_config = HLSConfig( + linear_function=[ + ("pmh", {}), + ("pmh", {"use_inverted": True}), + ("pmh", {"use_transposed": True}), + ("pmh", {"use_inverted": True, "use_transposed": True}), + ("pmh", {"section_size": 1}), + ("pmh", {"section_size": 3}), + ("kms", {}), + ("kms", {"use_inverted": True}), + ], + plugin_selection="all", + plugin_evaluation_fn=lambda circuit: circuit.depth(), + ) - # synthesize - qct = HighLevelSynthesis(hls_config=hls_config)(qc) + # synthesize + qct = HighLevelSynthesis(hls_config=hls_config)(qc) In the example, we run multiple synthesis methods with different parameters, choosing the best circuit in terms of depth. Note that optimizing diff --git a/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml b/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml index cd5cf651970..14da8ebf6a4 100644 --- a/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml +++ b/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml @@ -1,5 +1,5 @@ --- -features: +features_circuits: - | Added `ctrl_state` parameter to :func:`QuantumCircuit.mcx()`. @@ -13,6 +13,6 @@ features: .. code-block:: python from qiskit import QuantumCircuit - + qc = QuantumCircuit(3, 3) qc.mcx([0, 1], 2, ctrl_state="00") diff --git a/releasenotes/notes/1.1/commutative-cancellation-preset-passmanager-c137ce516a10eae5.yaml b/releasenotes/notes/1.1/commutative-cancellation-preset-passmanager-c137ce516a10eae5.yaml index 2c1698ef3e9..0f8d569eaa6 100644 --- a/releasenotes/notes/1.1/commutative-cancellation-preset-passmanager-c137ce516a10eae5.yaml +++ b/releasenotes/notes/1.1/commutative-cancellation-preset-passmanager-c137ce516a10eae5.yaml @@ -1,7 +1,7 @@ --- -features: +features_transpiler: - | Added the :class:`.CommutativeCancellation` pass to the ``init`` stage of the preset pass managers for optimization levels 2 and 3. This enables the preset pass managers to cancel additional logical operations at the beginning of the compilation pipeline. - + diff --git a/releasenotes/notes/1.1/databin-construction-72ec041075410cb2.yaml b/releasenotes/notes/1.1/databin-construction-72ec041075410cb2.yaml index a9dbd60298f..4b29d1c85cc 100644 --- a/releasenotes/notes/1.1/databin-construction-72ec041075410cb2.yaml +++ b/releasenotes/notes/1.1/databin-construction-72ec041075410cb2.yaml @@ -1,16 +1,18 @@ --- features_primitives: - | - `qiskit.primitives.containers.DataBin` now satisfies the `qiskit.primitives.containers.Shaped` - protocol. This means that every `DataBin` instance now has the additional attributes - * `shape: tuple[int, ...]` the leading shape of every entry in the instance - * `ndim: int` the length of `shape` - * `size: int` the product of the entries of `shape` + :class:`.DataBin` now satisfies the :class:`~.qiskit.primitives.containers.Shaped` + protocol. This means that every :class:`.DataBin` instance now has the additional attributes + + * :attr:`~.DataBin.shape` (`tuple[int, ...]`): the leading shape of every entry in the instance + * :attr:`~.DataBin.ndim` (`int`): the length of :attr:`~.DataBin.shape` + * :attr:`~.DataBin.size` (`int`): the product of the entries of :attr:`~.DataBin.shape` + The shape can be passed to the constructor. upgrade_primitives: - | - The function `qiskit.primitives.containers.make_data_bin()` no longer creates and returns a - `qiskit.primitives.containers.DataBin` subclass. It instead always returns the `DataBin` class. - However, it continues to exist for backwards compatibility, though will eventually be deprecated. - All users should migrate to construct `DataBin` instances directly, instead of instantiating - subclasses as output by `make_data_bin()`. + The function :meth:`~.make_data_bin` no longer creates and returns a + :class:`.DataBin` subclass. It instead always returns the :class:`.DataBin` class. + However, it continues to exist for backwards compatibility, though will eventually be deprecated. + All users should migrate to construct :class:`.DataBin` instances directly, instead of instantiating + subclasses as output by :meth:`~.make_data_bin`. diff --git a/releasenotes/notes/1.1/deprecate_providerV1-ba17d7b4639d1cc5.yaml b/releasenotes/notes/1.1/deprecate_providerV1-ba17d7b4639d1cc5.yaml index bfec8ef8904..479de23fd07 100644 --- a/releasenotes/notes/1.1/deprecate_providerV1-ba17d7b4639d1cc5.yaml +++ b/releasenotes/notes/1.1/deprecate_providerV1-ba17d7b4639d1cc5.yaml @@ -2,7 +2,7 @@ deprecations_providers: - | The abstract base classes ``Provider`` and ``ProviderV1`` are now deprecated and will be removed in Qiskit 2.0.0. - The abstraction provided by these interface definitions were not providing a huge value. solely just the attributes + The abstraction offered by these interface definitions were not providing a substantial value; it solely encapsulated the attributes ``name``, ``backends``, and a ``get_backend()``. A _provider_, as a concept, will continue existing as a collection of backends. If you're implementing a provider currently you can adjust your code by simply removing ``ProviderV1`` as the parent class of your diff --git a/releasenotes/notes/1.1/faster-lie-trotter-ba8f6dd84fe4cae4.yaml b/releasenotes/notes/1.1/faster-lie-trotter-ba8f6dd84fe4cae4.yaml index 2ca02d6f69f..570557a182e 100644 --- a/releasenotes/notes/1.1/faster-lie-trotter-ba8f6dd84fe4cae4.yaml +++ b/releasenotes/notes/1.1/faster-lie-trotter-ba8f6dd84fe4cae4.yaml @@ -1,6 +1,6 @@ --- features_synthesis: - | - :meth:`.LieTrotter.synthesize` now uses :meth:`.QuantumCircuit.repeat` to generate additional reps - after the first. This reduces the number of :meth:`.QuantumCircuit.compose` calls by a factor of + :meth:`.LieTrotter.synthesize` now uses :meth:`.QuantumCircuit.repeat` to generate additional repetitions of a Trotter step + after the first Trotter step. This reduces the number of :meth:`.QuantumCircuit.compose` calls by a factor of ``reps`` and significantly reduces the runtime for larger operators. diff --git a/releasenotes/notes/1.1/fix-pulse-parameter-formatter-2ee3fb91efb2794c.yaml b/releasenotes/notes/1.1/fix-pulse-parameter-formatter-2ee3fb91efb2794c.yaml index e4749646e1d..fcb6b53c106 100644 --- a/releasenotes/notes/1.1/fix-pulse-parameter-formatter-2ee3fb91efb2794c.yaml +++ b/releasenotes/notes/1.1/fix-pulse-parameter-formatter-2ee3fb91efb2794c.yaml @@ -4,4 +4,4 @@ fixes: Fixed a bug in :func:`qiskit.pulse.utils.format_parameter_value` function that unintentionally converts large enough integer numbers into float values or causes unexpected rounding. - See `qiskit/#11971 `__ for details. + See `#11971 `__ for details. diff --git a/releasenotes/notes/1.1/fixes_10852-e197344c5f44b4f1.yaml b/releasenotes/notes/1.1/fixes_10852-e197344c5f44b4f1.yaml index 755403d98a3..91ffde5ce8b 100644 --- a/releasenotes/notes/1.1/fixes_10852-e197344c5f44b4f1.yaml +++ b/releasenotes/notes/1.1/fixes_10852-e197344c5f44b4f1.yaml @@ -1,5 +1,5 @@ --- features_providers: - | - The :class:`.BasicSimulator` python-based simulator included in :mod:`qiskit.providers.basic_provider` - now includes all the standard gates (:mod:`qiskit.circuit.library .standard_gates`) up to 3 qubits. + The :class:`.BasicSimulator` python-based simulator included in :mod:`~.qiskit.providers.basic_provider` + now includes all the standard gates (:mod:`~.qiskit.circuit.library.standard_gates`) up to 3 qubits. diff --git a/releasenotes/notes/1.1/fixes_11212-d6de3c007ce6d697.yaml b/releasenotes/notes/1.1/fixes_11212-d6de3c007ce6d697.yaml index 32314b50692..ce5717762d1 100644 --- a/releasenotes/notes/1.1/fixes_11212-d6de3c007ce6d697.yaml +++ b/releasenotes/notes/1.1/fixes_11212-d6de3c007ce6d697.yaml @@ -2,5 +2,5 @@ deprecations_transpiler: - | The pass ``qiskit.transpiler.passes.CXCancellation`` was deprecated in favor of - class:`.InverseCancellation`, which is more generic. + :class:`.InverseCancellation`, which is more generic. ``CXCancellation`` is fully semantically equivalent to ``InverseCancellation([CXGate()])``. diff --git a/releasenotes/notes/1.1/layout-compose-0b9a9a72359638d8.yaml b/releasenotes/notes/1.1/layout-compose-0b9a9a72359638d8.yaml index 39ee7434509..da1bc35a73a 100644 --- a/releasenotes/notes/1.1/layout-compose-0b9a9a72359638d8.yaml +++ b/releasenotes/notes/1.1/layout-compose-0b9a9a72359638d8.yaml @@ -1,5 +1,5 @@ --- -features: +features_transpiler: - | Added a new method :meth:`.Layout.inverse` which is used for taking the inverse of a :class:`.Layout` object. diff --git a/releasenotes/notes/1.1/numpy-2.0-2f3e35bd42c48518.yaml b/releasenotes/notes/1.1/numpy-2.0-2f3e35bd42c48518.yaml index 3595f2f936b..eeff3c50377 100644 --- a/releasenotes/notes/1.1/numpy-2.0-2f3e35bd42c48518.yaml +++ b/releasenotes/notes/1.1/numpy-2.0-2f3e35bd42c48518.yaml @@ -1,5 +1,5 @@ --- -features: +features_misc: - | This release of Qiskit finalizes support for NumPy 2.0. Qiskit will continue to support both - Numpy 1.x and 2.x for the foreseeable future. + NumPy 1.x and 2.x for the foreseeable future. diff --git a/releasenotes/notes/1.1/obs-array-coerce-0d-28b192fb3d004d4a.yaml b/releasenotes/notes/1.1/obs-array-coerce-0d-28b192fb3d004d4a.yaml index 987709d36e2..bf2cd5efc96 100644 --- a/releasenotes/notes/1.1/obs-array-coerce-0d-28b192fb3d004d4a.yaml +++ b/releasenotes/notes/1.1/obs-array-coerce-0d-28b192fb3d004d4a.yaml @@ -1,6 +1,6 @@ --- fixes: - | - Fixed `qiskit.primitives.containers.observables_array.ObservablesArray.coerce()` - so that it returns a 0-d array when the input is a single, unnested observable. - Previously, it erroneously upgraded to a single dimension, with shape `(1,)`. \ No newline at end of file + Fixed :meth:`~qiskit.primitives.containers.observables_array.ObservablesArray.coerce` + so that it returns a 0-d array when the input is a single, unnested observable. + Previously, it erroneously upgraded to a single dimension, with shape `(1,)`. diff --git a/releasenotes/notes/1.1/optimize-annotated-conjugate-reduction-656438d3642f27dc.yaml b/releasenotes/notes/1.1/optimize-annotated-conjugate-reduction-656438d3642f27dc.yaml index 231f0e7c8f3..6631ba90de6 100644 --- a/releasenotes/notes/1.1/optimize-annotated-conjugate-reduction-656438d3642f27dc.yaml +++ b/releasenotes/notes/1.1/optimize-annotated-conjugate-reduction-656438d3642f27dc.yaml @@ -1,4 +1,4 @@ -features: +features_transpiler: - | Added a new reduction to the :class:`.OptimizeAnnotated` transpiler pass. This reduction looks for annotated operations (objects of type :class:`.AnnotatedOperation` diff --git a/releasenotes/notes/1.1/parameter_assignment_by_name_for_pulse_schedules-3a27bbbbf235fb9e.yaml b/releasenotes/notes/1.1/parameter_assignment_by_name_for_pulse_schedules-3a27bbbbf235fb9e.yaml index 551ea9e918c..4f1f74d23bb 100644 --- a/releasenotes/notes/1.1/parameter_assignment_by_name_for_pulse_schedules-3a27bbbbf235fb9e.yaml +++ b/releasenotes/notes/1.1/parameter_assignment_by_name_for_pulse_schedules-3a27bbbbf235fb9e.yaml @@ -1,8 +1,8 @@ --- features_pulse: - | - It is now possible to assign parameters to pulse :class:`.Schedule`and :class:`.ScheduleBlock` objects by specifying + It is now possible to assign parameters to pulse :class:`.Schedule` and :class:`.ScheduleBlock` objects by specifying the parameter name as a string. The parameter name can be used to assign values to all parameters within the - `Schedule` or `ScheduleBlock` that have the same name. Moreover, the parameter name of a `ParameterVector` + :class:`.Schedule` or :class:`.ScheduleBlock` that have the same name. Moreover, the parameter name of a :class:`.ParameterVector` can be used to assign all values of the vector simultaneously (the list of values should therefore match the length of the vector). diff --git a/releasenotes/notes/1.1/pauli-apply-layout-cdcbc1bce724a150.yaml b/releasenotes/notes/1.1/pauli-apply-layout-cdcbc1bce724a150.yaml index f3f69ce5cb1..4ddfd339571 100644 --- a/releasenotes/notes/1.1/pauli-apply-layout-cdcbc1bce724a150.yaml +++ b/releasenotes/notes/1.1/pauli-apply-layout-cdcbc1bce724a150.yaml @@ -1,31 +1,33 @@ --- features_quantum_info: - | - Added a new :meth:`~.Pauli.apply_layout` method that is equivalent to - :meth:`~.SparsePauliOp.apply_layout`. This method is used to apply - a :class:`~.TranspileLayout` layout from the transpiler to a :class:~.Pauli` + Added a new :meth:`~.Pauli.apply_layout` method in the class :class:`~.Pauli` that is equivalent to the + :meth:`~.SparsePauliOp.apply_layout` method in the class :class:`~.SparsePauliOp`. This method is + used to apply a :class:`~.TranspileLayout` layout from the transpiler to a :class:~.Pauli` observable that was built for an input circuit. This enables working with - :class:`~.BaseEstimator` / :class:`~.BaseEstimatorV2` implementations and - local transpilation when the input is of type :class:`~.Pauli`. For example:: - - from qiskit.circuit.library import RealAmplitudes - from qiskit.primitives import BackendEstimatorV2 - from qiskit.providers.fake_provider import GenericBackendV2 - from qiskit.quantum_info import Pauli - from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager - - psi = RealAmplitudes(num_qubits=2, reps=2) - H1 = Pauli("XI") - backend = GenericBackendV2(num_qubits=7) - estimator = BackendEstimatorV2(backend=backend) - thetas = [0, 1, 1, 2, 3, 5] - pm = generate_preset_pass_manager(optimization_level=3, backend=backend) - transpiled_psi = pm.run(psi) - permuted_op = H1.apply_layout(transpiled_psi.layout) - res = estimator.run([(transpiled_psi, permuted_op, thetas)]).result() - - where an input circuit is transpiled locally before it's passed to - :class:`~.BaseEstimator.run`. Transpilation expands the original - circuit from 2 to 7 qubits (the size of ``backend``) and permutes its layout, - which is then applied to ``H1`` using :meth:`~.Pauli.apply_layout` - to reflect the transformations performed by ``pm.run()``. \ No newline at end of file + :class:`~.BaseEstimator` / :class:`~.BaseEstimatorV2` implementations and + local transpilation when the input is of type :class:`~.Pauli`. For example: + + .. code-block:: python + + from qiskit.circuit.library import RealAmplitudes + from qiskit.primitives import BackendEstimatorV2 + from qiskit.providers.fake_provider import GenericBackendV2 + from qiskit.quantum_info import Pauli + from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager + + psi = RealAmplitudes(num_qubits=2, reps=2) + H1 = Pauli("XI") + backend = GenericBackendV2(num_qubits=7) + estimator = BackendEstimatorV2(backend=backend) + thetas = [0, 1, 1, 2, 3, 5] + pm = generate_preset_pass_manager(optimization_level=3, backend=backend) + transpiled_psi = pm.run(psi) + permuted_op = H1.apply_layout(transpiled_psi.layout) + res = estimator.run([(transpiled_psi, permuted_op, thetas)]).result() + + where an input circuit is transpiled locally before it's passed to + :class:`~.BaseEstimator.run`. Transpilation expands the original + circuit from 2 to 7 qubits (the size of ``backend``) and permutes its layout, + which is then applied to ``H1`` using :meth:`~.Pauli.apply_layout` + to reflect the transformations performed by ``pm.run()``. diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml new file mode 100644 index 00000000000..2ee9f3f767d --- /dev/null +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -0,0 +1,22 @@ +--- +prelude: > + The Qiskit 1.1.0 release is a minor feature release that includes a myriad of new feature and bugfixes. + The highlights for this release are: + + * Support for typed classical variables has been added to Qiskit's :class:`.QuantumCircuit`. These + classical variables can be specified as inputs or as scoped variables in a :class:`.QuantumCircuit` + where they e.g. store the output of qubit measurements or target control-flow operations. Support + for e.g. setting gate parameters or output variables will be added in the future. + + * Two synthesis steps essential for generating hardware-conforming quantum circuits have been + implemented in rust. This yields significant runtime speedups when decomposing unitary matrices + into two-qubit quantum gates using :class:`.TwoQubitBasisDecomposer` and :class:`.TwoQubitWeylDecomposition`. + + * A number of new transpiler passes have been introduced to Qiskit that yield significant runtime + speedups while also decreasing the size of the transpiled quantum circuits in many cases. Specifically, + :class:`.ElidePermutations` and :class:`.StarPreRouting` have been demonstrated to have a significant + impact on the routing output and runtime, :class:`.RemoveFinalReset` can improve quantum circuits + that include resets and :class:`.OptimizeAnnotated` improves the processing of annotated operations. + + * The default pass managers have been improved by extending them with the newly introduced transpiler + passes, a reorganization of existing passes and a fine-tuning of transpilation parameters. diff --git a/releasenotes/notes/1.1/remove-final-reset-488247c01c4e147d.yaml b/releasenotes/notes/1.1/remove-final-reset-488247c01c4e147d.yaml index 090654e16b9..e217228af91 100644 --- a/releasenotes/notes/1.1/remove-final-reset-488247c01c4e147d.yaml +++ b/releasenotes/notes/1.1/remove-final-reset-488247c01c4e147d.yaml @@ -1,5 +1,5 @@ --- -features: +features_transpiler: - | Added a new transpiler pass, :class:`.RemoveFinalReset`, which will remove any :class:`.Reset` operation which is the final diff --git a/releasenotes/notes/1.1/rework-inst-durations-passes-28c78401682e22c0.yaml b/releasenotes/notes/1.1/rework-inst-durations-passes-28c78401682e22c0.yaml index 2ccd92f19c1..41f4d16b2b3 100644 --- a/releasenotes/notes/1.1/rework-inst-durations-passes-28c78401682e22c0.yaml +++ b/releasenotes/notes/1.1/rework-inst-durations-passes-28c78401682e22c0.yaml @@ -2,14 +2,14 @@ fixes: - | The internal handling of custom circuit calibrations and :class:`.InstructionDurations` - has been offloaded from the :func:`.transpile` function to the individual transpiler passes: - :class:`qiskit.transpiler.passes.scheduling.DynamicalDecoupling`, - :class:`qiskit.transpiler.passes.scheduling.padding.DynamicalDecoupling`. Before, - instruction durations from circuit calibrations would not be taken into account unless + has been offloaded from the :func:`.transpile` function to the individual transpiler passes: + :class:`~qiskit.transpiler.passes.scheduling.DynamicalDecoupling`, + :class:`~qiskit.transpiler.passes.scheduling.padding.DynamicalDecoupling`. Before, + instruction durations from circuit calibrations would not be taken into account unless they were manually incorporated into `instruction_durations` input argument, but the passes - that need it now analyze the circuit and pick the most relevant duration value according + that need it now analyze the circuit and pick the most relevant duration value according to the following priority order: target > custom input > circuit calibrations. - | Fixed a bug in :func:`.transpile` where the ``num_processes`` argument would only be used - if ``dt`` or ``instruction_durations`` were provided. \ No newline at end of file + if ``dt`` or ``instruction_durations`` were provided. diff --git a/releasenotes/notes/1.1/spo-to-matrix-26445a791e24f62a.yaml b/releasenotes/notes/1.1/spo-to-matrix-26445a791e24f62a.yaml index 135e83ef99b..57a60094f1b 100644 --- a/releasenotes/notes/1.1/spo-to-matrix-26445a791e24f62a.yaml +++ b/releasenotes/notes/1.1/spo-to-matrix-26445a791e24f62a.yaml @@ -1,5 +1,5 @@ --- -features: +features_quantum_info: - | The performance of :meth:`.SparsePauliOp.to_matrix` has been greatly improved for both dense and sparse forms. By default, both will now take advantage of threaded parallelism available on diff --git a/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml b/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml index 0bf60329a23..a33f8ce58f1 100644 --- a/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml +++ b/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml @@ -1,9 +1,9 @@ --- -features: +features_transpiler: - | Added a new transpiler pass :class:`.StarPreRouting` which is designed to identify star connectivity subcircuits and then replace them with an optimal linear routing. This is useful for certain circuits that are composed of - this circuit connectivity such as Berstein Vazirani and QFT. For example: + this circuit connectivity such as Bernstein-Vazirani and QFT. For example: .. plot: diff --git a/releasenotes/notes/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/prepare-1.1.0-732e167b70ab4d01.yaml deleted file mode 100644 index 5e0a00c3ce2..00000000000 --- a/releasenotes/notes/prepare-1.1.0-732e167b70ab4d01.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -prelude: > - The Qiskit 1.1.0 release is a minor feature release that includes a myriad of new feature and bugfixes. - The highlights for this release are: - - * V2 primitives - - * Synthesis-Decomposition in rust - - * New transpiler passes: ElidePermutations, StarPreRouting, OptimizeAnnotated, RemoveFinalReset - - * Improvements to (the organization of) default passmanagers, i.e. new passes, fine-tuning of params - - * Improvements to QuantumVolume From bcc1621ed326c4e7523251a42be75cf23be4e130 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Mon, 13 May 2024 18:24:49 +0200 Subject: [PATCH 03/37] . --- .../1.0/primitives-v2-df871c0c6ac0b94a.yaml | 177 ------------------ .../pauli-apply-layout-cdcbc1bce724a150.yaml | 4 +- .../1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 4 + 3 files changed, 6 insertions(+), 179 deletions(-) delete mode 100644 releasenotes/notes/1.0/primitives-v2-df871c0c6ac0b94a.yaml diff --git a/releasenotes/notes/1.0/primitives-v2-df871c0c6ac0b94a.yaml b/releasenotes/notes/1.0/primitives-v2-df871c0c6ac0b94a.yaml deleted file mode 100644 index f34e1b6a323..00000000000 --- a/releasenotes/notes/1.0/primitives-v2-df871c0c6ac0b94a.yaml +++ /dev/null @@ -1,177 +0,0 @@ ---- -features_primitives: - - | - Version 2 of the primitives is introduced via a new base class for both the sampler and the - estimator, along with new types for their inputs and outputs. The emphasis of this new - version is on performing vectorized calls to the primitive ``run()`` methods, so that sweeps - over parameter value sets and observables can be efficiently specified. See - :class:`~.StatevectorSampler` and :class:`~.StatevectorEstimator` for reference implementations - of the V2 primitives. - - Moreover, the estimator has gained a ``precision`` argument in the :meth:`~.BaseEstimatorV2.run` - method that specifies the targeted precision of the expectation value estimates. Analogously, - the sampler has moved ``shots`` out of the options and into the arguments of the - :meth:`~.BaseSamplerV2.run` method. The sampler has also been changed to return the outputs - (e.g. bitstrings) from every shot, rather than providing a :class:`~.Counts`\-like return, and - also to store data from separate :class:`~.ClassicalRegister`\s . This enables derived classes - to implement sampler support for circuits with classical control flow. - - The primitive V2 base classes are: - - * :class:`.BaseSamplerV2` - * :class:`.BaseEstimatorV2` - - The new types which are used for inputs and outputs are: - - * :const:`.SamplerPubLike`\: primitive unified bloc (PUB) of sampler inputs; a union type - of allowed inputs to a sampler - * :const:`.EstimatorPubLike`\: Primitive unified bloc (PUB) of estimator inputs; a union - type of allowed inputs to an estimator - * :class:`.PubResult`\: the data and metadata resulting from a single PUB's execution - * :class:`.DataBin`\: A namespace to hold data from a single PUB's execution - * :class:`.BitArray`\: an array-valued collection of bit values in a dense format - * :class:`.PrimitiveResult`: an iterable of :class:`.PubResult`\s along with metadata - - - | - The reference implementation :class:`~.StatevectorEstimator` of :class:`~.BaseEstimatorV2` was - added. As seen in the example below, this estimator (and all V2 estimators) supports providing - arrays of observables and/or arrays of parameter value sets that are attached to particular - circuits. - - Each tuple of ``(circuit, observables, parameter values, precision)``, - called an estimator primitive unified bloc (PUB), produces its own array-based result. The - :meth:`~.EstimatorV2.run` method can be given many pubs at once. - - .. code-block:: python - - from qiskit.circuit import Parameter, QuantumCircuit - from qiskit.primitives import StatevectorEstimator - from qiskit.quantum_info import Pauli, SparsePauliOp - - import matplotlib.pyplot as plt - import numpy as np - - # Define a circuit with two parameters. - circuit = QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - circuit.ry(Parameter("a"), 0) - circuit.rz(Parameter("b"), 0) - circuit.cx(0, 1) - circuit.h(0) - - # Define a sweep over parameter values, where the second axis is over - # the two parameters in the circuit. - params = np.vstack([ - np.linspace(-np.pi, np.pi, 100), - np.linspace(-4 * np.pi, 4 * np.pi, 100) - ]).T - - # Define three observables. Many formats are supported here including - # classes such as qiskit.quantum_info.SparsePauliOp. The inner length-1 - # lists cause this array of observables to have shape (3, 1), rather - # than shape (3,) if they were omitted. - observables = [ - [SparsePauliOp(["XX", "IY"], [0.5, 0.5])], - [Pauli("XX")], - [Pauli("IY")] - ] - - # Instantiate a new statevector simulation based estimator object. - estimator = StatevectorEstimator() - - # Estimate the expectation value for all 300 combinations of - # observables and parameter values, where the pub result will have - # shape (3, 100). This shape is due to our array of parameter - # bindings having shape (100,), combined with our array of observables - # having shape (3, 1) - pub = (circuit, observables, params) - job = estimator.run([pub]) - - # Extract the result for the 0th pub (this example only has one pub). - result = job.result()[0] - - # Error-bar information is also available, but the error is 0 - # for this StatevectorEstimator. - result.data.stds - - # Pull out the array-based expectation value estimate data from the - # result and plot a trace for each observable. - for idx, pauli in enumerate(observables): - plt.plot(result.data.evs[idx], label=pauli) - plt.legend() - - - | - The reference implementation :class:`~.StatevectorSampler` of :class:`~.BaseSamplerV2` was - added. As seen in the example below, this sampler (and all V2 samplers) supports - providing arrays of parameter value sets to bind against a single circuit. - - Each tuple of ``(circuit, parameter values, shots)``, called a sampler - primitive unified bloc (PUB), produces its own array-based result. The :meth:`~.SamplerV2.run` - method can be given many pubs at once. - - .. code-block:: python - - from qiskit.circuit import ( - Parameter, QuantumCircuit, ClassicalRegister, QuantumRegister - ) - from qiskit.primitives import StatevectorSampler - - import matplotlib.pyplot as plt - import numpy as np - - # Define our circuit registers, including classical registers - # called 'alpha' and 'beta'. - qreg = QuantumRegister(3) - alpha = ClassicalRegister(2, "alpha") - beta = ClassicalRegister(1, "beta") - - # Define a quantum circuit with two parameters. - circuit = QuantumCircuit(qreg, alpha, beta) - circuit.h(0) - circuit.cx(0, 1) - circuit.cx(1, 2) - circuit.ry(Parameter("a"), 0) - circuit.rz(Parameter("b"), 0) - circuit.cx(1, 2) - circuit.cx(0, 1) - circuit.h(0) - circuit.measure([0, 1], alpha) - circuit.measure([2], beta) - - # Define a sweep over parameter values, where the second axis is over. - # the two parameters in the circuit. - params = np.vstack([ - np.linspace(-np.pi, np.pi, 100), - np.linspace(-4 * np.pi, 4 * np.pi, 100) - ]).T - - # Instantiate a new statevector simulation based sampler object. - sampler = StatevectorSampler() - - # Start a job that will return shots for all 100 parameter value sets. - pub = (circuit, params) - job = sampler.run([pub], shots=256) - - # Extract the result for the 0th pub (this example only has one pub). - result = job.result()[0] - - # There is one BitArray object for each ClassicalRegister in the - # circuit. Here, we can see that the BitArray for alpha contains data - # for all 100 sweep points, and that it is indeed storing data for 2 - # bits over 256 shots. - assert result.data.alpha.shape == (100,) - assert result.data.alpha.num_bits == 2 - assert result.data.alpha.num_shots == 256 - - # We can work directly with a binary array in performant applications. - raw = result.data.alpha.array - - # For small registers where it is anticipated to have many counts - # associated with the same bitstrings, we can turn the data from, - # for example, the 22nd sweep index into a dictionary of counts. - counts = result.data.alpha.get_counts(22) - - # Or, convert into a list of bitstrings that preserve shot order. - bitstrings = result.data.alpha.get_bitstrings(22) - print(bitstrings) diff --git a/releasenotes/notes/1.1/pauli-apply-layout-cdcbc1bce724a150.yaml b/releasenotes/notes/1.1/pauli-apply-layout-cdcbc1bce724a150.yaml index 4ddfd339571..2e9b05723d2 100644 --- a/releasenotes/notes/1.1/pauli-apply-layout-cdcbc1bce724a150.yaml +++ b/releasenotes/notes/1.1/pauli-apply-layout-cdcbc1bce724a150.yaml @@ -1,8 +1,8 @@ --- features_quantum_info: - | - Added a new :meth:`~.Pauli.apply_layout` method in the class :class:`~.Pauli` that is equivalent to the - :meth:`~.SparsePauliOp.apply_layout` method in the class :class:`~.SparsePauliOp`. This method is + Added a new :meth:`.Pauli.apply_layout` that is equivalent to the + :meth:`.SparsePauliOp.apply_layout`. This method is used to apply a :class:`~.TranspileLayout` layout from the transpiler to a :class:~.Pauli` observable that was built for an input circuit. This enables working with :class:`~.BaseEstimator` / :class:`~.BaseEstimatorV2` implementations and diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index 2ee9f3f767d..899063da451 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -20,3 +20,7 @@ prelude: > * The default pass managers have been improved by extending them with the newly introduced transpiler passes, a reorganization of existing passes and a fine-tuning of transpilation parameters. + + * Improvements to the primitives interface. In particular, :class:`~.SamplerPubResult` was introduced + to give access to the :meth:`~.join_data` method, :class:`.DataBin` was made into a mapping class, + and :class:`.BitArray` was given many new utility methods. From 0317dddfdb01104e61fe63ab2d4f74435f769454 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Tue, 14 May 2024 10:30:01 +0200 Subject: [PATCH 04/37] . --- qiskit/primitives/__init__.py | 16 +++++++++++----- qiskit/primitives/containers/__init__.py | 1 + qiskit/primitives/containers/bit_array.py | 1 + ...ct-commutation-analysis-3518129e91a33599.yaml | 4 ++-- ...trl_state-mcp-parameter-b23562aa7047665a.yaml | 6 +++--- ...ermutations-to-pipeline-077dad03bd55ab9c.yaml | 2 +- ...arameter-ctrl_state-mcx-816dcd80e459a5ed.yaml | 4 ++-- .../1.1/classical-store-e64ee1286219a862.yaml | 4 ++-- ...ommutation-checker-utf8-47b13b78a40af196.yaml | 4 ++-- .../databin-construction-72ec041075410cb2.yaml | 4 ++-- ...rol-flow-fold-minus-one-f2af168a5313385f.yaml | 2 +- ...m-pulse-qobj-conversion-5d6041b36356cfd1.yaml | 2 +- ...ilder-default-alingment-52f81224d90c21e2.yaml | 2 +- ...lse-parameter-formatter-2ee3fb91efb2794c.yaml | 2 +- .../fix-scheduling-units-59477912b47d3dc1.yaml | 2 +- .../1.1/parameter-hash-eq-645f9de55aa78d02.yaml | 2 +- .../1.1/pauli-apply-layout-cdcbc1bce724a150.yaml | 4 ++-- .../1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 2 +- ...k-inst-durations-passes-28c78401682e22c0.yaml | 4 ++-- 19 files changed, 38 insertions(+), 30 deletions(-) diff --git a/qiskit/primitives/__init__.py b/qiskit/primitives/__init__.py index 2423f3545f8..98d4ea481a1 100644 --- a/qiskit/primitives/__init__.py +++ b/qiskit/primitives/__init__.py @@ -51,7 +51,7 @@ * a collection parameter value sets to bind the circuit against, :math:`\theta_k`. Running an estimator returns a :class:`~qiskit.primitives.BasePrimitiveJob` object, where calling -the method :meth:`~qiskit.primitives.BasePrimitiveJob.result` results in expectation value estimates +the method :meth:`~qiskit.primitives.BasePrimitiveJob.result` results in expectation value estimates and metadata for each pub: .. math:: @@ -95,7 +95,7 @@ # [] ] job2 = estimator.run( [ - (psi1, [H1, H3], [theta1, theta3]), + (psi1, [H1, H3], [theta1, theta3]), (psi2, H2, theta2) ], precision=0.01 @@ -103,7 +103,7 @@ job_result = job2.result() print(f"The primitive-job finished with result {job_result}") - + Overview of SamplerV2 ===================== @@ -220,8 +220,8 @@ # , # ] job2 = estimator.run( - [psi1, psi2, psi1], - [H1, H2, H3], + [psi1, psi2, psi1], + [H1, H2, H3], [theta1, theta2, theta3] ) job_result = job2.result() @@ -417,8 +417,10 @@ DataBin PrimitiveResult PubResult + SamplerPubResult BasePrimitiveJob PrimitiveJob + Shaped Estimator V1 ------------ @@ -464,12 +466,16 @@ DataBin, PrimitiveResult, PubResult, + SamplerPubResult, EstimatorPubLike, SamplerPubLike, BindingsArrayLike, ObservableLike, ObservablesArrayLike, + Shaped, ) + + from .estimator import Estimator from .primitive_job import BasePrimitiveJob, PrimitiveJob from .sampler import Sampler diff --git a/qiskit/primitives/containers/__init__.py b/qiskit/primitives/containers/__init__.py index 62fb49a3fb9..02c090530f3 100644 --- a/qiskit/primitives/containers/__init__.py +++ b/qiskit/primitives/containers/__init__.py @@ -24,3 +24,4 @@ from .pub_result import PubResult from .sampler_pub import SamplerPubLike from .sampler_pub_result import SamplerPubResult +from .shape import Shaped diff --git a/qiskit/primitives/containers/bit_array.py b/qiskit/primitives/containers/bit_array.py index 24d52ca4e85..0702e5f210e 100644 --- a/qiskit/primitives/containers/bit_array.py +++ b/qiskit/primitives/containers/bit_array.py @@ -130,6 +130,7 @@ def __repr__(self): return f"BitArray({desc})" def __getitem__(self, indices): + """Slices the array along an existing axis of the array.""" if isinstance(indices, tuple) and len(indices) >= self.ndim + 2: raise ValueError( "BitArrays cannot be sliced along the bits axis, see slice_bits() instead." diff --git a/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml b/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml index 15f4137b1cf..f13d04b03f7 100644 --- a/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml +++ b/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml @@ -1,12 +1,12 @@ --- upgrade_transpiler: - | - Extended the commutation analysis performed by :class:`.CommutationChecker` to also work with + Extended the commutation analysis performed by :class:`~.CommutationChecker` to also work with abstract circuits, i.e. each operation in the input quantum circuit is now checked for its matrix representation before proceeding to the analysis step. Previously, the commutation analysis was only performed on physical circuits. In addition, each operation is now checked for its ability to be cached in the session commutation library. For example, this now enables computing - whether :class:`.AnnotatedOperation` commute. This enables transpiler passes that rely on :class:`.CommutationChecker` internally, + whether :class:`.AnnotatedOperation` commute. This enables transpiler passes that rely on :class:`~.CommutationChecker` internally, such as :class:`.CommutativeCancellation`, during earlier stages of a default transpilation pipeline (prior to basis translation). diff --git a/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml b/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml index 97bf76b742d..0bbf457a468 100644 --- a/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml +++ b/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml @@ -1,11 +1,11 @@ --- features_circuits: - | - Added ``ctrl_state`` parameter to :func:`QuantumCircuit.mcp()` and - :class:`MCPhaseGate()`. + Added ``ctrl_state`` parameter to :meth:`.QuantumCircuit.mcp()` and + :class:`.MCPhaseGate()`. - The :func:`QuantumCircuit.mcp()` function and :class:`MCPhaseGate()` have + The :meth:`.QuantumCircuit.mcp()` function and :class:`.MCPhaseGate()` have been updated to include a ``ctrl_state`` parameter. This enhancement allows users to specify the control state of the multi-controlled phase gate. The parameter can accept either an integer value or a bitstring and defaults to diff --git a/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml b/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml index a7219dcc316..6f9e8dbb4f0 100644 --- a/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml +++ b/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml @@ -5,5 +5,5 @@ features_transpiler: runs by default with optimization level 2 and 3. Intuitively, removing :class:`~.SwapGate`\s and :class:`~qiskit.circuit.library.PermutationGate`\s in a virtual circuit is almost always beneficial, as it makes the circuit shorter - and easier to route. As :class:`~qiskit.transpiler.passes.optimization.optimize_swap_before_measure.OptimizeSwapBeforeMeasure` is a special case + and easier to route. As :class:`~.OptimizeSwapBeforeMeasure` is a special case of :class:`~.ElidePermutations`, it has been removed from optimization level 3. diff --git a/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml b/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml index 14da8ebf6a4..3c57a63bef4 100644 --- a/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml +++ b/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml @@ -1,10 +1,10 @@ --- features_circuits: - | - Added `ctrl_state` parameter to :func:`QuantumCircuit.mcx()`. + Added `ctrl_state` parameter to :meth:`.QuantumCircuit.mcx()`. - The :func:`QuantumCircuit.mcx()` function in the quantum circuit library has + The :meth:`.QuantumCircuit.mcx()` function in the quantum circuit library has been enhanced to include a `ctrl_state` parameter, allowing users to specify the control state of the multi-controlled X gate. This parameter can accept either a decimal value or a bitstring and defaults to controlling the '1' diff --git a/releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml b/releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml index 9de8affebe4..ac50c149af8 100644 --- a/releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml +++ b/releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml @@ -44,8 +44,8 @@ features_circuits: A variable is a :class:`.Var` node, which can now contain an arbitrary type, and represents a unique memory location within its live range when added to a circuit. These can be constructed - in a circuit using :meth:`.QuantumCircuit.add_var` and :meth:`~.QuantumCircuit.add_input`, or - at a lower level using :meth:`.Var.new`. + in a circuit using :meth:`.QuantumCircuit.add_var` and :meth:`.QuantumCircuit.add_input`, or + at a lower level using :func:`~.qiskit.circuit.classical.expr.Var.new`. Variables can be manually stored to, using the :class:`.Store` instruction and its corresponding circuit method :meth:`.QuantumCircuit.store`. This includes writing to :class:`.Clbit` and diff --git a/releasenotes/notes/1.1/commutation-checker-utf8-47b13b78a40af196.yaml b/releasenotes/notes/1.1/commutation-checker-utf8-47b13b78a40af196.yaml index 1b6e8c6c25b..aaa6a3549fa 100644 --- a/releasenotes/notes/1.1/commutation-checker-utf8-47b13b78a40af196.yaml +++ b/releasenotes/notes/1.1/commutation-checker-utf8-47b13b78a40af196.yaml @@ -1,8 +1,8 @@ --- fixes: - | - Fixed an issue with the :class:`.CommutationChecker` class where it would error if a gate's + Fixed an issue with the :class:`~.CommutationChecker` class where it would error if a gate's :attr:`~.Gate.name` attribute was UTF8 encoded. Previously only gate names with ascii encoding would work. Fixed `#12501 `__ - + diff --git a/releasenotes/notes/1.1/databin-construction-72ec041075410cb2.yaml b/releasenotes/notes/1.1/databin-construction-72ec041075410cb2.yaml index 4b29d1c85cc..e3568e81133 100644 --- a/releasenotes/notes/1.1/databin-construction-72ec041075410cb2.yaml +++ b/releasenotes/notes/1.1/databin-construction-72ec041075410cb2.yaml @@ -11,8 +11,8 @@ features_primitives: The shape can be passed to the constructor. upgrade_primitives: - | - The function :meth:`~.make_data_bin` no longer creates and returns a + The function :meth:`.DataBin.make_data_bin` no longer creates and returns a :class:`.DataBin` subclass. It instead always returns the :class:`.DataBin` class. However, it continues to exist for backwards compatibility, though will eventually be deprecated. All users should migrate to construct :class:`.DataBin` instances directly, instead of instantiating - subclasses as output by :meth:`~.make_data_bin`. + subclasses as output by :meth:`.DataBin.make_data_bin`. diff --git a/releasenotes/notes/1.1/fix-control-flow-fold-minus-one-f2af168a5313385f.yaml b/releasenotes/notes/1.1/fix-control-flow-fold-minus-one-f2af168a5313385f.yaml index 5f8567da70e..de2d04adf3e 100644 --- a/releasenotes/notes/1.1/fix-control-flow-fold-minus-one-f2af168a5313385f.yaml +++ b/releasenotes/notes/1.1/fix-control-flow-fold-minus-one-f2af168a5313385f.yaml @@ -1,7 +1,7 @@ --- fixes: - | - Fixed an issue with the :func:`circuit_drawer` or :meth:`QuantumCircuit.draw` + Fixed an issue with the :func:`.circuit_drawer` or :meth:`.QuantumCircuit.draw` when using the ``mpl`` output option where the program would hang if the circuit being drawn had a ControlFlow operation in it and the ``fold`` option was set to -1 (meaning no fold). diff --git a/releasenotes/notes/1.1/fix-custom-pulse-qobj-conversion-5d6041b36356cfd1.yaml b/releasenotes/notes/1.1/fix-custom-pulse-qobj-conversion-5d6041b36356cfd1.yaml index b3fd0e98004..30b83ee3111 100644 --- a/releasenotes/notes/1.1/fix-custom-pulse-qobj-conversion-5d6041b36356cfd1.yaml +++ b/releasenotes/notes/1.1/fix-custom-pulse-qobj-conversion-5d6041b36356cfd1.yaml @@ -3,5 +3,5 @@ fixes: - | Fixed a bug in the conversion of custom pulse instructions to the legacy :mod:`qiskit.qobj` format. The bug was introduced in Qiskit 1.0.0 and caused conversion of instructions with custom pulse shapes to raise an error. After the fix, the conversion is - carried out correctly, and the custom pulse is converted to :class:`.pulse.Waveform` as it should. + carried out correctly, and the custom pulse is converted to :class:`~.pulse.library.Waveform` as it should. Fixed `#11828 `__. diff --git a/releasenotes/notes/1.1/fix-pulse-builder-default-alingment-52f81224d90c21e2.yaml b/releasenotes/notes/1.1/fix-pulse-builder-default-alingment-52f81224d90c21e2.yaml index b8d775e82a2..0ec881b4b1f 100644 --- a/releasenotes/notes/1.1/fix-pulse-builder-default-alingment-52f81224d90c21e2.yaml +++ b/releasenotes/notes/1.1/fix-pulse-builder-default-alingment-52f81224d90c21e2.yaml @@ -1,6 +1,6 @@ --- fixes: - | - Fixed a bug in the handling of ``default_alignment`` argument of :func:`~qiskit.pulse.build`. + Fixed a bug in the handling of ``default_alignment`` argument of :func:`~qiskit.pulse.builder.build`. Inputs of type :class:`~qiskit.pulse.transforms.AlignmentKind` are now correctly processed as default alignments. diff --git a/releasenotes/notes/1.1/fix-pulse-parameter-formatter-2ee3fb91efb2794c.yaml b/releasenotes/notes/1.1/fix-pulse-parameter-formatter-2ee3fb91efb2794c.yaml index fcb6b53c106..774d12f0969 100644 --- a/releasenotes/notes/1.1/fix-pulse-parameter-formatter-2ee3fb91efb2794c.yaml +++ b/releasenotes/notes/1.1/fix-pulse-parameter-formatter-2ee3fb91efb2794c.yaml @@ -1,7 +1,7 @@ --- fixes: - | - Fixed a bug in :func:`qiskit.pulse.utils.format_parameter_value` function that + Fixed a bug in :func:`.qiskit.pulse.utils.format_parameter_value` function that unintentionally converts large enough integer numbers into float values or causes unexpected rounding. See `#11971 `__ for details. diff --git a/releasenotes/notes/1.1/fix-scheduling-units-59477912b47d3dc1.yaml b/releasenotes/notes/1.1/fix-scheduling-units-59477912b47d3dc1.yaml index 72f4b46fc73..6d1456d8505 100644 --- a/releasenotes/notes/1.1/fix-scheduling-units-59477912b47d3dc1.yaml +++ b/releasenotes/notes/1.1/fix-scheduling-units-59477912b47d3dc1.yaml @@ -1,6 +1,6 @@ --- fixes: - | - A bug has been fixed in :func:`.convert_durations_to_dt` where the function would blindly apply + A bug has been fixed in :func:`~qiskit.circuit.duration.convert_durations_to_dt` where the function would blindly apply a conversion from seconds to ``dt`` on circuit durations, independently of the original units of the attribute. This could lead to wrong orders of magnitude in the reported circuit durations. diff --git a/releasenotes/notes/1.1/parameter-hash-eq-645f9de55aa78d02.yaml b/releasenotes/notes/1.1/parameter-hash-eq-645f9de55aa78d02.yaml index f134de5f00f..6b345a9b976 100644 --- a/releasenotes/notes/1.1/parameter-hash-eq-645f9de55aa78d02.yaml +++ b/releasenotes/notes/1.1/parameter-hash-eq-645f9de55aa78d02.yaml @@ -3,6 +3,6 @@ fixes: - | :class:`.Parameter` was updated so that instances that compare equal always have the same hash. Previously, only the :attr:`.Parameter.uuid` was - compared, so :class:`.Paramemter` instances with different names could + compared, so :class:`.Parameter` instances with different names could compare equal if they had been constructed using a common value for the ``uuid`` parameter (which is usually not passed explicitly). diff --git a/releasenotes/notes/1.1/pauli-apply-layout-cdcbc1bce724a150.yaml b/releasenotes/notes/1.1/pauli-apply-layout-cdcbc1bce724a150.yaml index 2e9b05723d2..0463e8e8ce9 100644 --- a/releasenotes/notes/1.1/pauli-apply-layout-cdcbc1bce724a150.yaml +++ b/releasenotes/notes/1.1/pauli-apply-layout-cdcbc1bce724a150.yaml @@ -3,7 +3,7 @@ features_quantum_info: - | Added a new :meth:`.Pauli.apply_layout` that is equivalent to the :meth:`.SparsePauliOp.apply_layout`. This method is - used to apply a :class:`~.TranspileLayout` layout from the transpiler to a :class:~.Pauli` + used to apply a :class:`~.TranspileLayout` layout from the transpiler to a :class:`~.Pauli` observable that was built for an input circuit. This enables working with :class:`~.BaseEstimator` / :class:`~.BaseEstimatorV2` implementations and local transpilation when the input is of type :class:`~.Pauli`. For example: @@ -27,7 +27,7 @@ features_quantum_info: res = estimator.run([(transpiled_psi, permuted_op, thetas)]).result() where an input circuit is transpiled locally before it's passed to - :class:`~.BaseEstimator.run`. Transpilation expands the original + :meth:`~.BaseEstimator.run`. Transpilation expands the original circuit from 2 to 7 qubits (the size of ``backend``) and permutes its layout, which is then applied to ``H1`` using :meth:`~.Pauli.apply_layout` to reflect the transformations performed by ``pm.run()``. diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index 899063da451..c2b354c9b78 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -22,5 +22,5 @@ prelude: > passes, a reorganization of existing passes and a fine-tuning of transpilation parameters. * Improvements to the primitives interface. In particular, :class:`~.SamplerPubResult` was introduced - to give access to the :meth:`~.join_data` method, :class:`.DataBin` was made into a mapping class, + to give access to the :meth:`.SamplerPubResult.join_data` method, :class:`.DataBin` was made into a mapping class, and :class:`.BitArray` was given many new utility methods. diff --git a/releasenotes/notes/1.1/rework-inst-durations-passes-28c78401682e22c0.yaml b/releasenotes/notes/1.1/rework-inst-durations-passes-28c78401682e22c0.yaml index 41f4d16b2b3..1deb26df9da 100644 --- a/releasenotes/notes/1.1/rework-inst-durations-passes-28c78401682e22c0.yaml +++ b/releasenotes/notes/1.1/rework-inst-durations-passes-28c78401682e22c0.yaml @@ -3,8 +3,8 @@ fixes: - | The internal handling of custom circuit calibrations and :class:`.InstructionDurations` has been offloaded from the :func:`.transpile` function to the individual transpiler passes: - :class:`~qiskit.transpiler.passes.scheduling.DynamicalDecoupling`, - :class:`~qiskit.transpiler.passes.scheduling.padding.DynamicalDecoupling`. Before, + :class:`~.qiskit.transpiler.passes.scheduling.DynamicalDecoupling`, + :class:`~.qiskit.transpiler.passes.scheduling.padding.DynamicalDecoupling`. Before, instruction durations from circuit calibrations would not be taken into account unless they were manually incorporated into `instruction_durations` input argument, but the passes that need it now analyze the circuit and pick the most relevant duration value according From e1be420e903a4b0cd22e44786f49ce8f755a8656 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Tue, 14 May 2024 17:13:04 +0200 Subject: [PATCH 05/37] Update releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml Co-authored-by: Matthew Treinish --- .../notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml b/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml index bd454228c69..2eeb6fe88ca 100644 --- a/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml +++ b/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml @@ -1,5 +1,5 @@ --- -upgrade_circuits: +features_circuits: - | The methods :meth:`~qiskit.circuit.QuantumCircuit.power`, :meth:`~qiskit.circuit.Gate.power`, as well as the similar methods From 040c75ba3cad7bbf7ddeb78f7bed9e4bd11813dc Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Tue, 14 May 2024 17:13:21 +0200 Subject: [PATCH 06/37] Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Matthew Treinish --- releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index c2b354c9b78..d203147f3ae 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -15,7 +15,7 @@ prelude: > * A number of new transpiler passes have been introduced to Qiskit that yield significant runtime speedups while also decreasing the size of the transpiled quantum circuits in many cases. Specifically, :class:`.ElidePermutations` and :class:`.StarPreRouting` have been demonstrated to have a significant - impact on the routing output and runtime, :class:`.RemoveFinalReset` can improve quantum circuits + impact on the routing output quality and runtime, :class:`.RemoveFinalReset` can improve quantum circuits that include resets and :class:`.OptimizeAnnotated` improves the processing of annotated operations. * The default pass managers have been improved by extending them with the newly introduced transpiler From d4be3cc82c3e2caa62e4ecb1aad317cf20fca6ac Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Tue, 14 May 2024 17:35:08 +0200 Subject: [PATCH 07/37] Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Ian Hincks --- releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index d203147f3ae..1039eb11e35 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -21,6 +21,9 @@ prelude: > * The default pass managers have been improved by extending them with the newly introduced transpiler passes, a reorganization of existing passes and a fine-tuning of transpilation parameters. + * New generic primitive V2 implementations were added, :class:`~.BackendEstimatorV2` and + :class:`~.BackendSamplerV2`, to compliment the existing full statevector based implementations. + * Improvements to the primitives interface. In particular, :class:`~.SamplerPubResult` was introduced to give access to the :meth:`.SamplerPubResult.join_data` method, :class:`.DataBin` was made into a mapping class, and :class:`.BitArray` was given many new utility methods. From 9b8edcf6bcb6f2ec88dd078cc3fece3fdb98ab84 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Tue, 14 May 2024 18:17:19 +0200 Subject: [PATCH 08/37] up --- qiskit/circuit/classical/expr/__init__.py | 2 +- ...commutation-analysis-3518129e91a33599.yaml | 2 +- ..._state-mcp-parameter-b23562aa7047665a.yaml | 6 +-- ...inear-plugin-options-b8a0ffe70dfe1676.yaml | 2 +- ...meter-ctrl_state-mcx-816dcd80e459a5ed.yaml | 4 +- .../1.1/fix-pub-coerce-5d13700e15126421.yaml | 8 ++-- .../1.1/star-prerouting-0998b59880c20cef.yaml | 40 +++++++++---------- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/qiskit/circuit/classical/expr/__init__.py b/qiskit/circuit/classical/expr/__init__.py index c0057ca96f0..00f1c2e0676 100644 --- a/qiskit/circuit/classical/expr/__init__.py +++ b/qiskit/circuit/classical/expr/__init__.py @@ -43,7 +43,7 @@ real-time variable, or a wrapper around a :class:`.Clbit` or :class:`.ClassicalRegister`. .. autoclass:: Var - :members: var, name + :members: var, name, new Similarly, literals used in expressions (such as integers) should be lifted to :class:`Value` nodes with associated types. diff --git a/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml b/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml index f13d04b03f7..8a05196aca4 100644 --- a/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml +++ b/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml @@ -1,5 +1,5 @@ --- -upgrade_transpiler: +features_transpiler: - | Extended the commutation analysis performed by :class:`~.CommutationChecker` to also work with abstract circuits, i.e. each operation in the input quantum circuit is now checked for its matrix diff --git a/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml b/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml index 0bbf457a468..6fb75911675 100644 --- a/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml +++ b/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml @@ -1,11 +1,11 @@ --- features_circuits: - | - Added ``ctrl_state`` parameter to :meth:`.QuantumCircuit.mcp()` and - :class:`.MCPhaseGate()`. + Added ``ctrl_state`` parameter to :meth:`.QuantumCircuit.mcp` and + :class:`.MCPhaseGate`. - The :meth:`.QuantumCircuit.mcp()` function and :class:`.MCPhaseGate()` have + The :meth:`.QuantumCircuit.mcp` function and :class:`.MCPhaseGate` have been updated to include a ``ctrl_state`` parameter. This enhancement allows users to specify the control state of the multi-controlled phase gate. The parameter can accept either an integer value or a bitstring and defaults to diff --git a/releasenotes/notes/1.1/add-linear-plugin-options-b8a0ffe70dfe1676.yaml b/releasenotes/notes/1.1/add-linear-plugin-options-b8a0ffe70dfe1676.yaml index 22930d6a0aa..7e6183ac5e3 100644 --- a/releasenotes/notes/1.1/add-linear-plugin-options-b8a0ffe70dfe1676.yaml +++ b/releasenotes/notes/1.1/add-linear-plugin-options-b8a0ffe70dfe1676.yaml @@ -1,5 +1,5 @@ --- -upgrade_synthesis: +features_synthesis: - | The :class:`.KMSSynthesisLinearFunction` plugin for synthesizing :class:`~qiskit.circuit.library.LinearFunction` objects now accepts diff --git a/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml b/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml index 3c57a63bef4..86cd26c6b73 100644 --- a/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml +++ b/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml @@ -1,10 +1,10 @@ --- features_circuits: - | - Added `ctrl_state` parameter to :meth:`.QuantumCircuit.mcx()`. + Added `ctrl_state` parameter to :meth:`.QuantumCircuit.mcx`. - The :meth:`.QuantumCircuit.mcx()` function in the quantum circuit library has + The :meth:`.QuantumCircuit.mcx` function in the quantum circuit library has been enhanced to include a `ctrl_state` parameter, allowing users to specify the control state of the multi-controlled X gate. This parameter can accept either a decimal value or a bitstring and defaults to controlling the '1' diff --git a/releasenotes/notes/1.1/fix-pub-coerce-5d13700e15126421.yaml b/releasenotes/notes/1.1/fix-pub-coerce-5d13700e15126421.yaml index 0d7386b345e..5900aff0d6b 100644 --- a/releasenotes/notes/1.1/fix-pub-coerce-5d13700e15126421.yaml +++ b/releasenotes/notes/1.1/fix-pub-coerce-5d13700e15126421.yaml @@ -2,7 +2,7 @@ fixes: - | - Fixed a bug where ``qiskit.primitives.containers.estimator_pub.EstimatorPub.coerce()`` and - ``qiskit.primitives.containers.sampler_pub.SamplerPub.coerce()`` - improperly handle the case where the parameter values are a ``BindingsArray`` instance, giving - rise to a ``ValueError`` whenever it is attempted. \ No newline at end of file + Fixed a bug where :meth:`~.qiskit.primitives.containers.estimator_pub.EstimatorPub.coerce` and + :meth:`~.qiskit.primitives.containers.sampler_pub.SamplerPub.coerce` + improperly handle the case where the parameter values are a :class:`.BindingsArray` instance, giving + rise to a :class:`.ValueError` whenever it is attempted. diff --git a/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml b/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml index a33f8ce58f1..37b580efa6a 100644 --- a/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml +++ b/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml @@ -5,28 +5,28 @@ features_transpiler: and then replace them with an optimal linear routing. This is useful for certain circuits that are composed of this circuit connectivity such as Bernstein-Vazirani and QFT. For example: - .. plot: + .. plot: - from qiskit.circuit import QuantumCircuit + from qiskit.circuit import QuantumCircuit - qc = QuantumCircuit(10) - qc.h(0) - qc.cx(0, range(1, 5)) - qc.h(9) - qc.cx(9, range(8, 4, -1)) - qc.measure_all() - qc.draw("mpl") + qc = QuantumCircuit(10) + qc.h(0) + qc.cx(0, range(1, 5)) + qc.h(9) + qc.cx(9, range(8, 4, -1)) + qc.measure_all() + qc.draw("mpl") - .. plot: - :include-source: + .. plot: + :include-source: - from qiskit.circuit import QuantumCircuit - from qiskit.transpiler.passes import StarPreRouting + from qiskit.circuit import QuantumCircuit + from qiskit.transpiler.passes import StarPreRouting - qc = QuantumCircuit(10) - qc.h(0) - qc.cx(0, range(1, 5)) - qc.h(9) - qc.cx(9, range(8, 4, -1)) - qc.measure_all() - StarPreRouting()(qc).draw("mpl") + qc = QuantumCircuit(10) + qc.h(0) + qc.cx(0, range(1, 5)) + qc.h(9) + qc.cx(9, range(8, 4, -1)) + qc.measure_all() + StarPreRouting()(qc).draw("mpl") From 2b5ede9743eea57a4c26677c715669ec879c1cfb Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Tue, 14 May 2024 18:46:58 +0200 Subject: [PATCH 09/37] up --- .../1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 12 ++++++-- .../1.1/star-prerouting-0998b59880c20cef.yaml | 28 ++++++++++++++----- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index 1039eb11e35..b3264bb6848 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -11,6 +11,10 @@ prelude: > * Two synthesis steps essential for generating hardware-conforming quantum circuits have been implemented in rust. This yields significant runtime speedups when decomposing unitary matrices into two-qubit quantum gates using :class:`.TwoQubitBasisDecomposer` and :class:`.TwoQubitWeylDecomposition`. + These improvements have a significant impact on the :class:`.UnitarySynthesis` employed in optimization + level 2 and 3 that incurred a large runtime overhead for these pass managers historically. + Furthermore, the numeric methods used in :class:`.Isometry` have been moved to rust, enabling large + runtime speed-ups in particular for controlled unitary gate synthesis. * A number of new transpiler passes have been introduced to Qiskit that yield significant runtime speedups while also decreasing the size of the transpiled quantum circuits in many cases. Specifically, @@ -19,11 +23,13 @@ prelude: > that include resets and :class:`.OptimizeAnnotated` improves the processing of annotated operations. * The default pass managers have been improved by extending them with the newly introduced transpiler - passes, a reorganization of existing passes and a fine-tuning of transpilation parameters. + passes, a reorganization of existing passes and a fine-tuning of transpilation parameters. In particular, + the optimization-level-2 preset pass manager has been refactored to have a better tradeoff between + the runtime and optimization effort in order to serve as a default pass manager in future releases. - * New generic primitive V2 implementations were added, :class:`~.BackendEstimatorV2` and + * New generic primitive V2 implementations were added, :class:`~.BackendEstimatorV2` and :class:`~.BackendSamplerV2`, to compliment the existing full statevector based implementations. - + * Improvements to the primitives interface. In particular, :class:`~.SamplerPubResult` was introduced to give access to the :meth:`.SamplerPubResult.join_data` method, :class:`.DataBin` was made into a mapping class, and :class:`.BitArray` was given many new utility methods. diff --git a/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml b/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml index 37b580efa6a..efe3f529a5e 100644 --- a/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml +++ b/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml @@ -9,11 +9,9 @@ features_transpiler: from qiskit.circuit import QuantumCircuit - qc = QuantumCircuit(10) + qc = QuantumCircuit(5) qc.h(0) qc.cx(0, range(1, 5)) - qc.h(9) - qc.cx(9, range(8, 4, -1)) qc.measure_all() qc.draw("mpl") @@ -23,10 +21,26 @@ features_transpiler: from qiskit.circuit import QuantumCircuit from qiskit.transpiler.passes import StarPreRouting - qc = QuantumCircuit(10) + qc = QuantumCircuit(5) qc.h(0) qc.cx(0, range(1, 5)) - qc.h(9) - qc.cx(9, range(8, 4, -1)) - qc.measure_all() StarPreRouting()(qc).draw("mpl") + + Alternatively, an existing preset pass manager can be extended by: + + .. plot: + :include-source: + + from qiskit import QuantumCircuit + from qiskit.transpiler import CouplingMap + from qiskit.transpiler.passes import StarPreRouting + from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager + + cm = CouplingMap.from_line(5) + qc = QuantumCircuit(5) + qc.h(0) + qc.cx(0, range(1, 5)) + pm = generate_preset_pass_manager(2, coupling_map=cm) + pm.init += StarPreRouting() + result = pm.run(qc) + result.draw("mpl") From f6e814704f36708165dc49f27f2661686afc5367 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Tue, 14 May 2024 23:50:08 +0200 Subject: [PATCH 10/37] Update releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml Co-authored-by: Matthew Treinish --- releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml b/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml index efe3f529a5e..261bd4c644d 100644 --- a/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml +++ b/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml @@ -5,7 +5,7 @@ features_transpiler: and then replace them with an optimal linear routing. This is useful for certain circuits that are composed of this circuit connectivity such as Bernstein-Vazirani and QFT. For example: - .. plot: + .. plot:: from qiskit.circuit import QuantumCircuit From de1334b45896ff1adfd7f99508e3dc53928ce797 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Tue, 14 May 2024 23:50:12 +0200 Subject: [PATCH 11/37] Update releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml Co-authored-by: Matthew Treinish --- releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml b/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml index 261bd4c644d..baef7caef46 100644 --- a/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml +++ b/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml @@ -28,7 +28,7 @@ features_transpiler: Alternatively, an existing preset pass manager can be extended by: - .. plot: + .. plot:: :include-source: from qiskit import QuantumCircuit From af706e47b46a6059ee0bd55b94737287b3fa8a75 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Tue, 14 May 2024 23:50:17 +0200 Subject: [PATCH 12/37] Update releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml Co-authored-by: Matthew Treinish --- releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml b/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml index baef7caef46..c72cbe49b8b 100644 --- a/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml +++ b/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml @@ -15,7 +15,7 @@ features_transpiler: qc.measure_all() qc.draw("mpl") - .. plot: + .. plot:: :include-source: from qiskit.circuit import QuantumCircuit From 9d8bf2ba89fe1eeba3dd6c936244f9ecff6291cc Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Tue, 14 May 2024 23:56:12 +0200 Subject: [PATCH 13/37] prelude - add platform support --- releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index b3264bb6848..4260f72ceed 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -33,3 +33,6 @@ prelude: > * Improvements to the primitives interface. In particular, :class:`~.SamplerPubResult` was introduced to give access to the :meth:`.SamplerPubResult.join_data` method, :class:`.DataBin` was made into a mapping class, and :class:`.BitArray` was given many new utility methods. + + * Changes to platform support: python 3.8 is deprecated starting with Qiskit 1.1.0 and will no longer be supported in 1.3.0, + and arm64 macOS has been promoted to tier 1 support. From d2ce8540870a230d0dbde96304995f34f8c8b544 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 15 May 2024 12:56:29 +0200 Subject: [PATCH 14/37] prelude update --- .../notes/1.1/databin-construction-72ec041075410cb2.yaml | 6 +++--- releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/releasenotes/notes/1.1/databin-construction-72ec041075410cb2.yaml b/releasenotes/notes/1.1/databin-construction-72ec041075410cb2.yaml index e3568e81133..01bcb62158c 100644 --- a/releasenotes/notes/1.1/databin-construction-72ec041075410cb2.yaml +++ b/releasenotes/notes/1.1/databin-construction-72ec041075410cb2.yaml @@ -1,7 +1,7 @@ --- features_primitives: - | - :class:`.DataBin` now satisfies the :class:`~.qiskit.primitives.containers.Shaped` + :class:`.DataBin` now satisfies the :class:`.Shaped` protocol. This means that every :class:`.DataBin` instance now has the additional attributes * :attr:`~.DataBin.shape` (`tuple[int, ...]`): the leading shape of every entry in the instance @@ -11,8 +11,8 @@ features_primitives: The shape can be passed to the constructor. upgrade_primitives: - | - The function :meth:`.DataBin.make_data_bin` no longer creates and returns a + The function :func:`.make_data_bin` no longer creates and returns a :class:`.DataBin` subclass. It instead always returns the :class:`.DataBin` class. However, it continues to exist for backwards compatibility, though will eventually be deprecated. All users should migrate to construct :class:`.DataBin` instances directly, instead of instantiating - subclasses as output by :meth:`.DataBin.make_data_bin`. + subclasses as output by :func:`.make_data_bin`. diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index 4260f72ceed..531c8007755 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -14,7 +14,8 @@ prelude: > These improvements have a significant impact on the :class:`.UnitarySynthesis` employed in optimization level 2 and 3 that incurred a large runtime overhead for these pass managers historically. Furthermore, the numeric methods used in :class:`.Isometry` have been moved to rust, enabling large - runtime speed-ups in particular for controlled unitary gate synthesis. + runtime speed-ups in particular for controlled unitary gate synthesis. The decomposition for multi-controlled + not and phase gates has been improved by more than two orders of magnitude. * A number of new transpiler passes have been introduced to Qiskit that yield significant runtime speedups while also decreasing the size of the transpiled quantum circuits in many cases. Specifically, From eeb4e77f194a679c8850afa3b6b792e5b7a58d9a Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 15 May 2024 17:38:42 +0200 Subject: [PATCH 15/37] Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Matthew Treinish --- .../notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index 531c8007755..9ce666381a5 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -37,3 +37,12 @@ prelude: > * Changes to platform support: python 3.8 is deprecated starting with Qiskit 1.1.0 and will no longer be supported in 1.3.0, and arm64 macOS has been promoted to tier 1 support. +upgrade_misc: + - | + The minimum supported version of Windows is now Windows 10. In previous releases we did not explicitly list + a minimum supported version of Windows and implicitly Windows 7, 8, and 8.1 may have worked (but were + never tested). But do to Rust 1.78 dropping support for older versions of Windows Qiskit's published binaries + on PyPI will not support older versions of Windows in this release. If you're using an older version of Windows + you can likely still build Qiskit from source using an older rust compiler (Qiskit's minimum supported rust + version for building from source is currently 1.70) but older versions of Windows are not a supported platform + and are untested. From fa2923b32fdc9a23805a86138e1125e779b37820 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 15 May 2024 20:35:50 +0200 Subject: [PATCH 16/37] Update releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml Co-authored-by: Matthew Treinish --- .../1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml b/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml index 86cd26c6b73..9684ae51b4d 100644 --- a/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml +++ b/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml @@ -1,7 +1,7 @@ --- features_circuits: - | - Added `ctrl_state` parameter to :meth:`.QuantumCircuit.mcx`. + Added a new ``ctrl_state`` argument to :meth:`.QuantumCircuit.mcx`. The :meth:`.QuantumCircuit.mcx` function in the quantum circuit library has From e6c6af8f774bb0483e5f6f8507e7a77eeb94c680 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 15 May 2024 20:36:38 +0200 Subject: [PATCH 17/37] Update releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml Co-authored-by: Matthew Treinish --- .../notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml b/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml index 2eeb6fe88ca..d106ab627a2 100644 --- a/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml +++ b/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml @@ -1,7 +1,7 @@ --- features_circuits: - | - The methods :meth:`~qiskit.circuit.QuantumCircuit.power`, + The methods :meth:`.QuantumCircuit.power`, :meth:`~qiskit.circuit.Gate.power`, as well as the similar methods of subclasses of :class:`~qiskit.circuit.Gate` (such as of :class:`~qiskit.circuit.library.SGate`) all have an additional From 23c3d50c3d541e340fa8f8dfbbe6c58005a9cba7 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 15 May 2024 20:36:56 +0200 Subject: [PATCH 18/37] Update releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml Co-authored-by: Matthew Treinish --- .../notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml b/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml index d106ab627a2..6f9e7185482 100644 --- a/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml +++ b/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml @@ -2,7 +2,7 @@ features_circuits: - | The methods :meth:`.QuantumCircuit.power`, - :meth:`~qiskit.circuit.Gate.power`, as well as the similar methods + :meth:`.Gate.power`, as well as the similar methods on subclasses of subclasses of :class:`~qiskit.circuit.Gate` (such as of :class:`~qiskit.circuit.library.SGate`) all have an additional argument ``annotated``. From 617e89d8b6bae202dcef70a948d936ad047ac26f Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 15 May 2024 20:37:10 +0200 Subject: [PATCH 19/37] Update releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml Co-authored-by: Matthew Treinish --- .../notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml b/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml index 6f9e7185482..15801b6c200 100644 --- a/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml +++ b/releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml @@ -5,7 +5,8 @@ features_circuits: :meth:`.Gate.power`, as well as the similar methods on subclasses of subclasses of :class:`~qiskit.circuit.Gate` (such as of :class:`~qiskit.circuit.library.SGate`) all have an additional - argument ``annotated``. + have a new argument ``annotated`` which is used to return an :class:`.AnnotatedOperation` + object when applying a power to a gate or circuit. The default value of ``False`` corresponds to the existing behavior. Furthermore, for standard gates with an explicitly defined ``power`` method, the argument ``annotated`` has no effect. From 0bcf66b92d82293154aa99865e17ea85b19e2f8b Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 15 May 2024 20:37:23 +0200 Subject: [PATCH 20/37] Update releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml Co-authored-by: Matthew Treinish --- .../1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml b/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml index 6fb75911675..7272eda325a 100644 --- a/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml +++ b/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml @@ -1,7 +1,7 @@ --- features_circuits: - | - Added ``ctrl_state`` parameter to :meth:`.QuantumCircuit.mcp` and + Added a new ``ctrl_state`` argument to :meth:`.QuantumCircuit.mcp` and :class:`.MCPhaseGate`. From f524374d428601a788afb10689f09797181c4308 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 15 May 2024 20:38:02 +0200 Subject: [PATCH 21/37] Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Matthew Treinish --- releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index 9ce666381a5..0ed7ed419ea 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -31,9 +31,6 @@ prelude: > * New generic primitive V2 implementations were added, :class:`~.BackendEstimatorV2` and :class:`~.BackendSamplerV2`, to compliment the existing full statevector based implementations. - * Improvements to the primitives interface. In particular, :class:`~.SamplerPubResult` was introduced - to give access to the :meth:`.SamplerPubResult.join_data` method, :class:`.DataBin` was made into a mapping class, - and :class:`.BitArray` was given many new utility methods. * Changes to platform support: python 3.8 is deprecated starting with Qiskit 1.1.0 and will no longer be supported in 1.3.0, and arm64 macOS has been promoted to tier 1 support. From 98cda11a0524f9e1320cedb75862390aab5fc994 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 15 May 2024 20:50:33 +0200 Subject: [PATCH 22/37] Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Matthew Treinish --- .../1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index 0ed7ed419ea..9dfaac4f138 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -8,14 +8,20 @@ prelude: > where they e.g. store the output of qubit measurements or target control-flow operations. Support for e.g. setting gate parameters or output variables will be added in the future. - * Two synthesis steps essential for generating hardware-conforming quantum circuits have been - implemented in rust. This yields significant runtime speedups when decomposing unitary matrices - into two-qubit quantum gates using :class:`.TwoQubitBasisDecomposer` and :class:`.TwoQubitWeylDecomposition`. - These improvements have a significant impact on the :class:`.UnitarySynthesis` employed in optimization - level 2 and 3 that incurred a large runtime overhead for these pass managers historically. - Furthermore, the numeric methods used in :class:`.Isometry` have been moved to rust, enabling large - runtime speed-ups in particular for controlled unitary gate synthesis. The decomposition for multi-controlled - not and phase gates has been improved by more than two orders of magnitude. + * The default two qubit synthesis methods that are used internally by the transpiler in the + :class:`.UnitarySynthesis` pass have been re-implemented in Rust. This yields significant + runtime speedups when decomposing two qubit unitary matrices. This corresponds + to a large improvement in the runtime for transpilation in level 3 where running + :class:`.UnitarySynthesis` for two qubit synthesis incurred a large runtime overhead + historically. This release also starts running :class:`.UnitarySynthesis` as part of the + optimization stage in optimization level 2 because of these runtime performance + improvements. + + Additionally, the numeric methods used in :class:`.Isometry` have been moved to rust, + enabling large runtime speed-ups in particular for controlled unitary gate synthesis. + The decomposition for multi-controlled :class:.XGate` and :class:`.PhaseGate` has been + improved resulting in a reduction in the number of gates used in the synthesis by more + than two orders of magnitude. * A number of new transpiler passes have been introduced to Qiskit that yield significant runtime speedups while also decreasing the size of the transpiled quantum circuits in many cases. Specifically, From eb3803fc8b13a96847636d9f0a1f5e9b99227d20 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 15 May 2024 20:57:34 +0200 Subject: [PATCH 23/37] Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Matthew Treinish --- .../notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index 9dfaac4f138..ff172da4c56 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -30,9 +30,11 @@ prelude: > that include resets and :class:`.OptimizeAnnotated` improves the processing of annotated operations. * The default pass managers have been improved by extending them with the newly introduced transpiler - passes, a reorganization of existing passes and a fine-tuning of transpilation parameters. In particular, - the optimization-level-2 preset pass manager has been refactored to have a better tradeoff between - the runtime and optimization effort in order to serve as a default pass manager in future releases. + passes. In particular, the optimization level 2 preset pass manager from + :class:`.generate_preset_pass_manager` and used internally by :func:.transpile` has been refactored to + have a better tradeoff between runtime and optimization effort in order to serve as a default pass + manager in future releases. While this release doesn't change the default to use level 2 it is a better + choice than using level 1 or 3. * New generic primitive V2 implementations were added, :class:`~.BackendEstimatorV2` and :class:`~.BackendSamplerV2`, to compliment the existing full statevector based implementations. From 4b7cad19a2f7008bdd4f2431316218d83950af7e Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 15 May 2024 21:04:32 +0200 Subject: [PATCH 24/37] comments from code review --- ...utations-to-pipeline-077dad03bd55ab9c.yaml | 3 ++- ...-conjugate-reduction-656438d3642f27dc.yaml | 8 ++++---- .../1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 19 +++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml b/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml index 6f9e8dbb4f0..7d05955b137 100644 --- a/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml +++ b/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml @@ -6,4 +6,5 @@ features_transpiler: :class:`~.SwapGate`\s and :class:`~qiskit.circuit.library.PermutationGate`\s in a virtual circuit is almost always beneficial, as it makes the circuit shorter and easier to route. As :class:`~.OptimizeSwapBeforeMeasure` is a special case - of :class:`~.ElidePermutations`, it has been removed from optimization level 3. + of :class:`~.ElidePermutations`, it has been replaced by the :class:`.ElidePermuations` pass as + part of the init stage in optimization level 3 pass managers. diff --git a/releasenotes/notes/1.1/optimize-annotated-conjugate-reduction-656438d3642f27dc.yaml b/releasenotes/notes/1.1/optimize-annotated-conjugate-reduction-656438d3642f27dc.yaml index 6631ba90de6..519ac5d0f40 100644 --- a/releasenotes/notes/1.1/optimize-annotated-conjugate-reduction-656438d3642f27dc.yaml +++ b/releasenotes/notes/1.1/optimize-annotated-conjugate-reduction-656438d3642f27dc.yaml @@ -2,15 +2,15 @@ features_transpiler: - | Added a new reduction to the :class:`.OptimizeAnnotated` transpiler pass. This reduction looks for annotated operations (objects of type :class:`.AnnotatedOperation` - that consist of a base operation ``B`` and a list ``M`` of control, inverse and power + that consist of a base operation :math:`B` and a list :math:`M` of control, inverse and power modifiers) with the following properties: - * the base operation ``B`` needs to be synthesized (i.e. it's not already supported + * the base operation :math:`B` needs to be synthesized (i.e. it's not already supported by the target or belongs to the equivalence library) - * the definition circuit for ``B`` can be expressed as ``P -- Q -- R`` with :math:`R = P^{-1}` + * the definition circuit for :math:`B` can be expressed as :math:`P` -- :math:`Q` -- :math:`R` with :math:`R = P^{-1}` - In this case the modifiers can be moved to the ``Q``-part only. As a specific example, + In this case the modifiers can be moved to the :math:`Q`-part only. As a specific example, controlled QFT-based adders have the form ``control - [QFT -- U -- IQFT]``, which can be simplified to ``QFT -- control-[U] -- IQFT``. By removing the controls over ``QFT`` and ``IQFT`` parts of the circuit, one obtains significantly fewer gates in the transpiled diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index ff172da4c56..b406d00752d 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -10,13 +10,12 @@ prelude: > * The default two qubit synthesis methods that are used internally by the transpiler in the :class:`.UnitarySynthesis` pass have been re-implemented in Rust. This yields significant - runtime speedups when decomposing two qubit unitary matrices. This corresponds - to a large improvement in the runtime for transpilation in level 3 where running - :class:`.UnitarySynthesis` for two qubit synthesis incurred a large runtime overhead - historically. This release also starts running :class:`.UnitarySynthesis` as part of the - optimization stage in optimization level 2 because of these runtime performance - improvements. - + runtime speedups when decomposing two qubit unitary matrices. As a consequence, the runtime of + transpilation with optimization level 3 was significantly improved where running + :class:`.UnitarySynthesis` incurred a large runtime overhead historically. This release also + starts running :class:`.UnitarySynthesis` as part of the optimization stage in optimization level + 2 because of these runtime performance improvements. + Additionally, the numeric methods used in :class:`.Isometry` have been moved to rust, enabling large runtime speed-ups in particular for controlled unitary gate synthesis. The decomposition for multi-controlled :class:.XGate` and :class:`.PhaseGate` has been @@ -26,12 +25,12 @@ prelude: > * A number of new transpiler passes have been introduced to Qiskit that yield significant runtime speedups while also decreasing the size of the transpiled quantum circuits in many cases. Specifically, :class:`.ElidePermutations` and :class:`.StarPreRouting` have been demonstrated to have a significant - impact on the routing output quality and runtime, :class:`.RemoveFinalReset` can improve quantum circuits - that include resets and :class:`.OptimizeAnnotated` improves the processing of annotated operations. + impact on the routing output quality and runtime and :class:`.RemoveFinalReset` can improve quantum circuits + that include resets. * The default pass managers have been improved by extending them with the newly introduced transpiler passes. In particular, the optimization level 2 preset pass manager from - :class:`.generate_preset_pass_manager` and used internally by :func:.transpile` has been refactored to + :class:`.generate_preset_pass_manager` and used internally by :func:`.transpile` has been refactored to have a better tradeoff between runtime and optimization effort in order to serve as a default pass manager in future releases. While this release doesn't change the default to use level 2 it is a better choice than using level 1 or 3. From f1bc34e517fc7114acb7d451b752d1ef08bc2c6b Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 15 May 2024 21:00:56 +0200 Subject: [PATCH 25/37] Apply suggestions from code review Co-authored-by: Matthew Treinish --- .../1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml | 2 +- .../add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml | 2 +- .../1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml | 2 +- releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml | 2 +- releasenotes/notes/1.1/fixes_10852-e197344c5f44b4f1.yaml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml b/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml index 7272eda325a..54f220a9bb3 100644 --- a/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml +++ b/releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml @@ -5,7 +5,7 @@ features_circuits: :class:`.MCPhaseGate`. - The :meth:`.QuantumCircuit.mcp` function and :class:`.MCPhaseGate` have + The :meth:`.QuantumCircuit.mcp` method and :class:`.MCPhaseGate` class have been updated to include a ``ctrl_state`` parameter. This enhancement allows users to specify the control state of the multi-controlled phase gate. The parameter can accept either an integer value or a bitstring and defaults to diff --git a/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml b/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml index 7d05955b137..60416f67867 100644 --- a/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml +++ b/releasenotes/notes/1.1/add-elide-permutations-to-pipeline-077dad03bd55ab9c.yaml @@ -2,7 +2,7 @@ features_transpiler: - | The transpiler pass :class:`~.ElidePermutations` - runs by default with optimization level 2 and 3. Intuitively, removing + runs by default in the init stage for optimization levels 2 and 3. Intuitively, removing :class:`~.SwapGate`\s and :class:`~qiskit.circuit.library.PermutationGate`\s in a virtual circuit is almost always beneficial, as it makes the circuit shorter and easier to route. As :class:`~.OptimizeSwapBeforeMeasure` is a special case diff --git a/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml b/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml index 9684ae51b4d..8e7298b98bf 100644 --- a/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml +++ b/releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml @@ -4,7 +4,7 @@ features_circuits: Added a new ``ctrl_state`` argument to :meth:`.QuantumCircuit.mcx`. - The :meth:`.QuantumCircuit.mcx` function in the quantum circuit library has + The :meth:`.QuantumCircuit.mcx` method in the quantum circuit library has been enhanced to include a `ctrl_state` parameter, allowing users to specify the control state of the multi-controlled X gate. This parameter can accept either a decimal value or a bitstring and defaults to controlling the '1' diff --git a/releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml b/releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml index ac50c149af8..81ff2e8d048 100644 --- a/releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml +++ b/releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml @@ -45,7 +45,7 @@ features_circuits: A variable is a :class:`.Var` node, which can now contain an arbitrary type, and represents a unique memory location within its live range when added to a circuit. These can be constructed in a circuit using :meth:`.QuantumCircuit.add_var` and :meth:`.QuantumCircuit.add_input`, or - at a lower level using :func:`~.qiskit.circuit.classical.expr.Var.new`. + at a lower level using :func:`.Var.new`. Variables can be manually stored to, using the :class:`.Store` instruction and its corresponding circuit method :meth:`.QuantumCircuit.store`. This includes writing to :class:`.Clbit` and diff --git a/releasenotes/notes/1.1/fixes_10852-e197344c5f44b4f1.yaml b/releasenotes/notes/1.1/fixes_10852-e197344c5f44b4f1.yaml index 91ffde5ce8b..579d244dbb6 100644 --- a/releasenotes/notes/1.1/fixes_10852-e197344c5f44b4f1.yaml +++ b/releasenotes/notes/1.1/fixes_10852-e197344c5f44b4f1.yaml @@ -2,4 +2,4 @@ features_providers: - | The :class:`.BasicSimulator` python-based simulator included in :mod:`~.qiskit.providers.basic_provider` - now includes all the standard gates (:mod:`~.qiskit.circuit.library.standard_gates`) up to 3 qubits. + now supports running all the standard gates up to 3 qubits defined in :mod:`qiskit.circuit.library`. From fd5cf84e679b4cd8c3930e6232d374a9040aaf6f Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Wed, 15 May 2024 21:01:38 +0200 Subject: [PATCH 26/37] Update releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml Co-authored-by: Matthew Treinish --- .../1.1/abstract-commutation-analysis-3518129e91a33599.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml b/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml index 8a05196aca4..c116135bd94 100644 --- a/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml +++ b/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml @@ -7,6 +7,6 @@ features_transpiler: performed on physical circuits. In addition, each operation is now checked for its ability to be cached in the session commutation library. For example, this now enables computing whether :class:`.AnnotatedOperation` commute. This enables transpiler passes that rely on :class:`~.CommutationChecker` internally, - such as :class:`.CommutativeCancellation`, during earlier stages of a default transpilation pipeline + such as :class:`.CommutativeCancellation`, to run during earlier stages of a default transpilation pipeline (prior to basis translation). From e6a69df585f6883fb8d2d6ad4b08877e172cf796 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Thu, 16 May 2024 00:12:48 +0200 Subject: [PATCH 27/37] Update qiskit/primitives/containers/shape.py Co-authored-by: Ian Hincks --- qiskit/primitives/containers/shape.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/qiskit/primitives/containers/shape.py b/qiskit/primitives/containers/shape.py index bb200c64af7..ff4e673ea0a 100644 --- a/qiskit/primitives/containers/shape.py +++ b/qiskit/primitives/containers/shape.py @@ -59,18 +59,18 @@ def __repr__(self): return f"{type(self).__name__}(<{self.shape}>)" @property - def shape(self): - """shape (tuple[int]): The leading shape of every entry in the instance.""" + def shape(self) -> tuple[int, ...]: + """The array shape of this object.""" return self._shape @property - def ndim(self): - """ndim (int): The length of the shape attribute.""" + def ndim(self) -> int: + """The length of the shape attribute.""" return len(self._shape) @property - def size(self): - """size (int): The product of the entries in the shape attribute.""" + def size(self) -> int: + """The product of the entries in the shape attribute.""" return int(np.prod(self._shape, dtype=int)) From 6adc048de63858a82e82b4c2098be667368625f7 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Thu, 16 May 2024 12:27:04 +0200 Subject: [PATCH 28/37] Update shape.py --- qiskit/primitives/containers/shape.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/qiskit/primitives/containers/shape.py b/qiskit/primitives/containers/shape.py index ff4e673ea0a..07a76582a80 100644 --- a/qiskit/primitives/containers/shape.py +++ b/qiskit/primitives/containers/shape.py @@ -60,17 +60,14 @@ def __repr__(self): @property def shape(self) -> tuple[int, ...]: - """The array shape of this object.""" return self._shape @property def ndim(self) -> int: - """The length of the shape attribute.""" return len(self._shape) @property def size(self) -> int: - """The product of the entries in the shape attribute.""" return int(np.prod(self._shape, dtype=int)) From 3ace3ba4dab7409bd48106dfd0156ec3e5ca7533 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Thu, 16 May 2024 14:47:56 +0200 Subject: [PATCH 29/37] Apply suggestions from code review Co-authored-by: Luciano Bello --- releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index b406d00752d..aca33e66cf6 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -16,7 +16,7 @@ prelude: > starts running :class:`.UnitarySynthesis` as part of the optimization stage in optimization level 2 because of these runtime performance improvements. - Additionally, the numeric methods used in :class:`.Isometry` have been moved to rust, + Additionally, the numeric methods used in :class:`.Isometry` have been moved to Rust, enabling large runtime speed-ups in particular for controlled unitary gate synthesis. The decomposition for multi-controlled :class:.XGate` and :class:`.PhaseGate` has been improved resulting in a reduction in the number of gates used in the synthesis by more @@ -39,7 +39,7 @@ prelude: > :class:`~.BackendSamplerV2`, to compliment the existing full statevector based implementations. - * Changes to platform support: python 3.8 is deprecated starting with Qiskit 1.1.0 and will no longer be supported in 1.3.0, + * Changes to platform support: Python 3.8 is deprecated starting with Qiskit 1.1.0 and will no longer be supported in 1.3.0, and arm64 macOS has been promoted to tier 1 support. upgrade_misc: - | @@ -47,6 +47,6 @@ upgrade_misc: a minimum supported version of Windows and implicitly Windows 7, 8, and 8.1 may have worked (but were never tested). But do to Rust 1.78 dropping support for older versions of Windows Qiskit's published binaries on PyPI will not support older versions of Windows in this release. If you're using an older version of Windows - you can likely still build Qiskit from source using an older rust compiler (Qiskit's minimum supported rust + you can likely still build Qiskit from source using an older Rust compiler (Qiskit's minimum supported Rust version for building from source is currently 1.70) but older versions of Windows are not a supported platform and are untested. From e6a76a0de163ee9f92b5d5ac261ff6c8da31e57b Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Thu, 16 May 2024 17:12:21 +0200 Subject: [PATCH 30/37] Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Matthew Treinish --- releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index aca33e66cf6..c60acf5639d 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -32,7 +32,7 @@ prelude: > passes. In particular, the optimization level 2 preset pass manager from :class:`.generate_preset_pass_manager` and used internally by :func:`.transpile` has been refactored to have a better tradeoff between runtime and optimization effort in order to serve as a default pass - manager in future releases. While this release doesn't change the default to use level 2 it is a better + manager in future releases. While this release doesn't change the default to use level 2 it is typically a better choice than using level 1 or 3. * New generic primitive V2 implementations were added, :class:`~.BackendEstimatorV2` and From fa162dcb2e9b09d103c6b04b6ec23394af235cdd Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Thu, 16 May 2024 17:12:31 +0200 Subject: [PATCH 31/37] Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Luciano Bello --- releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index c60acf5639d..8d2a6490e90 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -45,7 +45,7 @@ upgrade_misc: - | The minimum supported version of Windows is now Windows 10. In previous releases we did not explicitly list a minimum supported version of Windows and implicitly Windows 7, 8, and 8.1 may have worked (but were - never tested). But do to Rust 1.78 dropping support for older versions of Windows Qiskit's published binaries + never tested). But due to Rust 1.78 dropping support for older versions of Windows Qiskit's published binaries on PyPI will not support older versions of Windows in this release. If you're using an older version of Windows you can likely still build Qiskit from source using an older Rust compiler (Qiskit's minimum supported Rust version for building from source is currently 1.70) but older versions of Windows are not a supported platform From be333591bfabb1da545542f5e6500bf0518c1ef2 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Thu, 16 May 2024 17:17:49 +0200 Subject: [PATCH 32/37] . --- releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index 8d2a6490e90..63b185fe63f 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -38,7 +38,6 @@ prelude: > * New generic primitive V2 implementations were added, :class:`~.BackendEstimatorV2` and :class:`~.BackendSamplerV2`, to compliment the existing full statevector based implementations. - * Changes to platform support: Python 3.8 is deprecated starting with Qiskit 1.1.0 and will no longer be supported in 1.3.0, and arm64 macOS has been promoted to tier 1 support. upgrade_misc: @@ -46,7 +45,7 @@ upgrade_misc: The minimum supported version of Windows is now Windows 10. In previous releases we did not explicitly list a minimum supported version of Windows and implicitly Windows 7, 8, and 8.1 may have worked (but were never tested). But due to Rust 1.78 dropping support for older versions of Windows Qiskit's published binaries - on PyPI will not support older versions of Windows in this release. If you're using an older version of Windows + on PyPI will not support older versions of Windows starting with this release. If you're using an older version of Windows you can likely still build Qiskit from source using an older Rust compiler (Qiskit's minimum supported Rust version for building from source is currently 1.70) but older versions of Windows are not a supported platform and are untested. From fde8a63a49abc7dcbccc530ce0034b0b8aae0285 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Thu, 16 May 2024 17:30:17 +0200 Subject: [PATCH 33/37] . --- releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml index 63b185fe63f..cbdc387f945 100644 --- a/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -38,6 +38,7 @@ prelude: > * New generic primitive V2 implementations were added, :class:`~.BackendEstimatorV2` and :class:`~.BackendSamplerV2`, to compliment the existing full statevector based implementations. + * Changes to platform support: Python 3.8 is deprecated starting with Qiskit 1.1.0 and will no longer be supported in 1.3.0, and arm64 macOS has been promoted to tier 1 support. upgrade_misc: From 2e749fbe74fe92c4be87ec7c4abe9c6fe0cfb1be Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 16 May 2024 11:56:20 -0400 Subject: [PATCH 34/37] Move and update new fix release notes --- ...yout-duplicate-negative-indices-cf5517921fe52706.yaml | 9 +++++++++ ...arse-pauli-op-apply-layout-zero-43b9e70f0d1536a6.yaml | 0 .../fix-swap-router-layout-f28cf0a2de7976a8.yaml | 0 .../fix-symbolic-unit-scaling-c3eb4d9be674dfd6.yaml | 5 +++-- .../notes/1.1/parallel-check-8186a8f074774a1f.yaml | 8 ++++++++ .../notes/1.1/plot-circuit-layout-5935646107893c12.yaml | 6 ++++++ .../notes/{ => 1.1}/qasm2-bigint-8eff42acb67903e6.yaml | 2 +- ...yout-duplicate-negative-indices-cf5517921fe52706.yaml | 6 ------ releasenotes/notes/parallel-check-8186a8f074774a1f.yaml | 5 ----- .../notes/plot-circuit-layout-5935646107893c12.yaml | 5 ----- 10 files changed, 27 insertions(+), 19 deletions(-) create mode 100644 releasenotes/notes/1.1/fix-apply-layout-duplicate-negative-indices-cf5517921fe52706.yaml rename releasenotes/notes/{ => 1.1}/fix-sparse-pauli-op-apply-layout-zero-43b9e70f0d1536a6.yaml (100%) rename releasenotes/notes/{ => 1.1}/fix-swap-router-layout-f28cf0a2de7976a8.yaml (100%) rename releasenotes/notes/{ => 1.1}/fix-symbolic-unit-scaling-c3eb4d9be674dfd6.yaml (55%) create mode 100644 releasenotes/notes/1.1/parallel-check-8186a8f074774a1f.yaml create mode 100644 releasenotes/notes/1.1/plot-circuit-layout-5935646107893c12.yaml rename releasenotes/notes/{ => 1.1}/qasm2-bigint-8eff42acb67903e6.yaml (89%) delete mode 100644 releasenotes/notes/fix-apply-layout-duplicate-negative-indices-cf5517921fe52706.yaml delete mode 100644 releasenotes/notes/parallel-check-8186a8f074774a1f.yaml delete mode 100644 releasenotes/notes/plot-circuit-layout-5935646107893c12.yaml diff --git a/releasenotes/notes/1.1/fix-apply-layout-duplicate-negative-indices-cf5517921fe52706.yaml b/releasenotes/notes/1.1/fix-apply-layout-duplicate-negative-indices-cf5517921fe52706.yaml new file mode 100644 index 00000000000..1a444b209ac --- /dev/null +++ b/releasenotes/notes/1.1/fix-apply-layout-duplicate-negative-indices-cf5517921fe52706.yaml @@ -0,0 +1,9 @@ +--- +fixes: + - | + Fixed an issue with the :meth:`.SparsePauliOp.apply_layout` and + :meth:`.Pauli.apply_layout` methods when an invalid array with duplicate + or negative indices were passed in for the ``layout`` argument. Previously + this wouldn't result in an error and the transformation performed would + not be valid. These methods will now raise a :exc:`.QiskitError` if + duplicate indices or negative indices are provided as part of a layout. diff --git a/releasenotes/notes/fix-sparse-pauli-op-apply-layout-zero-43b9e70f0d1536a6.yaml b/releasenotes/notes/1.1/fix-sparse-pauli-op-apply-layout-zero-43b9e70f0d1536a6.yaml similarity index 100% rename from releasenotes/notes/fix-sparse-pauli-op-apply-layout-zero-43b9e70f0d1536a6.yaml rename to releasenotes/notes/1.1/fix-sparse-pauli-op-apply-layout-zero-43b9e70f0d1536a6.yaml diff --git a/releasenotes/notes/fix-swap-router-layout-f28cf0a2de7976a8.yaml b/releasenotes/notes/1.1/fix-swap-router-layout-f28cf0a2de7976a8.yaml similarity index 100% rename from releasenotes/notes/fix-swap-router-layout-f28cf0a2de7976a8.yaml rename to releasenotes/notes/1.1/fix-swap-router-layout-f28cf0a2de7976a8.yaml diff --git a/releasenotes/notes/fix-symbolic-unit-scaling-c3eb4d9be674dfd6.yaml b/releasenotes/notes/1.1/fix-symbolic-unit-scaling-c3eb4d9be674dfd6.yaml similarity index 55% rename from releasenotes/notes/fix-symbolic-unit-scaling-c3eb4d9be674dfd6.yaml rename to releasenotes/notes/1.1/fix-symbolic-unit-scaling-c3eb4d9be674dfd6.yaml index 5ca00904a9a..9aa371318bd 100644 --- a/releasenotes/notes/fix-symbolic-unit-scaling-c3eb4d9be674dfd6.yaml +++ b/releasenotes/notes/1.1/fix-symbolic-unit-scaling-c3eb4d9be674dfd6.yaml @@ -2,7 +2,8 @@ fixes: - | Fixed a floating-point imprecision when scaling certain pulse units - between seconds and nanoseconds. If the pulse was symbolically defined, + between seconds and nanoseconds. If the pulse was symbolically defined, an unnecessary floating-point error could be introduced by the scaling for certain builds of ``symengine``, which could manifest in unexpected - results once the symbols were fully bound. See `#12392 `__. + results once the symbols were fully bound. + Fixed `#12392 `__. diff --git a/releasenotes/notes/1.1/parallel-check-8186a8f074774a1f.yaml b/releasenotes/notes/1.1/parallel-check-8186a8f074774a1f.yaml new file mode 100644 index 00000000000..8c011c7a9e4 --- /dev/null +++ b/releasenotes/notes/1.1/parallel-check-8186a8f074774a1f.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Fixed a performance issue in :meth:`.PassManager.run` when it is running + over multiple circuits in parallel. It will no longer spend time + serializing the :class:`~.passmanager.PassManager` (which is a requirement for parallel + execution) when given multiple inputs if it is only going to process the + inputs serially. diff --git a/releasenotes/notes/1.1/plot-circuit-layout-5935646107893c12.yaml b/releasenotes/notes/1.1/plot-circuit-layout-5935646107893c12.yaml new file mode 100644 index 00000000000..3a89bf6392f --- /dev/null +++ b/releasenotes/notes/1.1/plot-circuit-layout-5935646107893c12.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixed a bug in :func:`plot_coupling_map` that caused the edges of the + coupling map to be colored incorrectly. + Fixed `#12369 `__. diff --git a/releasenotes/notes/qasm2-bigint-8eff42acb67903e6.yaml b/releasenotes/notes/1.1/qasm2-bigint-8eff42acb67903e6.yaml similarity index 89% rename from releasenotes/notes/qasm2-bigint-8eff42acb67903e6.yaml rename to releasenotes/notes/1.1/qasm2-bigint-8eff42acb67903e6.yaml index 2fb1b4dcc5a..bc234729eae 100644 --- a/releasenotes/notes/qasm2-bigint-8eff42acb67903e6.yaml +++ b/releasenotes/notes/1.1/qasm2-bigint-8eff42acb67903e6.yaml @@ -4,6 +4,6 @@ fixes: The OpenQASM 2.0 parser (:func:`.qasm2.load` and :func:`.qasm2.loads`) can now evaluate gate-angle expressions including integer operands that would overflow the system-size integer. These will be evaluated in a double-precision floating-point context, just like the rest of the - expression always has been. Beware: an arbitrarily large integer will not necessarily be + expression always has been. However, an arbitrarily large integer will not necessarily be exactly representable in double-precision floating-point, so there is a chance that however the circuit was generated, it had already lost all numerical precision modulo :math:`2\pi`. diff --git a/releasenotes/notes/fix-apply-layout-duplicate-negative-indices-cf5517921fe52706.yaml b/releasenotes/notes/fix-apply-layout-duplicate-negative-indices-cf5517921fe52706.yaml deleted file mode 100644 index 9fbe0ffd9c7..00000000000 --- a/releasenotes/notes/fix-apply-layout-duplicate-negative-indices-cf5517921fe52706.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -fixes: - - | - Fixed :meth:`.SparsePauliOp.apply_layout` and :meth:`.Pauli.apply_layout` - to raise :exc:`.QiskitError` if duplicate indices or negative indices are provided - as part of a layout. diff --git a/releasenotes/notes/parallel-check-8186a8f074774a1f.yaml b/releasenotes/notes/parallel-check-8186a8f074774a1f.yaml deleted file mode 100644 index d3266b2aa5f..00000000000 --- a/releasenotes/notes/parallel-check-8186a8f074774a1f.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -fixes: - - | - :meth:`.PassManager.run` will no longer waste time serializing itself when given multiple inputs - if it is only going to work in serial. diff --git a/releasenotes/notes/plot-circuit-layout-5935646107893c12.yaml b/releasenotes/notes/plot-circuit-layout-5935646107893c12.yaml deleted file mode 100644 index 72f2c95962a..00000000000 --- a/releasenotes/notes/plot-circuit-layout-5935646107893c12.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -fixes: - - | - Fixed a bug in :func:`plot_coupling_map` that caused the edges of the coupling map to be colored incorrectly. - See https://github.com/Qiskit/qiskit/pull/12369 for details. From e873ae9a146ae0b89bae5432798b6fc8e2cdfaea Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 16 May 2024 12:43:45 -0400 Subject: [PATCH 35/37] Small tweaks --- .../notes/1.1/fix-qdrift-evolution-bceb9c4f182ab0f5.yaml | 5 ++++- .../1.1/operator-from-circuit-bugfix-5dab5993526a2b0a.yaml | 2 +- .../1.1/show_idle_and_show_barrier-6e77e1f9d6f55599.yaml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/releasenotes/notes/1.1/fix-qdrift-evolution-bceb9c4f182ab0f5.yaml b/releasenotes/notes/1.1/fix-qdrift-evolution-bceb9c4f182ab0f5.yaml index a86869a4e54..69559b3e9ba 100644 --- a/releasenotes/notes/1.1/fix-qdrift-evolution-bceb9c4f182ab0f5.yaml +++ b/releasenotes/notes/1.1/fix-qdrift-evolution-bceb9c4f182ab0f5.yaml @@ -1,3 +1,6 @@ fixes: - | - Fix incorrect implemention of `qDRIFT`, negative coeffients of the Hamiltonian are now added back whereas they were always forced to be positive. + Fix an issue in the :class:`.QDrift` class where the coefficients of the + Hamiltonian were previously force to be positive by taking the absolute + value of each coefficient. This has been corrected so that the negative + coeffients' signs are added back. diff --git a/releasenotes/notes/1.1/operator-from-circuit-bugfix-5dab5993526a2b0a.yaml b/releasenotes/notes/1.1/operator-from-circuit-bugfix-5dab5993526a2b0a.yaml index 759f023efc8..213f12425c6 100644 --- a/releasenotes/notes/1.1/operator-from-circuit-bugfix-5dab5993526a2b0a.yaml +++ b/releasenotes/notes/1.1/operator-from-circuit-bugfix-5dab5993526a2b0a.yaml @@ -2,6 +2,6 @@ fixes: - | Fixed an issue with the :meth:`.Operator.from_circuit` constructor method where it would incorrectly - interpret the final layout permutation resulting in an invalid `Operator` being constructed. + interpret the final layout permutation resulting in an invalid :class:`.Operator` being constructed. Previously, the final layout was processed without regards for the initial layout, i.e. the initialization was incorrect for all quantum circuits that have a non-trivial initial layout. diff --git a/releasenotes/notes/1.1/show_idle_and_show_barrier-6e77e1f9d6f55599.yaml b/releasenotes/notes/1.1/show_idle_and_show_barrier-6e77e1f9d6f55599.yaml index ac0994b9d3a..00a6a4b1df9 100644 --- a/releasenotes/notes/1.1/show_idle_and_show_barrier-6e77e1f9d6f55599.yaml +++ b/releasenotes/notes/1.1/show_idle_and_show_barrier-6e77e1f9d6f55599.yaml @@ -1,5 +1,5 @@ --- -deprecations: +deprecations_visualization: - | The parameters ``show_idle`` and ``show_barrier`` in the timeline drawers had been replaced by ``idle_wires`` and ``plot_barriers`` respectively to match the circuit drawer parameters. Their previous names are now deprecated and will be removed in the next major From 6ec3efee8ea9d46d73f005abe08f0e68c79069f0 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Thu, 16 May 2024 12:48:15 -0400 Subject: [PATCH 36/37] Remove fix note for private API --- .../notes/1.1/fix-pub-coerce-5d13700e15126421.yaml | 8 -------- .../notes/1.1/obs-array-coerce-0d-28b192fb3d004d4a.yaml | 6 ------ 2 files changed, 14 deletions(-) delete mode 100644 releasenotes/notes/1.1/fix-pub-coerce-5d13700e15126421.yaml delete mode 100644 releasenotes/notes/1.1/obs-array-coerce-0d-28b192fb3d004d4a.yaml diff --git a/releasenotes/notes/1.1/fix-pub-coerce-5d13700e15126421.yaml b/releasenotes/notes/1.1/fix-pub-coerce-5d13700e15126421.yaml deleted file mode 100644 index 5900aff0d6b..00000000000 --- a/releasenotes/notes/1.1/fix-pub-coerce-5d13700e15126421.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- - -fixes: - - | - Fixed a bug where :meth:`~.qiskit.primitives.containers.estimator_pub.EstimatorPub.coerce` and - :meth:`~.qiskit.primitives.containers.sampler_pub.SamplerPub.coerce` - improperly handle the case where the parameter values are a :class:`.BindingsArray` instance, giving - rise to a :class:`.ValueError` whenever it is attempted. diff --git a/releasenotes/notes/1.1/obs-array-coerce-0d-28b192fb3d004d4a.yaml b/releasenotes/notes/1.1/obs-array-coerce-0d-28b192fb3d004d4a.yaml deleted file mode 100644 index bf2cd5efc96..00000000000 --- a/releasenotes/notes/1.1/obs-array-coerce-0d-28b192fb3d004d4a.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -fixes: - - | - Fixed :meth:`~qiskit.primitives.containers.observables_array.ObservablesArray.coerce` - so that it returns a 0-d array when the input is a single, unnested observable. - Previously, it erroneously upgraded to a single dimension, with shape `(1,)`. From 6199cc51b1733063f05d65e830c53b6044839e23 Mon Sep 17 00:00:00 2001 From: Jake Lishman Date: Thu, 16 May 2024 18:31:55 +0100 Subject: [PATCH 37/37] Add release notes for manual `Var` and `Store` (#12421) * Add release notes for manual `Var` and `Store` This adds the release notes and updates some small portions of documentation that were previously missed surrounding the new manual `Var` storage locations. This includes documenting all new keyword arguments to methods, upgrade instructions for providers, and adding the `Var.new` method to the documentation, which was previously erroneously omitted. * Fix Sphinx typo * Fix another Sphinx typo * Move QPY version bump to upgrade * Unify base release note * Reword providers upgrade note Co-authored-by: Matthew Treinish --------- Co-authored-by: Matthew Treinish (cherry picked from commit 554e661ee62ba6db1cfcbef0fabd98a1659a1641) --- qiskit/providers/__init__.py | 39 +++++- .../1.1/classical-store-e64ee1286219a862.yaml | 13 ++ .../1.1/storage-var-a00a33fcf9a71f3f.yaml | 122 ++++++++++++++++++ 3 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/1.1/storage-var-a00a33fcf9a71f3f.yaml diff --git a/qiskit/providers/__init__.py b/qiskit/providers/__init__.py index b0ebc942523..6736d67a214 100644 --- a/qiskit/providers/__init__.py +++ b/qiskit/providers/__init__.py @@ -452,8 +452,45 @@ def get_translation_stage_plugin(self): efficient output on ``Mybackend`` the transpiler will be able to perform these custom steps without any manual user input. +.. _providers-guide-real-time-variables: + +Real-time variables +^^^^^^^^^^^^^^^^^^^ + +The transpiler will automatically handle real-time typed classical variables (see +:mod:`qiskit.circuit.classical`) and treat the :class:`.Store` instruction as a built-in +"directive", similar to :class:`.Barrier`. No special handling from backends is necessary to permit +this. + +If your backend is *unable* to handle classical variables and storage, we recommend that you comment +on this in your documentation, and insert a check into your :meth:`~.BackendV2.run` method (see +:ref:`providers-guide-backend-run`) to eagerly reject circuits containing them. You can examine +:attr:`.QuantumCircuit.num_vars` for the presence of variables at the top level. If you accept +:ref:`control-flow operations `, you might need to recursively search the +internal :attr:`~.ControlFlowOp.blocks` of each for scope-local variables with +:attr:`.QuantumCircuit.num_declared_vars`. + +For example, a function to check for the presence of any manual storage locations, or manual stores +to memory:: + + from qiskit.circuit import Store, ControlFlowOp, QuantumCircuit + + def has_realtime_logic(circuit: QuantumCircuit) -> bool: + if circuit.num_vars: + return True + for instruction in circuit.data: + if isinstance(instruction.operation, Store): + return True + elif isinstance(instruction.operation, ControlFlowOp): + for block in instruction.operation.blocks: + if has_realtime_logic(block): + return True + return False + +.. _providers-guide-backend-run: + Backend.run Method --------------------- +------------------ Of key importance is the :meth:`~qiskit.providers.BackendV2.run` method, which is used to actually submit circuits to a device or simulator. The run method diff --git a/releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml b/releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml index 81ff2e8d048..7222f538bc3 100644 --- a/releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml +++ b/releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml @@ -54,3 +54,16 @@ features_circuits: Variables can be used wherever classical expressions (see :mod:`qiskit.circuit.classical.expr`) are valid. Currently this is the target expressions of control-flow operations, though we plan to expand this to gate parameters in the future, as the type and expression system are expanded. + + See :ref:`circuit-repr-real-time-classical` for more discussion of these variables, and the + associated data model. + + These are supported throughout the transpiler, through QPY serialization (:mod:`qiskit.qpy`), + OpenQASM 3 export (:mod:`qiskit.qasm3`), and have initial support through the circuit visualizers + (see :meth:`.QuantumCircuit.draw`). + + .. note:: + + The new classical variables and storage will take some time to become supported on hardware + and simulator backends. They are not supported in the primitives interfaces + (:mod:`qiskit.primitives`), but will likely inform those interfaces as they evolve. diff --git a/releasenotes/notes/1.1/storage-var-a00a33fcf9a71f3f.yaml b/releasenotes/notes/1.1/storage-var-a00a33fcf9a71f3f.yaml new file mode 100644 index 00000000000..b3b18be2fc1 --- /dev/null +++ b/releasenotes/notes/1.1/storage-var-a00a33fcf9a71f3f.yaml @@ -0,0 +1,122 @@ +--- +features_circuits: + - | + :class:`.QuantumCircuit` has several new methods to work with and inspect manual :class:`.Var` + variables. + + See :ref:`circuit-real-time-methods` for more in-depth discussion on all of these. + + The new methods are: + + * :meth:`~.QuantumCircuit.add_var` + * :meth:`~.QuantumCircuit.add_input` + * :meth:`~.QuantumCircuit.add_capture` + * :meth:`~.QuantumCircuit.add_uninitialized_var` + * :meth:`~.QuantumCircuit.get_var` + * :meth:`~.QuantumCircuit.has_var` + * :meth:`~.QuantumCircuit.iter_vars` + * :meth:`~.QuantumCircuit.iter_declared_vars` + * :meth:`~.QuantumCircuit.iter_captured_vars` + * :meth:`~.QuantumCircuit.iter_input_vars` + * :meth:`~.QuantumCircuit.store` + + In addition, there are several new dynamic attributes on :class:`.QuantumCircuit` surrounding + these variables: + + * :attr:`~.QuantumCircuit.num_vars` + * :attr:`~.QuantumCircuit.num_input_vars` + * :attr:`~.QuantumCircuit.num_captured_vars` + * :attr:`~.QuantumCircuit.num_declared_vars` + - | + :class:`.ControlFlowOp` and its subclasses now have a :meth:`~.ControlFlowOp.iter_captured_vars` + method, which will return an iterator over the unique variables captured in any of its immediate + blocks. + - | + :class:`.DAGCircuit` has several new methods to work with and inspect manual :class:`.Var` + variables. These are largely equivalent to their :class:`.QuantumCircuit` counterparts, except + that the :class:`.DAGCircuit` ones are optimized for programmatic access with already defined + objects, while the :class:`.QuantumCircuit` methods are more focussed on interactive human use. + + The new methods are: + + * :meth:`~.DAGCircuit.add_input_var` + * :meth:`~.DAGCircuit.add_captured_var` + * :meth:`~.DAGCircuit.add_declared_var` + * :meth:`~.DAGCircuit.has_var` + * :meth:`~.DAGCircuit.iter_vars` + * :meth:`~.DAGCircuit.iter_declared_vars` + * :meth:`~.DAGCircuit.iter_captured_vars` + * :meth:`~.DAGCircuit.iter_input_vars` + + There are also new public attributes: + + * :attr:`~.DAGCircuit.num_vars` + * :attr:`~.DAGCircuit.num_input_vars` + * :attr:`~.DAGCircuit.num_captured_vars` + * :attr:`~.DAGCircuit.num_declared_vars` + - | + :attr:`.DAGCircuit.wires` will now also contain any :class:`.Var` manual variables in the + circuit as well, as these are also classical data flow. + - | + A new method, :meth:`.Var.new`, is added to manually construct a real-time classical variable + that owns its memory. + - | + :meth:`.QuantumCircuit.compose` has two need keyword arguments, ``var_remap`` and ``inline_captures`` + to better support real-time classical variables. + + ``var_remap`` can be used to rewrite :class:`.Var` nodes in the circuit argument as its + instructions are inlined onto the base circuit. This can be used to avoid naming conflicts. + + ``inline_captures`` can be set to ``True`` (defaults to ``False``) to link all :class:`.Var` + nodes tracked as "captures" in the argument circuit with the same :class:`.Var` nodes in the + base circuit, without attempting to redeclare the variables. This can be used, in combination + with :meth:`.QuantumCircuit.copy_empty_like`'s ``vars_mode="captures"`` handling, to build up + a circuit layer by layer, containing variables. + - | + :meth:`.DAGCircuit.compose` has a new keyword argument, ``inline_captures``, which can be set to + ``True`` to inline "captured" :class:`.Var` nodes on the argument circuit onto the base circuit + without redeclaring them. In conjunction with the ``vars_mode="captures"`` option to several + :class:`.DAGCircuit` methods, this can be used to combine DAGs that operate on the same variables. + - | + :meth:`.QuantumCircuit.copy_empty_like` and :meth:`.DAGCircuit.copy_empty_like` have a new + keyword argument, ``vars_mode`` which controls how any memory-owning :class:`.Var` nodes are + tracked in the output. By default (``"alike"``), the variables are declared in the same + input/captured/local mode as the source. This can be set to ``"captures"`` to convert all + variables to captures (useful with :meth:`~.QuantumCircuit.compose`) or ``"drop"`` to remove + them. + - | + A new ``vars_mode`` keyword argument has been added to the :class:`.DAGCircuit` methods: + + * :meth:`~.DAGCircuit.separable_circuits` + * :meth:`~.DAGCircuit.layers` + * :meth:`~.DAGCircuit.serial_layers` + + which has the same meaning as it does for :meth:`~.DAGCircuit.copy_empty_like`. +features_qasm: + - | + The OpenQASM 3 exporter supports manual-storage :class:`.Var` nodes on circuits. +features_qpy: + - | + QPY (:mod:`qiskit.qpy`) format version 12 has been added, which includes support for memory-owning + :class:`.Var` variables. See :ref:`qpy_version_12` for more detail on the format changes. +features_visualization: + - | + The text and `Matplotlib `__ circuit drawers (:meth:`.QuantumCircuit.draw`) + have minimal support for displaying expressions involving manual real-time variables. The + :class:`.Store` operation and the variable initializations are not yet supported; for large-scale + dynamic circuits, we recommend using the OpenQASM 3 export capabilities (:func:`.qasm3.dumps`) to + get a textual representation of a circuit. +upgrade_qpy: + - | + The value of :attr:`qiskit.qpy.QPY_VERSION` is now 12. :attr:`.QPY_COMPATIBILITY_VERSION` is + unchanged at 10. +upgrade_providers: + - | + Implementations of :class:`.BackendV2` (and :class:`.BackendV1`) may desire to update their + :meth:`~.BackendV2.run` methods to eagerly reject inputs containing typed + classical variables (see :mod:`qiskit.circuit.classical`) and the :class:`.Store` instruction, + if they do not have support for them. The new :class:`.Store` instruction is treated by the + transpiler as an always-available "directive" (like :class:`.Barrier`); if your backends do not + support this won't be caught by the :mod:`~qiskit.transpiler`. + + See :ref:`providers-guide-real-time-variables` for more information.