From 7d29dc1b33ab0229bc77ab773b8d2f7fd2589552 Mon Sep 17 00:00:00 2001 From: Sebastian Brandhofer <148463728+sbrandhsn@users.noreply.github.com> Date: Thu, 16 May 2024 21:15:32 +0200 Subject: [PATCH] Prepare 1.1.0 release (#12371) This commit prepares the repo for the 1.1.0 release. It updates the version numbers to indicate it is the final 1.1.0 release, and updates the release notes to prepare them for publishing. Once this merges this commit should be used to tag the 1.1.0 release. * draft 1.1.0 * fixes text/typos * . * . * Update releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Ian Hincks * up * up * Update releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml Co-authored-by: Matthew Treinish * prelude - add platform support * prelude update * Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/added-parameter-ctrl_state-mcx-816dcd80e459a5ed.yaml Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/add-annotated-arg-to-power-4afe90e89fa50f5a.yaml Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/add-ctrl_state-mcp-parameter-b23562aa7047665a.yaml Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Matthew Treinish * comments from code review * Apply suggestions from code review Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml Co-authored-by: Matthew Treinish * Update qiskit/primitives/containers/shape.py Co-authored-by: Ian Hincks * Update shape.py * Apply suggestions from code review Co-authored-by: Luciano Bello * Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Matthew Treinish * Update releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml Co-authored-by: Luciano Bello * . * . * Move and update new fix release notes * Small tweaks * Remove fix note for private API * 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) --------- Co-authored-by: Matthew Treinish Co-authored-by: Ian Hincks Co-authored-by: Luciano Bello Co-authored-by: Jake Lishman --- docs/conf.py | 2 +- docs/release_notes.rst | 2 +- qiskit/VERSION.txt | 2 +- qiskit/circuit/classical/expr/__init__.py | 2 +- qiskit/primitives/__init__.py | 16 +- qiskit/primitives/containers/__init__.py | 1 + qiskit/primitives/containers/bit_array.py | 1 + qiskit/primitives/containers/shape.py | 6 +- qiskit/providers/__init__.py | 39 +++- .../1.0/primitives-v2-df871c0c6ac0b94a.yaml | 177 ------------------ ...commutation-analysis-3518129e91a33599.yaml | 16 +- ...notated-arg-to-power-4afe90e89fa50f5a.yaml | 14 +- ...backend-estimator-v2-26cf14a3612bb81a.yaml | 2 +- ...d-backend-sampler-v2-5e40135781eebc7f.yaml | 2 +- ..._state-mcp-parameter-b23562aa7047665a.yaml | 12 +- ...utations-to-pipeline-077dad03bd55ab9c.yaml | 7 +- .../1.1/add-elide-swaps-b0a4c373c9af1efd.yaml | 4 +- ...inear-plugin-options-b8a0ffe70dfe1676.yaml | 2 +- ...n-all-plugins-option-ba8806a269e5713c.yaml | 58 +++--- ...meter-ctrl_state-mcx-816dcd80e459a5ed.yaml | 8 +- .../1.1/classical-store-e64ee1286219a862.yaml | 17 +- ...utation-checker-utf8-47b13b78a40af196.yaml | 4 +- ...n-preset-passmanager-c137ce516a10eae5.yaml | 4 +- ...databin-construction-72ec041075410cb2.yaml | 22 ++- ...deprecate_providerV1-ba17d7b4639d1cc5.yaml | 2 +- .../faster-lie-trotter-ba8f6dd84fe4cae4.yaml | 4 +- ...ate-negative-indices-cf5517921fe52706.yaml | 9 + ...-flow-fold-minus-one-f2af168a5313385f.yaml | 2 +- ...ulse-qobj-conversion-5d6041b36356cfd1.yaml | 2 +- .../1.1/fix-pub-coerce-5d13700e15126421.yaml | 8 - ...er-default-alingment-52f81224d90c21e2.yaml | 2 +- ...-parameter-formatter-2ee3fb91efb2794c.yaml | 4 +- ...fix-qdrift-evolution-bceb9c4f182ab0f5.yaml | 5 +- ...fix-scheduling-units-59477912b47d3dc1.yaml | 2 +- ...op-apply-layout-zero-43b9e70f0d1536a6.yaml | 0 ...x-swap-router-layout-f28cf0a2de7976a8.yaml | 0 ...ymbolic-unit-scaling-c3eb4d9be674dfd6.yaml | 5 +- .../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 - ...-from-circuit-bugfix-5dab5993526a2b0a.yaml | 2 +- ...-conjugate-reduction-656438d3642f27dc.yaml | 10 +- .../1.1/parallel-check-8186a8f074774a1f.yaml | 8 + .../parameter-hash-eq-645f9de55aa78d02.yaml | 2 +- ..._for_pulse_schedules-3a27bbbbf235fb9e.yaml | 4 +- .../pauli-apply-layout-cdcbc1bce724a150.yaml | 56 +++--- .../plot-circuit-layout-5935646107893c12.yaml | 6 + .../1.1/prepare-1.1.0-732e167b70ab4d01.yaml | 52 +++++ .../qasm2-bigint-8eff42acb67903e6.yaml | 2 +- .../remove-final-reset-488247c01c4e147d.yaml | 2 +- ...nst-durations-passes-28c78401682e22c0.yaml | 12 +- ...dle_and_show_barrier-6e77e1f9d6f55599.yaml | 2 +- .../1.1/spo-to-matrix-26445a791e24f62a.yaml | 2 +- .../1.1/star-prerouting-0998b59880c20cef.yaml | 58 +++--- .../1.1/storage-var-a00a33fcf9a71f3f.yaml | 122 ++++++++++++ ...ate-negative-indices-cf5517921fe52706.yaml | 6 - .../parallel-check-8186a8f074774a1f.yaml | 5 - .../plot-circuit-layout-5935646107893c12.yaml | 5 - 60 files changed, 457 insertions(+), 382 deletions(-) delete mode 100644 releasenotes/notes/1.0/primitives-v2-df871c0c6ac0b94a.yaml create mode 100644 releasenotes/notes/1.1/fix-apply-layout-duplicate-negative-indices-cf5517921fe52706.yaml delete mode 100644 releasenotes/notes/1.1/fix-pub-coerce-5d13700e15126421.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%) delete mode 100644 releasenotes/notes/1.1/obs-array-coerce-0d-28b192fb3d004d4a.yaml create mode 100644 releasenotes/notes/1.1/parallel-check-8186a8f074774a1f.yaml create mode 100644 releasenotes/notes/1.1/plot-circuit-layout-5935646107893c12.yaml create mode 100644 releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml rename releasenotes/notes/{ => 1.1}/qasm2-bigint-8eff42acb67903e6.yaml (89%) create mode 100644 releasenotes/notes/1.1/storage-var-a00a33fcf9a71f3f.yaml 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/docs/conf.py b/docs/conf.py index 7081b7d4ed9a..f2b16b77f221 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 fddd907195fc..37e1127c5d8b 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 686366e4bb8a..9084fa2f716a 100644 --- a/qiskit/VERSION.txt +++ b/qiskit/VERSION.txt @@ -1 +1 @@ -1.1.0rc1 +1.1.0 diff --git a/qiskit/circuit/classical/expr/__init__.py b/qiskit/circuit/classical/expr/__init__.py index c0057ca96f02..00f1c2e06767 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/qiskit/primitives/__init__.py b/qiskit/primitives/__init__.py index 2423f3545f80..98d4ea481a18 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 62fb49a3fb91..02c090530f37 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 24d52ca4e85a..0702e5f210ed 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/qiskit/primitives/containers/shape.py b/qiskit/primitives/containers/shape.py index 6d893f46c13f..07a76582a800 100644 --- a/qiskit/primitives/containers/shape.py +++ b/qiskit/primitives/containers/shape.py @@ -59,15 +59,15 @@ def __repr__(self): return f"{type(self).__name__}(<{self.shape}>)" @property - def shape(self): + def shape(self) -> tuple[int, ...]: return self._shape @property - def ndim(self): + def ndim(self) -> int: return len(self._shape) @property - def size(self): + def size(self) -> int: return int(np.prod(self._shape, dtype=int)) diff --git a/qiskit/providers/__init__.py b/qiskit/providers/__init__.py index b0ebc942523c..6736d67a214b 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.0/primitives-v2-df871c0c6ac0b94a.yaml b/releasenotes/notes/1.0/primitives-v2-df871c0c6ac0b94a.yaml deleted file mode 100644 index f34e1b6a3234..000000000000 --- 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/abstract-commutation-analysis-3518129e91a33599.yaml b/releasenotes/notes/1.1/abstract-commutation-analysis-3518129e91a33599.yaml index eee58d4305a6..c116135bd941 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: +features_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, - such as :class:`.CommutativeCancellation`, during earlier stages of a default transpilation pipeline + 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`, to run 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 95537833b6d4..15801b6c2003 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,17 +1,19 @@ --- -features: +features_circuits: - | - The methods :meth:`~qiskit.circuit.QuantumCircuit.power`, - :meth:`~qiskit.circuit.Gate.power`, as well as the similar methods + The methods :meth:`.QuantumCircuit.power`, + :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, 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 c8ac782f4ba6..e032e3ddd16e 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 9cd9002a77be..bb5147c2dcea 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 10a5e1065180..54f220a9bb30 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,20 +1,20 @@ --- -features: +features_circuits: - | - Added ``ctrl_state`` parameter to :func:`QuantumCircuit.mcp()` and - :class:`MCPhaseGate()`. + Added a new ``ctrl_state`` argument to :meth:`.QuantumCircuit.mcp` and + :class:`.MCPhaseGate`. - The :func:`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 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. .. 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 ddc35ddcb987..60416f678672 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,9 +1,10 @@ --- -features: +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 - 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/add-elide-swaps-b0a4c373c9af1efd.yaml b/releasenotes/notes/1.1/add-elide-swaps-b0a4c373c9af1efd.yaml index a8da2921990a..fbf1e5f75a60 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 @@ -38,4 +38,4 @@ features: 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-linear-plugin-options-b8a0ffe70dfe1676.yaml b/releasenotes/notes/1.1/add-linear-plugin-options-b8a0ffe70dfe1676.yaml index efd0453ca464..7e6183ac5e36 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: +features_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 2ab34c61fb35..7beab3fefbe3 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"``. @@ -14,37 +14,39 @@ features: 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: - 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 + .. code-block:: python - # 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 - # 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(), - ) + # 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]) - # synthesize - qct = HighLevelSynthesis(hls_config=hls_config)(qc) + # 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) 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 cd5cf651970a..8e7298b98bf7 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: +features_circuits: - | - Added `ctrl_state` parameter to :func:`QuantumCircuit.mcx()`. + Added a new ``ctrl_state`` argument to :meth:`.QuantumCircuit.mcx`. - The :func:`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' @@ -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/classical-store-e64ee1286219a862.yaml b/releasenotes/notes/1.1/classical-store-e64ee1286219a862.yaml index 9de8affebe49..7222f538bc3a 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:`.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 @@ -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/commutation-checker-utf8-47b13b78a40af196.yaml b/releasenotes/notes/1.1/commutation-checker-utf8-47b13b78a40af196.yaml index 1b6e8c6c25b1..aaa6a3549faf 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/commutative-cancellation-preset-passmanager-c137ce516a10eae5.yaml b/releasenotes/notes/1.1/commutative-cancellation-preset-passmanager-c137ce516a10eae5.yaml index 2c1698ef3e9a..0f8d569eaa65 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 a9dbd60298fc..01bcb62158cc 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:`.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 :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 :func:`.make_data_bin`. diff --git a/releasenotes/notes/1.1/deprecate_providerV1-ba17d7b4639d1cc5.yaml b/releasenotes/notes/1.1/deprecate_providerV1-ba17d7b4639d1cc5.yaml index bfec8ef89041..479de23fd07e 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 2ca02d6f69f0..570557a182e7 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-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 000000000000..1a444b209ac6 --- /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/1.1/fix-control-flow-fold-minus-one-f2af168a5313385f.yaml b/releasenotes/notes/1.1/fix-control-flow-fold-minus-one-f2af168a5313385f.yaml index 5f8567da70e2..de2d04adf3eb 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 b3fd0e980045..30b83ee31111 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-pub-coerce-5d13700e15126421.yaml b/releasenotes/notes/1.1/fix-pub-coerce-5d13700e15126421.yaml deleted file mode 100644 index 0d7386b345e7..000000000000 --- a/releasenotes/notes/1.1/fix-pub-coerce-5d13700e15126421.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- - -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 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 b8d775e82a21..0ec881b4b1fe 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 e4749646e1d6..774d12f0969d 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 `qiskit/#11971 `__ for details. + See `#11971 `__ for details. diff --git a/releasenotes/notes/1.1/fix-qdrift-evolution-bceb9c4f182ab0f5.yaml b/releasenotes/notes/1.1/fix-qdrift-evolution-bceb9c4f182ab0f5.yaml index a86869a4e540..69559b3e9bac 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/fix-scheduling-units-59477912b47d3dc1.yaml b/releasenotes/notes/1.1/fix-scheduling-units-59477912b47d3dc1.yaml index 72f4b46fc739..6d1456d85051 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/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 5ca00904a9ae..9aa371318bde 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/fixes_10852-e197344c5f44b4f1.yaml b/releasenotes/notes/1.1/fixes_10852-e197344c5f44b4f1.yaml index 755403d98a32..579d244dbb6b 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 supports running all the standard gates up to 3 qubits defined in :mod:`qiskit.circuit.library`. diff --git a/releasenotes/notes/1.1/fixes_11212-d6de3c007ce6d697.yaml b/releasenotes/notes/1.1/fixes_11212-d6de3c007ce6d697.yaml index 32314b506922..ce5717762d18 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 39ee7434509a..da1bc35a73a2 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 3595f2f936bd..eeff3c503776 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 deleted file mode 100644 index 987709d36e2a..000000000000 --- a/releasenotes/notes/1.1/obs-array-coerce-0d-28b192fb3d004d4a.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -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 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 759f023efc87..213f12425c6d 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/optimize-annotated-conjugate-reduction-656438d3642f27dc.yaml b/releasenotes/notes/1.1/optimize-annotated-conjugate-reduction-656438d3642f27dc.yaml index 231f0e7c8f3e..519ac5d0f407 100644 --- a/releasenotes/notes/1.1/optimize-annotated-conjugate-reduction-656438d3642f27dc.yaml +++ b/releasenotes/notes/1.1/optimize-annotated-conjugate-reduction-656438d3642f27dc.yaml @@ -1,16 +1,16 @@ -features: +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/parallel-check-8186a8f074774a1f.yaml b/releasenotes/notes/1.1/parallel-check-8186a8f074774a1f.yaml new file mode 100644 index 000000000000..8c011c7a9e44 --- /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/parameter-hash-eq-645f9de55aa78d02.yaml b/releasenotes/notes/1.1/parameter-hash-eq-645f9de55aa78d02.yaml index f134de5f00fa..6b345a9b976a 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/parameter_assignment_by_name_for_pulse_schedules-3a27bbbbf235fb9e.yaml b/releasenotes/notes/1.1/parameter_assignment_by_name_for_pulse_schedules-3a27bbbbf235fb9e.yaml index 551ea9e918c6..4f1f74d23bbe 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 f3f69ce5cb19..0463e8e8ce92 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` 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 - 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 + :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/plot-circuit-layout-5935646107893c12.yaml b/releasenotes/notes/1.1/plot-circuit-layout-5935646107893c12.yaml new file mode 100644 index 000000000000..3a89bf6392f8 --- /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/1.1/prepare-1.1.0-732e167b70ab4d01.yaml b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml new file mode 100644 index 000000000000..cbdc387f9452 --- /dev/null +++ b/releasenotes/notes/1.1/prepare-1.1.0-732e167b70ab4d01.yaml @@ -0,0 +1,52 @@ +--- +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. + + * 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. 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 + 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, + :class:`.ElidePermutations` and :class:`.StarPreRouting` have been demonstrated to have a significant + 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 + 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 typically 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. + + + * 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 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 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. 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 2fb1b4dcc5a1..bc234729eae9 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/1.1/remove-final-reset-488247c01c4e147d.yaml b/releasenotes/notes/1.1/remove-final-reset-488247c01c4e147d.yaml index 090654e16b9d..e217228af911 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 2ccd92f19c14..1deb26df9dab 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/show_idle_and_show_barrier-6e77e1f9d6f55599.yaml b/releasenotes/notes/1.1/show_idle_and_show_barrier-6e77e1f9d6f55599.yaml index ac0994b9d3a9..00a6a4b1df90 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 diff --git a/releasenotes/notes/1.1/spo-to-matrix-26445a791e24f62a.yaml b/releasenotes/notes/1.1/spo-to-matrix-26445a791e24f62a.yaml index 135e83ef99b1..57a60094f1b0 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 0bf60329a230..c72cbe49b8b7 100644 --- a/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml +++ b/releasenotes/notes/1.1/star-prerouting-0998b59880c20cef.yaml @@ -1,32 +1,46 @@ --- -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: + .. 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(5) + qc.h(0) + qc.cx(0, range(1, 5)) + 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(5) + qc.h(0) + qc.cx(0, range(1, 5)) + 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") 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 000000000000..b3b18be2fc1a --- /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. 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 9fbe0ffd9c79..000000000000 --- 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 d3266b2aa5f2..000000000000 --- 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 72f2c95962a5..000000000000 --- 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.