Qiskit docs generation only changes release notes for its own version (#860)

### Summary 

Part of #755

This PR changes the logic of the API generation script to only modify
the release notes file of the version we are regenerating at that
moment. Before, the release notes files contained more than one version,
and we needed to update several files, independently of what version we
were regenerating. After https://github.com/Qiskit/qiskit/pull/11840, we
can assume that the release notes files will only contain their own
versions, and we can simply our script by removing some functions.

### New logic

The API generation script will transform every link of the release notes
files to point to its version folder instead of the top level. Once we
have the correct links, we will directly write the release notes file,
if we didn't have them before, or otherwise, we will create a new file
containing the header of the old file we had and the version sections of
the new one downloaded from Box. That way, we can make manual changes
like the table added in the release notes of qiskit 0.44 without losing
them in the next regeneration.

### Functions removed

This change allows us to remove the following two functions:

The `extractMarkdownReleaseNotesPatches` function extracted all the
versions in a release notes file and stored the markdown of each patch
to posteriorly merge them under their minor version file. Now we have
one minor version per file, so we don't need to break the release notes
into pieces anymore. The new logic treats all patch versions as a block.

The `sortReleaseNotesVersions` were used to sort the patch versions.
Given that the file will have the correct order, we don't need to worry
about it either.

Removing these two functions allows us to remove the test file, given
that they composed the entire file.
This commit is contained in:
Arnau Casau 2024-02-23 12:29:39 +01:00 committed by GitHub
parent 138a8a064e
commit cfa6334596
6 changed files with 354 additions and 584 deletions

View File

@ -20,8 +20,6 @@ This page contains the release notes for Qiskit 0.45, the first release after th
<span id="relnotes-0-45-3-stable-0-45-prelude" />
<span id="id8" />
### Prelude
Qiskit 0.45.3 is a point release with no code changes other than to raise an [`ImportError`](https://docs.python.org/3/library/exceptions.html#ImportError "(in Python v3.12)") if it detects it has been installed in an invalid environment with Qiskit >=1.0.
@ -40,13 +38,13 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
<span id="relnotes-0-45-2-stable-0-45" />
<span id="id9" />
<span id="id3" />
## 0.45.2
<span id="relnotes-0-45-2-stable-0-45-prelude" />
<span id="id10" />
<span id="id4" />
### Prelude
@ -54,23 +52,21 @@ Qiskit 0.45.2 is a small patch release, fixing several bugs found in the 0.45 re
<span id="relnotes-0-45-2-stable-0-45-bug-fixes" />
<span id="id11" />
### Bug Fixes
* Calling [`copy()`](/api/qiskit/qiskit.circuit.QuantumCircuit#copy "qiskit.circuit.QuantumCircuit.copy") or [`copy_empty_like()`](/api/qiskit/qiskit.circuit.QuantumCircuit#copy_empty_like "qiskit.circuit.QuantumCircuit.copy_empty_like") on a `BlueprintCircuit` will now correctly propagate the [`global_phase`](/api/qiskit/qiskit.circuit.QuantumCircuit#global_phase "qiskit.circuit.QuantumCircuit.global_phase") to the copy. Previously, the global phase would always be zero after the copy.
* Calling [`copy()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#copy "qiskit.circuit.QuantumCircuit.copy") or [`copy_empty_like()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#copy_empty_like "qiskit.circuit.QuantumCircuit.copy_empty_like") on a `BlueprintCircuit` will now correctly propagate the [`global_phase`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#global_phase "qiskit.circuit.QuantumCircuit.global_phase") to the copy. Previously, the global phase would always be zero after the copy.
* QPY (using [`qpy.dump()`](/api/qiskit/qpy#qiskit.qpy.dump "qiskit.qpy.dump") and [`qpy.load()`](/api/qiskit/qpy#qiskit.qpy.load "qiskit.qpy.load")) will now correctly serialize and deserialize quantum circuits with Clifford operators ([`Clifford`](/api/qiskit/qiskit.quantum_info.Clifford "qiskit.quantum_info.Clifford")).
* QPY (using [`qpy.dump()`](/api/qiskit/0.45/qpy#qiskit.qpy.dump "qiskit.qpy.dump") and [`qpy.load()`](/api/qiskit/0.45/qpy#qiskit.qpy.load "qiskit.qpy.load")) will now correctly serialize and deserialize quantum circuits with Clifford operators ([`Clifford`](/api/qiskit/0.45/qiskit.quantum_info.Clifford "qiskit.quantum_info.Clifford")).
* Fixed an issue in the `mpl` circuit drawer where the text would print beyond the end of the box for a [`SwitchCaseOp`](/api/qiskit/qiskit.circuit.SwitchCaseOp "qiskit.circuit.SwitchCaseOp") if the default case was empty.
* Fixed an issue in the `mpl` circuit drawer where the text would print beyond the end of the box for a [`SwitchCaseOp`](/api/qiskit/0.45/qiskit.circuit.SwitchCaseOp "qiskit.circuit.SwitchCaseOp") if the default case was empty.
* The qubit-argument broadcasting of [`QuantumCircuit.delay()`](/api/qiskit/qiskit.circuit.QuantumCircuit#delay "qiskit.circuit.QuantumCircuit.delay") now correctly produces individual [`Delay`](/api/qiskit/qiskit.circuit.Delay "qiskit.circuit.Delay") instructions for each qubit, as intended. Previously, when given certain iterables (such as [`set`](https://docs.python.org/3/library/stdtypes.html#set "(in Python v3.12)")s), it would instead silently produce an invalid circuit that might fail in unusual locations.
* The qubit-argument broadcasting of [`QuantumCircuit.delay()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#delay "qiskit.circuit.QuantumCircuit.delay") now correctly produces individual [`Delay`](/api/qiskit/0.45/qiskit.circuit.Delay "qiskit.circuit.Delay") instructions for each qubit, as intended. Previously, when given certain iterables (such as [`set`](https://docs.python.org/3/library/stdtypes.html#set "(in Python v3.12)")s), it would instead silently produce an invalid circuit that might fail in unusual locations.
* Fixed a bug that results in an error when a user tries to load .calibration data of a gate in [`Target`](/api/qiskit/qiskit.transpiler.Target "qiskit.transpiler.Target") in a particular situation. This occurs when the backend reports only partial calibration data, for example referencing a waveform pulse in a command definition but not including that waveform pulse in the pulse library. In this situation, the Qiskit pulse object cannot be built, resulting in a failure to build the pulse schedule for the calibration. Now when calibration data is incomplete the [`Target`](/api/qiskit/qiskit.transpiler.Target "qiskit.transpiler.Target") treats it as equivalent to no calibration being reported at all and does not raise an exception.
* Fixed a bug that results in an error when a user tries to load .calibration data of a gate in [`Target`](/api/qiskit/0.45/qiskit.transpiler.Target "qiskit.transpiler.Target") in a particular situation. This occurs when the backend reports only partial calibration data, for example referencing a waveform pulse in a command definition but not including that waveform pulse in the pulse library. In this situation, the Qiskit pulse object cannot be built, resulting in a failure to build the pulse schedule for the calibration. Now when calibration data is incomplete the [`Target`](/api/qiskit/0.45/qiskit.transpiler.Target "qiskit.transpiler.Target") treats it as equivalent to no calibration being reported at all and does not raise an exception.
* Fixed an issue with the [`Optimize1qGatesDecomposition`](/api/qiskit/qiskit.transpiler.passes.Optimize1qGatesDecomposition "qiskit.transpiler.passes.Optimize1qGatesDecomposition") transpiler pass where it would potentially resynthesize a single ideal (meaning the error rate is `0.0`) gate which was present in the [`Target`](/api/qiskit/qiskit.transpiler.Target "qiskit.transpiler.Target"). This is now fixed so the pass [`Optimize1qGatesDecomposition`](/api/qiskit/qiskit.transpiler.passes.Optimize1qGatesDecomposition "qiskit.transpiler.passes.Optimize1qGatesDecomposition") will defer to the circuits gate if the error rate (which includes number of gates) are the same. Fixed [#10568](https://github.com/Qiskit/qiskit/issues/10568)
* Fixed an issue with the [`Optimize1qGatesDecomposition`](/api/qiskit/0.45/qiskit.transpiler.passes.Optimize1qGatesDecomposition "qiskit.transpiler.passes.Optimize1qGatesDecomposition") transpiler pass where it would potentially resynthesize a single ideal (meaning the error rate is `0.0`) gate which was present in the [`Target`](/api/qiskit/0.45/qiskit.transpiler.Target "qiskit.transpiler.Target"). This is now fixed so the pass [`Optimize1qGatesDecomposition`](/api/qiskit/0.45/qiskit.transpiler.passes.Optimize1qGatesDecomposition "qiskit.transpiler.passes.Optimize1qGatesDecomposition") will defer to the circuits gate if the error rate (which includes number of gates) are the same. Fixed [#10568](https://github.com/Qiskit/qiskit/issues/10568)
* Fixed an issue with the `OptimizeSwapBeforeMeasure` pass where it would incorrectly optimize circuits involving swap and measure instructions. This commit fixes the bug by changing [`DAGCircuit.successors()`](/api/qiskit/qiskit.dagcircuit.DAGCircuit#successors "qiskit.dagcircuit.DAGCircuit.successors") to [`DAGCircuit.descendants()`](/api/qiskit/qiskit.dagcircuit.DAGCircuit#descendants "qiskit.dagcircuit.DAGCircuit.descendants"). Also, added a couple of extra tests to ensure that the bug is fixed. For example:
* Fixed an issue with the `OptimizeSwapBeforeMeasure` pass where it would incorrectly optimize circuits involving swap and measure instructions. This commit fixes the bug by changing [`DAGCircuit.successors()`](/api/qiskit/0.45/qiskit.dagcircuit.DAGCircuit#successors "qiskit.dagcircuit.DAGCircuit.successors") to [`DAGCircuit.descendants()`](/api/qiskit/0.45/qiskit.dagcircuit.DAGCircuit#descendants "qiskit.dagcircuit.DAGCircuit.descendants"). Also, added a couple of extra tests to ensure that the bug is fixed. For example:
```python
from qiskit import QuantumCircuit
@ -114,17 +110,17 @@ Qiskit 0.45.2 is a small patch release, fixing several bugs found in the 0.45 re
0 0
```
* Fix a bug in the [`StabilizerState`](/api/qiskit/qiskit.quantum_info.StabilizerState "qiskit.quantum_info.StabilizerState") string representation.
* Fix a bug in the [`StabilizerState`](/api/qiskit/0.45/qiskit.quantum_info.StabilizerState "qiskit.quantum_info.StabilizerState") string representation.
<span id="relnotes-0-45-1-stable-0-45" />
<span id="id12" />
<span id="id5" />
## 0.45.1
<span id="relnotes-0-45-1-stable-0-45-prelude" />
<span id="id13" />
<span id="id6" />
### Prelude
@ -132,43 +128,41 @@ Qiskit Terra 0.45.1 is a small patch release, fixing several bugs found in the 0
<span id="relnotes-0-45-1-stable-0-45-new-features" />
<span id="id14" />
### New Features
* Added support for using Qiskit with Python 3.12. As of this release Qiskit supports running with Python versions 3.8, 3.9, 3.10, 3.11, and 3.12.
<span id="relnotes-0-45-1-stable-0-45-bug-fixes" />
<span id="id15" />
<span id="id7" />
### Bug Fixes
* [`QuantumCircuit.barrier()`](/api/qiskit/qiskit.circuit.QuantumCircuit#barrier "qiskit.circuit.QuantumCircuit.barrier") will now generate correct output when given a [`set`](https://docs.python.org/3/library/stdtypes.html#set "(in Python v3.12)") as one of its inputs. Previously, it would append an invalid operation onto the circuit, though in practice this usually would not cause observable problems. Fixed [#11208](https://github.com/Qiskit/qiskit/issues/11208)
* [`QuantumCircuit.barrier()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#barrier "qiskit.circuit.QuantumCircuit.barrier") will now generate correct output when given a [`set`](https://docs.python.org/3/library/stdtypes.html#set "(in Python v3.12)") as one of its inputs. Previously, it would append an invalid operation onto the circuit, though in practice this usually would not cause observable problems. Fixed [#11208](https://github.com/Qiskit/qiskit/issues/11208)
* The property [`Instruction.condition_bits`](/api/qiskit/qiskit.circuit.Instruction#condition_bits "qiskit.circuit.Instruction.condition_bits") will now correctly handle runtime classical expressions ([`qiskit.circuit.classical`](/api/qiskit/circuit_classical#module-qiskit.circuit.classical "qiskit.circuit.classical")).
* The property [`Instruction.condition_bits`](/api/qiskit/0.45/qiskit.circuit.Instruction#condition_bits "qiskit.circuit.Instruction.condition_bits") will now correctly handle runtime classical expressions ([`qiskit.circuit.classical`](/api/qiskit/0.45/circuit_classical#module-qiskit.circuit.classical "qiskit.circuit.classical")).
* Fixed the [`hash()`](https://docs.python.org/3/library/functions.html#hash "(in Python v3.12)") of Qiskit Pulse `Channel` objects (such as [`DriveChannel`](/api/qiskit/qiskit.pulse.channels.DriveChannel "qiskit.pulse.channels.DriveChannel")) in cases where the channel was transferred from one Python process to another that used a different hash seed.
* Fixed the [`hash()`](https://docs.python.org/3/library/functions.html#hash "(in Python v3.12)") of Qiskit Pulse `Channel` objects (such as [`DriveChannel`](/api/qiskit/0.45/qiskit.pulse.channels.DriveChannel "qiskit.pulse.channels.DriveChannel")) in cases where the channel was transferred from one Python process to another that used a different hash seed.
* Conditioned custom gates imported from OpenQASM 2 will now correctly retain their conditions when pickled and deep-copied. Previously, any conditional custom gate (defined by a `gate` statement in an OpenQASM 2 file) would lose its condition when copied or pickled.
* Fixed QPY deserialization of the [`StatePreparation`](/api/qiskit/qiskit.circuit.library.StatePreparation "qiskit.circuit.library.StatePreparation") and [`Initialize`](/api/qiskit/qiskit.circuit.library.Initialize "qiskit.circuit.library.Initialize") circuit instructions with string and integer parameters (as opposed to an explicit statevector, which was already working). Fixed [#11158](https://github.com/Qiskit/qiskit/issues/11158).
* Fixed QPY deserialization of the [`StatePreparation`](/api/qiskit/0.45/qiskit.circuit.library.StatePreparation "qiskit.circuit.library.StatePreparation") and [`Initialize`](/api/qiskit/0.45/qiskit.circuit.library.Initialize "qiskit.circuit.library.Initialize") circuit instructions with string and integer parameters (as opposed to an explicit statevector, which was already working). Fixed [#11158](https://github.com/Qiskit/qiskit/issues/11158).
* Fixed a bug in [`SabreLayout`](/api/qiskit/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") where it would fail to add the register information to the [`Layout`](/api/qiskit/qiskit.transpiler.Layout "qiskit.transpiler.Layout") object used for [`TranspileLayout.initial_layout`](/api/qiskit/qiskit.transpiler.TranspileLayout#initial_layout "qiskit.transpiler.TranspileLayout.initial_layout"). This affected circuit visualization with [`QuantumCircuit.draw()`](/api/qiskit/qiskit.circuit.QuantumCircuit#draw "qiskit.circuit.QuantumCircuit.draw") and [`circuit_drawer()`](/api/qiskit/qiskit.visualization.circuit_drawer "qiskit.visualization.circuit_drawer") after transpilation which would show a virtual qubit label of the form `Qubit[QuantumRegister(6, 'q', 0)]` rather than the expected virtual qubit label using the register name (e.g. `q0`). Fixed [#11038](https://github.com/Qiskit/qiskit/issues/11038)
* Fixed a bug in [`SabreLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") where it would fail to add the register information to the [`Layout`](/api/qiskit/0.45/qiskit.transpiler.Layout "qiskit.transpiler.Layout") object used for [`TranspileLayout.initial_layout`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#initial_layout "qiskit.transpiler.TranspileLayout.initial_layout"). This affected circuit visualization with [`QuantumCircuit.draw()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#draw "qiskit.circuit.QuantumCircuit.draw") and [`circuit_drawer()`](/api/qiskit/0.45/qiskit.visualization.circuit_drawer "qiskit.visualization.circuit_drawer") after transpilation which would show a virtual qubit label of the form `Qubit[QuantumRegister(6, 'q', 0)]` rather than the expected virtual qubit label using the register name (e.g. `q0`). Fixed [#11038](https://github.com/Qiskit/qiskit/issues/11038)
* Fixed an issue with [`qpy.dump()`](/api/qiskit/qpy#qiskit.qpy.dump "qiskit.qpy.dump") which would cause the function to potentially ignore the value of `use_symengine` when serializing a [`ScheduleBlock`](/api/qiskit/qiskit.pulse.ScheduleBlock "qiskit.pulse.ScheduleBlock") object. This would result in an invalid QPY payload being generated as it would report it was using symengine for symbolic expressions but actually contain sympy serialized data.
* Fixed an issue with [`qpy.dump()`](/api/qiskit/0.45/qpy#qiskit.qpy.dump "qiskit.qpy.dump") which would cause the function to potentially ignore the value of `use_symengine` when serializing a [`ScheduleBlock`](/api/qiskit/0.45/qiskit.pulse.ScheduleBlock "qiskit.pulse.ScheduleBlock") object. This would result in an invalid QPY payload being generated as it would report it was using symengine for symbolic expressions but actually contain sympy serialized data.
* Fixed a bug which caused [`UnitaryOverlap`](/api/qiskit/qiskit.circuit.library.UnitaryOverlap "qiskit.circuit.library.UnitaryOverlap") to error upon initialization if given an input circuit containing a barrier.
* Fixed a bug which caused [`UnitaryOverlap`](/api/qiskit/0.45/qiskit.circuit.library.UnitaryOverlap "qiskit.circuit.library.UnitaryOverlap") to error upon initialization if given an input circuit containing a barrier.
<span id="relnotes-0-45-0-stable-0-45" />
<span id="id16" />
<span id="id8" />
## 0.45.0
<span id="relnotes-0-45-0-stable-0-45-prelude" />
<span id="id17" />
<span id="id9" />
### Prelude
@ -180,18 +174,16 @@ Qiskit 0.45.0 is the last feature release before 1.0. It prepares the ground for
Some feature highlights of Qiskit 0.45.0 are:
* Starting in this release, all unparametrized gates in the Qiskit standard circuit library are now **singletons**. By default, these gates share a single instance in memory, so once a gate of a specific type, lets say [`XGate`](/api/qiskit/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate"), is instantiated, any subsequent instances of [`XGate`](/api/qiskit/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate") will be a reference to the first one. This results in a reduced memory usage and construction overhead when using multiple gates of the same type in a circuit. To realize this feature, new base classes have been introduced: [`SingletonInstruction`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonInstruction "qiskit.circuit.singleton.SingletonInstruction") and [`SingletonGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate"). See feature notes for more details.
* We have added a new **generic pass manager interface** that can be found in the new [`qiskit.passmanager`](/api/qiskit/passmanager#module-qiskit.passmanager "qiskit.passmanager") module. This is a generalization of the pass manager that was used to build the Qiskit transpiler, and it introduces a generic framework to enable users to create new pass managers that use different intermediate representations (IRs). The module includes a generic pass manager base class, flow controllers, and the necessary infrastructure to manage the execution of pass manager tasks. The new interface was used to rebuild the existing pass manager in the [`qiskit.transpiler`](/api/qiskit/transpiler#module-qiskit.transpiler "qiskit.transpiler") module, cleaning up technical debt in the code, and improving usability and performance. See feature and upgrade notes for more details.
* 0.45.0 allows users to better interact with the **layout permutations** performed by the transpiler. The data contained in the [`TranspileLayout`](/api/qiskit/qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") class is now more accessible through a series of new methods and attributes. And a new [`SparsePauliOp.apply_layout()`](/api/qiskit/qiskit.quantum_info.SparsePauliOp#apply_layout "qiskit.quantum_info.SparsePauliOp.apply_layout") method allows to apply a specific layout permutation to a [`SparsePauliOp`](/api/qiskit/qiskit.quantum_info.SparsePauliOp "qiskit.quantum_info.SparsePauliOp") observable that was built for an input circuit to the transpiler. See feature notes for more details.
* Finally, we have introduced **annotated operations** with the new [`AnnotatedOperation`](/api/qiskit/qiskit.circuit.AnnotatedOperation "qiskit.circuit.AnnotatedOperation") class, which allows to formulate complex circuit instructions as a base instruction with a set of modifiers. For example, instead of a specific operation type that implements the controlled inverse of a [`RXGate`](/api/qiskit/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate"), we can now use an annotated [`RXGate`](/api/qiskit/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate") with inverse and control attributes. See feature notes for more details.
* Starting in this release, all unparametrized gates in the Qiskit standard circuit library are now **singletons**. By default, these gates share a single instance in memory, so once a gate of a specific type, lets say [`XGate`](/api/qiskit/0.45/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate"), is instantiated, any subsequent instances of [`XGate`](/api/qiskit/0.45/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate") will be a reference to the first one. This results in a reduced memory usage and construction overhead when using multiple gates of the same type in a circuit. To realize this feature, new base classes have been introduced: [`SingletonInstruction`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonInstruction "qiskit.circuit.singleton.SingletonInstruction") and [`SingletonGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate"). See feature notes for more details.
* We have added a new **generic pass manager interface** that can be found in the new [`qiskit.passmanager`](/api/qiskit/0.45/passmanager#module-qiskit.passmanager "qiskit.passmanager") module. This is a generalization of the pass manager that was used to build the Qiskit transpiler, and it introduces a generic framework to enable users to create new pass managers that use different intermediate representations (IRs). The module includes a generic pass manager base class, flow controllers, and the necessary infrastructure to manage the execution of pass manager tasks. The new interface was used to rebuild the existing pass manager in the [`qiskit.transpiler`](/api/qiskit/0.45/transpiler#module-qiskit.transpiler "qiskit.transpiler") module, cleaning up technical debt in the code, and improving usability and performance. See feature and upgrade notes for more details.
* 0.45.0 allows users to better interact with the **layout permutations** performed by the transpiler. The data contained in the [`TranspileLayout`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") class is now more accessible through a series of new methods and attributes. And a new [`SparsePauliOp.apply_layout()`](/api/qiskit/0.45/qiskit.quantum_info.SparsePauliOp#apply_layout "qiskit.quantum_info.SparsePauliOp.apply_layout") method allows to apply a specific layout permutation to a [`SparsePauliOp`](/api/qiskit/0.45/qiskit.quantum_info.SparsePauliOp "qiskit.quantum_info.SparsePauliOp") observable that was built for an input circuit to the transpiler. See feature notes for more details.
* Finally, we have introduced **annotated operations** with the new [`AnnotatedOperation`](/api/qiskit/0.45/qiskit.circuit.AnnotatedOperation "qiskit.circuit.AnnotatedOperation") class, which allows to formulate complex circuit instructions as a base instruction with a set of modifiers. For example, instead of a specific operation type that implements the controlled inverse of a [`RXGate`](/api/qiskit/0.45/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate"), we can now use an annotated [`RXGate`](/api/qiskit/0.45/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate") with inverse and control attributes. See feature notes for more details.
<span id="relnotes-0-45-0-stable-0-45-circuits-features" />
<span id="id18" />
### Circuits Features
* Added a new class [`AnnotatedOperation`](/api/qiskit/qiskit.circuit.AnnotatedOperation "qiskit.circuit.AnnotatedOperation") that is a subclass of [`Operation`](/api/qiskit/qiskit.circuit.Operation "qiskit.circuit.Operation") and represents some “base operation” modified by a list of “modifiers”. The base operation is of type [`Operation`](/api/qiskit/qiskit.circuit.Operation "qiskit.circuit.Operation") and the currently supported modifiers are of types [`InverseModifier`](/api/qiskit/qiskit.circuit.InverseModifier "qiskit.circuit.InverseModifier"), [`ControlModifier`](/api/qiskit/qiskit.circuit.ControlModifier "qiskit.circuit.ControlModifier") and [`PowerModifier`](/api/qiskit/qiskit.circuit.PowerModifier "qiskit.circuit.PowerModifier"). The modifiers are applied in the order they appear in the list.
* Added a new class [`AnnotatedOperation`](/api/qiskit/0.45/qiskit.circuit.AnnotatedOperation "qiskit.circuit.AnnotatedOperation") that is a subclass of [`Operation`](/api/qiskit/0.45/qiskit.circuit.Operation "qiskit.circuit.Operation") and represents some “base operation” modified by a list of “modifiers”. The base operation is of type [`Operation`](/api/qiskit/0.45/qiskit.circuit.Operation "qiskit.circuit.Operation") and the currently supported modifiers are of types [`InverseModifier`](/api/qiskit/0.45/qiskit.circuit.InverseModifier "qiskit.circuit.InverseModifier"), [`ControlModifier`](/api/qiskit/0.45/qiskit.circuit.ControlModifier "qiskit.circuit.ControlModifier") and [`PowerModifier`](/api/qiskit/0.45/qiskit.circuit.PowerModifier "qiskit.circuit.PowerModifier"). The modifiers are applied in the order they appear in the list.
As an example:
@ -220,80 +212,80 @@ Some feature highlights of Qiskit 0.45.0 are:
For convenience, a single modifier can be also passed directly, thus `AnnotatedGate(SGate(), [ControlModifier(1)])` is equivalent to `AnnotatedGate(SGate(), ControlModifier(1))`.
A distinguishing feature of an annotated operation is that circuit definition is not constructed when the operation is declared, and instead happens only during transpilation, specifically during the [`HighLevelSynthesis`](/api/qiskit/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") transpiler pass.
A distinguishing feature of an annotated operation is that circuit definition is not constructed when the operation is declared, and instead happens only during transpilation, specifically during the [`HighLevelSynthesis`](/api/qiskit/0.45/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") transpiler pass.
An annotated operation can be also viewed as a “higher-level” or a “more abstract” object that can be added onto a quantum circuit. This enables writing transpiler optimization passes that make use of this higher-level representation, for instance removing a gate that is immediately followed by its inverse (note that this reduction might not be possible if both the gate and its inverse are first synthesized into simpler gates).
In a sense, an annotated operation can be viewed as an extension of [`ControlledGate`](/api/qiskit/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate"), which also allows adding control to the base operation. In the future we are planning to replace [`ControlledGate`](/api/qiskit/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate") by [`AnnotatedOperation`](/api/qiskit/qiskit.circuit.AnnotatedOperation "qiskit.circuit.AnnotatedOperation"). Similar to controlled gates, the transpiler synthesizes annotated operations before layout/routing takes place.
In a sense, an annotated operation can be viewed as an extension of [`ControlledGate`](/api/qiskit/0.45/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate"), which also allows adding control to the base operation. In the future we are planning to replace [`ControlledGate`](/api/qiskit/0.45/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate") by [`AnnotatedOperation`](/api/qiskit/0.45/qiskit.circuit.AnnotatedOperation "qiskit.circuit.AnnotatedOperation"). Similar to controlled gates, the transpiler synthesizes annotated operations before layout/routing takes place.
As of now, the annotated operations can appear only in the top-level of a quantum circuit, that is they cannot appear inside of the recursively-defined `definition` circuit. We are planning to remove this limitation later.
* Added a new option `max_num_qubits` to [`qiskit.circuit.CommutationChecker.commute()`](/api/qiskit/qiskit.circuit.CommutationChecker#commute "qiskit.circuit.CommutationChecker.commute") that specifies the maximum number of qubits to consider for the more expensive matrix multiplication-based commutativity check. This avoids trying to internally allocate arrays of size $2^N \times 2^N$. Simpler versions of commutativity check (for instance, two quantum operations commute when they are over disjoint sets of qubits) continue to work without this limit.
* Added a new option `max_num_qubits` to [`qiskit.circuit.CommutationChecker.commute()`](/api/qiskit/0.45/qiskit.circuit.CommutationChecker#commute "qiskit.circuit.CommutationChecker.commute") that specifies the maximum number of qubits to consider for the more expensive matrix multiplication-based commutativity check. This avoids trying to internally allocate arrays of size $2^N \times 2^N$. Simpler versions of commutativity check (for instance, two quantum operations commute when they are over disjoint sets of qubits) continue to work without this limit.
* Added a new argument, `check_input`, to the constructor for the [`UnitaryGate`](/api/qiskit/qiskit.circuit.library.UnitaryGate "qiskit.circuit.library.UnitaryGate") class. This flag is used to disable the default initialization checks that input object represents a unitary matrix. This can be used to speed up the creation of [`UnitaryGate`](/api/qiskit/qiskit.circuit.library.UnitaryGate "qiskit.circuit.library.UnitaryGate") objects if you know the input is already a unitary matrix. This new option should only be used in these cases because if its set to `False` and the input is not unitary this will result in an invalid `UnitaryGate` object.
* Added a new argument, `check_input`, to the constructor for the [`UnitaryGate`](/api/qiskit/0.45/qiskit.circuit.library.UnitaryGate "qiskit.circuit.library.UnitaryGate") class. This flag is used to disable the default initialization checks that input object represents a unitary matrix. This can be used to speed up the creation of [`UnitaryGate`](/api/qiskit/0.45/qiskit.circuit.library.UnitaryGate "qiskit.circuit.library.UnitaryGate") objects if you know the input is already a unitary matrix. This new option should only be used in these cases because if its set to `False` and the input is not unitary this will result in an invalid `UnitaryGate` object.
* A new method [`Parameter.assign()`](/api/qiskit/qiskit.circuit.Parameter#assign "qiskit.circuit.Parameter.assign") has been added. This method primarily serves as a fast path to improve the performance of [`QuantumCircuit.assign_parameters()`](/api/qiskit/qiskit.circuit.QuantumCircuit#assign_parameters "qiskit.circuit.QuantumCircuit.assign_parameters") for the common case of circuits that predominantly contain “expressions” that are actually just single parameters to be assigned later.
* A new method [`Parameter.assign()`](/api/qiskit/0.45/qiskit.circuit.Parameter#assign "qiskit.circuit.Parameter.assign") has been added. This method primarily serves as a fast path to improve the performance of [`QuantumCircuit.assign_parameters()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#assign_parameters "qiskit.circuit.QuantumCircuit.assign_parameters") for the common case of circuits that predominantly contain “expressions” that are actually just single parameters to be assigned later.
* The performance of [`QuantumCircuit.assign_parameters()`](/api/qiskit/qiskit.circuit.QuantumCircuit#assign_parameters "qiskit.circuit.QuantumCircuit.assign_parameters") when assigning a single parameter of a circuit that involves many parameters has been improved.
* The performance of [`QuantumCircuit.assign_parameters()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#assign_parameters "qiskit.circuit.QuantumCircuit.assign_parameters") when assigning a single parameter of a circuit that involves many parameters has been improved.
* Introduced two new classes, [`SingletonInstruction`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonInstruction "qiskit.circuit.singleton.SingletonInstruction") and [`SingletonGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate"), which are subclasses of [`Instruction`](/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction") and [`Gate`](/api/qiskit/qiskit.circuit.Gate "qiskit.circuit.Gate") respectively, that use a single instance for all objects of that type. The intent behind this class is to minimize the memory and construction overhead of using multiple gates in a circuit with the tradeoff of having global shared state. For this reason this class is only applicable to gates that do not have any unique and/or mutable state stored in an instance. For example, the best example of this is [`XGate`](/api/qiskit/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate") doesnt contain any state and could leverage [`SingletonGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate") (and does starting in this release), while [`RXGate`](/api/qiskit/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate") stores an angle parameter in an instance and thus can not use [`SingletonGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate") because a single shared global instance can not represent the parameter values.
* Introduced two new classes, [`SingletonInstruction`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonInstruction "qiskit.circuit.singleton.SingletonInstruction") and [`SingletonGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate"), which are subclasses of [`Instruction`](/api/qiskit/0.45/qiskit.circuit.Instruction "qiskit.circuit.Instruction") and [`Gate`](/api/qiskit/0.45/qiskit.circuit.Gate "qiskit.circuit.Gate") respectively, that use a single instance for all objects of that type. The intent behind this class is to minimize the memory and construction overhead of using multiple gates in a circuit with the tradeoff of having global shared state. For this reason this class is only applicable to gates that do not have any unique and/or mutable state stored in an instance. For example, the best example of this is [`XGate`](/api/qiskit/0.45/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate") doesnt contain any state and could leverage [`SingletonGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate") (and does starting in this release), while [`RXGate`](/api/qiskit/0.45/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate") stores an angle parameter in an instance and thus can not use [`SingletonGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate") because a single shared global instance can not represent the parameter values.
The other potential issue to be aware of when using singleton classes is that the [`Instruction`](/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction") data model supports some mutable state. Specifically, the [`label`](/api/qiskit/qiskit.circuit.Instruction#label "qiskit.circuit.Instruction.label"), [`duration`](/api/qiskit/qiskit.circuit.Instruction#duration "qiskit.circuit.Instruction.duration"), [`unit`](/api/qiskit/qiskit.circuit.Instruction#unit "qiskit.circuit.Instruction.unit"), and [`condition`](/api/qiskit/qiskit.circuit.Instruction#condition "qiskit.circuit.Instruction.condition") attributes are all accessible and mutable in the [`Instruction`](/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction") and its direct subclasses. However, this is incompatible with having a shared object via [`SingletonInstruction`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonInstruction "qiskit.circuit.singleton.SingletonInstruction"). For instances of [`SingletonInstruction`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonInstruction "qiskit.circuit.singleton.SingletonInstruction"), setting these attributes directly is not allowed and it will raise an exception. If they are needed for a particular instance, you must ensure you have a mutable instance using [`Instruction.to_mutable()`](/api/qiskit/qiskit.circuit.Instruction#to_mutable "qiskit.circuit.Instruction.to_mutable") (or use [`Instruction.c_if()`](/api/qiskit/qiskit.circuit.Instruction#c_if "qiskit.circuit.Instruction.c_if") for [`condition`](/api/qiskit/qiskit.circuit.Instruction#condition "qiskit.circuit.Instruction.condition")). `label`, `duration` and `unit` can also be given as keyword arguments during class construction.
The other potential issue to be aware of when using singleton classes is that the [`Instruction`](/api/qiskit/0.45/qiskit.circuit.Instruction "qiskit.circuit.Instruction") data model supports some mutable state. Specifically, the [`label`](/api/qiskit/0.45/qiskit.circuit.Instruction#label "qiskit.circuit.Instruction.label"), [`duration`](/api/qiskit/0.45/qiskit.circuit.Instruction#duration "qiskit.circuit.Instruction.duration"), [`unit`](/api/qiskit/0.45/qiskit.circuit.Instruction#unit "qiskit.circuit.Instruction.unit"), and [`condition`](/api/qiskit/0.45/qiskit.circuit.Instruction#condition "qiskit.circuit.Instruction.condition") attributes are all accessible and mutable in the [`Instruction`](/api/qiskit/0.45/qiskit.circuit.Instruction "qiskit.circuit.Instruction") and its direct subclasses. However, this is incompatible with having a shared object via [`SingletonInstruction`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonInstruction "qiskit.circuit.singleton.SingletonInstruction"). For instances of [`SingletonInstruction`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonInstruction "qiskit.circuit.singleton.SingletonInstruction"), setting these attributes directly is not allowed and it will raise an exception. If they are needed for a particular instance, you must ensure you have a mutable instance using [`Instruction.to_mutable()`](/api/qiskit/0.45/qiskit.circuit.Instruction#to_mutable "qiskit.circuit.Instruction.to_mutable") (or use [`Instruction.c_if()`](/api/qiskit/0.45/qiskit.circuit.Instruction#c_if "qiskit.circuit.Instruction.c_if") for [`condition`](/api/qiskit/0.45/qiskit.circuit.Instruction#condition "qiskit.circuit.Instruction.condition")). `label`, `duration` and `unit` can also be given as keyword arguments during class construction.
* The following standard library gates are now instances of [`SingletonGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate"):
* The following standard library gates are now instances of [`SingletonGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate"):
> * [`DCXGate`](/api/qiskit/qiskit.circuit.library.DCXGate "qiskit.circuit.library.DCXGate")
> * [`ECRGate`](/api/qiskit/qiskit.circuit.library.ECRGate "qiskit.circuit.library.ECRGate")
> * [`HGate`](/api/qiskit/qiskit.circuit.library.HGate "qiskit.circuit.library.HGate")
> * [`IGate`](/api/qiskit/qiskit.circuit.library.IGate "qiskit.circuit.library.IGate")
> * [`iSwapGate`](/api/qiskit/qiskit.circuit.library.iSwapGate "qiskit.circuit.library.iSwapGate")
> * [`SGate`](/api/qiskit/qiskit.circuit.library.SGate "qiskit.circuit.library.SGate")
> * [`SdgGate`](/api/qiskit/qiskit.circuit.library.SdgGate "qiskit.circuit.library.SdgGate")
> * [`SwapGate`](/api/qiskit/qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")
> * [`SXGate`](/api/qiskit/qiskit.circuit.library.SXGate "qiskit.circuit.library.SXGate")
> * [`SXdgGate`](/api/qiskit/qiskit.circuit.library.SXdgGate "qiskit.circuit.library.SXdgGate")
> * [`TGate`](/api/qiskit/qiskit.circuit.library.TGate "qiskit.circuit.library.TGate")
> * [`TdgGate`](/api/qiskit/qiskit.circuit.library.TdgGate "qiskit.circuit.library.TdgGate")
> * [`XGate`](/api/qiskit/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate")
> * [`RCCXGate`](/api/qiskit/qiskit.circuit.library.RCCXGate "qiskit.circuit.library.RCCXGate")
> * [`RC3XGate`](/api/qiskit/qiskit.circuit.library.RC3XGate "qiskit.circuit.library.RC3XGate")
> * [`YGate`](/api/qiskit/qiskit.circuit.library.YGate "qiskit.circuit.library.YGate")
> * [`ZGate`](/api/qiskit/qiskit.circuit.library.ZGate "qiskit.circuit.library.ZGate")
> * [`DCXGate`](/api/qiskit/0.45/qiskit.circuit.library.DCXGate "qiskit.circuit.library.DCXGate")
> * [`ECRGate`](/api/qiskit/0.45/qiskit.circuit.library.ECRGate "qiskit.circuit.library.ECRGate")
> * [`HGate`](/api/qiskit/0.45/qiskit.circuit.library.HGate "qiskit.circuit.library.HGate")
> * [`IGate`](/api/qiskit/0.45/qiskit.circuit.library.IGate "qiskit.circuit.library.IGate")
> * [`iSwapGate`](/api/qiskit/0.45/qiskit.circuit.library.iSwapGate "qiskit.circuit.library.iSwapGate")
> * [`SGate`](/api/qiskit/0.45/qiskit.circuit.library.SGate "qiskit.circuit.library.SGate")
> * [`SdgGate`](/api/qiskit/0.45/qiskit.circuit.library.SdgGate "qiskit.circuit.library.SdgGate")
> * [`SwapGate`](/api/qiskit/0.45/qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")
> * [`SXGate`](/api/qiskit/0.45/qiskit.circuit.library.SXGate "qiskit.circuit.library.SXGate")
> * [`SXdgGate`](/api/qiskit/0.45/qiskit.circuit.library.SXdgGate "qiskit.circuit.library.SXdgGate")
> * [`TGate`](/api/qiskit/0.45/qiskit.circuit.library.TGate "qiskit.circuit.library.TGate")
> * [`TdgGate`](/api/qiskit/0.45/qiskit.circuit.library.TdgGate "qiskit.circuit.library.TdgGate")
> * [`XGate`](/api/qiskit/0.45/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate")
> * [`RCCXGate`](/api/qiskit/0.45/qiskit.circuit.library.RCCXGate "qiskit.circuit.library.RCCXGate")
> * [`RC3XGate`](/api/qiskit/0.45/qiskit.circuit.library.RC3XGate "qiskit.circuit.library.RC3XGate")
> * [`YGate`](/api/qiskit/0.45/qiskit.circuit.library.YGate "qiskit.circuit.library.YGate")
> * [`ZGate`](/api/qiskit/0.45/qiskit.circuit.library.ZGate "qiskit.circuit.library.ZGate")
This means that if these classes are instantiated as (e.g.) [`XGate()`](/api/qiskit/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate") using all the constructor defaults, they will all share a single global instance. This results in a large reduction in the memory overhead for > 1 object of these types and significantly faster object construction time.
This means that if these classes are instantiated as (e.g.) [`XGate()`](/api/qiskit/0.45/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate") using all the constructor defaults, they will all share a single global instance. This results in a large reduction in the memory overhead for > 1 object of these types and significantly faster object construction time.
* Introduced a new class [`SingletonControlledGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate") which is a subclass of [`ControlledGate`](/api/qiskit/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate") that uses a single instance for all objects of that type. The intent behind this class is to minimize the memory and construction overhead of using multiple gates in a circuit with the tradeoff of having a global shared state. For this reason, this class is only applicable to gates that do not have any unique and/or mutable state stored in an instance. For example, a [`CXGate`](/api/qiskit/qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate") doesnt contain any state and thus can leverage [`SingletonControlledGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate") (and does starting in this release). In contrast, [`CRXGate`](/api/qiskit/qiskit.circuit.library.CRXGate "qiskit.circuit.library.CRXGate") stores an angle parameter as part of its instance data and thus can not use [`SingletonControlledGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate").
* Introduced a new class [`SingletonControlledGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate") which is a subclass of [`ControlledGate`](/api/qiskit/0.45/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate") that uses a single instance for all objects of that type. The intent behind this class is to minimize the memory and construction overhead of using multiple gates in a circuit with the tradeoff of having a global shared state. For this reason, this class is only applicable to gates that do not have any unique and/or mutable state stored in an instance. For example, a [`CXGate`](/api/qiskit/0.45/qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate") doesnt contain any state and thus can leverage [`SingletonControlledGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate") (and does starting in this release). In contrast, [`CRXGate`](/api/qiskit/0.45/qiskit.circuit.library.CRXGate "qiskit.circuit.library.CRXGate") stores an angle parameter as part of its instance data and thus can not use [`SingletonControlledGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate").
The other potential issue to be aware of when using [`SingletonControlledGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate") is that the original data model of [`ControlledGate`](/api/qiskit/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate") supports mutation. Specifically, the [`label`](/api/qiskit/qiskit.circuit.ControlledGate#label "qiskit.circuit.ControlledGate.label"), [`duration`](/api/qiskit/qiskit.circuit.ControlledGate#duration "qiskit.circuit.ControlledGate.duration"), [`unit`](/api/qiskit/qiskit.circuit.ControlledGate#unit "qiskit.circuit.ControlledGate.unit"), [`condition`](/api/qiskit/qiskit.circuit.ControlledGate#condition "qiskit.circuit.ControlledGate.condition"), and [`ctrl_state`](/api/qiskit/qiskit.circuit.ControlledGate#ctrl_state "qiskit.circuit.ControlledGate.ctrl_state") attributes are all accessible and mutable in the [`ControlledGate`](/api/qiskit/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate"), but mutation of these attributes on [`SingletonControlledGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate") subclasses is not allowed, and will raise an exception. These attributes can be customized but only at creation time (i.e. via the constructor). In that case, the newly constructed gate will be a separate instance with the custom state instead of the globally shared instance. You can also use the `SingletonControlledGate.to_mutable()` method to get a mutable copy of a gate object and then mutate the attributes like you would on any other [`Instruction`](/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction") object.
The other potential issue to be aware of when using [`SingletonControlledGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate") is that the original data model of [`ControlledGate`](/api/qiskit/0.45/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate") supports mutation. Specifically, the [`label`](/api/qiskit/0.45/qiskit.circuit.ControlledGate#label "qiskit.circuit.ControlledGate.label"), [`duration`](/api/qiskit/0.45/qiskit.circuit.ControlledGate#duration "qiskit.circuit.ControlledGate.duration"), [`unit`](/api/qiskit/0.45/qiskit.circuit.ControlledGate#unit "qiskit.circuit.ControlledGate.unit"), [`condition`](/api/qiskit/0.45/qiskit.circuit.ControlledGate#condition "qiskit.circuit.ControlledGate.condition"), and [`ctrl_state`](/api/qiskit/0.45/qiskit.circuit.ControlledGate#ctrl_state "qiskit.circuit.ControlledGate.ctrl_state") attributes are all accessible and mutable in the [`ControlledGate`](/api/qiskit/0.45/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate"), but mutation of these attributes on [`SingletonControlledGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate") subclasses is not allowed, and will raise an exception. These attributes can be customized but only at creation time (i.e. via the constructor). In that case, the newly constructed gate will be a separate instance with the custom state instead of the globally shared instance. You can also use the `SingletonControlledGate.to_mutable()` method to get a mutable copy of a gate object and then mutate the attributes like you would on any other [`Instruction`](/api/qiskit/0.45/qiskit.circuit.Instruction "qiskit.circuit.Instruction") object.
* The following standard library gates are now instances of [`SingletonControlledGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate"):
* The following standard library gates are now instances of [`SingletonControlledGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate"):
> * [`CHGate`](/api/qiskit/qiskit.circuit.library.CHGate "qiskit.circuit.library.CHGate")
> * [`CSGate`](/api/qiskit/qiskit.circuit.library.CSGate "qiskit.circuit.library.CSGate")
> * [`CSdgGate`](/api/qiskit/qiskit.circuit.library.CSdgGate "qiskit.circuit.library.CSdgGate")
> * [`CSwapGate`](/api/qiskit/qiskit.circuit.library.CSwapGate "qiskit.circuit.library.CSwapGate")
> * [`CSXGate`](/api/qiskit/qiskit.circuit.library.CSXGate "qiskit.circuit.library.CSXGate")
> * [`CXGate`](/api/qiskit/qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate")
> * [`CCXGate`](/api/qiskit/qiskit.circuit.library.CCXGate "qiskit.circuit.library.CCXGate")
> * [`C3SXGate`](/api/qiskit/qiskit.circuit.library.C3SXGate "qiskit.circuit.library.C3SXGate")
> * [`C3XGate`](/api/qiskit/qiskit.circuit.library.C3XGate "qiskit.circuit.library.C3XGate")
> * [`C4XGate`](/api/qiskit/qiskit.circuit.library.C4XGate "qiskit.circuit.library.C4XGate")
> * [`CYGate`](/api/qiskit/qiskit.circuit.library.CYGate "qiskit.circuit.library.CYGate")
> * [`CZGate`](/api/qiskit/qiskit.circuit.library.CZGate "qiskit.circuit.library.CZGate")
> * [`CHGate`](/api/qiskit/0.45/qiskit.circuit.library.CHGate "qiskit.circuit.library.CHGate")
> * [`CSGate`](/api/qiskit/0.45/qiskit.circuit.library.CSGate "qiskit.circuit.library.CSGate")
> * [`CSdgGate`](/api/qiskit/0.45/qiskit.circuit.library.CSdgGate "qiskit.circuit.library.CSdgGate")
> * [`CSwapGate`](/api/qiskit/0.45/qiskit.circuit.library.CSwapGate "qiskit.circuit.library.CSwapGate")
> * [`CSXGate`](/api/qiskit/0.45/qiskit.circuit.library.CSXGate "qiskit.circuit.library.CSXGate")
> * [`CXGate`](/api/qiskit/0.45/qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate")
> * [`CCXGate`](/api/qiskit/0.45/qiskit.circuit.library.CCXGate "qiskit.circuit.library.CCXGate")
> * [`C3SXGate`](/api/qiskit/0.45/qiskit.circuit.library.C3SXGate "qiskit.circuit.library.C3SXGate")
> * [`C3XGate`](/api/qiskit/0.45/qiskit.circuit.library.C3XGate "qiskit.circuit.library.C3XGate")
> * [`C4XGate`](/api/qiskit/0.45/qiskit.circuit.library.C4XGate "qiskit.circuit.library.C4XGate")
> * [`CYGate`](/api/qiskit/0.45/qiskit.circuit.library.CYGate "qiskit.circuit.library.CYGate")
> * [`CZGate`](/api/qiskit/0.45/qiskit.circuit.library.CZGate "qiskit.circuit.library.CZGate")
This means that unless a `label`, `condition`, `duration`, `unit`, or `ctrl_state` are set on the instance at creation time they will all share a single global instance whenever a new gate object is created. This results in a large reduction in the memory overhead for > 1 object of these types.
* Added a new method [`Instruction.to_mutable()`](/api/qiskit/qiskit.circuit.Instruction#to_mutable "qiskit.circuit.Instruction.to_mutable") and attribute [`Instruction.mutable`](/api/qiskit/qiskit.circuit.Instruction#mutable "qiskit.circuit.Instruction.mutable") which is used to get a mutable copy and check whether an [`Instruction`](/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction") object is mutable. With the introduction of [`SingletonGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate") these methods can be used to have a unified interface to deal with the mutablitiy of instruction objects.
* Added a new method [`Instruction.to_mutable()`](/api/qiskit/0.45/qiskit.circuit.Instruction#to_mutable "qiskit.circuit.Instruction.to_mutable") and attribute [`Instruction.mutable`](/api/qiskit/0.45/qiskit.circuit.Instruction#mutable "qiskit.circuit.Instruction.mutable") which is used to get a mutable copy and check whether an [`Instruction`](/api/qiskit/0.45/qiskit.circuit.Instruction "qiskit.circuit.Instruction") object is mutable. With the introduction of [`SingletonGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate") these methods can be used to have a unified interface to deal with the mutablitiy of instruction objects.
* Added an attribute [`Instruction.base_class`](/api/qiskit/qiskit.circuit.Instruction#base_class "qiskit.circuit.Instruction.base_class"), which gets the “base” type of an instruction. Many instructions will satisfy `type(obj) == obj.base_class`, however the singleton instances of [`SingletonInstruction`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonInstruction "qiskit.circuit.singleton.SingletonInstruction") and [`SingletonGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate") are subclasses of their base type. You can use the new [`base_class`](/api/qiskit/qiskit.circuit.Instruction#base_class "qiskit.circuit.Instruction.base_class") attribute to find the base class of these. See the attribute documentation for considerations on when other subclasses may modify their [`base_class`](/api/qiskit/qiskit.circuit.Instruction#base_class "qiskit.circuit.Instruction.base_class"), and what this means for execution.
* Added an attribute [`Instruction.base_class`](/api/qiskit/0.45/qiskit.circuit.Instruction#base_class "qiskit.circuit.Instruction.base_class"), which gets the “base” type of an instruction. Many instructions will satisfy `type(obj) == obj.base_class`, however the singleton instances of [`SingletonInstruction`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonInstruction "qiskit.circuit.singleton.SingletonInstruction") and [`SingletonGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate") are subclasses of their base type. You can use the new [`base_class`](/api/qiskit/0.45/qiskit.circuit.Instruction#base_class "qiskit.circuit.Instruction.base_class") attribute to find the base class of these. See the attribute documentation for considerations on when other subclasses may modify their [`base_class`](/api/qiskit/0.45/qiskit.circuit.Instruction#base_class "qiskit.circuit.Instruction.base_class"), and what this means for execution.
* Added the [`UnitaryOverlap`](/api/qiskit/qiskit.circuit.library.UnitaryOverlap "qiskit.circuit.library.UnitaryOverlap") circuit to the Qiskit circuit library. It can be used to compute the fidelity of states generated by unitaries by looking at the probability of the output distribution in the all-zeros state or, equivalently, by computing the expectation value of the projector onto the all-zeros state. This is useful in applications such as machine learning, and computing excited states in quantum chemistry, to name a few.
* Added the [`UnitaryOverlap`](/api/qiskit/0.45/qiskit.circuit.library.UnitaryOverlap "qiskit.circuit.library.UnitaryOverlap") circuit to the Qiskit circuit library. It can be used to compute the fidelity of states generated by unitaries by looking at the probability of the output distribution in the all-zeros state or, equivalently, by computing the expectation value of the projector onto the all-zeros state. This is useful in applications such as machine learning, and computing excited states in quantum chemistry, to name a few.
<span id="relnotes-0-45-0-stable-0-45-pulse-features" />
### Pulse Features
* Enabled circuit-to-pulse scheduling using [`BackendV2`](/api/qiskit/qiskit.providers.BackendV2 "qiskit.providers.BackendV2").
* Enabled circuit-to-pulse scheduling using [`BackendV2`](/api/qiskit/0.45/qiskit.providers.BackendV2 "qiskit.providers.BackendV2").
```python
# import a fake backend which is a sub-class of BackendV2
@ -307,15 +299,13 @@ Some feature highlights of Qiskit 0.45.0 are:
sched = schedule(circuits=qc, backend=FakePerth())
```
Since [`BackendV2`](/api/qiskit/qiskit.providers.BackendV2 "qiskit.providers.BackendV2") was not supported by the [`schedule()`](/api/qiskit/compiler#qiskit.compiler.schedule "qiskit.compiler.schedule") function, this caused the `schedule()` method to error out when the `backend` argument was supplied with an instance of [`BackendV2`](/api/qiskit/qiskit.providers.BackendV2 "qiskit.providers.BackendV2"). Refer to [#10837](https://github.com/Qiskit/qiskit/issues/10837) for more information.
Since [`BackendV2`](/api/qiskit/0.45/qiskit.providers.BackendV2 "qiskit.providers.BackendV2") was not supported by the [`schedule()`](/api/qiskit/0.45/compiler#qiskit.compiler.schedule "qiskit.compiler.schedule") function, this caused the `schedule()` method to error out when the `backend` argument was supplied with an instance of [`BackendV2`](/api/qiskit/0.45/qiskit.providers.BackendV2 "qiskit.providers.BackendV2"). Refer to [#10837](https://github.com/Qiskit/qiskit/issues/10837) for more information.
<span id="relnotes-0-45-0-stable-0-45-openqasm-features" />
<span id="id20" />
### OpenQASM Features
* The OpenQASM 2 module [`qiskit.qasm2`](/api/qiskit/qasm2#module-qiskit.qasm2 "qiskit.qasm2") has gained the export functions [`dump()`](/api/qiskit/qasm2#qiskit.qasm2.dump "qiskit.qasm2.dump") and [`dumps()`](/api/qiskit/qasm2#qiskit.qasm2.dumps "qiskit.qasm2.dumps"). These are used in a very similar manner to the previous `QuantumCircuit.qasm()`:
* The OpenQASM 2 module [`qiskit.qasm2`](/api/qiskit/0.45/qasm2#module-qiskit.qasm2 "qiskit.qasm2") has gained the export functions [`dump()`](/api/qiskit/0.45/qasm2#qiskit.qasm2.dump "qiskit.qasm2.dump") and [`dumps()`](/api/qiskit/0.45/qasm2#qiskit.qasm2.dumps "qiskit.qasm2.dumps"). These are used in a very similar manner to the previous [`QuantumCircuit.qasm()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#qasm "qiskit.circuit.QuantumCircuit.qasm"):
```python
from qiskit import qasm2, QuantumCircuit
@ -326,12 +316,10 @@ Some feature highlights of Qiskit 0.45.0 are:
print(qasm2.dumps(qc))
```
The new functions stem from the same code as `QuantumCircuit.qasm()`, which will slowly be phased out and replaced with the new paths, to provide a more coherent interface when compared to the OpenQASM 3 ([`qiskit.qasm3`](/api/qiskit/qasm3#module-qiskit.qasm3 "qiskit.qasm3")) and QPY ([`qiskit.qpy`](/api/qiskit/qpy#module-qiskit.qpy "qiskit.qpy")) modules. This is particularly important since the method name `qasm()` gave no indication of the OpenQASM version, and since it was originally added, Qiskit has gained several serialisation modules that could easily become confused.
The new functions stem from the same code as [`QuantumCircuit.qasm()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#qasm "qiskit.circuit.QuantumCircuit.qasm"), which will slowly be phased out and replaced with the new paths, to provide a more coherent interface when compared to the OpenQASM 3 ([`qiskit.qasm3`](/api/qiskit/0.45/qasm3#module-qiskit.qasm3 "qiskit.qasm3")) and QPY ([`qiskit.qpy`](/api/qiskit/0.45/qpy#module-qiskit.qpy "qiskit.qpy")) modules. This is particularly important since the method name [`qasm()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#qasm "qiskit.circuit.QuantumCircuit.qasm") gave no indication of the OpenQASM version, and since it was originally added, Qiskit has gained several serialisation modules that could easily become confused.
<span id="relnotes-0-45-0-stable-0-45-qpy-features" />
<span id="id21" />
### QPY Features
* QPY now supports the use of symengine-native serialization and deserialization for objects of type `ParameterExpression` as well as symbolic expressions in Pulse schedule blocks. This is a faster serialization alternative, but not supported in all platforms. Please check that your target platform is supported by the symengine library before setting this option, as it will be **required** by qpy to deserialize the payload.
@ -359,15 +347,13 @@ Some feature highlights of Qiskit 0.45.0 are:
<span id="relnotes-0-45-0-stable-0-45-quantum-information-features" />
<span id="id22" />
### Quantum Information Features
* Added [`Clifford.from_linear_function()`](/api/qiskit/qiskit.quantum_info.Clifford#from_linear_function "qiskit.quantum_info.Clifford.from_linear_function") and [`Clifford.from_permutation()`](/api/qiskit/qiskit.quantum_info.Clifford#from_permutation "qiskit.quantum_info.Clifford.from_permutation") methods that create a [`Clifford`](/api/qiskit/qiskit.quantum_info.Clifford "qiskit.quantum_info.Clifford") object from [`LinearFunction`](/api/qiskit/qiskit.circuit.library.LinearFunction "qiskit.circuit.library.LinearFunction") and from [`PermutationGate`](/api/qiskit/qiskit.circuit.library.PermutationGate "qiskit.circuit.library.PermutationGate") respectively. As a consequence, a [`Clifford`](/api/qiskit/qiskit.quantum_info.Clifford "qiskit.quantum_info.Clifford") can now be constructed directly from a [`LinearFunction`](/api/qiskit/qiskit.circuit.library.LinearFunction "qiskit.circuit.library.LinearFunction"), a [`PermutationGate`](/api/qiskit/qiskit.circuit.library.PermutationGate "qiskit.circuit.library.PermutationGate"), or a quantum circuit containing such gates.
* Added [`Clifford.from_linear_function()`](/api/qiskit/0.45/qiskit.quantum_info.Clifford#from_linear_function "qiskit.quantum_info.Clifford.from_linear_function") and [`Clifford.from_permutation()`](/api/qiskit/0.45/qiskit.quantum_info.Clifford#from_permutation "qiskit.quantum_info.Clifford.from_permutation") methods that create a [`Clifford`](/api/qiskit/0.45/qiskit.quantum_info.Clifford "qiskit.quantum_info.Clifford") object from [`LinearFunction`](/api/qiskit/0.45/qiskit.circuit.library.LinearFunction "qiskit.circuit.library.LinearFunction") and from [`PermutationGate`](/api/qiskit/0.45/qiskit.circuit.library.PermutationGate "qiskit.circuit.library.PermutationGate") respectively. As a consequence, a [`Clifford`](/api/qiskit/0.45/qiskit.quantum_info.Clifford "qiskit.quantum_info.Clifford") can now be constructed directly from a [`LinearFunction`](/api/qiskit/0.45/qiskit.circuit.library.LinearFunction "qiskit.circuit.library.LinearFunction"), a [`PermutationGate`](/api/qiskit/0.45/qiskit.circuit.library.PermutationGate "qiskit.circuit.library.PermutationGate"), or a quantum circuit containing such gates.
* The [`Operator`](/api/qiskit/qiskit.quantum_info.Operator "qiskit.quantum_info.Operator") class now has a [`draw()`](/api/qiskit/qiskit.quantum_info.Operator#draw "qiskit.quantum_info.Operator.draw") method allowing it to be displayed as a text matrix, IPython LaTeX object or LaTeX source. The default draw type still is the ASCII `__repr__` of the operator.
* The [`Operator`](/api/qiskit/0.45/qiskit.quantum_info.Operator "qiskit.quantum_info.Operator") class now has a [`draw()`](/api/qiskit/0.45/qiskit.quantum_info.Operator#draw "qiskit.quantum_info.Operator.draw") method allowing it to be displayed as a text matrix, IPython LaTeX object or LaTeX source. The default draw type still is the ASCII `__repr__` of the operator.
* Added a new method, [`apply_layout()`](/api/qiskit/qiskit.quantum_info.SparsePauliOp#apply_layout "qiskit.quantum_info.SparsePauliOp.apply_layout"), to the [`SparsePauliOp`](/api/qiskit/qiskit.quantum_info.SparsePauliOp "qiskit.quantum_info.SparsePauliOp") class. This method is used to apply a [`TranspileLayout`](/api/qiskit/qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") layout from the transpiler to a [`SparsePauliOp`](/api/qiskit/qiskit.quantum_info.SparsePauliOp "qiskit.quantum_info.SparsePauliOp") observable that was built for an input circuit to the transpiler. This enables working with `BaseEstimator` implementations and local transpilation more easily. For example:
* Added a new method, [`apply_layout()`](/api/qiskit/0.45/qiskit.quantum_info.SparsePauliOp#apply_layout "qiskit.quantum_info.SparsePauliOp.apply_layout"), to the [`SparsePauliOp`](/api/qiskit/0.45/qiskit.quantum_info.SparsePauliOp "qiskit.quantum_info.SparsePauliOp") class. This method is used to apply a [`TranspileLayout`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") layout from the transpiler to a [`SparsePauliOp`](/api/qiskit/0.45/qiskit.quantum_info.SparsePauliOp "qiskit.quantum_info.SparsePauliOp") observable that was built for an input circuit to the transpiler. This enables working with [`BaseEstimator`](/api/qiskit/0.45/qiskit.primitives.BaseEstimator "qiskit.primitives.BaseEstimator") implementations and local transpilation more easily. For example:
```python
from qiskit.circuit.library import RealAmplitudes
@ -387,23 +373,21 @@ Some feature highlights of Qiskit 0.45.0 are:
res = estimator.run(transpiled_psi, permuted_op, thetas)
```
where an input circuit is transpiled locally before its passed to `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 [`apply_layout()`](/api/qiskit/qiskit.quantum_info.SparsePauliOp#apply_layout "qiskit.quantum_info.SparsePauliOp.apply_layout") to reflect the transformations performed by [`transpile()`](/api/qiskit/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile").
where an input circuit is transpiled locally before its passed to `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 [`apply_layout()`](/api/qiskit/0.45/qiskit.quantum_info.SparsePauliOp#apply_layout "qiskit.quantum_info.SparsePauliOp.apply_layout") to reflect the transformations performed by [`transpile()`](/api/qiskit/0.45/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile").
<span id="relnotes-0-45-0-stable-0-45-transpiler-features" />
<span id="id23" />
### Transpiler Features
* The [`HighLevelSynthesis`](/api/qiskit/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") class is extended to synthesize circuits with objects of type [`AnnotatedOperation`](/api/qiskit/qiskit.circuit.AnnotatedOperation "qiskit.circuit.AnnotatedOperation").
* The [`HighLevelSynthesis`](/api/qiskit/0.45/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") class is extended to synthesize circuits with objects of type [`AnnotatedOperation`](/api/qiskit/0.45/qiskit.circuit.AnnotatedOperation "qiskit.circuit.AnnotatedOperation").
* A new [`qiskit.passmanager`](/api/qiskit/passmanager#module-qiskit.passmanager "qiskit.passmanager") module has been added to the Qiskit library. This module implements a generic pass manager and flow controllers, and provides infrastructure to manage execution of pass manager tasks. The module provides base classes for passes ([`GenericPass`](/api/qiskit/qiskit.passmanager.GenericPass "qiskit.passmanager.GenericPass")) and flow controllers ([`BaseController`](/api/qiskit/qiskit.passmanager.BaseController "qiskit.passmanager.BaseController")), as well as a new interface class, `passmanager.Task`, to manage the execution of the pass manager (see the `Task.execute()` method). These new classes follow the composite pattern, as flow controllers are collections of passes, and a controller can be recursively nested into the task pipeline. It must also be noted the base classes are not not aware of the input and output object types, and they must be subclassed for a particular program type to optimize. This unified design reduces the complexity of the conventional pass manager, and no longer requires the use of classes such as the `RunningPassManager` to handle the execution logic dispatch and task structure renormalization. The [`qiskit.transpiler`](/api/qiskit/transpiler#module-qiskit.transpiler "qiskit.transpiler") module has been reorganized to rebuild the existing pass managers based off of the generic pass manager. See upgrade notes for more details.
* A new [`qiskit.passmanager`](/api/qiskit/0.45/passmanager#module-qiskit.passmanager "qiskit.passmanager") module has been added to the Qiskit library. This module implements a generic pass manager and flow controllers, and provides infrastructure to manage execution of pass manager tasks. The module provides base classes for passes ([`GenericPass`](/api/qiskit/0.45/qiskit.passmanager.GenericPass "qiskit.passmanager.GenericPass")) and flow controllers ([`BaseController`](/api/qiskit/0.45/qiskit.passmanager.BaseController "qiskit.passmanager.BaseController")), as well as a new interface class, `passmanager.Task`, to manage the execution of the pass manager (see the `Task.execute()` method). These new classes follow the composite pattern, as flow controllers are collections of passes, and a controller can be recursively nested into the task pipeline. It must also be noted the base classes are not not aware of the input and output object types, and they must be subclassed for a particular program type to optimize. This unified design reduces the complexity of the conventional pass manager, and no longer requires the use of classes such as the `RunningPassManager` to handle the execution logic dispatch and task structure renormalization. The [`qiskit.transpiler`](/api/qiskit/0.45/transpiler#module-qiskit.transpiler "qiskit.transpiler") module has been reorganized to rebuild the existing pass managers based off of the generic pass manager. See upgrade notes for more details.
* Added a new analysis [`SabrePreLayout`](/api/qiskit/qiskit.transpiler.passes.SabrePreLayout "qiskit.transpiler.passes.SabrePreLayout") pass that creates a starting layout for [`SabreLayout`](/api/qiskit/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout"), writing the layout into the property set value `sabre_starting_layouts`.
* Added a new analysis [`SabrePreLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.SabrePreLayout "qiskit.transpiler.passes.SabrePreLayout") pass that creates a starting layout for [`SabreLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout"), writing the layout into the property set value `sabre_starting_layouts`.
The pass works by augmenting the coupling map with more and more “extra” edges until [`VF2Layout`](/api/qiskit/qiskit.transpiler.passes.VF2Layout "qiskit.transpiler.passes.VF2Layout") succeeds to find a perfect graph isomorphism. More precisely, the augmented coupling map contains edges between nodes that are within a given distance `d` in the original coupling map, and the value of `d` is increased until an isomorphism is found. The pass also optionally minimizes the number of extra edges involved in the layout until a local minimum is found. This involves removing extra edges and calling [`VF2Layout`](/api/qiskit/qiskit.transpiler.passes.VF2Layout "qiskit.transpiler.passes.VF2Layout") to check if an isomorphism still exists.
The pass works by augmenting the coupling map with more and more “extra” edges until [`VF2Layout`](/api/qiskit/0.45/qiskit.transpiler.passes.VF2Layout "qiskit.transpiler.passes.VF2Layout") succeeds to find a perfect graph isomorphism. More precisely, the augmented coupling map contains edges between nodes that are within a given distance `d` in the original coupling map, and the value of `d` is increased until an isomorphism is found. The pass also optionally minimizes the number of extra edges involved in the layout until a local minimum is found. This involves removing extra edges and calling [`VF2Layout`](/api/qiskit/0.45/qiskit.transpiler.passes.VF2Layout "qiskit.transpiler.passes.VF2Layout") to check if an isomorphism still exists.
Here is an example of calling the [`SabrePreLayout`](/api/qiskit/qiskit.transpiler.passes.SabrePreLayout "qiskit.transpiler.passes.SabrePreLayout") before [`SabreLayout`](/api/qiskit/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout"):
Here is an example of calling the [`SabrePreLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.SabrePreLayout "qiskit.transpiler.passes.SabrePreLayout") before [`SabreLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout"):
```python
import math
@ -427,25 +411,25 @@ Some feature highlights of Qiskit 0.45.0 are:
pm.run(qc)
```
* Added the arguments `coupling_map`, `target` and `use_qubit_indices` to [`HighLevelSynthesis`](/api/qiskit/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") transpiler pass. The argument `target` specifies the target backend, allowing the synthesis plugins called within the pass to access all target-specific information, such as the coupling map and the supported gate set. The argument `coupling_map` only specifies the coupling map, and is only used when `target` is not specified. The argument `use_qubit_indices` indicates whether the high-level-synthesis pass is running before or after the layout is set, that is, whether the qubit indices of higher-level-objects correspond to qubit indices on the target backend.
* Added the arguments `coupling_map`, `target` and `use_qubit_indices` to [`HighLevelSynthesis`](/api/qiskit/0.45/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") transpiler pass. The argument `target` specifies the target backend, allowing the synthesis plugins called within the pass to access all target-specific information, such as the coupling map and the supported gate set. The argument `coupling_map` only specifies the coupling map, and is only used when `target` is not specified. The argument `use_qubit_indices` indicates whether the high-level-synthesis pass is running before or after the layout is set, that is, whether the qubit indices of higher-level-objects correspond to qubit indices on the target backend.
* Added the arguments `coupling_map`, `target` and `qubits` to [`HighLevelSynthesisPlugin`](/api/qiskit/qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin"). The positional argument `target` specifies the target backend, allowing the plugin to access all target-specific information, such as the coupling map, the supported gate set, and so on. The positional argument `coupling_map` only specifies the coupling map, and is only used when `target` is not specified. The positional argument `qubits` specifies the list of qubits over which the higher-level-object is defined, in case the synthesis is done on the physical circuit. The value of `None` indicates that the layout has not yet been chosen.
* Added the arguments `coupling_map`, `target` and `qubits` to [`HighLevelSynthesisPlugin`](/api/qiskit/0.45/qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin "qiskit.transpiler.passes.synthesis.plugin.HighLevelSynthesisPlugin"). The positional argument `target` specifies the target backend, allowing the plugin to access all target-specific information, such as the coupling map, the supported gate set, and so on. The positional argument `coupling_map` only specifies the coupling map, and is only used when `target` is not specified. The positional argument `qubits` specifies the list of qubits over which the higher-level-object is defined, in case the synthesis is done on the physical circuit. The value of `None` indicates that the layout has not yet been chosen.
This enables a cleaner separation of synthesis plugins options into general interface options for plugins (that is, `coupling_map`, `target`, and `qubits`) and into plugin-specific options (a free form configuration dictionary specified via `options`). It is worthwhile to note that this change is backward-compatible, if the options `coupling_map`, etc. are not explicitly added to the plugins `run()` method, they will appear as part of `options`.
* The [`DAGCircuit`](/api/qiskit/qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") methods [`apply_operation_back()`](/api/qiskit/qiskit.dagcircuit.DAGCircuit#apply_operation_back "qiskit.dagcircuit.DAGCircuit.apply_operation_back") and [`apply_operation_front()`](/api/qiskit/qiskit.dagcircuit.DAGCircuit#apply_operation_front "qiskit.dagcircuit.DAGCircuit.apply_operation_front") have gained a `check` keyword argument that can be set `False` to skip validation that the inputs uphold the [`DAGCircuit`](/api/qiskit/qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") data-structure invariants. This is useful as a performance optimisation when the DAG is being built from known-good data, such as during transpiler passes.
* The [`DAGCircuit`](/api/qiskit/0.45/qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") methods [`apply_operation_back()`](/api/qiskit/0.45/qiskit.dagcircuit.DAGCircuit#apply_operation_back "qiskit.dagcircuit.DAGCircuit.apply_operation_back") and [`apply_operation_front()`](/api/qiskit/0.45/qiskit.dagcircuit.DAGCircuit#apply_operation_front "qiskit.dagcircuit.DAGCircuit.apply_operation_front") have gained a `check` keyword argument that can be set `False` to skip validation that the inputs uphold the [`DAGCircuit`](/api/qiskit/0.45/qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") data-structure invariants. This is useful as a performance optimisation when the DAG is being built from known-good data, such as during transpiler passes.
* The method [`CouplingMap.reduce()`](/api/qiskit/qiskit.transpiler.CouplingMap#reduce "qiskit.transpiler.CouplingMap.reduce") now accepts an additional argument `check_if_connected`, defaulted to `True`. This corresponds to the previous behavior, checking whether the reduced coupling map remains connected and raising a `CouplingError` if not so. When set to `False`, the check is skipped, allowing disconnected reduced coupling maps.
* The method [`CouplingMap.reduce()`](/api/qiskit/0.45/qiskit.transpiler.CouplingMap#reduce "qiskit.transpiler.CouplingMap.reduce") now accepts an additional argument `check_if_connected`, defaulted to `True`. This corresponds to the previous behavior, checking whether the reduced coupling map remains connected and raising a `CouplingError` if not so. When set to `False`, the check is skipped, allowing disconnected reduced coupling maps.
* The constructor for [`HighLevelSynthesis`](/api/qiskit/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") transpiler pass now accepts additional arguments `equivalence_library`, `basis_gates`, and `min_qubits`. The pass can now unroll custom definitions similarly to [`UnrollCustomDefinitions`](/api/qiskit/qiskit.transpiler.passes.UnrollCustomDefinitions "qiskit.transpiler.passes.UnrollCustomDefinitions"), and as such completely subsumes the functionality of the latter pass. In particular, [`HighLevelSynthesis`](/api/qiskit/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") is now recursive, fixing an oversight in the initial implementation. Thus, when either `target` or `basis_gates` are specified, [`HighLevelSynthesis`](/api/qiskit/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") recursively synthesizes all high-level objects, annotated operations and custom gates in the circuit, leaving only gates that are supported by the target or belong to the equivalence library. This allows to use [`HighLevelSynthesis`](/api/qiskit/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") as a drop-in replacement for [`UnrollCustomDefinitions`](/api/qiskit/qiskit.transpiler.passes.UnrollCustomDefinitions "qiskit.transpiler.passes.UnrollCustomDefinitions"). On the other hand, when neither `target` nor `basis_gates` are specified, the pass synthesizes only the “top-level” high-level objects and annotated operations, i.e. does not recursively descent into the custom gates `definition` field. This is backward-compatible both with [`UnrollCustomDefinitions`](/api/qiskit/qiskit.transpiler.passes.UnrollCustomDefinitions "qiskit.transpiler.passes.UnrollCustomDefinitions") (which would not do anything) and with the older behavior of the high level synthesis pass, which allows to use it as an intermediate transform, only synthesizing high-level objects as specified by [`HLSConfig`](/api/qiskit/qiskit.transpiler.passes.HLSConfig "qiskit.transpiler.passes.HLSConfig").
* The constructor for [`HighLevelSynthesis`](/api/qiskit/0.45/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") transpiler pass now accepts additional arguments `equivalence_library`, `basis_gates`, and `min_qubits`. The pass can now unroll custom definitions similarly to [`UnrollCustomDefinitions`](/api/qiskit/0.45/qiskit.transpiler.passes.UnrollCustomDefinitions "qiskit.transpiler.passes.UnrollCustomDefinitions"), and as such completely subsumes the functionality of the latter pass. In particular, [`HighLevelSynthesis`](/api/qiskit/0.45/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") is now recursive, fixing an oversight in the initial implementation. Thus, when either `target` or `basis_gates` are specified, [`HighLevelSynthesis`](/api/qiskit/0.45/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") recursively synthesizes all high-level objects, annotated operations and custom gates in the circuit, leaving only gates that are supported by the target or belong to the equivalence library. This allows to use [`HighLevelSynthesis`](/api/qiskit/0.45/qiskit.transpiler.passes.HighLevelSynthesis "qiskit.transpiler.passes.HighLevelSynthesis") as a drop-in replacement for [`UnrollCustomDefinitions`](/api/qiskit/0.45/qiskit.transpiler.passes.UnrollCustomDefinitions "qiskit.transpiler.passes.UnrollCustomDefinitions"). On the other hand, when neither `target` nor `basis_gates` are specified, the pass synthesizes only the “top-level” high-level objects and annotated operations, i.e. does not recursively descent into the custom gates `definition` field. This is backward-compatible both with [`UnrollCustomDefinitions`](/api/qiskit/0.45/qiskit.transpiler.passes.UnrollCustomDefinitions "qiskit.transpiler.passes.UnrollCustomDefinitions") (which would not do anything) and with the older behavior of the high level synthesis pass, which allows to use it as an intermediate transform, only synthesizing high-level objects as specified by `HLSConfig`.
* Significantly improved the performance of the [`MergeAdjacentBarriers`](/api/qiskit/qiskit.transpiler.passes.MergeAdjacentBarriers "qiskit.transpiler.passes.MergeAdjacentBarriers") transpiler pass, which used to rebuild the complete DAG to merge the barriers.
* Significantly improved the performance of the [`MergeAdjacentBarriers`](/api/qiskit/0.45/qiskit.transpiler.passes.MergeAdjacentBarriers "qiskit.transpiler.passes.MergeAdjacentBarriers") transpiler pass, which used to rebuild the complete DAG to merge the barriers.
* Added a new keyword argument, `min_qubits`, to the constructor of the [`BasisTranslator`](/api/qiskit/qiskit.transpiler.passes.BasisTranslator "qiskit.transpiler.passes.BasisTranslator") transpiler pass. When set to a non-zero value this is used to set a minimum number of qubits to filter operations to translate in the circuit. For example, if `min_qubits=3` is set the [`BasisTranslator`](/api/qiskit/qiskit.transpiler.passes.BasisTranslator "qiskit.transpiler.passes.BasisTranslator") instance will only translate gates in the circuit that operate on 3 or more qubits.
* Added a new keyword argument, `min_qubits`, to the constructor of the [`BasisTranslator`](/api/qiskit/0.45/qiskit.transpiler.passes.BasisTranslator "qiskit.transpiler.passes.BasisTranslator") transpiler pass. When set to a non-zero value this is used to set a minimum number of qubits to filter operations to translate in the circuit. For example, if `min_qubits=3` is set the [`BasisTranslator`](/api/qiskit/0.45/qiskit.transpiler.passes.BasisTranslator "qiskit.transpiler.passes.BasisTranslator") instance will only translate gates in the circuit that operate on 3 or more qubits.
* Added a new keyword argument, `min_qubits`, to the constructor of the [`UnrollCustomDefinitions`](/api/qiskit/qiskit.transpiler.passes.UnrollCustomDefinitions "qiskit.transpiler.passes.UnrollCustomDefinitions") transpiler pass. When set to a non-zero value this is used to set a minimum number of qubits to filter operations to translate in the circuit. For example, if `min_qubits=3` is set the [`UnrollCustomDefinitions`](/api/qiskit/qiskit.transpiler.passes.UnrollCustomDefinitions "qiskit.transpiler.passes.UnrollCustomDefinitions") instance will only translate gates in the circuit that operate on 3 or more qubits.
* Added a new keyword argument, `min_qubits`, to the constructor of the [`UnrollCustomDefinitions`](/api/qiskit/0.45/qiskit.transpiler.passes.UnrollCustomDefinitions "qiskit.transpiler.passes.UnrollCustomDefinitions") transpiler pass. When set to a non-zero value this is used to set a minimum number of qubits to filter operations to translate in the circuit. For example, if `min_qubits=3` is set the [`UnrollCustomDefinitions`](/api/qiskit/0.45/qiskit.transpiler.passes.UnrollCustomDefinitions "qiskit.transpiler.passes.UnrollCustomDefinitions") instance will only translate gates in the circuit that operate on 3 or more qubits.
* Added support to the [`SabreLayout`](/api/qiskit/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") pass to add trials with specified starting layouts. The [`SabreLayout`](/api/qiskit/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") transpiler pass typically runs multiple layout trials that all start with fully random layouts which then use a routing pass to permute that layout instead of inserting swaps to find a layout which will result in fewer swap gates. This new feature enables running an [`AnalysisPass`](/api/qiskit/qiskit.transpiler.AnalysisPass "qiskit.transpiler.AnalysisPass") prior to [`SabreLayout`](/api/qiskit/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") which sets the `"sabre_starting_layout"` field in the property set to provide the [`SabreLayout`](/api/qiskit/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") with additional starting layouts to use in its internal trials. For example, if you wanted to run [`DenseLayout`](/api/qiskit/qiskit.transpiler.passes.DenseLayout "qiskit.transpiler.passes.DenseLayout") as the starting point for one trial in [`SabreLayout`](/api/qiskit/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") you would do something like:
* Added support to the [`SabreLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") pass to add trials with specified starting layouts. The [`SabreLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") transpiler pass typically runs multiple layout trials that all start with fully random layouts which then use a routing pass to permute that layout instead of inserting swaps to find a layout which will result in fewer swap gates. This new feature enables running an [`AnalysisPass`](/api/qiskit/0.45/qiskit.transpiler.AnalysisPass "qiskit.transpiler.AnalysisPass") prior to [`SabreLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") which sets the `"sabre_starting_layout"` field in the property set to provide the [`SabreLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") with additional starting layouts to use in its internal trials. For example, if you wanted to run [`DenseLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.DenseLayout "qiskit.transpiler.passes.DenseLayout") as the starting point for one trial in [`SabreLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") you would do something like:
```python
from qiskit.providers.fake_provider import FakeSherbrooke
@ -469,17 +453,17 @@ Some feature highlights of Qiskit 0.45.0 are:
opt_level_1.pre_layout = pre_layout
```
Then when the `opt_level_1` [`StagedPassManager`](/api/qiskit/qiskit.transpiler.StagedPassManager "qiskit.transpiler.StagedPassManager") is run with a circuit the output of the [`DenseLayout`](/api/qiskit/qiskit.transpiler.passes.DenseLayout "qiskit.transpiler.passes.DenseLayout") pass will be used for one of the [`SabreLayout`](/api/qiskit/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") trials in addition to the 5 fully random trials that run by default in optimization level 1.
Then when the `opt_level_1` [`StagedPassManager`](/api/qiskit/0.45/qiskit.transpiler.StagedPassManager "qiskit.transpiler.StagedPassManager") is run with a circuit the output of the [`DenseLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.DenseLayout "qiskit.transpiler.passes.DenseLayout") pass will be used for one of the [`SabreLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") trials in addition to the 5 fully random trials that run by default in optimization level 1.
* Two new transpiler passes are added to generate single-pulse RX gate calibrations on the fly. These single-pulse RX calibrations will reduce the gate time in half, as described in P.Gokhale et al, Optimized Quantum Compilation for Near-Term Algorithms with OpenPulse (2020), [arXiv:2004.11205](https://arxiv.org/abs/2004.11205).
To reduce the amount of RX calibration data that needs to be generated, [`NormalizeRXAngle`](/api/qiskit/qiskit.transpiler.passes.NormalizeRXAngle "qiskit.transpiler.passes.optimization.normalize_rx_angle.NormalizeRXAngle") performs three optimizations: wrapping the [`RXGate`](/api/qiskit/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate") rotation angles to `[0, pi]`, replacing `RX(pi/2)` and `RX(pi)` with [`SXGate`](/api/qiskit/qiskit.circuit.library.SXGate "qiskit.circuit.library.SXGate") and [`XGate`](/api/qiskit/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate"), and quantizing the rotation angles. This pass is required to be run before [`RXCalibrationBuilder`](/api/qiskit/qiskit.transpiler.passes.RXCalibrationBuilder "qiskit.transpiler.passes.calibration.rx_builder.RXCalibrationBuilder"), which generates RX calibrations on the fly.
To reduce the amount of RX calibration data that needs to be generated, [`NormalizeRXAngle`](/api/qiskit/0.45/qiskit.transpiler.passes.NormalizeRXAngle "qiskit.transpiler.passes.optimization.normalize_rx_angle.NormalizeRXAngle") performs three optimizations: wrapping the [`RXGate`](/api/qiskit/0.45/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate") rotation angles to `[0, pi]`, replacing `RX(pi/2)` and `RX(pi)` with [`SXGate`](/api/qiskit/0.45/qiskit.circuit.library.SXGate "qiskit.circuit.library.SXGate") and [`XGate`](/api/qiskit/0.45/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate"), and quantizing the rotation angles. This pass is required to be run before [`RXCalibrationBuilder`](/api/qiskit/0.45/qiskit.transpiler.passes.RXCalibrationBuilder "qiskit.transpiler.passes.calibration.rx_builder.RXCalibrationBuilder"), which generates RX calibrations on the fly.
The optimizations performed by [`NormalizeRXAngle`](/api/qiskit/qiskit.transpiler.passes.NormalizeRXAngle "qiskit.transpiler.passes.NormalizeRXAngle") reduce the amount of calibration data and enable us to take advantage of the more accurate, hardware-calibrated pulses. The calibrations generated by [`RXCalibrationBuilder`](/api/qiskit/qiskit.transpiler.passes.RXCalibrationBuilder "qiskit.transpiler.passes.RXCalibrationBuilder") are bootstrapped from the [`SXGate`](/api/qiskit/qiskit.circuit.library.SXGate "qiskit.circuit.library.SXGate") calibration, which should be already present in the target. The amplitude is linearly scaled to achieve the desired arbitrary rotation angle.
The optimizations performed by [`NormalizeRXAngle`](/api/qiskit/0.45/qiskit.transpiler.passes.NormalizeRXAngle "qiskit.transpiler.passes.NormalizeRXAngle") reduce the amount of calibration data and enable us to take advantage of the more accurate, hardware-calibrated pulses. The calibrations generated by [`RXCalibrationBuilder`](/api/qiskit/0.45/qiskit.transpiler.passes.RXCalibrationBuilder "qiskit.transpiler.passes.RXCalibrationBuilder") are bootstrapped from the [`SXGate`](/api/qiskit/0.45/qiskit.circuit.library.SXGate "qiskit.circuit.library.SXGate") calibration, which should be already present in the target. The amplitude is linearly scaled to achieve the desired arbitrary rotation angle.
Such single-pulse calibrations reduces the [`RXGate`](/api/qiskit/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate") time in half, compared to the conventional sequence that consists of two [`SXGate`](/api/qiskit/qiskit.circuit.library.SXGate "qiskit.circuit.library.SXGate") pulses. There could be an improvement in fidelity due to this reduction in gate time.
Such single-pulse calibrations reduces the [`RXGate`](/api/qiskit/0.45/qiskit.circuit.library.RXGate "qiskit.circuit.library.RXGate") time in half, compared to the conventional sequence that consists of two [`SXGate`](/api/qiskit/0.45/qiskit.circuit.library.SXGate "qiskit.circuit.library.SXGate") pulses. There could be an improvement in fidelity due to this reduction in gate time.
* Added new methods to [`TranspileLayout`](/api/qiskit/qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout"), [`initial_index_layout()`](/api/qiskit/qiskit.transpiler.TranspileLayout#initial_index_layout "qiskit.transpiler.TranspileLayout.initial_index_layout") and [`routing_permutation()`](/api/qiskit/qiskit.transpiler.TranspileLayout#routing_permutation "qiskit.transpiler.TranspileLayout.routing_permutation"), which are used to generate a list view of the [`TranspileLayout.initial_layout`](/api/qiskit/qiskit.transpiler.TranspileLayout#initial_layout "qiskit.transpiler.TranspileLayout.initial_layout") and [`TranspileLayout.final_layout`](/api/qiskit/qiskit.transpiler.TranspileLayout#final_layout "qiskit.transpiler.TranspileLayout.final_layout") attributes respectively. For example, if the [`final_layout`](/api/qiskit/qiskit.transpiler.TranspileLayout#final_layout "qiskit.transpiler.TranspileLayout.final_layout") attribute was:
* Added new methods to [`TranspileLayout`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout"), [`initial_index_layout()`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#initial_index_layout "qiskit.transpiler.TranspileLayout.initial_index_layout") and [`routing_permutation()`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#routing_permutation "qiskit.transpiler.TranspileLayout.routing_permutation"), which are used to generate a list view of the [`TranspileLayout.initial_layout`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#initial_layout "qiskit.transpiler.TranspileLayout.initial_layout") and [`TranspileLayout.final_layout`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#final_layout "qiskit.transpiler.TranspileLayout.final_layout") attributes respectively. For example, if the [`final_layout`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#final_layout "qiskit.transpiler.TranspileLayout.final_layout") attribute was:
```python
Layout({
@ -490,15 +474,15 @@ Some feature highlights of Qiskit 0.45.0 are:
})
```
then [`routing_permutation()`](/api/qiskit/qiskit.transpiler.TranspileLayout#routing_permutation "qiskit.transpiler.TranspileLayout.routing_permutation") will return:
then [`routing_permutation()`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#routing_permutation "qiskit.transpiler.TranspileLayout.routing_permutation") will return:
```python
[2, 3, 0, 1]
```
* Added a new method to [`TranspileLayout`](/api/qiskit/qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout"), [`initial_virtual_layout()`](/api/qiskit/qiskit.transpiler.TranspileLayout#initial_virtual_layout "qiskit.transpiler.TranspileLayout.initial_virtual_layout"), which is equivalent to the [`TranspileLayout.initial_layout`](/api/qiskit/qiskit.transpiler.TranspileLayout#initial_layout "qiskit.transpiler.TranspileLayout.initial_layout") attribute but gives the option to filter ancilla qubits that were added to the circuit. By default the [`TranspileLayout.initial_layout`](/api/qiskit/qiskit.transpiler.TranspileLayout#initial_layout "qiskit.transpiler.TranspileLayout.initial_layout") will typically include any ancillas added by the transpiler.
* Added a new method to [`TranspileLayout`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout"), [`initial_virtual_layout()`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#initial_virtual_layout "qiskit.transpiler.TranspileLayout.initial_virtual_layout"), which is equivalent to the [`TranspileLayout.initial_layout`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#initial_layout "qiskit.transpiler.TranspileLayout.initial_layout") attribute but gives the option to filter ancilla qubits that were added to the circuit. By default the [`TranspileLayout.initial_layout`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#initial_layout "qiskit.transpiler.TranspileLayout.initial_layout") will typically include any ancillas added by the transpiler.
* Added a new methods, [`final_index_layout()`](/api/qiskit/qiskit.transpiler.TranspileLayout#final_index_layout "qiskit.transpiler.TranspileLayout.final_index_layout") and [`final_virtual_layout()`](/api/qiskit/qiskit.transpiler.TranspileLayout#final_virtual_layout "qiskit.transpiler.TranspileLayout.final_virtual_layout") to the [`TranspileLayout`](/api/qiskit/qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") class. These methods are used to return a final layout (the mapping of input circuit qubits to the final position in the output). This is distinct from the [`final_layout`](/api/qiskit/qiskit.transpiler.TranspileLayout#final_layout "qiskit.transpiler.TranspileLayout.final_layout") attribute which is the permutation caused by routing as a [`Layout`](/api/qiskit/qiskit.transpiler.Layout "qiskit.transpiler.Layout") object. The [`final_index_layout()`](/api/qiskit/qiskit.transpiler.TranspileLayout#final_index_layout "qiskit.transpiler.TranspileLayout.final_index_layout") method returns a list to show the output position for each qubit in the input circuit to the transpiler. For example, with an original circuit:
* Added a new methods, [`final_index_layout()`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#final_index_layout "qiskit.transpiler.TranspileLayout.final_index_layout") and [`final_virtual_layout()`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#final_virtual_layout "qiskit.transpiler.TranspileLayout.final_virtual_layout") to the [`TranspileLayout`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout "qiskit.transpiler.TranspileLayout") class. These methods are used to return a final layout (the mapping of input circuit qubits to the final position in the output). This is distinct from the [`final_layout`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#final_layout "qiskit.transpiler.TranspileLayout.final_layout") attribute which is the permutation caused by routing as a [`Layout`](/api/qiskit/0.45/qiskit.transpiler.Layout "qiskit.transpiler.Layout") object. The [`final_index_layout()`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#final_index_layout "qiskit.transpiler.TranspileLayout.final_index_layout") method returns a list to show the output position for each qubit in the input circuit to the transpiler. For example, with an original circuit:
```python
qc = QuantumCircuit(3)
@ -517,13 +501,13 @@ Some feature highlights of Qiskit 0.45.0 are:
tqc.cx(2, 1)
```
then the output from [`final_index_layout()`](/api/qiskit/qiskit.transpiler.TranspileLayout#final_index_layout "qiskit.transpiler.TranspileLayout.final_index_layout") would return a list of:
then the output from [`final_index_layout()`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#final_index_layout "qiskit.transpiler.TranspileLayout.final_index_layout") would return a list of:
```python
[2, 0, 1]
```
The [`final_virtual_layout()`](/api/qiskit/qiskit.transpiler.TranspileLayout#final_virtual_layout "qiskit.transpiler.TranspileLayout.final_virtual_layout") returns this as a [`Layout`](/api/qiskit/qiskit.transpiler.Layout "qiskit.transpiler.Layout") object, so the return from the above example would be:
The [`final_virtual_layout()`](/api/qiskit/0.45/qiskit.transpiler.TranspileLayout#final_virtual_layout "qiskit.transpiler.TranspileLayout.final_virtual_layout") returns this as a [`Layout`](/api/qiskit/0.45/qiskit.transpiler.Layout "qiskit.transpiler.Layout") object, so the return from the above example would be:
```python
Layout({
@ -535,29 +519,25 @@ Some feature highlights of Qiskit 0.45.0 are:
<span id="relnotes-0-45-0-stable-0-45-visualization-features" />
<span id="id24" />
### Visualization Features
* Added the ability to display conditions as expressions from [`Expr`](/api/qiskit/circuit_classical#qiskit.circuit.classical.expr.Expr "qiskit.circuit.classical.expr.Expr") in the [`QuantumCircuit.draw()`](/api/qiskit/qiskit.circuit.QuantumCircuit#draw "qiskit.circuit.QuantumCircuit.draw") method and the [`circuit_drawer()`](/api/qiskit/qiskit.visualization.circuit_drawer "qiskit.visualization.circuit_drawer") function when visualizing circuits that have [`ControlFlowOp`](/api/qiskit/qiskit.circuit.ControlFlowOp "qiskit.circuit.ControlFlowOp") instructions.
* Added the ability to display conditions as expressions from [`Expr`](/api/qiskit/0.45/circuit_classical#qiskit.circuit.classical.expr.Expr "qiskit.circuit.classical.expr.Expr") in the [`QuantumCircuit.draw()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#draw "qiskit.circuit.QuantumCircuit.draw") method and the [`circuit_drawer()`](/api/qiskit/0.45/qiskit.visualization.circuit_drawer "qiskit.visualization.circuit_drawer") function when visualizing circuits that have [`ControlFlowOp`](/api/qiskit/0.45/qiskit.circuit.ControlFlowOp "qiskit.circuit.ControlFlowOp") instructions.
* Added the `"iqp"` and `"iqp-dark"` color styles for the `matplotlib` circuit drawer, which are based on the IBM Quantum Platform color scheme.
* In `TextDrawer`, operations built from [`ControlFlowOp`](/api/qiskit/qiskit.circuit.ControlFlowOp "qiskit.circuit.ControlFlowOp"), including `if`, `else`, `while`, `for`, and `switch/case`, whether directly instantiated or built using methods in [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit"), will now fully display the circuits defined in the ControlFlowOps with brackets to delineate the circuits.
* In `TextDrawer`, operations built from [`ControlFlowOp`](/api/qiskit/0.45/qiskit.circuit.ControlFlowOp "qiskit.circuit.ControlFlowOp"), including `if`, `else`, `while`, `for`, and `switch/case`, whether directly instantiated or built using methods in [`QuantumCircuit`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit"), will now fully display the circuits defined in the ControlFlowOps with brackets to delineate the circuits.
* When defining a custom stylesheet for the pulse timeline drawer [`qiskit.visualization.timeline_drawer()`](/api/qiskit/qiskit.visualization.timeline_drawer "qiskit.visualization.timeline_drawer"), “generator” functions that have the object attribute `accepts_program` set to `True` will receive an extra keyword argument `program` containing the full scheduled [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") being drawn.
* When defining a custom stylesheet for the pulse timeline drawer [`qiskit.visualization.timeline_drawer()`](/api/qiskit/0.45/qiskit.visualization.timeline_drawer "qiskit.visualization.timeline_drawer"), “generator” functions that have the object attribute `accepts_program` set to `True` will receive an extra keyword argument `program` containing the full scheduled [`QuantumCircuit`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") being drawn.
* The visualizations from the [`plot_gate_map()`](/api/qiskit/qiskit.visualization.plot_gate_map "qiskit.visualization.plot_gate_map"), [`plot_coupling_map()`](/api/qiskit/qiskit.visualization.plot_coupling_map "qiskit.visualization.plot_coupling_map"). [`plot_error_map()`](/api/qiskit/qiskit.visualization.plot_error_map "qiskit.visualization.plot_error_map"), and [`plot_circuit_layout()`](/api/qiskit/qiskit.visualization.plot_circuit_layout "qiskit.visualization.plot_circuit_layout") functions have been significantly improved for rendering layouts of backends with large numbers of qubits. This was accomplished by leveraging [graphviz](https://graphviz.org/) through rustworkxs `graphviz_draw()` function to perform a more sophisticated algorithmic graph layout that scales for large numbers of qubits.
* The visualizations from the [`plot_gate_map()`](/api/qiskit/0.45/qiskit.visualization.plot_gate_map "qiskit.visualization.plot_gate_map"), [`plot_coupling_map()`](/api/qiskit/0.45/qiskit.visualization.plot_coupling_map "qiskit.visualization.plot_coupling_map"). [`plot_error_map()`](/api/qiskit/0.45/qiskit.visualization.plot_error_map "qiskit.visualization.plot_error_map"), and [`plot_circuit_layout()`](/api/qiskit/0.45/qiskit.visualization.plot_circuit_layout "qiskit.visualization.plot_circuit_layout") functions have been significantly improved for rendering layouts of backends with large numbers of qubits. This was accomplished by leveraging [graphviz](https://graphviz.org/) through rustworkxs `graphviz_draw()` function to perform a more sophisticated algorithmic graph layout that scales for large numbers of qubits.
![\_images/release\_notes-2.png](/images/api/qiskit/release_notes-2.png)
![\_images/release\_notes-1.png](/images/api/qiskit/release_notes-1.png)
<span id="relnotes-0-45-0-stable-0-45-misc-features" />
<span id="id25" />
### Misc. Features
* Added support for expressing the sign of a [`ParameterExpression`](/api/qiskit/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression"). Instead of assigning a concrete value and using [`numpy.sign`](https://numpy.org/doc/stable/reference/generated/numpy.sign.html#numpy.sign "(in NumPy v1.26)") or other library functions, the user can use the instance of the [`ParameterExpression`](/api/qiskit/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") class to calculate the sign and can work with the sign before the expression is fully assigned.
* Added support for expressing the sign of a [`ParameterExpression`](/api/qiskit/0.45/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression"). Instead of assigning a concrete value and using [`numpy.sign`](https://numpy.org/doc/stable/reference/generated/numpy.sign.html#numpy.sign "(in NumPy v1.26)") or other library functions, the user can use the instance of the [`ParameterExpression`](/api/qiskit/0.45/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") class to calculate the sign and can work with the sign before the expression is fully assigned.
It can be used as follows:
@ -572,77 +552,73 @@ Some feature highlights of Qiskit 0.45.0 are:
Refer to [#10360](https://github.com/Qiskit/qiskit-terra/issues/10360) for more details.
* [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "qiskit.circuit.Parameter") now has an advanced-usage keyword argument `uuid` in its constructor, which can be used to make the [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "qiskit.circuit.Parameter") compare equal to another of the same name. This should not typically be used by users, and is most useful for custom serialisation and deserialisation.
* [`Parameter`](/api/qiskit/0.45/qiskit.circuit.Parameter "qiskit.circuit.Parameter") now has an advanced-usage keyword argument `uuid` in its constructor, which can be used to make the [`Parameter`](/api/qiskit/0.45/qiskit.circuit.Parameter "qiskit.circuit.Parameter") compare equal to another of the same name. This should not typically be used by users, and is most useful for custom serialisation and deserialisation.
<span id="relnotes-0-45-0-stable-0-45-circuits-upgrade-notes" />
<span id="id26" />
### Circuits Upgrade Notes
* The [`ControlledGate.definition`](/api/qiskit/qiskit.circuit.ControlledGate#definition "qiskit.circuit.ControlledGate.definition") of the output from the [`Gate.control()`](/api/qiskit/qiskit.circuit.Gate#control "qiskit.circuit.Gate.control") method may be different as compared to previous releases. The internal generation of the [`Gate.control()`](/api/qiskit/qiskit.circuit.Gate#control "qiskit.circuit.Gate.control") method is no longer using the now deprecated `Unroller` transpiler pass to generate its definition and this can potentially cause a different definition to be generated. The output [`ControlledGate`](/api/qiskit/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate") objects definition will be unitary equivalent to what was generated before. But if you require the exact definition from calling [`Gate.control()`](/api/qiskit/qiskit.circuit.Gate#control "qiskit.circuit.Gate.control") you can use an earlier release and save the circuit with [`qpy.dump()`](/api/qiskit/qpy#qiskit.qpy.dump "qiskit.qpy.dump") and then load it with a newer release.
* The [`ControlledGate.definition`](/api/qiskit/0.45/qiskit.circuit.ControlledGate#definition "qiskit.circuit.ControlledGate.definition") of the output from the [`Gate.control()`](/api/qiskit/0.45/qiskit.circuit.Gate#control "qiskit.circuit.Gate.control") method may be different as compared to previous releases. The internal generation of the [`Gate.control()`](/api/qiskit/0.45/qiskit.circuit.Gate#control "qiskit.circuit.Gate.control") method is no longer using the now deprecated [`Unroller`](/api/qiskit/0.45/qiskit.transpiler.passes.Unroller "qiskit.transpiler.passes.Unroller") transpiler pass to generate its definition and this can potentially cause a different definition to be generated. The output [`ControlledGate`](/api/qiskit/0.45/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate") objects definition will be unitary equivalent to what was generated before. But if you require the exact definition from calling [`Gate.control()`](/api/qiskit/0.45/qiskit.circuit.Gate#control "qiskit.circuit.Gate.control") you can use an earlier release and save the circuit with [`qpy.dump()`](/api/qiskit/0.45/qpy#qiskit.qpy.dump "qiskit.qpy.dump") and then load it with a newer release.
* The property `num_ancilla_qubits` from the class [`PolynomialPauliRotations`](/api/qiskit/qiskit.circuit.library.PolynomialPauliRotations "qiskit.circuit.library.PolynomialPauliRotations") has been removed, as deprecated in Qiskit 0.23.0. Instead, use the property [`PolynomialPauliRotations.num_ancillas`](/api/qiskit/qiskit.circuit.library.PolynomialPauliRotations#num_ancillas "qiskit.circuit.library.PolynomialPauliRotations.num_ancillas").
* The property `num_ancilla_qubits` from the class [`PolynomialPauliRotations`](/api/qiskit/0.45/qiskit.circuit.library.PolynomialPauliRotations "qiskit.circuit.library.PolynomialPauliRotations") has been removed, as deprecated in Qiskit 0.23.0. Instead, use the property [`PolynomialPauliRotations.num_ancillas`](/api/qiskit/0.45/qiskit.circuit.library.PolynomialPauliRotations#num_ancillas "qiskit.circuit.library.PolynomialPauliRotations.num_ancillas").
* The following standard library gates:
> * [`DCXGate`](/api/qiskit/qiskit.circuit.library.DCXGate "qiskit.circuit.library.DCXGate")
> * [`ECRGate`](/api/qiskit/qiskit.circuit.library.ECRGate "qiskit.circuit.library.ECRGate")
> * [`HGate`](/api/qiskit/qiskit.circuit.library.HGate "qiskit.circuit.library.HGate")
> * [`IGate`](/api/qiskit/qiskit.circuit.library.IGate "qiskit.circuit.library.IGate")
> * [`iSwapGate`](/api/qiskit/qiskit.circuit.library.iSwapGate "qiskit.circuit.library.iSwapGate")
> * [`SGate`](/api/qiskit/qiskit.circuit.library.SGate "qiskit.circuit.library.SGate")
> * [`SdgGate`](/api/qiskit/qiskit.circuit.library.SdgGate "qiskit.circuit.library.SdgGate")
> * [`SwapGate`](/api/qiskit/qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")
> * [`SXGate`](/api/qiskit/qiskit.circuit.library.SXGate "qiskit.circuit.library.SXGate")
> * [`SXdgGate`](/api/qiskit/qiskit.circuit.library.SXdgGate "qiskit.circuit.library.SXdgGate")
> * [`TGate`](/api/qiskit/qiskit.circuit.library.TGate "qiskit.circuit.library.TGate")
> * [`TdgGate`](/api/qiskit/qiskit.circuit.library.TdgGate "qiskit.circuit.library.TdgGate")
> * [`XGate`](/api/qiskit/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate")
> * [`RCCXGate`](/api/qiskit/qiskit.circuit.library.RCCXGate "qiskit.circuit.library.RCCXGate")
> * [`RC3XGate`](/api/qiskit/qiskit.circuit.library.RC3XGate "qiskit.circuit.library.RC3XGate")
> * [`YGate`](/api/qiskit/qiskit.circuit.library.YGate "qiskit.circuit.library.YGate")
> * [`ZGate`](/api/qiskit/qiskit.circuit.library.ZGate "qiskit.circuit.library.ZGate")
> * [`CHGate`](/api/qiskit/qiskit.circuit.library.CHGate "qiskit.circuit.library.CHGate")
> * [`CSGate`](/api/qiskit/qiskit.circuit.library.CSGate "qiskit.circuit.library.CSGate")
> * [`CSdgGate`](/api/qiskit/qiskit.circuit.library.CSdgGate "qiskit.circuit.library.CSdgGate")
> * [`CSwapGate`](/api/qiskit/qiskit.circuit.library.CSwapGate "qiskit.circuit.library.CSwapGate")
> * [`CSXGate`](/api/qiskit/qiskit.circuit.library.CSXGate "qiskit.circuit.library.CSXGate")
> * [`CXGate`](/api/qiskit/qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate")
> * [`CCXGate`](/api/qiskit/qiskit.circuit.library.CCXGate "qiskit.circuit.library.CCXGate")
> * [`C3SXGate`](/api/qiskit/qiskit.circuit.library.C3SXGate "qiskit.circuit.library.C3SXGate")
> * [`C3XGate`](/api/qiskit/qiskit.circuit.library.C3XGate "qiskit.circuit.library.C3XGate")
> * [`C4XGate`](/api/qiskit/qiskit.circuit.library.C4XGate "qiskit.circuit.library.C4XGate")
> * [`CYGate`](/api/qiskit/qiskit.circuit.library.CYGate "qiskit.circuit.library.CYGate")
> * [`CZGate`](/api/qiskit/qiskit.circuit.library.CZGate "qiskit.circuit.library.CZGate")
> * [`DCXGate`](/api/qiskit/0.45/qiskit.circuit.library.DCXGate "qiskit.circuit.library.DCXGate")
> * [`ECRGate`](/api/qiskit/0.45/qiskit.circuit.library.ECRGate "qiskit.circuit.library.ECRGate")
> * [`HGate`](/api/qiskit/0.45/qiskit.circuit.library.HGate "qiskit.circuit.library.HGate")
> * [`IGate`](/api/qiskit/0.45/qiskit.circuit.library.IGate "qiskit.circuit.library.IGate")
> * [`iSwapGate`](/api/qiskit/0.45/qiskit.circuit.library.iSwapGate "qiskit.circuit.library.iSwapGate")
> * [`SGate`](/api/qiskit/0.45/qiskit.circuit.library.SGate "qiskit.circuit.library.SGate")
> * [`SdgGate`](/api/qiskit/0.45/qiskit.circuit.library.SdgGate "qiskit.circuit.library.SdgGate")
> * [`SwapGate`](/api/qiskit/0.45/qiskit.circuit.library.SwapGate "qiskit.circuit.library.SwapGate")
> * [`SXGate`](/api/qiskit/0.45/qiskit.circuit.library.SXGate "qiskit.circuit.library.SXGate")
> * [`SXdgGate`](/api/qiskit/0.45/qiskit.circuit.library.SXdgGate "qiskit.circuit.library.SXdgGate")
> * [`TGate`](/api/qiskit/0.45/qiskit.circuit.library.TGate "qiskit.circuit.library.TGate")
> * [`TdgGate`](/api/qiskit/0.45/qiskit.circuit.library.TdgGate "qiskit.circuit.library.TdgGate")
> * [`XGate`](/api/qiskit/0.45/qiskit.circuit.library.XGate "qiskit.circuit.library.XGate")
> * [`RCCXGate`](/api/qiskit/0.45/qiskit.circuit.library.RCCXGate "qiskit.circuit.library.RCCXGate")
> * [`RC3XGate`](/api/qiskit/0.45/qiskit.circuit.library.RC3XGate "qiskit.circuit.library.RC3XGate")
> * [`YGate`](/api/qiskit/0.45/qiskit.circuit.library.YGate "qiskit.circuit.library.YGate")
> * [`ZGate`](/api/qiskit/0.45/qiskit.circuit.library.ZGate "qiskit.circuit.library.ZGate")
> * [`CHGate`](/api/qiskit/0.45/qiskit.circuit.library.CHGate "qiskit.circuit.library.CHGate")
> * [`CSGate`](/api/qiskit/0.45/qiskit.circuit.library.CSGate "qiskit.circuit.library.CSGate")
> * [`CSdgGate`](/api/qiskit/0.45/qiskit.circuit.library.CSdgGate "qiskit.circuit.library.CSdgGate")
> * [`CSwapGate`](/api/qiskit/0.45/qiskit.circuit.library.CSwapGate "qiskit.circuit.library.CSwapGate")
> * [`CSXGate`](/api/qiskit/0.45/qiskit.circuit.library.CSXGate "qiskit.circuit.library.CSXGate")
> * [`CXGate`](/api/qiskit/0.45/qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate")
> * [`CCXGate`](/api/qiskit/0.45/qiskit.circuit.library.CCXGate "qiskit.circuit.library.CCXGate")
> * [`C3SXGate`](/api/qiskit/0.45/qiskit.circuit.library.C3SXGate "qiskit.circuit.library.C3SXGate")
> * [`C3XGate`](/api/qiskit/0.45/qiskit.circuit.library.C3XGate "qiskit.circuit.library.C3XGate")
> * [`C4XGate`](/api/qiskit/0.45/qiskit.circuit.library.C4XGate "qiskit.circuit.library.C4XGate")
> * [`CYGate`](/api/qiskit/0.45/qiskit.circuit.library.CYGate "qiskit.circuit.library.CYGate")
> * [`CZGate`](/api/qiskit/0.45/qiskit.circuit.library.CZGate "qiskit.circuit.library.CZGate")
are no longer able to set [`label`](/api/qiskit/qiskit.circuit.Gate#label "qiskit.circuit.Gate.label"), [`condition`](/api/qiskit/qiskit.circuit.Gate#condition "qiskit.circuit.Gate.condition"), [`duration`](/api/qiskit/qiskit.circuit.Gate#duration "qiskit.circuit.Gate.duration"), or [`unit`](/api/qiskit/qiskit.circuit.Gate#unit "qiskit.circuit.Gate.unit") (and [`ctrl_state`](/api/qiskit/qiskit.circuit.ControlledGate#ctrl_state "qiskit.circuit.ControlledGate.ctrl_state") for [`ControlledGate`](/api/qiskit/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate") subclasses) after instantiating an object anymore. You can still set [`condition`](/api/qiskit/qiskit.circuit.Gate#condition "qiskit.circuit.Gate.condition") through the use [`c_if()`](/api/qiskit/qiskit.circuit.Gate#c_if "qiskit.circuit.Gate.c_if"). You can use [`to_mutable()`](/api/qiskit/qiskit.circuit.Gate#to_mutable "qiskit.circuit.Gate.to_mutable") to get a mutable copy of the instruction and then use the setter on that copy instead of the original object. `label`, `duration` and `unit` can be given as keyword arguments to these gates at construction time, and a mutable instance will be returned automatically. This change was necessary as part of converting these classes to be [`SingletonGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate") and [`SingletonControlledGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate") types which greatly reduces the memory footprint of repeated instances of these gates.
are no longer able to set [`label`](/api/qiskit/0.45/qiskit.circuit.Gate#label "qiskit.circuit.Gate.label"), [`condition`](/api/qiskit/0.45/qiskit.circuit.Gate#condition "qiskit.circuit.Gate.condition"), [`duration`](/api/qiskit/0.45/qiskit.circuit.Gate#duration "qiskit.circuit.Gate.duration"), or [`unit`](/api/qiskit/0.45/qiskit.circuit.Gate#unit "qiskit.circuit.Gate.unit") (and [`ctrl_state`](/api/qiskit/0.45/qiskit.circuit.ControlledGate#ctrl_state "qiskit.circuit.ControlledGate.ctrl_state") for [`ControlledGate`](/api/qiskit/0.45/qiskit.circuit.ControlledGate "qiskit.circuit.ControlledGate") subclasses) after instantiating an object anymore. You can still set [`condition`](/api/qiskit/0.45/qiskit.circuit.Gate#condition "qiskit.circuit.Gate.condition") through the use [`c_if()`](/api/qiskit/0.45/qiskit.circuit.Gate#c_if "qiskit.circuit.Gate.c_if"). You can use [`to_mutable()`](/api/qiskit/0.45/qiskit.circuit.Gate#to_mutable "qiskit.circuit.Gate.to_mutable") to get a mutable copy of the instruction and then use the setter on that copy instead of the original object. `label`, `duration` and `unit` can be given as keyword arguments to these gates at construction time, and a mutable instance will be returned automatically. This change was necessary as part of converting these classes to be [`SingletonGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate") and [`SingletonControlledGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonControlledGate "qiskit.circuit.singleton.SingletonControlledGate") types which greatly reduces the memory footprint of repeated instances of these gates.
* For anything that interacts with [`Gate`](/api/qiskit/qiskit.circuit.Gate "qiskit.circuit.Gate"), [`Operation`](/api/qiskit/qiskit.circuit.Operation "qiskit.circuit.Operation"), or [`Instruction`](/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction") objects or works with these as part of a [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") or [`DAGCircuit`](/api/qiskit/qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") classes, it is important to note that the use of shared references for instances is much more common now. Previously, it was possible to reuse and share an instance of a circuit operation, but it wasnt very commonly used and a copy would generate a unique instance. This has changed starting in this release because of [`SingletonInstruction`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonInstruction "qiskit.circuit.singleton.SingletonInstruction") and [`SingletonGate`](/api/qiskit/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate") being made available (and a large number of standard library gates now built off of them). If your usage of these objects is assuming unique instances for every circuit operation, this becomes a potential issue, as now a shared state will be reused between operations of the same type (that will persist through copy and deep copies). You can rely on the [`Instruction.mutable`](/api/qiskit/qiskit.circuit.Instruction#mutable "qiskit.circuit.Instruction.mutable") attribute to check the mutability of an object or use [`Instruction.to_mutable()`](/api/qiskit/qiskit.circuit.Instruction#to_mutable "qiskit.circuit.Instruction.to_mutable") to get a mutable copy of any instruction.
* For anything that interacts with [`Gate`](/api/qiskit/0.45/qiskit.circuit.Gate "qiskit.circuit.Gate"), [`Operation`](/api/qiskit/0.45/qiskit.circuit.Operation "qiskit.circuit.Operation"), or [`Instruction`](/api/qiskit/0.45/qiskit.circuit.Instruction "qiskit.circuit.Instruction") objects or works with these as part of a [`QuantumCircuit`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") or [`DAGCircuit`](/api/qiskit/0.45/qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") classes, it is important to note that the use of shared references for instances is much more common now. Previously, it was possible to reuse and share an instance of a circuit operation, but it wasnt very commonly used and a copy would generate a unique instance. This has changed starting in this release because of [`SingletonInstruction`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonInstruction "qiskit.circuit.singleton.SingletonInstruction") and [`SingletonGate`](/api/qiskit/0.45/circuit_singleton#qiskit.circuit.singleton.SingletonGate "qiskit.circuit.singleton.SingletonGate") being made available (and a large number of standard library gates now built off of them). If your usage of these objects is assuming unique instances for every circuit operation, this becomes a potential issue, as now a shared state will be reused between operations of the same type (that will persist through copy and deep copies). You can rely on the [`Instruction.mutable`](/api/qiskit/0.45/qiskit.circuit.Instruction#mutable "qiskit.circuit.Instruction.mutable") attribute to check the mutability of an object or use [`Instruction.to_mutable()`](/api/qiskit/0.45/qiskit.circuit.Instruction#to_mutable "qiskit.circuit.Instruction.to_mutable") to get a mutable copy of any instruction.
* More [`Instruction`](/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction") instances (those that return singletons) no longer strictly satisfy (for example):
* More [`Instruction`](/api/qiskit/0.45/qiskit.circuit.Instruction "qiskit.circuit.Instruction") instances (those that return singletons) no longer strictly satisfy (for example):
```python
type(XGate()) is XGate
```
The returned object will, however, still be a standard subclass so [`isinstance()`](https://docs.python.org/3/library/functions.html#isinstance "(in Python v3.12)") (the correct way to do type checking) will continue to work correctly. Several instructions already had this property (e.g. [`MCXGate`](/api/qiskit/qiskit.circuit.library.MCXGate "qiskit.circuit.library.MCXGate")), but it is now more common as many more standard gates will do this.
The returned object will, however, still be a standard subclass so [`isinstance()`](https://docs.python.org/3/library/functions.html#isinstance "(in Python v3.12)") (the correct way to do type checking) will continue to work correctly. Several instructions already had this property (e.g. [`MCXGate`](/api/qiskit/0.45/qiskit.circuit.library.MCXGate "qiskit.circuit.library.MCXGate")), but it is now more common as many more standard gates will do this.
If you require the “base” type of a gate for some reason, omitting the synthetic singleton subclasses, which cannot be instantiated, see [`Instruction.base_class`](/api/qiskit/qiskit.circuit.Instruction#base_class "qiskit.circuit.Instruction.base_class").
If you require the “base” type of a gate for some reason, omitting the synthetic singleton subclasses, which cannot be instantiated, see [`Instruction.base_class`](/api/qiskit/0.45/qiskit.circuit.Instruction#base_class "qiskit.circuit.Instruction.base_class").
* The definition of [`UnitaryGate`](/api/qiskit/qiskit.circuit.library.UnitaryGate "qiskit.circuit.library.UnitaryGate") for single qubit unitaries is now in terms of [`UGate`](/api/qiskit/qiskit.circuit.library.UGate "qiskit.circuit.library.UGate") instead of the legacy [`U3Gate`](/api/qiskit/qiskit.circuit.library.U3Gate "qiskit.circuit.library.U3Gate") class.
* The definition of [`UnitaryGate`](/api/qiskit/0.45/qiskit.circuit.library.UnitaryGate "qiskit.circuit.library.UnitaryGate") for single qubit unitaries is now in terms of [`UGate`](/api/qiskit/0.45/qiskit.circuit.library.UGate "qiskit.circuit.library.UGate") instead of the legacy [`U3Gate`](/api/qiskit/0.45/qiskit.circuit.library.U3Gate "qiskit.circuit.library.U3Gate") class.
<span id="relnotes-0-45-0-stable-0-45-providers-upgrade-notes" />
<span id="id27" />
### Providers Upgrade Notes
* The `QasmSimulatorPy` python-based simulator included in `qiskit.providers.basicaer` now includes `'h'` ([`HGate`](/api/qiskit/qiskit.circuit.library.HGate "qiskit.circuit.library.HGate")), `'p'` ([`PhaseGate`](/api/qiskit/qiskit.circuit.library.PhaseGate "qiskit.circuit.library.PhaseGate")), and `'u'` ([`UGate`](/api/qiskit/qiskit.circuit.library.UGate "qiskit.circuit.library.UGate")) in its basis gate set.
* The [`QasmSimulatorPy`](/api/qiskit/0.45/qiskit.providers.basicaer.QasmSimulatorPy "qiskit.providers.basicaer.QasmSimulatorPy") python-based simulator included in [`qiskit.providers.basicaer`](/api/qiskit/0.45/providers_basicaer#module-qiskit.providers.basicaer "qiskit.providers.basicaer") now includes `'h'` ([`HGate`](/api/qiskit/0.45/qiskit.circuit.library.HGate "qiskit.circuit.library.HGate")), `'p'` ([`PhaseGate`](/api/qiskit/0.45/qiskit.circuit.library.PhaseGate "qiskit.circuit.library.PhaseGate")), and `'u'` ([`UGate`](/api/qiskit/0.45/qiskit.circuit.library.UGate "qiskit.circuit.library.UGate")) in its basis gate set.
* The argument `channel` in the method [`PulseBackendConfiguration.control()`](/api/qiskit/qiskit.providers.models.PulseBackendConfiguration#control "qiskit.providers.models.PulseBackendConfiguration.control") is removed. It was deprecated in Qiskit 0.33 (with Terra 0.19), released on Dec 2021. Instead use the `qubits` argument.
* The argument `channel` in the method [`PulseBackendConfiguration.control()`](/api/qiskit/0.45/qiskit.providers.models.PulseBackendConfiguration#control "qiskit.providers.models.PulseBackendConfiguration.control") is removed. It was deprecated in Qiskit 0.33 (with Terra 0.19), released on Dec 2021. Instead use the `qubits` argument.
* Replaced the argument `qobj[Qobj]` in `QasmSimulatorPy.run()` with `run_input[QuantumCircuit or list]`
* Replaced the argument `qobj[Qobj]` in [`QasmSimulatorPy.run()`](/api/qiskit/0.45/qiskit.providers.basicaer.QasmSimulatorPy#run "qiskit.providers.basicaer.QasmSimulatorPy.run") with `run_input[QuantumCircuit or list]`
Here is an example to migrate your code:
@ -670,69 +646,59 @@ Some feature highlights of Qiskit 0.45.0 are:
<span id="relnotes-0-45-0-stable-0-45-pulse-upgrade-notes" />
<span id="id28" />
### Pulse Upgrade Notes
* The functions `qiskit.scheduler.utils.format_meas_map()`, `qiskit.scheduler.utils.measure()`, and `qiskit.scheduler.utils.measure_all()` had been moved to `qiskit.pulse.utils.format_meas_map()`, `qiskit.pulse.macros.measure()`, and `qiskit.pulse.macros.measure_all()` respectively. The previous location was deprecated in Qiskit 0.20.0 (Terra 0.15.0, released on 2020-08-10) and it is no longer supported.
* The methods `to_dict` in the classes [`pulse.transforms.AlignmentKind`](/api/qiskit/pulse#qiskit.pulse.transforms.AlignmentKind "qiskit.pulse.transforms.AlignmentKind"), [`pulse.transforms.AlignEquispaced`](/api/qiskit/qiskit.pulse.transforms.AlignEquispaced "qiskit.pulse.transforms.AlignEquispaced"), and [`pulse.transforms.AlignFunc`](/api/qiskit/qiskit.pulse.transforms.AlignFunc "qiskit.pulse.transforms.AlignFunc") are removed. They were deprecatedin Qiskit 0.37 (with Terra 0.21), released on June 2022.
* The methods `to_dict` in the classes [`pulse.transforms.AlignmentKind`](/api/qiskit/0.45/pulse#qiskit.pulse.transforms.AlignmentKind "qiskit.pulse.transforms.AlignmentKind"), [`pulse.transforms.AlignEquispaced`](/api/qiskit/0.45/qiskit.pulse.transforms.AlignEquispaced "qiskit.pulse.transforms.AlignEquispaced"), and [`pulse.transforms.AlignFunc`](/api/qiskit/0.45/qiskit.pulse.transforms.AlignFunc "qiskit.pulse.transforms.AlignFunc") are removed. They were deprecatedin Qiskit 0.37 (with Terra 0.21), released on June 2022.
<span id="relnotes-0-45-0-stable-0-45-qpy-upgrade-notes" />
<span id="id29" />
### QPY Upgrade Notes
* The use of the keyword `circuits` for the first positional argument in the function [`qiskit.qpy.dump()`](/api/qiskit/qpy#qiskit.qpy.dump "qiskit.qpy.dump") is removed as its usage was deprecated in Qiskit 0.37 (with Terra 0.21), released on June 2022. Instead, use the keyword `programs` can be used instead (or just pass the argument in positionally), which behaves identically.
* The use of the keyword `circuits` for the first positional argument in the function [`qiskit.qpy.dump()`](/api/qiskit/0.45/qpy#qiskit.qpy.dump "qiskit.qpy.dump") is removed as its usage was deprecated in Qiskit 0.37 (with Terra 0.21), released on June 2022. Instead, use the keyword `programs` can be used instead (or just pass the argument in positionally), which behaves identically.
<span id="relnotes-0-45-0-stable-0-45-quantum-information-upgrade-notes" />
<span id="id30" />
### Quantum Information Upgrade Notes
* The method [`qiskit.quantum_info.pauli_basis()`](/api/qiskit/qiskit.quantum_info.pauli_basis "qiskit.quantum_info.pauli_basis") does not accept the `pauli_list` argument any more. It was deprecated in Qiskit 0.39 (with Terra 0.22), released on Oct 2022.
* The method [`qiskit.quantum_info.pauli_basis()`](/api/qiskit/0.45/qiskit.quantum_info.pauli_basis "qiskit.quantum_info.pauli_basis") does not accept the `pauli_list` argument any more. It was deprecated in Qiskit 0.39 (with Terra 0.22), released on Oct 2022.
* The function `random_stabilizer_table` in the `qiskit.quantum_info.random` module is removed. It was deprecated in Qiskit 0.39 (with Terra 0.22), released on Oct 2022. Instead, use `qiskit.quantum_info.random.random_pauli_list()`.
* The classes `qiskit.quantum_info.PauliTable` and `qiskit.quantum_info.StabilizerTable` are removed. The function `random_pauli_table()` is also removed. They were deprecated in Qiskit 0.43 (with Terra 0.24), released in May 2023. Instead, you should use [`PauliList`](/api/qiskit/qiskit.quantum_info.PauliList "qiskit.quantum_info.PauliList") and [`random_pauli_list()`](/api/qiskit/quantum_info#qiskit.quantum_info.random_pauli_list "qiskit.quantum_info.random_pauli_list").
* The classes `qiskit.quantum_info.PauliTable` and `qiskit.quantum_info.StabilizerTable` are removed. The function `random_pauli_table()` is also removed. They were deprecated in Qiskit 0.43 (with Terra 0.24), released in May 2023. Instead, you should use [`PauliList`](/api/qiskit/0.45/qiskit.quantum_info.PauliList "qiskit.quantum_info.PauliList") and [`random_pauli_list()`](/api/qiskit/0.45/quantum_info#qiskit.quantum_info.random_pauli_list "qiskit.quantum_info.random_pauli_list").
* The arguments `z` and `x` to the initializer of to [`Pauli`](/api/qiskit/qiskit.quantum_info.Pauli "qiskit.quantum_info.Pauli") were removed, as deprecated in Qiskit Terra 0.17 (released on April, 2021). A pair of `x` and `z` should be passed positionally as a single tuple instead (`Pauli((z, x))`).
* The arguments `z` and `x` to the initializer of to [`Pauli`](/api/qiskit/0.45/qiskit.quantum_info.Pauli "qiskit.quantum_info.Pauli") were removed, as deprecated in Qiskit Terra 0.17 (released on April, 2021). A pair of `x` and `z` should be passed positionally as a single tuple instead (`Pauli((z, x))`).
* The argument `label` to the initializer of [`Pauli`](/api/qiskit/qiskit.quantum_info.Pauli "qiskit.quantum_info.Pauli") was removed, as deprecated in Qiskit Terra 0.17 (released on April, 2021). Pass the label positionally instead, such as `Pauli("XYZ")`.
* The argument `label` to the initializer of [`Pauli`](/api/qiskit/0.45/qiskit.quantum_info.Pauli "qiskit.quantum_info.Pauli") was removed, as deprecated in Qiskit Terra 0.17 (released on April, 2021). Pass the label positionally instead, such as `Pauli("XYZ")`.
* Importing from `qiskit.quantum_info.operators.pauli` is not allowed anymore, as it was deprecated in Qiskit Terra 0.21 (released on June, 2022). Import directly from `qiskit.quantum_info` instead.
<span id="relnotes-0-45-0-stable-0-45-synthesis-upgrade-notes" />
<span id="id31" />
### Synthesis Upgrade Notes
* The parameter `order` in [`synthesis.SuzukiTrotter`](/api/qiskit/qiskit.synthesis.SuzukiTrotter "qiskit.synthesis.SuzukiTrotter") constructor raises an exception instead of deprecation warning when set in an odd number. Suzuki product formulae are symmetric and therefore only defined for even orders.
* The parameter `order` in [`synthesis.SuzukiTrotter`](/api/qiskit/0.45/qiskit.synthesis.SuzukiTrotter "qiskit.synthesis.SuzukiTrotter") constructor raises an exception instead of deprecation warning when set in an odd number. Suzuki product formulae are symmetric and therefore only defined for even orders.
<span id="relnotes-0-45-0-stable-0-45-transpiler-upgrade-notes" />
<span id="id32" />
### Transpiler Upgrade Notes
* As a consequence of the pass manager refactoring efforts, existing flow controllers: [`FlowControllerLinear`](/api/qiskit/qiskit.passmanager.FlowControllerLinear "qiskit.passmanager.FlowControllerLinear"), [`ConditionalController`](/api/qiskit/qiskit.passmanager.ConditionalController "qiskit.passmanager.ConditionalController"), and [`DoWhileController`](/api/qiskit/qiskit.passmanager.DoWhileController "qiskit.passmanager.DoWhileController") are now subclasses of the [`BaseController`](/api/qiskit/qiskit.passmanager.BaseController "qiskit.passmanager.BaseController"). Note that these controllers have dropped the implementation of the [`__iter__()`](https://docs.python.org/3/reference/datamodel.html#object.__iter__ "(in Python v3.12)") method. They are now only iterable in the context of a flow-controller execution, which threads the compilation state through after each inner task is executed.
* As a consequence of the pass manager refactoring efforts, existing flow controllers: [`FlowControllerLinear`](/api/qiskit/0.45/qiskit.passmanager.FlowControllerLinear "qiskit.passmanager.FlowControllerLinear"), [`ConditionalController`](/api/qiskit/0.45/qiskit.passmanager.ConditionalController "qiskit.passmanager.ConditionalController"), and [`DoWhileController`](/api/qiskit/0.45/qiskit.passmanager.DoWhileController "qiskit.passmanager.DoWhileController") are now subclasses of the [`BaseController`](/api/qiskit/0.45/qiskit.passmanager.BaseController "qiskit.passmanager.BaseController"). Note that these controllers have dropped the implementation of the [`__iter__()`](https://docs.python.org/3/reference/datamodel.html#object.__iter__ "(in Python v3.12)") method. They are now only iterable in the context of a flow-controller execution, which threads the compilation state through after each inner task is executed.
* The functionalitly of the `RunningPassManager` class has been superseded by the new pass manager framework ([`BasePassManager`](/api/qiskit/qiskit.passmanager.BasePassManager "qiskit.passmanager.BasePassManager") and [`BaseController`](/api/qiskit/qiskit.passmanager.BaseController "qiskit.passmanager.BaseController")). The running pass manager is now a stateless flow controller (essentially, an alias of [`FlowControllerLinear`](/api/qiskit/qiskit.passmanager.FlowControllerLinear "qiskit.passmanager.FlowControllerLinear")), as the pass manager is responsible for the construction of task pipeline, while the controller is responsible for the execution of associated tasks. Subclassing the `RunningPassManager` is no longer recommended, and this class will be completely replaced with the flow controller in future releases.
* The functionalitly of the `RunningPassManager` class has been superseded by the new pass manager framework ([`BasePassManager`](/api/qiskit/0.45/qiskit.passmanager.BasePassManager "qiskit.passmanager.BasePassManager") and [`BaseController`](/api/qiskit/0.45/qiskit.passmanager.BaseController "qiskit.passmanager.BaseController")). The running pass manager is now a stateless flow controller (essentially, an alias of [`FlowControllerLinear`](/api/qiskit/0.45/qiskit.passmanager.FlowControllerLinear "qiskit.passmanager.FlowControllerLinear")), as the pass manager is responsible for the construction of task pipeline, while the controller is responsible for the execution of associated tasks. Subclassing the `RunningPassManager` is no longer recommended, and this class will be completely replaced with the flow controller in future releases.
* A new class, [`WorkflowStatus`](/api/qiskit/qiskit.passmanager.WorkflowStatus "qiskit.passmanager.WorkflowStatus"), has been introduced to track the status of the pass manager workflow. This portable object is created when the pass manager is run, and handed over to the underlying tasks. Such status was previously managed by the `RunningPassManager` with instance variables.
* A new class, [`WorkflowStatus`](/api/qiskit/0.45/qiskit.passmanager.WorkflowStatus "qiskit.passmanager.WorkflowStatus"), has been introduced to track the status of the pass manager workflow. This portable object is created when the pass manager is run, and handed over to the underlying tasks. Such status was previously managed by the `RunningPassManager` with instance variables.
* The transpiler-specific [`transpiler.PassManager`](/api/qiskit/qiskit.transpiler.PassManager "qiskit.transpiler.PassManager") (used in [`transpile()`](/api/qiskit/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile")) is now a subclass of [`passmanager.BasePassManager`](/api/qiskit/qiskit.passmanager.BasePassManager "qiskit.passmanager.BasePassManager"). However, this class hierarchy change doesnt introduce any breaking change to the public-facing API.
* The transpiler-specific [`transpiler.PassManager`](/api/qiskit/0.45/qiskit.transpiler.PassManager "qiskit.transpiler.PassManager") (used in [`transpile()`](/api/qiskit/0.45/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile")) is now a subclass of [`passmanager.BasePassManager`](/api/qiskit/0.45/qiskit.passmanager.BasePassManager "qiskit.passmanager.BasePassManager"). However, this class hierarchy change doesnt introduce any breaking change to the public-facing API.
* Exceptions raised during pass-manager execution now inherit from the newly introduced [`PassManagerError`](/api/qiskit/passmanager#qiskit.passmanager.PassManagerError "qiskit.passmanager.PassManagerError"). A generic failure of the pass-manager machinery will raise [`PassManagerError`](/api/qiskit/passmanager#qiskit.passmanager.PassManagerError "qiskit.passmanager.PassManagerError") for general pass managers, but the transpiler-specific `transpile.PassManager` will currently wrap this in its specific [`TranspilerError`](/api/qiskit/transpiler#qiskit.transpiler.TranspilerError "qiskit.transpiler.TranspilerError") for backwards compatibility. This wrapping will be removed in the future.
* Exceptions raised during pass-manager execution now inherit from the newly introduced [`PassManagerError`](/api/qiskit/0.45/passmanager#qiskit.passmanager.PassManagerError "qiskit.passmanager.PassManagerError"). A generic failure of the pass-manager machinery will raise [`PassManagerError`](/api/qiskit/0.45/passmanager#qiskit.passmanager.PassManagerError "qiskit.passmanager.PassManagerError") for general pass managers, but the transpiler-specific `transpile.PassManager` will currently wrap this in its specific [`TranspilerError`](/api/qiskit/0.45/transpiler#qiskit.transpiler.TranspilerError "qiskit.transpiler.TranspilerError") for backwards compatibility. This wrapping will be removed in the future.
* The use of `FencedObject` in the pass manager framework has been removed. This wrapper class cannot protect mutable object attributes from modification, and this should not be an issue for properly implemented code. Analysis passes should not modify an input IR, controllers should not update the property set, and so forth. Its the pass manager developers responsibility to ensure that the pass is not modifying object attributes,
* The plugin name `default` is reserved for the [plugin stages](/api/qiskit/transpiler_plugins#stage-table) `init`, `layout`, `optimization`, and `scheduling`. These stages previously did not reserve this plugin name, but the `default` name is now used to represent Qiskits built-in default method for these stages. If you were using these names for plugins on these stages these will conflict with Qiskits usage and you should rename your plugin.
* The plugin name `default` is reserved for the [plugin stages](/api/qiskit/0.45/transpiler_plugins#stage-table) `init`, `layout`, `optimization`, and `scheduling`. These stages previously did not reserve this plugin name, but the `default` name is now used to represent Qiskits built-in default method for these stages. If you were using these names for plugins on these stages these will conflict with Qiskits usage and you should rename your plugin.
* Disabled the use of the [`RemoveResetInZeroState`](/api/qiskit/qiskit.transpiler.passes.RemoveResetInZeroState "qiskit.transpiler.passes.RemoveResetInZeroState") class in the preset passmanagers. Previously, when [`transpile()`](/api/qiskit/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`generate_preset_pass_manager()`](/api/qiskit/transpiler_preset#qiskit.transpiler.preset_passmanagers.generate_preset_pass_manager "qiskit.transpiler.preset_passmanagers.generate_preset_pass_manager") was run with `optimization_level` at level 1, 2, or 3, it would run [`RemoveResetInZeroState`](/api/qiskit/qiskit.transpiler.passes.RemoveResetInZeroState "qiskit.transpiler.passes.RemoveResetInZeroState"). However, this pass prohibited the notion of arbitrary initial states unless explicitly set to zeros with resets. If you need to run the pass as part of your compilation pipeline, you can run something like:
* Disabled the use of the [`RemoveResetInZeroState`](/api/qiskit/0.45/qiskit.transpiler.passes.RemoveResetInZeroState "qiskit.transpiler.passes.RemoveResetInZeroState") class in the preset passmanagers. Previously, when [`transpile()`](/api/qiskit/0.45/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") or [`generate_preset_pass_manager()`](/api/qiskit/0.45/transpiler_preset#qiskit.transpiler.preset_passmanagers.generate_preset_pass_manager "qiskit.transpiler.preset_passmanagers.generate_preset_pass_manager") was run with `optimization_level` at level 1, 2, or 3, it would run [`RemoveResetInZeroState`](/api/qiskit/0.45/qiskit.transpiler.passes.RemoveResetInZeroState "qiskit.transpiler.passes.RemoveResetInZeroState"). However, this pass prohibited the notion of arbitrary initial states unless explicitly set to zeros with resets. If you need to run the pass as part of your compilation pipeline, you can run something like:
```python
pm = generate_preset_pass_manager(1, backend)
@ -746,43 +712,39 @@ Some feature highlights of Qiskit 0.45.0 are:
> [https://github.com/qiskit-community/qiskit-bip-mapper](https://github.com/qiskit-community/qiskit-bip-mapper)
The pass was made into a separate plugin package for two reasons: first, the dependency on CPLEX makes it harder to use, and secondly, the plugin package integrates more cleanly with [`transpile()`](/api/qiskit/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile"). The optional extra `bip-mapper` to install `cplex` and `docplex` to support this pass has been removed as nothing in Qiskit optionally requires it anymore.
The pass was made into a separate plugin package for two reasons: first, the dependency on CPLEX makes it harder to use, and secondly, the plugin package integrates more cleanly with [`transpile()`](/api/qiskit/0.45/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile"). The optional extra `bip-mapper` to install `cplex` and `docplex` to support this pass has been removed as nothing in Qiskit optionally requires it anymore.
* The argument `qubits` in the method [`InstructionDurations.get()`](/api/qiskit/qiskit.transpiler.InstructionDurations#get "qiskit.transpiler.InstructionDurations.get"), does not accept [`Qubit`](/api/qiskit/qiskit.circuit.Qubit "qiskit.circuit.Qubit") (or a list of them) any more. This functionality was deprecated in Qiskit 0.33 (with Terra 0.19), released on Dec 2021. Instead, use an integer for the qubit indices.
* The argument `qubits` in the method [`InstructionDurations.get()`](/api/qiskit/0.45/qiskit.transpiler.InstructionDurations#get "qiskit.transpiler.InstructionDurations.get"), does not accept [`Qubit`](/api/qiskit/0.45/qiskit.circuit.Qubit "qiskit.circuit.Qubit") (or a list of them) any more. This functionality was deprecated in Qiskit 0.33 (with Terra 0.19), released on Dec 2021. Instead, use an integer for the qubit indices.
* Removed the argument `qubit_channel_mapping` in [`RZXCalibrationBuilder`](/api/qiskit/qiskit.transpiler.passes.RZXCalibrationBuilder "qiskit.transpiler.passes.RZXCalibrationBuilder"), which was deprecated in Qiskit 0.39 (released on Oct 2022, with qiskit-terra 0.22)
* Removed the argument `qubit_channel_mapping` in [`RZXCalibrationBuilder`](/api/qiskit/0.45/qiskit.transpiler.passes.RZXCalibrationBuilder "qiskit.transpiler.passes.RZXCalibrationBuilder"), which was deprecated in Qiskit 0.39 (released on Oct 2022, with qiskit-terra 0.22)
* In [`transpiler.CouplingMap`](/api/qiskit/qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap") method `subgraph` is removed as deprecated in 0.20. `reduce()` can be used in place of method `subgraph`.
* In [`transpiler.CouplingMap`](/api/qiskit/0.45/qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap") method `subgraph` is removed as deprecated in 0.20. `reduce()` can be used in place of method `subgraph`.
<span id="relnotes-0-45-0-stable-0-45-visualization-upgrade-notes" />
<span id="id33" />
### Visualization Upgrade Notes
* Removed support for using the keyword `rho` for the first positional argument in [`plot_state_hinton()`](/api/qiskit/qiskit.visualization.plot_state_hinton "qiskit.visualization.plot_state_hinton"), [`plot_bloch_multivector()`](/api/qiskit/qiskit.visualization.plot_bloch_multivector "qiskit.visualization.plot_bloch_multivector"), [`plot_state_city()`](/api/qiskit/qiskit.visualization.plot_state_city "qiskit.visualization.plot_state_city"), [`plot_state_paulivec()`](/api/qiskit/qiskit.visualization.plot_state_paulivec "qiskit.visualization.plot_state_paulivec"), and [`plot_state_qsphere()`](/api/qiskit/qiskit.visualization.plot_state_qsphere "qiskit.visualization.plot_state_qsphere"). The use of `rho` has been replaced by `state`, which can be used instead. Removed `qiskit.scheduler.utils` as all contained functions were moved to `qiskit.pulse.macros` and `qiskit.pulse.utils`. All these were deprecated since 0.15 (released on August 06, 2020) and now they are removed.
* Removed support for using the keyword `rho` for the first positional argument in [`plot_state_hinton()`](/api/qiskit/0.45/qiskit.visualization.plot_state_hinton "qiskit.visualization.plot_state_hinton"), [`plot_bloch_multivector()`](/api/qiskit/0.45/qiskit.visualization.plot_bloch_multivector "qiskit.visualization.plot_bloch_multivector"), [`plot_state_city()`](/api/qiskit/0.45/qiskit.visualization.plot_state_city "qiskit.visualization.plot_state_city"), [`plot_state_paulivec()`](/api/qiskit/0.45/qiskit.visualization.plot_state_paulivec "qiskit.visualization.plot_state_paulivec"), and [`plot_state_qsphere()`](/api/qiskit/0.45/qiskit.visualization.plot_state_qsphere "qiskit.visualization.plot_state_qsphere"). The use of `rho` has been replaced by `state`, which can be used instead. Removed `qiskit.scheduler.utils` as all contained functions were moved to `qiskit.pulse.macros` and `qiskit.pulse.utils`. All these were deprecated since 0.15 (released on August 06, 2020) and now they are removed.
* The class constructor arguments `qregs`, `cregs`, `layout` and `global_phase` for `visualization.QCircuitImage` are removed, as they were deprecated in 0.20.
* The visualization functions: [`plot_gate_map()`](/api/qiskit/qiskit.visualization.plot_gate_map "qiskit.visualization.plot_gate_map"), [`plot_coupling_map()`](/api/qiskit/qiskit.visualization.plot_coupling_map "qiskit.visualization.plot_coupling_map"). [`plot_error_map()`](/api/qiskit/qiskit.visualization.plot_error_map "qiskit.visualization.plot_error_map"), and [`plot_circuit_layout()`](/api/qiskit/qiskit.visualization.plot_circuit_layout "qiskit.visualization.plot_circuit_layout") now depend on [graphviz](https://graphviz.org/) being installed to function. This change was necessary to enable visualizing backends with larger numbers of qubits. This additional external requirement is in addition to the existing optional dependencies these functions previously required. You find details on how to install graphviz here: [https://graphviz.org/download/](https://graphviz.org/download/)
* The visualization functions: [`plot_gate_map()`](/api/qiskit/0.45/qiskit.visualization.plot_gate_map "qiskit.visualization.plot_gate_map"), [`plot_coupling_map()`](/api/qiskit/0.45/qiskit.visualization.plot_coupling_map "qiskit.visualization.plot_coupling_map"). [`plot_error_map()`](/api/qiskit/0.45/qiskit.visualization.plot_error_map "qiskit.visualization.plot_error_map"), and [`plot_circuit_layout()`](/api/qiskit/0.45/qiskit.visualization.plot_circuit_layout "qiskit.visualization.plot_circuit_layout") now depend on [graphviz](https://graphviz.org/) being installed to function. This change was necessary to enable visualizing backends with larger numbers of qubits. This additional external requirement is in addition to the existing optional dependencies these functions previously required. You find details on how to install graphviz here: [https://graphviz.org/download/](https://graphviz.org/download/)
<span id="relnotes-0-45-0-stable-0-45-misc-upgrade-notes" />
<span id="id34" />
### Misc. Upgrade Notes
* The [`QuasiDistribution`](/api/qiskit/qiskit.result.QuasiDistribution "qiskit.result.QuasiDistribution") values might include floating-point errors. `QuasiDistribution.__repr__` rounds using `numpy.round()` and the parameter `ndigits` can be manipulated with the class attribute `__ndigits__`. The default is `15`.
* The [`QuasiDistribution`](/api/qiskit/0.45/qiskit.result.QuasiDistribution "qiskit.result.QuasiDistribution") values might include floating-point errors. `QuasiDistribution.__repr__` rounds using `numpy.round()` and the parameter `ndigits` can be manipulated with the class attribute `__ndigits__`. The default is `15`.
* The class `qiskit.qobj.Qobj` is removed. It was deprecated in Qiskit 0.33 (with Terra 0.19), released on Dec 2021. Instead, use [`qiskit.qobj.QasmQobj`](/api/qiskit/qiskit.qobj.QasmQobj "qiskit.qobj.QasmQobj") or [`qiskit.qobj.PulseQobj`](/api/qiskit/qiskit.qobj.PulseQobj "qiskit.qobj.PulseQobj").
* The class `qiskit.qobj.Qobj` is removed. It was deprecated in Qiskit 0.33 (with Terra 0.19), released on Dec 2021. Instead, use [`qiskit.qobj.QasmQobj`](/api/qiskit/0.45/qiskit.qobj.QasmQobj "qiskit.qobj.QasmQobj") or [`qiskit.qobj.PulseQobj`](/api/qiskit/0.45/qiskit.qobj.PulseQobj "qiskit.qobj.PulseQobj").
* The decorator `qiskit.utils.deprecation.deprecate_function()` has been deprecated since Qiskit 0.39.0 (released on October 2022, with qiskit-terra 0.22.0) and now is been removed. Use [`qiskit.utils.deprecate_func()`](/api/qiskit/utils#qiskit.utils.deprecate_func "qiskit.utils.deprecate_func") instead.
* The decorator `qiskit.utils.deprecation.deprecate_function()` has been deprecated since Qiskit 0.39.0 (released on October 2022, with qiskit-terra 0.22.0) and now is been removed. Use [`qiskit.utils.deprecate_func()`](/api/qiskit/0.45/utils#qiskit.utils.deprecate_func "qiskit.utils.deprecate_func") instead.
* The function `execute()` does not accept the arguments `qobj_id` and `qobj_header` any more. Their use was deprecated in Qiskit 0.37 (with Terra 0.21), released on June 2022.
* The function [`execute()`](/api/qiskit/0.45/execute#qiskit.execute_function.execute "qiskit.execute_function.execute") does not accept the arguments `qobj_id` and `qobj_header` any more. Their use was deprecated in Qiskit 0.37 (with Terra 0.21), released on June 2022.
* The transpilation pass `qiskit.transpiler.passes.CXDirection` is removed. Its use was deprecated in Qiskit 0.37 (with Terra 0.21), released on June 2022. Instead, use the more generic [`GateDirection`](/api/qiskit/qiskit.transpiler.passes.GateDirection "qiskit.transpiler.passes.GateDirection") pass.
* The transpilation pass `qiskit.transpiler.passes.CXDirection` is removed. Its use was deprecated in Qiskit 0.37 (with Terra 0.21), released on June 2022. Instead, use the more generic [`GateDirection`](/api/qiskit/0.45/qiskit.transpiler.passes.GateDirection "qiskit.transpiler.passes.GateDirection") pass.
* The transpilation pass `qiskit.transpiler.passes.CheckCXDirection` is removed. Its use was deprecated in Qiskit 0.37 (with Terra 0.21), released on June 2022. Instead, use the more generic [`CheckGateDirection`](/api/qiskit/qiskit.transpiler.passes.CheckGateDirection "qiskit.transpiler.passes.CheckGateDirection") pass.
* The transpilation pass `qiskit.transpiler.passes.CheckCXDirection` is removed. Its use was deprecated in Qiskit 0.37 (with Terra 0.21), released on June 2022. Instead, use the more generic [`CheckGateDirection`](/api/qiskit/0.45/qiskit.transpiler.passes.CheckGateDirection "qiskit.transpiler.passes.CheckGateDirection") pass.
* Building Qiskit from source now requires a Rust compiler compatible with language version 1.64. This has been increased from the previous minimum supported Rust version of 1.61 for building earlier versions of Qiskit.
@ -796,63 +758,63 @@ Some feature highlights of Qiskit 0.45.0 are:
### Circuits Deprecations
* Passing `None` as the `qargs` or `cargs` arguments to [`DAGCircuit.apply_operation_back()`](/api/qiskit/qiskit.dagcircuit.DAGCircuit#apply_operation_back "qiskit.dagcircuit.DAGCircuit.apply_operation_back") or [`apply_operation_front()`](/api/qiskit/qiskit.dagcircuit.DAGCircuit#apply_operation_front "qiskit.dagcircuit.DAGCircuit.apply_operation_front") is deprecated and will be removed in Qiskit 1.0. This has been explicitly against the typing documentation for some time, but silently accepted by Qiskit. Instead, simply pass `()` rather than `None`.
* Passing `None` as the `qargs` or `cargs` arguments to [`DAGCircuit.apply_operation_back()`](/api/qiskit/0.45/qiskit.dagcircuit.DAGCircuit#apply_operation_back "qiskit.dagcircuit.DAGCircuit.apply_operation_back") or [`apply_operation_front()`](/api/qiskit/0.45/qiskit.dagcircuit.DAGCircuit#apply_operation_front "qiskit.dagcircuit.DAGCircuit.apply_operation_front") is deprecated and will be removed in Qiskit 1.0. This has been explicitly against the typing documentation for some time, but silently accepted by Qiskit. Instead, simply pass `()` rather than `None`.
* The method `QuantumCircuit.bind_parameters()` is now deprecated and will be removed from the codebase in no less than 3 months from the release date. Its functionality overlapped highly with [`QuantumCircuit.assign_parameters()`](/api/qiskit/qiskit.circuit.QuantumCircuit#assign_parameters "qiskit.circuit.QuantumCircuit.assign_parameters"), and can be totally replaced by it. Please use [`QuantumCircuit.assign_parameters()`](/api/qiskit/qiskit.circuit.QuantumCircuit#assign_parameters "qiskit.circuit.QuantumCircuit.assign_parameters") instead.
* The method [`QuantumCircuit.bind_parameters()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#bind_parameters "qiskit.circuit.QuantumCircuit.bind_parameters") is now deprecated and will be removed from the codebase in no less than 3 months from the release date. Its functionality overlapped highly with [`QuantumCircuit.assign_parameters()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#assign_parameters "qiskit.circuit.QuantumCircuit.assign_parameters"), and can be totally replaced by it. Please use [`QuantumCircuit.assign_parameters()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#assign_parameters "qiskit.circuit.QuantumCircuit.assign_parameters") instead.
* Deprecate duplicate gate methods on [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit"). The rule applied is that the method names reflect that gate names, e.g. the [`CXGate`](/api/qiskit/qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate") is added via [`QuantumCircuit.cx()`](/api/qiskit/qiskit.circuit.QuantumCircuit#cx "qiskit.circuit.QuantumCircuit.cx") and not `QuantumCircuit.cnot()`. The deprecations are:
* Deprecate duplicate gate methods on [`QuantumCircuit`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit"). The rule applied is that the method names reflect that gate names, e.g. the [`CXGate`](/api/qiskit/0.45/qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate") is added via [`QuantumCircuit.cx()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#cx "qiskit.circuit.QuantumCircuit.cx") and not [`QuantumCircuit.cnot()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#cnot "qiskit.circuit.QuantumCircuit.cnot"). The deprecations are:
* `QuantumCircuit.cnot()` in favor of [`QuantumCircuit.cx()`](/api/qiskit/qiskit.circuit.QuantumCircuit#cx "qiskit.circuit.QuantumCircuit.cx")
* `QuantumCircuit.toffoli()` in favor of [`QuantumCircuit.ccx()`](/api/qiskit/qiskit.circuit.QuantumCircuit#ccx "qiskit.circuit.QuantumCircuit.ccx")
* `QuantumCircuit.fredkin()` in favor of [`QuantumCircuit.cswap()`](/api/qiskit/qiskit.circuit.QuantumCircuit#cswap "qiskit.circuit.QuantumCircuit.cswap")
* `QuantumCircuit.mct()` in favor of [`QuantumCircuit.mcx()`](/api/qiskit/qiskit.circuit.QuantumCircuit#mcx "qiskit.circuit.QuantumCircuit.mcx")
* `QuantumCircuit.i()` in favor of [`QuantumCircuit.id()`](/api/qiskit/qiskit.circuit.QuantumCircuit#id "qiskit.circuit.QuantumCircuit.id")
* [`QuantumCircuit.cnot()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#cnot "qiskit.circuit.QuantumCircuit.cnot") in favor of [`QuantumCircuit.cx()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#cx "qiskit.circuit.QuantumCircuit.cx")
* [`QuantumCircuit.toffoli()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#toffoli "qiskit.circuit.QuantumCircuit.toffoli") in favor of [`QuantumCircuit.ccx()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#ccx "qiskit.circuit.QuantumCircuit.ccx")
* [`QuantumCircuit.fredkin()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#fredkin "qiskit.circuit.QuantumCircuit.fredkin") in favor of [`QuantumCircuit.cswap()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#cswap "qiskit.circuit.QuantumCircuit.cswap")
* [`QuantumCircuit.mct()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#mct "qiskit.circuit.QuantumCircuit.mct") in favor of [`QuantumCircuit.mcx()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#mcx "qiskit.circuit.QuantumCircuit.mcx")
* [`QuantumCircuit.i()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#i "qiskit.circuit.QuantumCircuit.i") in favor of [`QuantumCircuit.id()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#id "qiskit.circuit.QuantumCircuit.id")
Note that `QuantumCircuit.i()` is the only exception to the rule above, but since [`QuantumCircuit.id()`](/api/qiskit/qiskit.circuit.QuantumCircuit#id "qiskit.circuit.QuantumCircuit.id") more intuively represents the identity and is used more, we chose it over its counterpart.
Note that [`QuantumCircuit.i()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#i "qiskit.circuit.QuantumCircuit.i") is the only exception to the rule above, but since [`QuantumCircuit.id()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#id "qiskit.circuit.QuantumCircuit.id") more intuively represents the identity and is used more, we chose it over its counterpart.
* To streamline the structure of Qiskits gates and operations, the `qiskit.extensions` module is pending deprecation and will be deprecated in a future release. The following objects have been moved to [`qiskit.circuit.library`](/api/qiskit/circuit_library#module-qiskit.circuit.library "qiskit.circuit.library")
* To streamline the structure of Qiskits gates and operations, the [`qiskit.extensions`](/api/qiskit/0.45/extensions#module-qiskit.extensions "qiskit.extensions") module is pending deprecation and will be deprecated in a future release. The following objects have been moved to [`qiskit.circuit.library`](/api/qiskit/0.45/circuit_library#module-qiskit.circuit.library "qiskit.circuit.library")
* [`DiagonalGate`](/api/qiskit/qiskit.circuit.library.DiagonalGate "qiskit.circuit.library.DiagonalGate"),
* [`HamiltonianGate`](/api/qiskit/qiskit.circuit.library.HamiltonianGate "qiskit.circuit.library.HamiltonianGate"),
* [`Initialize`](/api/qiskit/qiskit.circuit.library.Initialize "qiskit.circuit.library.Initialize"),
* [`Isometry`](/api/qiskit/qiskit.circuit.library.Isometry "qiskit.circuit.library.Isometry"),
* [`DiagonalGate`](/api/qiskit/0.45/qiskit.circuit.library.DiagonalGate "qiskit.circuit.library.DiagonalGate"),
* [`HamiltonianGate`](/api/qiskit/0.45/qiskit.circuit.library.HamiltonianGate "qiskit.circuit.library.HamiltonianGate"),
* [`Initialize`](/api/qiskit/0.45/qiskit.circuit.library.Initialize "qiskit.circuit.library.Initialize"),
* [`Isometry`](/api/qiskit/0.45/qiskit.circuit.library.Isometry "qiskit.circuit.library.Isometry"),
* `MCGupDiag`,
* [`UCGate`](/api/qiskit/qiskit.circuit.library.UCGate "qiskit.circuit.library.UCGate"),
* [`UCPauliRotGate`](/api/qiskit/qiskit.circuit.library.UCPauliRotGate "qiskit.circuit.library.UCPauliRotGate"),
* [`UCRXGate`](/api/qiskit/qiskit.circuit.library.UCRXGate "qiskit.circuit.library.UCRXGate"),
* [`UCRYGate`](/api/qiskit/qiskit.circuit.library.UCRYGate "qiskit.circuit.library.UCRYGate"),
* [`UCRZGate`](/api/qiskit/qiskit.circuit.library.UCRZGate "qiskit.circuit.library.UCRZGate"),
* [`UnitaryGate`](/api/qiskit/qiskit.circuit.library.UnitaryGate "qiskit.circuit.library.UnitaryGate").
* [`UCGate`](/api/qiskit/0.45/qiskit.circuit.library.UCGate "qiskit.circuit.library.UCGate"),
* [`UCPauliRotGate`](/api/qiskit/0.45/qiskit.circuit.library.UCPauliRotGate "qiskit.circuit.library.UCPauliRotGate"),
* [`UCRXGate`](/api/qiskit/0.45/qiskit.circuit.library.UCRXGate "qiskit.circuit.library.UCRXGate"),
* [`UCRYGate`](/api/qiskit/0.45/qiskit.circuit.library.UCRYGate "qiskit.circuit.library.UCRYGate"),
* [`UCRZGate`](/api/qiskit/0.45/qiskit.circuit.library.UCRZGate "qiskit.circuit.library.UCRZGate"),
* [`UnitaryGate`](/api/qiskit/0.45/qiskit.circuit.library.UnitaryGate "qiskit.circuit.library.UnitaryGate").
These instructions have already been deprecated in this release,
* `SingleQubitUnitary`, instead use [`library.UnitaryGate`](/api/qiskit/qiskit.circuit.library.UnitaryGate "qiskit.circuit.library.UnitaryGate"),
* `Snapshot`, which has been superseded by Qiskit Aers save instructions,
* [`SingleQubitUnitary`](/api/qiskit/0.45/qiskit.extensions.SingleQubitUnitary "qiskit.extensions.SingleQubitUnitary"), instead use [`library.UnitaryGate`](/api/qiskit/0.45/qiskit.circuit.library.UnitaryGate "qiskit.circuit.library.UnitaryGate"),
* [`Snapshot`](/api/qiskit/0.45/qiskit.extensions.Snapshot "qiskit.extensions.Snapshot"), which has been superseded by Qiskit Aers save instructions,
along with their circuit methods
* `QuantumCircuit.snapshot()`,
* `QuantumCircuit.squ()`.
* [`QuantumCircuit.snapshot()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#snapshot "qiskit.circuit.QuantumCircuit.snapshot"),
* [`QuantumCircuit.squ()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#squ "qiskit.circuit.QuantumCircuit.squ").
In addition, the following circuit methods are pending deprecation
* `QuantumCircuit.diagonal()`,
* `QuantumCircuit.hamiltonian()`,
* `QuantumCircuit.isometry()` and `QuantumCircuit.iso()`,
* `QuantumCircuit.uc()`,
* `QuantumCircuit.ucrx()`,
* `QuantumCircuit.ucry()`,
* `QuantumCircuit.ucrz()`.
* [`QuantumCircuit.diagonal()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#diagonal "qiskit.circuit.QuantumCircuit.diagonal"),
* [`QuantumCircuit.hamiltonian()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#hamiltonian "qiskit.circuit.QuantumCircuit.hamiltonian"),
* [`QuantumCircuit.isometry()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#isometry "qiskit.circuit.QuantumCircuit.isometry") and [`QuantumCircuit.iso()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#iso "qiskit.circuit.QuantumCircuit.iso"),
* [`QuantumCircuit.uc()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#uc "qiskit.circuit.QuantumCircuit.uc"),
* [`QuantumCircuit.ucrx()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#ucrx "qiskit.circuit.QuantumCircuit.ucrx"),
* [`QuantumCircuit.ucry()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#ucry "qiskit.circuit.QuantumCircuit.ucry"),
* [`QuantumCircuit.ucrz()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#ucrz "qiskit.circuit.QuantumCircuit.ucrz").
Since the entire module is pending deprecation, so is `ExtensionError`.
Since the entire module is pending deprecation, so is [`ExtensionError`](/api/qiskit/0.45/extensions#qiskit.extensions.ExtensionError "qiskit.extensions.ExtensionError").
* The little-used [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") class data attributes `header` and `extension_lib` are deprecated and scheduled for removal. These respectively held strings of the OpenQASM 2.0 version header statement and `qelib1.inc` include statement. No alternative will be provided; these were mostly intended as internal details.
* The little-used [`QuantumCircuit`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") class data attributes [`header`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#header "qiskit.circuit.QuantumCircuit.header") and [`extension_lib`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#extension_lib "qiskit.circuit.QuantumCircuit.extension_lib") are deprecated and scheduled for removal. These respectively held strings of the OpenQASM 2.0 version header statement and `qelib1.inc` include statement. No alternative will be provided; these were mostly intended as internal details.
<span id="relnotes-0-45-0-stable-0-45-transpiler-deprecations" />
### Transpiler Deprecations
* The flow controller factory method `FlowController.controller_factory()` is deprecated along with `FlowController.add_flow_controller()` and `FlowController.remove_flow_controller()`. In the future, task construction with keyword arguments in the [`BasePassManager.append()`](/api/qiskit/qiskit.passmanager.BasePassManager#append "qiskit.passmanager.BasePassManager.append") method will also be deprecated. Controllers must be explicitly instantiated and appended to the pass manager. For example, the previously used conventional syntax
* The flow controller factory method [`FlowController.controller_factory()`](/api/qiskit/0.45/qiskit.passmanager.FlowController#controller_factory "qiskit.passmanager.FlowController.controller_factory") is deprecated along with [`FlowController.add_flow_controller()`](/api/qiskit/0.45/qiskit.passmanager.FlowController#add_flow_controller "qiskit.passmanager.FlowController.add_flow_controller") and [`FlowController.remove_flow_controller()`](/api/qiskit/0.45/qiskit.passmanager.FlowController#remove_flow_controller "qiskit.passmanager.FlowController.remove_flow_controller"). In the future, task construction with keyword arguments in the [`BasePassManager.append()`](/api/qiskit/0.45/qiskit.passmanager.BasePassManager#append "qiskit.passmanager.BasePassManager.append") method will also be deprecated. Controllers must be explicitly instantiated and appended to the pass manager. For example, the previously used conventional syntax
```python
pm.append([task1, task2], condition=lambda x: x["value1"] > 10)
@ -867,11 +829,11 @@ Some feature highlights of Qiskit 0.45.0 are:
The latter allows more precise control on the order of controllers especially when multiple keyword arguments are specified together, and allows for the construction of general flow controllers that may have more than one pipeline or do not take a single simple conditional function in their constructors.
* The `FlowControllerLinear.append()`, `DoWhileController.append()`, and `ConditionalController.append()` methods are all deprecated immediately. The construction of the pass manager task pipeline is now the role of [`BasePassManager`](/api/qiskit/qiskit.passmanager.BasePassManager "qiskit.passmanager.BasePassManager"), and individual flow controllers do not need to this method. For a flow controller, all the passes should be specificed in one go directly to the constructor.
* The [`FlowControllerLinear.append()`](/api/qiskit/0.45/qiskit.passmanager.FlowControllerLinear#append "qiskit.passmanager.FlowControllerLinear.append"), [`DoWhileController.append()`](/api/qiskit/0.45/qiskit.passmanager.DoWhileController#append "qiskit.passmanager.DoWhileController.append"), and [`ConditionalController.append()`](/api/qiskit/0.45/qiskit.passmanager.ConditionalController#append "qiskit.passmanager.ConditionalController.append") methods are all deprecated immediately. The construction of the pass manager task pipeline is now the role of [`BasePassManager`](/api/qiskit/0.45/qiskit.passmanager.BasePassManager "qiskit.passmanager.BasePassManager"), and individual flow controllers do not need to this method. For a flow controller, all the passes should be specificed in one go directly to the constructor.
* The general attribute and variable name `passes` is replaced with `tasks` all over the [`qiskit.passmanager`](/api/qiskit/passmanager#module-qiskit.passmanager "qiskit.passmanager") module. Note that a task must indicate a union of pass and controller, and the singular form pass conflicts with the Python keyword. In this sense, the use of tasks is much preferable.
* The general attribute and variable name `passes` is replaced with `tasks` all over the [`qiskit.passmanager`](/api/qiskit/0.45/passmanager#module-qiskit.passmanager "qiskit.passmanager") module. Note that a task must indicate a union of pass and controller, and the singular form pass conflicts with the Python keyword. In this sense, the use of tasks is much preferable.
* The `Unroller` transpiler pass has been deprecated and will be removed in a future release. The `Unroller` has been superseded by the [`BasisTranslator`](/api/qiskit/qiskit.transpiler.passes.BasisTranslator "qiskit.transpiler.passes.BasisTranslator") which provides a similar set of functionality but offers it in a more general manner so that youre able to translate a circuit to any universal basis set. The `Unroller` class only works in situations where the circuits gate definitions are recursively defined in terms of the target basis; for Qiskits standard library gates this means [`UGate`](/api/qiskit/qiskit.circuit.library.UGate "qiskit.circuit.library.UGate") and [`CXGate`](/api/qiskit/qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate"). If you are using the `Unroller` pass it can be replaced by using a custom pass manager of the form:
* The [`Unroller`](/api/qiskit/0.45/qiskit.transpiler.passes.Unroller "qiskit.transpiler.passes.Unroller") transpiler pass has been deprecated and will be removed in a future release. The [`Unroller`](/api/qiskit/0.45/qiskit.transpiler.passes.Unroller "qiskit.transpiler.passes.Unroller") has been superseded by the [`BasisTranslator`](/api/qiskit/0.45/qiskit.transpiler.passes.BasisTranslator "qiskit.transpiler.passes.BasisTranslator") which provides a similar set of functionality but offers it in a more general manner so that youre able to translate a circuit to any universal basis set. The [`Unroller`](/api/qiskit/0.45/qiskit.transpiler.passes.Unroller "qiskit.transpiler.passes.Unroller") class only works in situations where the circuits gate definitions are recursively defined in terms of the target basis; for Qiskits standard library gates this means [`UGate`](/api/qiskit/0.45/qiskit.circuit.library.UGate "qiskit.circuit.library.UGate") and [`CXGate`](/api/qiskit/0.45/qiskit.circuit.library.CXGate "qiskit.circuit.library.CXGate"). If you are using the [`Unroller`](/api/qiskit/0.45/qiskit.transpiler.passes.Unroller "qiskit.transpiler.passes.Unroller") pass it can be replaced by using a custom pass manager of the form:
```python
from qiskit.transpiler import PassManager
@ -887,7 +849,7 @@ Some feature highlights of Qiskit 0.45.0 are:
pm.run(circuit)
```
* The use of the value `"unroller"` for the `translation_method` keyword argument on the [`transpile()`](/api/qiskit/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") and [`generate_preset_pass_manager()`](/api/qiskit/transpiler_preset#qiskit.transpiler.preset_passmanagers.generate_preset_pass_manager "qiskit.transpiler.preset_passmanagers.generate_preset_pass_manager") has been deprecated. This translation stage plugin will be removed from Qiskit in a future release as it has been superseded by the default `"translator"` method which will work similarly to the `"unroller"` plugin but support a broader set of target backends.
* The use of the value `"unroller"` for the `translation_method` keyword argument on the [`transpile()`](/api/qiskit/0.45/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") and [`generate_preset_pass_manager()`](/api/qiskit/0.45/transpiler_preset#qiskit.transpiler.preset_passmanagers.generate_preset_pass_manager "qiskit.transpiler.preset_passmanagers.generate_preset_pass_manager") has been deprecated. This translation stage plugin will be removed from Qiskit in a future release as it has been superseded by the default `"translator"` method which will work similarly to the `"unroller"` plugin but support a broader set of target backends.
<span id="relnotes-0-45-0-stable-0-45-visualization-deprecations" />
@ -906,7 +868,7 @@ Some feature highlights of Qiskit 0.45.0 are:
circuit.draw("mpl", style="clifford") # or style="iqp"
```
* Passing a circuit to [`qiskit.visualization.timeline_drawer()`](/api/qiskit/qiskit.visualization.timeline_drawer "qiskit.visualization.timeline_drawer") that does not have scheduled node start-time information is deprecated. Only circuits that have gone through one of the scheduling analysis passes (for example [`ALAPScheduleAnalysis`](/api/qiskit/qiskit.transpiler.passes.ALAPScheduleAnalysis "qiskit.transpiler.passes.ALAPScheduleAnalysis") or [`ASAPScheduleAnalysis`](/api/qiskit/qiskit.transpiler.passes.ASAPScheduleAnalysis "qiskit.transpiler.passes.ASAPScheduleAnalysis")) can be visualised. If you have used one of the old-style scheduling passes (for example [`ALAPSchedule`](/api/qiskit/qiskit.transpiler.passes.ALAPSchedule "qiskit.transpiler.passes.ALAPSchedule") or [`ASAPSchedule`](/api/qiskit/qiskit.transpiler.passes.ASAPSchedule "qiskit.transpiler.passes.ASAPSchedule")), you can propagate the scheduling information by running:
* Passing a circuit to [`qiskit.visualization.timeline_drawer()`](/api/qiskit/0.45/qiskit.visualization.timeline_drawer "qiskit.visualization.timeline_drawer") that does not have scheduled node start-time information is deprecated. Only circuits that have gone through one of the scheduling analysis passes (for example [`ALAPScheduleAnalysis`](/api/qiskit/0.45/qiskit.transpiler.passes.ALAPScheduleAnalysis "qiskit.transpiler.passes.ALAPScheduleAnalysis") or [`ASAPScheduleAnalysis`](/api/qiskit/0.45/qiskit.transpiler.passes.ASAPScheduleAnalysis "qiskit.transpiler.passes.ASAPScheduleAnalysis")) can be visualised. If you have used one of the old-style scheduling passes (for example [`ALAPSchedule`](/api/qiskit/0.45/qiskit.transpiler.passes.ALAPSchedule "qiskit.transpiler.passes.ALAPSchedule") or [`ASAPSchedule`](/api/qiskit/0.45/qiskit.transpiler.passes.ASAPSchedule "qiskit.transpiler.passes.ASAPSchedule")), you can propagate the scheduling information by running:
```python
from qiskit import transpile
@ -924,19 +886,19 @@ Some feature highlights of Qiskit 0.45.0 are:
<span id="relnotes-0-45-0-stable-0-45-bug-fixes" />
<span id="id35" />
<span id="id11" />
### Bug Fixes
* The maximum number of qubits to consider for matrix multiplication-based commutativity check in [`CommutationChecker`](/api/qiskit/qiskit.circuit.CommutationChecker "qiskit.circuit.CommutationChecker") is now limited to 3 by default. Fixed [#10488](https://github.com/Qiskit/qiskit-terra/issues/10488)
* The maximum number of qubits to consider for matrix multiplication-based commutativity check in [`CommutationChecker`](/api/qiskit/0.45/qiskit.circuit.CommutationChecker "qiskit.circuit.CommutationChecker") is now limited to 3 by default. Fixed [#10488](https://github.com/Qiskit/qiskit-terra/issues/10488)
* The [`GateDirection`](/api/qiskit/qiskit.transpiler.passes.GateDirection "qiskit.transpiler.passes.GateDirection") transpiler pass will now use discrete-basis translations rather than relying on a continuous [`RYGate`](/api/qiskit/qiskit.circuit.library.RYGate "qiskit.circuit.library.RYGate"), which should help make some discrete-basis-set targets slightly more reliable. In general, [`transpile()`](/api/qiskit/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") only has partial support for basis sets that do not contain a continuously-parametrised operation, and so it may not always succeed in these situations, and will almost certainly not produce optimal results.
* The [`GateDirection`](/api/qiskit/0.45/qiskit.transpiler.passes.GateDirection "qiskit.transpiler.passes.GateDirection") transpiler pass will now use discrete-basis translations rather than relying on a continuous [`RYGate`](/api/qiskit/0.45/qiskit.circuit.library.RYGate "qiskit.circuit.library.RYGate"), which should help make some discrete-basis-set targets slightly more reliable. In general, [`transpile()`](/api/qiskit/0.45/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") only has partial support for basis sets that do not contain a continuously-parametrised operation, and so it may not always succeed in these situations, and will almost certainly not produce optimal results.
* Fixed [`CommutationAnalysis`](/api/qiskit/qiskit.transpiler.passes.CommutationAnalysis "qiskit.transpiler.passes.CommutationAnalysis") to group gates on a wire into sets, with each set only containing gates that pairwise commute. This prevents `CommutationCancellation` from performing unsound optimizations. See [#8020](https://github.com/Qiskit/qiskit-terra/issues/8020)
* Fixed [`CommutationAnalysis`](/api/qiskit/0.45/qiskit.transpiler.passes.CommutationAnalysis "qiskit.transpiler.passes.CommutationAnalysis") to group gates on a wire into sets, with each set only containing gates that pairwise commute. This prevents `CommutationCancellation` from performing unsound optimizations. See [#8020](https://github.com/Qiskit/qiskit-terra/issues/8020)
* [`CUGate`](/api/qiskit/qiskit.circuit.library.CUGate "qiskit.circuit.library.CUGate") will now behave correctly during calls to [`QuantumCircuit.assign_parameters()`](/api/qiskit/qiskit.circuit.QuantumCircuit#assign_parameters "qiskit.circuit.QuantumCircuit.assign_parameters"). Previously, it would cause various odd errors, often some time after the initial circuit assignment. See [#7326](https://github.com/Qiskit/qiskit/issues/7326), [#7410](https://github.com/Qiskit/qiskit/issues/7410), [#9627](https://github.com/Qiskit/qiskit/issues/9627), [#10002](https://github.com/Qiskit/qiskit/issues/10002), and [#10131](https://github.com/Qiskit/qiskit/issues/10131).
* [`CUGate`](/api/qiskit/0.45/qiskit.circuit.library.CUGate "qiskit.circuit.library.CUGate") will now behave correctly during calls to [`QuantumCircuit.assign_parameters()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#assign_parameters "qiskit.circuit.QuantumCircuit.assign_parameters"). Previously, it would cause various odd errors, often some time after the initial circuit assignment. See [#7326](https://github.com/Qiskit/qiskit/issues/7326), [#7410](https://github.com/Qiskit/qiskit/issues/7410), [#9627](https://github.com/Qiskit/qiskit/issues/9627), [#10002](https://github.com/Qiskit/qiskit/issues/10002), and [#10131](https://github.com/Qiskit/qiskit/issues/10131).
* The control-flow builder interface (the context-manager forms of [`QuantumCircuit.if_test()`](/api/qiskit/qiskit.circuit.QuantumCircuit#if_test "qiskit.circuit.QuantumCircuit.if_test"), [`while_loop()`](/api/qiskit/qiskit.circuit.QuantumCircuit#while_loop "qiskit.circuit.QuantumCircuit.while_loop"), [`for_loop()`](/api/qiskit/qiskit.circuit.QuantumCircuit#for_loop "qiskit.circuit.QuantumCircuit.for_loop") and [`switch()`](/api/qiskit/qiskit.circuit.QuantumCircuit#switch "qiskit.circuit.QuantumCircuit.switch")) will now correctly track a separate global-phase advancement within that block. You can add a global-phase advancement to an inner block by assigning to [`QuantumCircuit.global_phase`](/api/qiskit/qiskit.circuit.QuantumCircuit#global_phase "qiskit.circuit.QuantumCircuit.global_phase") within a builder scope:
* The control-flow builder interface (the context-manager forms of [`QuantumCircuit.if_test()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#if_test "qiskit.circuit.QuantumCircuit.if_test"), [`while_loop()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#while_loop "qiskit.circuit.QuantumCircuit.while_loop"), [`for_loop()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#for_loop "qiskit.circuit.QuantumCircuit.for_loop") and [`switch()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#switch "qiskit.circuit.QuantumCircuit.switch")) will now correctly track a separate global-phase advancement within that block. You can add a global-phase advancement to an inner block by assigning to [`QuantumCircuit.global_phase`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#global_phase "qiskit.circuit.QuantumCircuit.global_phase") within a builder scope:
```python
from math import pi
@ -961,29 +923,29 @@ Some feature highlights of Qiskit 0.45.0 are:
assert qc.global_phase == pi / 2
```
The meaning of [`QuantumCircuit.global_phase`](/api/qiskit/qiskit.circuit.QuantumCircuit#global_phase "qiskit.circuit.QuantumCircuit.global_phase") is taken to be the global-phase advancement that is inherent to a single execution of the block. It is still a *global* phase advancement, in that if the block is entered, the phase of all qubits in the entire program will be advanced.
The meaning of [`QuantumCircuit.global_phase`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#global_phase "qiskit.circuit.QuantumCircuit.global_phase") is taken to be the global-phase advancement that is inherent to a single execution of the block. It is still a *global* phase advancement, in that if the block is entered, the phase of all qubits in the entire program will be advanced.
* Fix the coloring of the `"iqx"` and `"iqx-dark"` matplotlib color schemes, which previously drew the [`RZGate`](/api/qiskit/qiskit.circuit.library.RZGate "qiskit.circuit.library.RZGate"), [`RZZGate`](/api/qiskit/qiskit.circuit.library.RZZGate "qiskit.circuit.library.RZZGate"), (multi-)controlled [`PhaseGate`](/api/qiskit/qiskit.circuit.library.PhaseGate "qiskit.circuit.library.PhaseGate")s and [`iSwapGate`](/api/qiskit/qiskit.circuit.library.iSwapGate "qiskit.circuit.library.iSwapGate") in the wrong color.
* Fix the coloring of the `"iqx"` and `"iqx-dark"` matplotlib color schemes, which previously drew the [`RZGate`](/api/qiskit/0.45/qiskit.circuit.library.RZGate "qiskit.circuit.library.RZGate"), [`RZZGate`](/api/qiskit/0.45/qiskit.circuit.library.RZZGate "qiskit.circuit.library.RZZGate"), (multi-)controlled [`PhaseGate`](/api/qiskit/0.45/qiskit.circuit.library.PhaseGate "qiskit.circuit.library.PhaseGate")s and [`iSwapGate`](/api/qiskit/0.45/qiskit.circuit.library.iSwapGate "qiskit.circuit.library.iSwapGate") in the wrong color.
* The hash of a [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "qiskit.circuit.Parameter") is now equal to the hashes of any [`ParameterExpression`](/api/qiskit/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") that it compares equal to. Previously the hashes were different, which would cause spurious additional entries in hashmaps when [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "qiskit.circuit.Parameter") and [`ParameterExpression`](/api/qiskit/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") values were mixed in the same map as it violated Pythons data model.
* The hash of a [`Parameter`](/api/qiskit/0.45/qiskit.circuit.Parameter "qiskit.circuit.Parameter") is now equal to the hashes of any [`ParameterExpression`](/api/qiskit/0.45/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") that it compares equal to. Previously the hashes were different, which would cause spurious additional entries in hashmaps when [`Parameter`](/api/qiskit/0.45/qiskit.circuit.Parameter "qiskit.circuit.Parameter") and [`ParameterExpression`](/api/qiskit/0.45/qiskit.circuit.ParameterExpression "qiskit.circuit.ParameterExpression") values were mixed in the same map as it violated Pythons data model.
* Fixed a bug in QPY serialization ([`qiskit.qpy`](/api/qiskit/qpy#module-qiskit.qpy "qiskit.qpy")) where controlled unitary gates in a circuit could result would fail to deserialize. Fixed [#10802](https://github.com/Qiskit/qiskit-terra/issues/10802).
* Fixed a bug in QPY serialization ([`qiskit.qpy`](/api/qiskit/0.45/qpy#module-qiskit.qpy "qiskit.qpy")) where controlled unitary gates in a circuit could result would fail to deserialize. Fixed [#10802](https://github.com/Qiskit/qiskit-terra/issues/10802).
* Fixes the implementation of [`random_statevector()`](/api/qiskit/quantum_info#qiskit.quantum_info.random_statevector "qiskit.quantum_info.random_statevector") so that it samples from the uniform distribution.
* Fixes the implementation of [`random_statevector()`](/api/qiskit/0.45/quantum_info#qiskit.quantum_info.random_statevector "qiskit.quantum_info.random_statevector") so that it samples from the uniform distribution.
* The pass `NoiseAdaptiveLayout` now takes [`CouplingMap`](/api/qiskit/qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap") as an optional argument. This is used by the plugin to control on inconsistency between [`configuration()`](/api/qiskit/qiskit.providers.BackendV1#configuration "qiskit.providers.BackendV1.configuration") and [`properties()`](/api/qiskit/qiskit.providers.BackendV1#properties "qiskit.providers.BackendV1.properties"), like in the case of `FakeMelbourne`. Fixed [#7677](https://github.com/Qiskit/qiskit-terra/issues/7677).
* The pass [`NoiseAdaptiveLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.NoiseAdaptiveLayout "qiskit.transpiler.passes.NoiseAdaptiveLayout") now takes [`CouplingMap`](/api/qiskit/0.45/qiskit.transpiler.CouplingMap "qiskit.transpiler.CouplingMap") as an optional argument. This is used by the plugin to control on inconsistency between [`configuration()`](/api/qiskit/0.45/qiskit.providers.BackendV1#configuration "qiskit.providers.BackendV1.configuration") and [`properties()`](/api/qiskit/0.45/qiskit.providers.BackendV1#properties "qiskit.providers.BackendV1.properties"), like in the case of [`FakeMelbourne`](/api/qiskit/0.45/qiskit.providers.fake_provider.FakeMelbourne "qiskit.providers.fake_provider.FakeMelbourne"). Fixed [#7677](https://github.com/Qiskit/qiskit-terra/issues/7677).
* The methods [`QuantumCircuit.copy()`](/api/qiskit/qiskit.circuit.QuantumCircuit#copy "qiskit.circuit.QuantumCircuit.copy") and [`copy_empty_like()`](/api/qiskit/qiskit.circuit.QuantumCircuit#copy_empty_like "qiskit.circuit.QuantumCircuit.copy_empty_like") will now raise an error if the `name` argument is incorrectly typed, instead of generating an invalid circuit.
* The methods [`QuantumCircuit.copy()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#copy "qiskit.circuit.QuantumCircuit.copy") and [`copy_empty_like()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#copy_empty_like "qiskit.circuit.QuantumCircuit.copy_empty_like") will now raise an error if the `name` argument is incorrectly typed, instead of generating an invalid circuit.
* The `"decay"` heuristic of [`SabreSwap`](/api/qiskit/qiskit.transpiler.passes.SabreSwap "qiskit.transpiler.passes.SabreSwap") and [`SabreLayout`](/api/qiskit/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") now tracks the depth correctly on physical qubits rather than mistakenly tracking the “depth” of swaps on virtual qubits.
* The `"decay"` heuristic of [`SabreSwap`](/api/qiskit/0.45/qiskit.transpiler.passes.SabreSwap "qiskit.transpiler.passes.SabreSwap") and [`SabreLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.SabreLayout "qiskit.transpiler.passes.SabreLayout") now tracks the depth correctly on physical qubits rather than mistakenly tracking the “depth” of swaps on virtual qubits.
* Fixed an oversight in the [`ECRGate`](/api/qiskit/qiskit.circuit.library.ECRGate "qiskit.circuit.library.ECRGate") that prevented setting an [`ECRGate.label`](/api/qiskit/qiskit.circuit.library.ECRGate#label "qiskit.circuit.library.ECRGate.label") attribute at object construction time. All other [`Gate`](/api/qiskit/qiskit.circuit.Gate "qiskit.circuit.Gate") classes and subclasses enable setting a `label` keyword argument in the constructor.
* Fixed an oversight in the [`ECRGate`](/api/qiskit/0.45/qiskit.circuit.library.ECRGate "qiskit.circuit.library.ECRGate") that prevented setting an [`ECRGate.label`](/api/qiskit/0.45/qiskit.circuit.library.ECRGate#label "qiskit.circuit.library.ECRGate.label") attribute at object construction time. All other [`Gate`](/api/qiskit/0.45/qiskit.circuit.Gate "qiskit.circuit.Gate") classes and subclasses enable setting a `label` keyword argument in the constructor.
* Fixed an oversight in the [`Gate`](/api/qiskit/qiskit.circuit.Gate "qiskit.circuit.Gate") (and standard-library subclasses) constructor where the [`duration`](/api/qiskit/qiskit.circuit.Gate#duration "qiskit.circuit.Gate.duration") and [`unit`](/api/qiskit/qiskit.circuit.Gate#unit "qiskit.circuit.Gate.unit") attributes could not be set as keyword arguments during construction. The parent class [`Instruction`](/api/qiskit/qiskit.circuit.Instruction "qiskit.circuit.Instruction") supported setting this but [`Gate`](/api/qiskit/qiskit.circuit.Gate "qiskit.circuit.Gate") was previously not exposing this interface correctly.
* Fixed an oversight in the [`Gate`](/api/qiskit/0.45/qiskit.circuit.Gate "qiskit.circuit.Gate") (and standard-library subclasses) constructor where the [`duration`](/api/qiskit/0.45/qiskit.circuit.Gate#duration "qiskit.circuit.Gate.duration") and [`unit`](/api/qiskit/0.45/qiskit.circuit.Gate#unit "qiskit.circuit.Gate.unit") attributes could not be set as keyword arguments during construction. The parent class [`Instruction`](/api/qiskit/0.45/qiskit.circuit.Instruction "qiskit.circuit.Instruction") supported setting this but [`Gate`](/api/qiskit/0.45/qiskit.circuit.Gate "qiskit.circuit.Gate") was previously not exposing this interface correctly.
* Added support to allow `SparsePauliOp` default initialization passing an empty iterable to the static methods [`from_list()`](/api/qiskit/qiskit.quantum_info.SparsePauliOp#from_list "qiskit.quantum_info.SparsePauliOp.from_list") and [`from_sparse_list()`](/api/qiskit/qiskit.quantum_info.SparsePauliOp#from_sparse_list "qiskit.quantum_info.SparsePauliOp.from_sparse_list"). Fixed [#10159](https://github.com/Qiskit/qiskit-terra/issues/10159).
* Added support to allow `SparsePauliOp` default initialization passing an empty iterable to the static methods [`from_list()`](/api/qiskit/0.45/qiskit.quantum_info.SparsePauliOp#from_list "qiskit.quantum_info.SparsePauliOp.from_list") and [`from_sparse_list()`](/api/qiskit/0.45/qiskit.quantum_info.SparsePauliOp#from_sparse_list "qiskit.quantum_info.SparsePauliOp.from_sparse_list"). Fixed [#10159](https://github.com/Qiskit/qiskit-terra/issues/10159).
* The use of the (deprecated) `Optimizer` class on [`AQC`](/api/qiskit/qiskit.synthesis.unitary.aqc.AQC "qiskit.synthesis.unitary.aqc.AQC") did not have a non-deprecated alternative path, which should have been introduced in Qiskit 0.44. It now accepts a callable that implements the `Minimizer` protocol, as explicitly stated in the deprecation warning. The callable can look like the following example:
* The use of the (deprecated) `Optimizer` class on [`AQC`](/api/qiskit/0.45/qiskit.transpiler.synthesis.aqc.AQC "qiskit.transpiler.synthesis.aqc.AQC") did not have a non-deprecated alternative path, which should have been introduced in Qiskit 0.44. It now accepts a callable that implements the [`Minimizer`](/api/qiskit/0.45/qiskit.algorithms.optimizers.Minimizer "qiskit.algorithms.optimizers.Minimizer") protocol, as explicitly stated in the deprecation warning. The callable can look like the following example:
> ```python
> from scipy.optimize import minimize
@ -993,13 +955,13 @@ Some feature highlights of Qiskit 0.45.0 are:
> aqc = AQC(optimizer=optimizer)
> ```
* Fixed an issue with the [`Barrier`](/api/qiskit/qiskit.circuit.library.Barrier "qiskit.circuit.library.Barrier") class. When adding a [`Barrier`](/api/qiskit/qiskit.circuit.library.Barrier "qiskit.circuit.library.Barrier") instance to a [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") with the [`QuantumCircuit.append()`](/api/qiskit/qiskit.circuit.QuantumCircuit#append "qiskit.circuit.QuantumCircuit.append") method previously there was no validation that the size of the barrier matched the qargs specified.
* Fixed an issue with the [`Barrier`](/api/qiskit/0.45/qiskit.circuit.library.Barrier "qiskit.circuit.library.Barrier") class. When adding a [`Barrier`](/api/qiskit/0.45/qiskit.circuit.library.Barrier "qiskit.circuit.library.Barrier") instance to a [`QuantumCircuit`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") with the [`QuantumCircuit.append()`](/api/qiskit/0.45/qiskit.circuit.QuantumCircuit#append "qiskit.circuit.QuantumCircuit.append") method previously there was no validation that the size of the barrier matched the qargs specified.
* The `BlockCollapser` transpiler pass will now correctly handle circuits that contain more than one condition on the same classical register.
* `BlueprintCircuit` subclasses will now behave correctly when the semi-public method `QuantumCircuit._append()` is used with the blueprint in an unbuilt state, *i.e.* the circuit will be built before attempting the append.
* Adjusted zoom, fontsize, and margins in [`plot_state_city()`](/api/qiskit/qiskit.visualization.plot_state_city "qiskit.visualization.plot_state_city") to fit the plot better for more figure sizes. Corrected the Z-ordering behavior of bars and the zero-amplitude plane, and corrected display of negative real value bars.
* Adjusted zoom, fontsize, and margins in [`plot_state_city()`](/api/qiskit/0.45/qiskit.visualization.plot_state_city "qiskit.visualization.plot_state_city") to fit the plot better for more figure sizes. Corrected the Z-ordering behavior of bars and the zero-amplitude plane, and corrected display of negative real value bars.
<span id="relnotes-0-45-0-stable-0-45-other-notes" />
@ -1009,5 +971,5 @@ Some feature highlights of Qiskit 0.45.0 are:
We cannot prevent your package manager from resolving to older versions of Qiskit (which do not have the same pin but are still likely to be incompatible) if you forcibly try to install Qiskit alongside Numpy 2, before we have released a compatible version.
* Modified the behavior of the [`VF2Layout`](/api/qiskit/qiskit.transpiler.passes.VF2Layout "qiskit.transpiler.passes.VF2Layout") and [`VF2PostLayout`](/api/qiskit/qiskit.transpiler.passes.VF2PostLayout "qiskit.transpiler.passes.VF2PostLayout") transpiler passes, which would previously run their internal scoring using multithreading if the input circuits were sufficiently large. The multithreading usage has now been removed from the passes, as it was shown to cause a performance regression instead of an improvement like originally intended.
* Modified the behavior of the [`VF2Layout`](/api/qiskit/0.45/qiskit.transpiler.passes.VF2Layout "qiskit.transpiler.passes.VF2Layout") and [`VF2PostLayout`](/api/qiskit/0.45/qiskit.transpiler.passes.VF2PostLayout "qiskit.transpiler.passes.VF2PostLayout") transpiler passes, which would previously run their internal scoring using multithreading if the input circuits were sufficiently large. The multithreading usage has now been removed from the passes, as it was shown to cause a performance regression instead of an improvement like originally intended.

View File

@ -6,9 +6,7 @@ description: New features and bug fixes
## 0.46.0
<span id="relnotes-0-46-0-stable-0-46-prelude" />
<span id="id5" />
<span id="relnotes-0-46-0-prelude" />
### Prelude
@ -26,17 +24,17 @@ If `import qiskit` raises an [`ImportError`](https://docs.python.org/3/library/e
If you develop a library based on Qiskit and you still have a dependency on `qiskit-terra`, you should urgently release a new package that depends only on `qiskit`. Since version 0.44, the `qiskit` package contained only the `qiskit-terra` compiler core (the component that is now simply called “Qiskit”), so if your minimum version is `0.44`, you can safely switch a `qiskit-terra>=0.44` dependency to `qiskit>=0.44` with no change in what will be installed. For more detail and recommendations for testing and preparation, see the [section for developers of the migration guide](https://qisk.it/1-0-packaging-migration#for-developers).
<span id="relnotes-0-46-0-stable-0-46-new-features" />
<span id="relnotes-0-46-0-new-features" />
### New Features
* A new function, [`qs_decomposition()`](/api/qiskit/synthesis#qiskit.synthesis.qs_decomposition "qiskit.synthesis.qs_decomposition"), has been added to [`qiskit.synthesis`](/api/qiskit/synthesis#module-qiskit.synthesis "qiskit.synthesis"). This function allows to apply the Quantum Shannon Decomposition of arbitrary unitaries.
* A new function, [`qs_decomposition()`](/api/qiskit/0.46/synthesis#qiskit.synthesis.qs_decomposition "qiskit.synthesis.qs_decomposition"), has been added to [`qiskit.synthesis`](/api/qiskit/0.46/synthesis#module-qiskit.synthesis "qiskit.synthesis"). This function allows to apply the Quantum Shannon Decomposition of arbitrary unitaries.
* A new [`qiskit.providers.basic_provider`](/api/qiskit/providers_basic_provider#module-qiskit.providers.basic_provider "qiskit.providers.basic_provider") module has been introduced to replace `qiskit.providers.basicaer`. This module contains provider tools that mirror those of the `BasicAer` provider and offers a single, non-efficient, statevector-based simulator: [`BasicSimulator`](/api/qiskit/qiskit.providers.basic_provider.BasicSimulator "qiskit.providers.basic_provider.BasicSimulator"). This simulator is based on the [`BackendV2`](/api/qiskit/qiskit.providers.BackendV2 "qiskit.providers.BackendV2") interface and is exclusively intended for testing and simple prototyping, for more advanced simulation capabilities, please refer to the `qiskit-aer` package. See the `BasicAer` deprecation note for migration guidelines.
* A new [`qiskit.providers.basic_provider`](/api/qiskit/0.46/providers_basic_provider#module-qiskit.providers.basic_provider "qiskit.providers.basic_provider") module has been introduced to replace [`qiskit.providers.basicaer`](/api/qiskit/0.46/providers_basicaer#module-qiskit.providers.basicaer "qiskit.providers.basicaer"). This module contains provider tools that mirror those of the `BasicAer` provider and offers a single, non-efficient, statevector-based simulator: [`BasicSimulator`](/api/qiskit/0.46/qiskit.providers.basic_provider.BasicSimulator "qiskit.providers.basic_provider.BasicSimulator"). This simulator is based on the [`BackendV2`](/api/qiskit/0.46/qiskit.providers.BackendV2 "qiskit.providers.BackendV2") interface and is exclusively intended for testing and simple prototyping, for more advanced simulation capabilities, please refer to the `qiskit-aer` package. See the `BasicAer` deprecation note for migration guidelines.
* The [`Target`](/api/qiskit/qiskit.transpiler.Target "qiskit.transpiler.Target") interface and transpiler pipeline now support target definitions with `num_qubits=None`. This is to allow the creation of [`Target`](/api/qiskit/qiskit.transpiler.Target "qiskit.transpiler.Target")-based simulators with a flexible number of qubits. A target with `num_qubits=None` will exclusively contain global instructions (with `qargs=None`) and when given to the transpiler, it is expected that the transpiler will not resize the circuit. This change in the [`Target`](/api/qiskit/qiskit.transpiler.Target "qiskit.transpiler.Target") requires future transpiler passes to account for the case where `target.num_qubits is None`.
* The [`Target`](/api/qiskit/0.46/qiskit.transpiler.Target "qiskit.transpiler.Target") interface and transpiler pipeline now support target definitions with `num_qubits=None`. This is to allow the creation of [`Target`](/api/qiskit/0.46/qiskit.transpiler.Target "qiskit.transpiler.Target")-based simulators with a flexible number of qubits. A target with `num_qubits=None` will exclusively contain global instructions (with `qargs=None`) and when given to the transpiler, it is expected that the transpiler will not resize the circuit. This change in the [`Target`](/api/qiskit/0.46/qiskit.transpiler.Target "qiskit.transpiler.Target") requires future transpiler passes to account for the case where `target.num_qubits is None`.
* A new class, [`GenericBackendV2`](/api/qiskit/qiskit.providers.fake_provider.GenericBackendV2 "qiskit.providers.fake_provider.GenericBackendV2") has been added to the [`qiskit.providers.fake_provider`](/api/qiskit/providers_fake_provider#module-qiskit.providers.fake_provider "qiskit.providers.fake_provider") module. This class is configurable, and builds a [`BackendV2`](/api/qiskit/qiskit.providers.BackendV2 "qiskit.providers.BackendV2") instance that can run locally (in the spirit of fake backends). Users can configure the number of qubits, basis gates, coupling map, ability to run dynamic circuits (control flow instructions), instruction calibrations and dtm of the backend without having to deal with manual target construction. Qubit and gate properties are generated by randomly sampling from default ranges. The seed for this random generation can be fixed to ensure the reproducibility of the backend output. Its important to note that this backend only supports gates in the standard library. If you need a more flexible backend, there is always the option to directly instantiate a [`Target`](/api/qiskit/qiskit.transpiler.Target "qiskit.transpiler.Target") object to use for transpilation.
* A new class, [`GenericBackendV2`](/api/qiskit/0.46/qiskit.providers.fake_provider.GenericBackendV2 "qiskit.providers.fake_provider.GenericBackendV2") has been added to the [`qiskit.providers.fake_provider`](/api/qiskit/0.46/providers_fake_provider#module-qiskit.providers.fake_provider "qiskit.providers.fake_provider") module. This class is configurable, and builds a [`BackendV2`](/api/qiskit/0.46/qiskit.providers.BackendV2 "qiskit.providers.BackendV2") instance that can run locally (in the spirit of fake backends). Users can configure the number of qubits, basis gates, coupling map, ability to run dynamic circuits (control flow instructions), instruction calibrations and dtm of the backend without having to deal with manual target construction. Qubit and gate properties are generated by randomly sampling from default ranges. The seed for this random generation can be fixed to ensure the reproducibility of the backend output. Its important to note that this backend only supports gates in the standard library. If you need a more flexible backend, there is always the option to directly instantiate a [`Target`](/api/qiskit/0.46/qiskit.transpiler.Target "qiskit.transpiler.Target") object to use for transpilation.
Example usage 1:
@ -92,73 +90,71 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
The noise properties generated by these class do not mimic any concrete quantum device, and should not be used to measure concrete backend behaviors. They are “reasonable defaults” that can be used to test general backend-interfacing functionality. For a more accurate simulation of existing devices, you can manually build a noise model from the real backend using the functionality offered in `qiskit-aer`.
</Admonition>
<span id="relnotes-0-46-0-stable-0-46-upgrade-notes" />
<span id="id6" />
<span id="relnotes-0-46-0-upgrade-notes" />
### Upgrade Notes
* The minimum version required for `symengine` was bumped to >=0.11. This enabled removing workarounds from [`ParameterExpression.is_real()`](/api/qiskit/qiskit.circuit.ParameterExpression#is_real "qiskit.circuit.ParameterExpression.is_real") to handle a bug in earlier releases of `symengine`.
* The minimum version required for `symengine` was bumped to >=0.11. This enabled removing workarounds from [`ParameterExpression.is_real()`](/api/qiskit/0.46/qiskit.circuit.ParameterExpression#is_real "qiskit.circuit.ParameterExpression.is_real") to handle a bug in earlier releases of `symengine`.
<span id="relnotes-0-46-0-stable-0-46-deprecation-notes" />
<span id="relnotes-0-46-0-deprecation-notes" />
### Deprecation Notes
* The `ScheduleBlock.scoped_parameters()` and `ScheduleBlock.search_parameters()` methods have been deprecated. These methods produce [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects with names modified to indicate pulse scoping. The original intention of the methods was that these objects would still link to the original unscoped [`Parameter`](/api/qiskit/qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects. However, the modification of the name breaks the link so that assigning using the scoped version does not work. See [#11654](https://github.com/Qiskit/qiskit/issues/11654) for more context.
* The [`ScheduleBlock.scoped_parameters()`](/api/qiskit/0.46/qiskit.pulse.ScheduleBlock#scoped_parameters "qiskit.pulse.ScheduleBlock.scoped_parameters") and [`ScheduleBlock.search_parameters()`](/api/qiskit/0.46/qiskit.pulse.ScheduleBlock#search_parameters "qiskit.pulse.ScheduleBlock.search_parameters") methods have been deprecated. These methods produce [`Parameter`](/api/qiskit/0.46/qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects with names modified to indicate pulse scoping. The original intention of the methods was that these objects would still link to the original unscoped [`Parameter`](/api/qiskit/0.46/qiskit.circuit.Parameter "qiskit.circuit.Parameter") objects. However, the modification of the name breaks the link so that assigning using the scoped version does not work. See [#11654](https://github.com/Qiskit/qiskit/issues/11654) for more context.
* Passing a [`QuasiDistribution`](/api/qiskit/qiskit.result.QuasiDistribution "qiskit.result.QuasiDistribution"), [`ProbDistribution`](/api/qiskit/qiskit.result.ProbDistribution "qiskit.result.ProbDistribution"), or a distribution dictionary in for the `data` argument of the [`plot_histogram()`](/api/qiskit/qiskit.visualization.plot_histogram "qiskit.visualization.plot_histogram") visualization function is now deprecated. Support for doing this will be removed in the Qiskit 1.0 release. If you would like to plot a histogram from a [`QuasiDistribution`](/api/qiskit/qiskit.result.QuasiDistribution "qiskit.result.QuasiDistribution"), [`ProbDistribution`](/api/qiskit/qiskit.result.ProbDistribution "qiskit.result.ProbDistribution"), or a distribution dictionary you should use the [`plot_distribution()`](/api/qiskit/qiskit.visualization.plot_distribution "qiskit.visualization.plot_distribution") function instead.
* Passing a [`QuasiDistribution`](/api/qiskit/0.46/qiskit.result.QuasiDistribution "qiskit.result.QuasiDistribution"), [`ProbDistribution`](/api/qiskit/0.46/qiskit.result.ProbDistribution "qiskit.result.ProbDistribution"), or a distribution dictionary in for the `data` argument of the [`plot_histogram()`](/api/qiskit/0.46/qiskit.visualization.plot_histogram "qiskit.visualization.plot_histogram") visualization function is now deprecated. Support for doing this will be removed in the Qiskit 1.0 release. If you would like to plot a histogram from a [`QuasiDistribution`](/api/qiskit/0.46/qiskit.result.QuasiDistribution "qiskit.result.QuasiDistribution"), [`ProbDistribution`](/api/qiskit/0.46/qiskit.result.ProbDistribution "qiskit.result.ProbDistribution"), or a distribution dictionary you should use the [`plot_distribution()`](/api/qiskit/0.46/qiskit.visualization.plot_distribution "qiskit.visualization.plot_distribution") function instead.
* The `qiskit-terra` Python package is deprecated and will no longer receive updates starting in Qiskit 1.0.0. If youre installing `qiskit-terra` by itself this will no longer be updated for Qiskit>=1.0.0. If youre running qiskit without the `qiskit` package a `FutureWarning` will be emitted on import of [`qiskit`](/api/qiskit/index#module-qiskit "qiskit") to indicate youre not using the `qiskit` package.
* The `qiskit-terra` Python package is deprecated and will no longer receive updates starting in Qiskit 1.0.0. If youre installing `qiskit-terra` by itself this will no longer be updated for Qiskit>=1.0.0. If youre running qiskit without the `qiskit` package a `FutureWarning` will be emitted on import of [`qiskit`](/api/qiskit/0.46/index#module-qiskit "qiskit") to indicate youre not using the `qiskit` package.
* Use of the `qiskit.Aer` object is deprecated and will be removed in Qiskit 1.0. You should instead use the same object from the `qiskit_aer` namespace, which is a drop-in replacement.
* Importing from `qiskit.providers.aer` is deprecated and will stop working in Qiskit 1.0. You should instead import from `qiskit_aer`, which is a drop-in replacement.
* Running pulse jobs on backends from [`qiskit.providers.fake_provider`](/api/qiskit/providers_fake_provider#module-qiskit.providers.fake_provider "qiskit.providers.fake_provider") is deprecated, and all support will be removed in Qiskit 1.0. This is due to Qiskit Aer removing its simulation functionality for such jobs. For low-level Hamiltonian-simulation workloads, consider using a specialised library such as [Qiskit Dynamics](https://qiskit.org/ecosystem/dynamics).
* Running pulse jobs on backends from [`qiskit.providers.fake_provider`](/api/qiskit/0.46/providers_fake_provider#module-qiskit.providers.fake_provider "qiskit.providers.fake_provider") is deprecated, and all support will be removed in Qiskit 1.0. This is due to Qiskit Aer removing its simulation functionality for such jobs. For low-level Hamiltonian-simulation workloads, consider using a specialised library such as [Qiskit Dynamics](https://qiskit.org/ecosystem/dynamics).
* The `qiskit.transpiler.synthesis` module is deprecated and will be removed in Qiskit 1.0. The following objects have been moved:
* `qiskit.transpiler.synthesis.aqc` has been moved to [`qiskit.synthesis.unitary.aqc`](/api/qiskit/qiskit.synthesis.unitary.aqc#module-qiskit.synthesis.unitary.aqc "qiskit.synthesis.unitary.aqc") (except of `qiskit.synthesis.unitary.aqc.AQCSynthesisPlugin`).
* `qiskit.transpiler.synthesis.aqc` has been moved to [`qiskit.synthesis.unitary.aqc`](/api/qiskit/0.46/synthesis_aqc#module-qiskit.synthesis.unitary.aqc "qiskit.synthesis.unitary.aqc") (except of `qiskit.synthesis.unitary.aqc.AQCSynthesisPlugin`).
* `qiskit.synthesis.unitary.aqc.AQCSynthesisPlugin` has been moved to `qiskit.transpiler.passes.synthesis.AQCSynthesisPlugin`.
* `qiskit.transpiler.synthesis.graysynth()` has been moved to [`qiskit.synthesis.synth_cnot_phase_aam()`](/api/qiskit/synthesis#qiskit.synthesis.synth_cnot_phase_aam "qiskit.synthesis.synth_cnot_phase_aam").
* `qiskit.transpiler.synthesis.cnot_synth()` has been moved to [`qiskit.synthesis.synth_cnot_count_full_pmh()`](/api/qiskit/synthesis#qiskit.synthesis.synth_cnot_count_full_pmh "qiskit.synthesis.synth_cnot_count_full_pmh").
* `qiskit.transpiler.synthesis.graysynth()` has been moved to [`qiskit.synthesis.synth_cnot_phase_aam()`](/api/qiskit/0.46/synthesis#qiskit.synthesis.synth_cnot_phase_aam "qiskit.synthesis.synth_cnot_phase_aam").
* `qiskit.transpiler.synthesis.cnot_synth()` has been moved to [`qiskit.synthesis.synth_cnot_count_full_pmh()`](/api/qiskit/0.46/synthesis#qiskit.synthesis.synth_cnot_count_full_pmh "qiskit.synthesis.synth_cnot_count_full_pmh").
* The `qiskit.tools.jupyter` module has been deprecated and will be removed in Qiskit 1.0.0. This module is deprecated because the functionality in this module is tied to the legacy `qiskit-ibmq-provider` package which is no longer supported and also only supported [`BackendV1`](/api/qiskit/qiskit.providers.BackendV1 "qiskit.providers.BackendV1"). If youre using this functionality currently, similar jupyter tools exist in the [qiskit-ibm-provider](https://github.com/Qiskit/qiskit-ibm-provider) package which can be used instead. The documentation for this module can be found here:
* The `qiskit.tools.jupyter` module has been deprecated and will be removed in Qiskit 1.0.0. This module is deprecated because the functionality in this module is tied to the legacy `qiskit-ibmq-provider` package which is no longer supported and also only supported [`BackendV1`](/api/qiskit/0.46/qiskit.providers.BackendV1 "qiskit.providers.BackendV1"). If youre using this functionality currently, similar jupyter tools exist in the [qiskit-ibm-provider](https://github.com/Qiskit/qiskit-ibm-provider) package which can be used instead. The documentation for this module can be found here:
[https://docs.quantum.ibm.com/api/qiskit-ibm-provider/ibm\_jupyter](https://docs.quantum.ibm.com/api/qiskit-ibm-provider/ibm_jupyter)
* The `qiskit.tools.monitor` module has been deprecated and will be removed in Qiskit 1.0.0. This module is deprecated because the functionality in this module is tied to the legacy `qiskit-ibmq-provider` package which is no longer supported and also only supported [`BackendV1`](/api/qiskit/qiskit.providers.BackendV1 "qiskit.providers.BackendV1").
* The `qiskit.tools.monitor` module has been deprecated and will be removed in Qiskit 1.0.0. This module is deprecated because the functionality in this module is tied to the legacy `qiskit-ibmq-provider` package which is no longer supported and also only supported [`BackendV1`](/api/qiskit/0.46/qiskit.providers.BackendV1 "qiskit.providers.BackendV1").
* The `qiskit.tools.visualization` module has been deprecated and will be removed in Qiskit 1.0.0. This module was a legacy redirect from the original location of Qiskits visualization module and was moved to [`qiskit.visualization`](/api/qiskit/visualization#module-qiskit.visualization "qiskit.visualization") in Qiskit 0.8.0. If youre still using this path you can just update your imports from `qiskit.tools.visualization` to [`qiskit.visualization`](/api/qiskit/visualization#module-qiskit.visualization "qiskit.visualization").
* The `qiskit.tools.visualization` module has been deprecated and will be removed in Qiskit 1.0.0. This module was a legacy redirect from the original location of Qiskits visualization module and was moved to [`qiskit.visualization`](/api/qiskit/0.46/visualization#module-qiskit.visualization "qiskit.visualization") in Qiskit 0.8.0. If youre still using this path you can just update your imports from `qiskit.tools.visualization` to [`qiskit.visualization`](/api/qiskit/0.46/visualization#module-qiskit.visualization "qiskit.visualization").
* The `qiskit.tools.events` module and the `progressbar()` utility it exposed has been deprecated and will be removed in the Qiskit 1.0.0 release. This modules functionality was not widely used and better covered by dedicated packages such as [tqdm](https://github.com/tqdm/tqdm).
* The `qiskit.tools` module has been deprecated and will be removed in Qiskit 1.0.0. Except as noted in the release notes above for specific submodules (`qiskit.tools.jupyter`, `qiskit.tools.monitor`, `qiskit.tools.events` and `qiskit.tools.visualization`) the functionality in this module have been migrated to [`qiskit.utils`](/api/qiskit/utils#module-qiskit.utils "qiskit.utils"). If youre using any functionality in this module you can update your imports from `qiskit.tools` to [`qiskit.utils`](/api/qiskit/utils#module-qiskit.utils "qiskit.utils").
* The `qiskit.tools` module has been deprecated and will be removed in Qiskit 1.0.0. Except as noted in the release notes above for specific submodules (`qiskit.tools.jupyter`, `qiskit.tools.monitor`, `qiskit.tools.events` and `qiskit.tools.visualization`) the functionality in this module have been migrated to [`qiskit.utils`](/api/qiskit/0.46/utils#module-qiskit.utils "qiskit.utils"). If youre using any functionality in this module you can update your imports from `qiskit.tools` to [`qiskit.utils`](/api/qiskit/0.46/utils#module-qiskit.utils "qiskit.utils").
* The module `qiskit.test` is deprecated. This module contains tooling and helpers for internal Qiskit testing, and most of its functionality had been moved or is not used in Qiskit anymore. In practice, the module was never meant to be used externally. If any of the code in the module is absolutely necessary beyond Qiskit, consider copying that code out into your own test infrastructure.
* The `qiskit.quantum_info.synthesis` module is deprecated and will be removed in Qiskit 1.0.0. The following objects have been moved to [`qiskit.synthesis`](/api/qiskit/synthesis#module-qiskit.synthesis "qiskit.synthesis"):
* The `qiskit.quantum_info.synthesis` module is deprecated and will be removed in Qiskit 1.0.0. The following objects have been moved to [`qiskit.synthesis`](/api/qiskit/0.46/synthesis#module-qiskit.synthesis "qiskit.synthesis"):
* [`OneQubitEulerDecomposer`](/api/qiskit/qiskit.synthesis.OneQubitEulerDecomposer "qiskit.synthesis.OneQubitEulerDecomposer") has been moved to `qiskit.synthesis.one_qubit`
* [`TwoQubitBasisDecomposer`](/api/qiskit/qiskit.synthesis.TwoQubitBasisDecomposer "qiskit.synthesis.TwoQubitBasisDecomposer") has been moved to `qiskit.synthesis.two_qubits`
* [`XXDecomposer`](/api/qiskit/qiskit.synthesis.XXDecomposer "qiskit.synthesis.XXDecomposer") has been moved to `qiskit.synthesis.two_qubits`
* [`two_qubit_cnot_decompose()`](/api/qiskit/synthesis#qiskit.synthesis.two_qubit_cnot_decompose "qiskit.synthesis.two_qubit_cnot_decompose") has been moved to `qiskit.synthesis.two_qubits`
* [`OneQubitEulerDecomposer`](/api/qiskit/0.46/qiskit.synthesis.OneQubitEulerDecomposer "qiskit.synthesis.OneQubitEulerDecomposer") has been moved to `qiskit.synthesis.one_qubit`
* [`TwoQubitBasisDecomposer`](/api/qiskit/0.46/qiskit.synthesis.TwoQubitBasisDecomposer "qiskit.synthesis.TwoQubitBasisDecomposer") has been moved to `qiskit.synthesis.two_qubits`
* [`XXDecomposer`](/api/qiskit/0.46/qiskit.synthesis.XXDecomposer "qiskit.synthesis.XXDecomposer") has been moved to `qiskit.synthesis.two_qubits`
* `two_qubit_cnot_decompose()` has been moved to `qiskit.synthesis.two_qubits`
The class [`Quaternion`](/api/qiskit/qiskit.quantum_info.Quaternion "qiskit.quantum_info.Quaternion") has been migrated from `qiskit.quantum_info.synthesis` to [`qiskit.quantum_info`](/api/qiskit/quantum_info#module-qiskit.quantum_info "qiskit.quantum_info"). This move has not affected the usual import path of the class, but accessing it via the `qiskit.quantum_info.synthesis` is now deprecated.
The class [`Quaternion`](/api/qiskit/0.46/qiskit.quantum_info.Quaternion "qiskit.quantum_info.Quaternion") has been migrated from `qiskit.quantum_info.synthesis` to [`qiskit.quantum_info`](/api/qiskit/0.46/quantum_info#module-qiskit.quantum_info "qiskit.quantum_info"). This move has not affected the usual import path of the class, but accessing it via the `qiskit.quantum_info.synthesis` is now deprecated.
This function is deprecated and will be removed in Qiskit 1.0.0:
* `cnot_rxx_decompose()`
* The legacy OpenQASM 2 parser module previously present in `qiskit.qasm` has been deprecated. It will be removed in the Qiskit 1.0.0 release. The legacy OpenQASM 2 parser has been superseded by the [`qiskit.qasm2`](/api/qiskit/qasm2#module-qiskit.qasm2 "qiskit.qasm2") module which provides a faster more correct parser for OpenQASM 2.
* The legacy OpenQASM 2 parser module previously present in [`qiskit.qasm`](/api/qiskit/0.46/qasm#module-qiskit.qasm "qiskit.qasm") has been deprecated. It will be removed in the Qiskit 1.0.0 release. The legacy OpenQASM 2 parser has been superseded by the [`qiskit.qasm2`](/api/qiskit/0.46/qasm2#module-qiskit.qasm2 "qiskit.qasm2") module which provides a faster more correct parser for OpenQASM 2.
* The `qiskit.converters.ast_to_dag` function has been deprecated and will be removed in the Qiskit 1.0.0 release. It previously was used to convert the abstract syntax tree generated by the legacy OpenQASM 2 parser (in the `qiskit.qasm` module which has been deprecated) and convert that directly to a [`DAGCircuit`](/api/qiskit/qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit"). As the legacy OpenQASM 2 parser has been deprecated this function will no longer serves a purpose after the legacy parser is removed. If you were previously using this, you can instead parse your OpenQASM 2 files into a [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") using the [`QuantumCircuit.from_qasm_file()`](/api/qiskit/qiskit.circuit.QuantumCircuit#from_qasm_file "qiskit.circuit.QuantumCircuit.from_qasm_file") or [`QuantumCircuit.from_qasm_str()`](/api/qiskit/qiskit.circuit.QuantumCircuit#from_qasm_str "qiskit.circuit.QuantumCircuit.from_qasm_str") constructor methods and then converting that [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") into a [`DAGCircuit`](/api/qiskit/qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") with [`circuit_to_dag()`](/api/qiskit/converters#qiskit.converters.circuit_to_dag "qiskit.converters.circuit_to_dag").
* The `qiskit.converters.ast_to_dag` function has been deprecated and will be removed in the Qiskit 1.0.0 release. It previously was used to convert the abstract syntax tree generated by the legacy OpenQASM 2 parser (in the [`qiskit.qasm`](/api/qiskit/0.46/qasm#module-qiskit.qasm "qiskit.qasm") module which has been deprecated) and convert that directly to a [`DAGCircuit`](/api/qiskit/0.46/qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit"). As the legacy OpenQASM 2 parser has been deprecated this function will no longer serves a purpose after the legacy parser is removed. If you were previously using this, you can instead parse your OpenQASM 2 files into a [`QuantumCircuit`](/api/qiskit/0.46/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") using the [`QuantumCircuit.from_qasm_file()`](/api/qiskit/0.46/qiskit.circuit.QuantumCircuit#from_qasm_file "qiskit.circuit.QuantumCircuit.from_qasm_file") or [`QuantumCircuit.from_qasm_str()`](/api/qiskit/0.46/qiskit.circuit.QuantumCircuit#from_qasm_str "qiskit.circuit.QuantumCircuit.from_qasm_str") constructor methods and then converting that [`QuantumCircuit`](/api/qiskit/0.46/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") into a [`DAGCircuit`](/api/qiskit/0.46/qiskit.dagcircuit.DAGCircuit "qiskit.dagcircuit.DAGCircuit") with [`circuit_to_dag()`](/api/qiskit/0.46/converters#qiskit.converters.circuit_to_dag "qiskit.converters.circuit_to_dag").
* The `QuantumCircuit.qasm()` method used to generate a OpenQASM 2 representation of the [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") object has been deprecated and will be removed in the Qiskit 1.0.0 release. The [`qasm2.dump()`](/api/qiskit/qasm2#qiskit.qasm2.dump "qiskit.qasm2.dump") or [`qasm2.dumps()`](/api/qiskit/qasm2#qiskit.qasm2.dumps "qiskit.qasm2.dumps") functions which provide similar functionality should be used instead. If you were using the `QuantumCircuit.qasm()` method to generate pygments formatted output you should instead look at the standalone `openqasm-pygments` package to provide this functionality (as [`qasm2.dump()`](/api/qiskit/qasm2#qiskit.qasm2.dump "qiskit.qasm2.dump") and [`qasm2.dumps()`](/api/qiskit/qasm2#qiskit.qasm2.dumps "qiskit.qasm2.dumps") do not provide pygments colored output).
* The [`QuantumCircuit.qasm()`](/api/qiskit/0.46/qiskit.circuit.QuantumCircuit#qasm "qiskit.circuit.QuantumCircuit.qasm") method used to generate a OpenQASM 2 representation of the [`QuantumCircuit`](/api/qiskit/0.46/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") object has been deprecated and will be removed in the Qiskit 1.0.0 release. The [`qasm2.dump()`](/api/qiskit/0.46/qasm2#qiskit.qasm2.dump "qiskit.qasm2.dump") or [`qasm2.dumps()`](/api/qiskit/0.46/qasm2#qiskit.qasm2.dumps "qiskit.qasm2.dumps") functions which provide similar functionality should be used instead. If you were using the [`QuantumCircuit.qasm()`](/api/qiskit/0.46/qiskit.circuit.QuantumCircuit#qasm "qiskit.circuit.QuantumCircuit.qasm") method to generate pygments formatted output you should instead look at the standalone `openqasm-pygments` package to provide this functionality (as [`qasm2.dump()`](/api/qiskit/0.46/qasm2#qiskit.qasm2.dump "qiskit.qasm2.dump") and [`qasm2.dumps()`](/api/qiskit/0.46/qasm2#qiskit.qasm2.dumps "qiskit.qasm2.dumps") do not provide pygments colored output).
* The `ParametricPulse` base class and pulses are now deprecated, and will be removed in Qiskit 1.0. This includes:
* The [`ParametricPulse`](/api/qiskit/0.46/qiskit.pulse.library.ParametricPulse "qiskit.pulse.library.parametric_pulses.ParametricPulse") base class and pulses are now deprecated, and will be removed in Qiskit 1.0. This includes:
* `ParametricPulse`
* [`ParametricPulse`](/api/qiskit/0.46/qiskit.pulse.library.ParametricPulse "qiskit.pulse.library.parametric_pulses.ParametricPulse")
* `Constant`
* `Drag`
* `Gaussian`
@ -166,9 +162,9 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
The class has been superseded by `SymbolicPulse` and the corresponding pulse library. `SymbolicPulse` provides better performance, flexibility and QPY support.
* The `NoiseAdaptiveLayout` transpiler pass and the corresponding `"noise_adaptive"` layout stage plugin have been deprecated and will be removed in the 1.0.0 release. This pass has been largely superseded by [`VF2Layout`](/api/qiskit/qiskit.transpiler.passes.VF2Layout "qiskit.transpiler.passes.VF2Layout") and [`VF2PostLayout`](/api/qiskit/qiskit.transpiler.passes.VF2PostLayout "qiskit.transpiler.passes.VF2PostLayout") which will set a layout based on the reported noise characteristics of a backend.
* The [`NoiseAdaptiveLayout`](/api/qiskit/0.46/qiskit.transpiler.passes.NoiseAdaptiveLayout "qiskit.transpiler.passes.NoiseAdaptiveLayout") transpiler pass and the corresponding `"noise_adaptive"` layout stage plugin have been deprecated and will be removed in the 1.0.0 release. This pass has been largely superseded by [`VF2Layout`](/api/qiskit/0.46/qiskit.transpiler.passes.VF2Layout "qiskit.transpiler.passes.VF2Layout") and [`VF2PostLayout`](/api/qiskit/0.46/qiskit.transpiler.passes.VF2PostLayout "qiskit.transpiler.passes.VF2PostLayout") which will set a layout based on the reported noise characteristics of a backend.
* The `CrosstalkAdaptiveSchedule` transpiler pass has been deprecated and will be removed in the 1.0.0 release. This pass was not usable any longer because its internal operation was dependent on custom properties being set in the [`BackendProperties`](/api/qiskit/qiskit.providers.models.BackendProperties "qiskit.providers.models.BackendProperties") payload of a [`BackendV1`](/api/qiskit/qiskit.providers.BackendV1 "qiskit.providers.BackendV1") instance. As no backends are setting these fields the pass has been deprecated.
* The [`CrosstalkAdaptiveSchedule`](/api/qiskit/0.46/qiskit.transpiler.passes.CrosstalkAdaptiveSchedule "qiskit.transpiler.passes.CrosstalkAdaptiveSchedule") transpiler pass has been deprecated and will be removed in the 1.0.0 release. This pass was not usable any longer because its internal operation was dependent on custom properties being set in the [`BackendProperties`](/api/qiskit/0.46/qiskit.providers.models.BackendProperties "qiskit.providers.models.BackendProperties") payload of a [`BackendV1`](/api/qiskit/0.46/qiskit.providers.BackendV1 "qiskit.providers.BackendV1") instance. As no backends are setting these fields the pass has been deprecated.
* The `qiskit.visualization.qcstyle` module is now deprecated and will be removed in the Qiskit 1.0.0 release. Instead you should use `qiskit.visualization.circuit.qcstyle` as direct replacement.
@ -181,7 +177,7 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
* `u3()`,
* `x()`
As well as input arguments of type [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") type in [`call()`](/api/qiskit/pulse#qiskit.pulse.builder.call "qiskit.pulse.builder.call").
As well as input arguments of type [`QuantumCircuit`](/api/qiskit/0.46/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") type in [`call()`](/api/qiskit/0.46/pulse#qiskit.pulse.builder.call "qiskit.pulse.builder.call").
If you still wish to inject backend calibrated schedules, you can use following pattern instead of calling gate commands.
@ -196,7 +192,7 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
pulse.call(sched)
```
Similarly, [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") can be injected in the builder context by manually transpiling and scheduling the object.
Similarly, [`QuantumCircuit`](/api/qiskit/0.46/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") can be injected in the builder context by manually transpiling and scheduling the object.
```python
from math import pi
@ -213,21 +209,21 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
pulse.call(sched)
```
In any case we now recommend to write a minimum pulse program with the builder and attach it to [`QuantumCircuit`](/api/qiskit/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") via the [`QuantumCircuit.add_calibration()`](/api/qiskit/qiskit.circuit.QuantumCircuit#add_calibration "qiskit.circuit.QuantumCircuit.add_calibration") method as a microcode of a gate instruction, rather than writing the entire program with the pulse model.
In any case we now recommend to write a minimum pulse program with the builder and attach it to [`QuantumCircuit`](/api/qiskit/0.46/qiskit.circuit.QuantumCircuit "qiskit.circuit.QuantumCircuit") via the [`QuantumCircuit.add_calibration()`](/api/qiskit/0.46/qiskit.circuit.QuantumCircuit#add_calibration "qiskit.circuit.QuantumCircuit.add_calibration") method as a microcode of a gate instruction, rather than writing the entire program with the pulse model.
The following arguments in [`build()`](/api/qiskit/pulse#qiskit.pulse.builder.build "qiskit.pulse.builder.build") have also been deprecated:
The following arguments in [`build()`](/api/qiskit/0.46/pulse#qiskit.pulse.builder.build "qiskit.pulse.builder.build") have also been deprecated:
* `default_transpiler_settings`
* `default_circuit_scheduler_settings`
Together with the functions:
* `active_transpiler_settings()`
* `active_circuit_scheduler_settings()`
* `transpiler_settings()`
* `circuit_scheduler_settings()`
* [`active_transpiler_settings()`](/api/qiskit/0.46/pulse#qiskit.pulse.builder.active_transpiler_settings "qiskit.pulse.builder.active_transpiler_settings")
* [`active_circuit_scheduler_settings()`](/api/qiskit/0.46/pulse#qiskit.pulse.builder.active_circuit_scheduler_settings "qiskit.pulse.builder.active_circuit_scheduler_settings")
* [`transpiler_settings()`](/api/qiskit/0.46/pulse#qiskit.pulse.builder.transpiler_settings "qiskit.pulse.builder.transpiler_settings")
* [`circuit_scheduler_settings()`](/api/qiskit/0.46/pulse#qiskit.pulse.builder.circuit_scheduler_settings "qiskit.pulse.builder.circuit_scheduler_settings")
* The following tools in [`qiskit.utils`](/api/qiskit/utils#module-qiskit.utils "qiskit.utils") have been deprecated:
* The following tools in [`qiskit.utils`](/api/qiskit/0.46/utils#module-qiskit.utils "qiskit.utils") have been deprecated:
* Utils in `qiskit.utils.arithmetic`
* Utils in `qiskit.utils.circuit_utils`
@ -236,11 +232,11 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
These functions were used exclusively in the context of `qiskit.algorithms` and `qiskit.opflow`, and will be removed following the removals of `qiskit.algorithms` and `qiskit.opflow` in Qiskit 1.0.
* The [`qiskit.providers.fake_provider`](/api/qiskit/providers_fake_provider#module-qiskit.providers.fake_provider "qiskit.providers.fake_provider") module has been migrated to the `qiskit-ibm-runtime` Python package. For this reason, the following elements in the [`qiskit.providers.fake_provider`](/api/qiskit/providers_fake_provider#module-qiskit.providers.fake_provider "qiskit.providers.fake_provider") have been deprecated as of Qiskit 0.46 and will be removed in Qiskit 1.0:
* The [`qiskit.providers.fake_provider`](/api/qiskit/0.46/providers_fake_provider#module-qiskit.providers.fake_provider "qiskit.providers.fake_provider") module has been migrated to the `qiskit-ibm-runtime` Python package. For this reason, the following elements in the [`qiskit.providers.fake_provider`](/api/qiskit/0.46/providers_fake_provider#module-qiskit.providers.fake_provider "qiskit.providers.fake_provider") have been deprecated as of Qiskit 0.46 and will be removed in Qiskit 1.0:
* `qiskit.providers.fake_provider.FakeProvider`
* [`qiskit.providers.fake_provider.FakeProvider`](/api/qiskit/0.46/qiskit.providers.fake_provider.FakeProvider "qiskit.providers.fake_provider.FakeProvider")
* `qiskit.providers.fake_provider.FakeProviderForBackendV2`
* [`qiskit.providers.fake_provider.FakeProviderForBackendV2`](/api/qiskit/0.46/qiskit.providers.fake_provider.FakeProviderForBackendV2 "qiskit.providers.fake_provider.FakeProviderForBackendV2")
* `qiskit.providers.fake_provider.FakeProviderFactory`
@ -250,7 +246,7 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
(accessible through the provider)
* `qiskit.providers.fake_provider.FakeQasmSimulator`
* [`qiskit.providers.fake_provider.FakeQasmSimulator`](/api/qiskit/0.46/qiskit.providers.fake_provider.FakeQasmSimulator "qiskit.providers.fake_provider.FakeQasmSimulator")
* `qiskit.providers.fake_provider.FakeJob`
@ -271,14 +267,14 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
backend2 = FakeSherbrooke()
```
Additionally, the following fake backends designed for special testing purposes have been superseded by the new [`GenericBackendV2`](/api/qiskit/qiskit.providers.fake_provider.GenericBackendV2 "qiskit.providers.fake_provider.GenericBackendV2") class, and are also deprecated as of Qiskit 0.46:
Additionally, the following fake backends designed for special testing purposes have been superseded by the new [`GenericBackendV2`](/api/qiskit/0.46/qiskit.providers.fake_provider.GenericBackendV2 "qiskit.providers.fake_provider.GenericBackendV2") class, and are also deprecated as of Qiskit 0.46:
* `qiskit.providers.fake_provider.fake_backend_v2.FakeBackendV2`
* [`qiskit.providers.fake_provider.fake_backend_v2.FakeBackendV2`](/api/qiskit/0.46/qiskit.providers.fake_provider.FakeBackendV2 "qiskit.providers.fake_provider.fake_backend_v2.FakeBackendV2")
* `qiskit.providers.fake_provider.fake_backend_v2.FakeBackendV2LegacyQubitProps`
* `qiskit.providers.fake_provider.fake_backend_v2.FakeBackend5QV2`
* [`qiskit.providers.fake_provider.fake_backend_v2.FakeBackend5QV2`](/api/qiskit/0.46/qiskit.providers.fake_provider.FakeBackend5QV2 "qiskit.providers.fake_provider.fake_backend_v2.FakeBackend5QV2")
* `qiskit.providers.fake_provider.fake_backend_v2.FakeBackendSimple`
Migration example to the new [`GenericBackendV2`](/api/qiskit/qiskit.providers.fake_provider.GenericBackendV2 "qiskit.providers.fake_provider.GenericBackendV2") class:
Migration example to the new [`GenericBackendV2`](/api/qiskit/0.46/qiskit.providers.fake_provider.GenericBackendV2 "qiskit.providers.fake_provider.GenericBackendV2") class:
```python
# Legacy path
@ -293,19 +289,19 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
# but will generate different results
```
* The `qiskit.extensions` module is now deprecated. It had been pending deprecation since the Qiskit 0.45 release. Most objects have been moved to [`qiskit.circuit.library`](/api/qiskit/circuit_library#module-qiskit.circuit.library "qiskit.circuit.library"), including:
* The [`qiskit.extensions`](/api/qiskit/0.46/extensions#module-qiskit.extensions "qiskit.extensions") module is now deprecated. It had been pending deprecation since the Qiskit 0.45 release. Most objects have been moved to [`qiskit.circuit.library`](/api/qiskit/0.46/circuit_library#module-qiskit.circuit.library "qiskit.circuit.library"), including:
* [`DiagonalGate`](/api/qiskit/qiskit.circuit.library.DiagonalGate "qiskit.circuit.library.DiagonalGate"),
* [`DiagonalGate`](/api/qiskit/0.46/qiskit.circuit.library.DiagonalGate "qiskit.circuit.library.DiagonalGate"),
* `HamiltonianGateGate`,
* [`Initialize`](/api/qiskit/qiskit.circuit.library.Initialize "qiskit.circuit.library.Initialize"),
* [`Isometry`](/api/qiskit/qiskit.circuit.library.Isometry "qiskit.circuit.library.Isometry"),
* [`Initialize`](/api/qiskit/0.46/qiskit.circuit.library.Initialize "qiskit.circuit.library.Initialize"),
* [`Isometry`](/api/qiskit/0.46/qiskit.circuit.library.Isometry "qiskit.circuit.library.Isometry"),
* `MCGupDiag`,
* [`UCGate`](/api/qiskit/qiskit.circuit.library.UCGate "qiskit.circuit.library.UCGate"),
* [`UCPauliRotGate`](/api/qiskit/qiskit.circuit.library.UCPauliRotGate "qiskit.circuit.library.UCPauliRotGate"),
* [`UCRXGate`](/api/qiskit/qiskit.circuit.library.UCRXGate "qiskit.circuit.library.UCRXGate"),
* [`UCRYGate`](/api/qiskit/qiskit.circuit.library.UCRYGate "qiskit.circuit.library.UCRYGate"),
* [`UCRZGate`](/api/qiskit/qiskit.circuit.library.UCRZGate "qiskit.circuit.library.UCRZGate"),
* [`UnitaryGate`](/api/qiskit/qiskit.circuit.library.UnitaryGate "qiskit.circuit.library.UnitaryGate").
* [`UCGate`](/api/qiskit/0.46/qiskit.circuit.library.UCGate "qiskit.circuit.library.UCGate"),
* [`UCPauliRotGate`](/api/qiskit/0.46/qiskit.circuit.library.UCPauliRotGate "qiskit.circuit.library.UCPauliRotGate"),
* [`UCRXGate`](/api/qiskit/0.46/qiskit.circuit.library.UCRXGate "qiskit.circuit.library.UCRXGate"),
* [`UCRYGate`](/api/qiskit/0.46/qiskit.circuit.library.UCRYGate "qiskit.circuit.library.UCRYGate"),
* [`UCRZGate`](/api/qiskit/0.46/qiskit.circuit.library.UCRZGate "qiskit.circuit.library.UCRZGate"),
* [`UnitaryGate`](/api/qiskit/0.46/qiskit.circuit.library.UnitaryGate "qiskit.circuit.library.UnitaryGate").
With the deprecation of the objects, the following circuit methods have also been deprecated:
@ -317,7 +313,7 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
* `QuantumCircuit.ucry`,
* `QuantumCircuit.ucrz`.
* Qiskits `execute()` function is deprecated. This function served as a high-level wrapper around transpiling a circuit with some transpile options and running it on a backend with some run options. To do the same thing, you can explicitly use the [`transpile()`](/api/qiskit/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function (with appropriate transpile options) followed by `backend.run()` (with appropriate run options).
* Qiskits [`execute()`](/api/qiskit/0.46/execute#qiskit.execute_function.execute "qiskit.execute_function.execute") function is deprecated. This function served as a high-level wrapper around transpiling a circuit with some transpile options and running it on a backend with some run options. To do the same thing, you can explicitly use the [`transpile()`](/api/qiskit/0.46/compiler#qiskit.compiler.transpile "qiskit.compiler.transpile") function (with appropriate transpile options) followed by `backend.run()` (with appropriate run options).
For example, instead of running:
@ -334,7 +330,7 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
job = backend.run(new_circuit)
```
Alternatively, the `Sampler` primitive is semantically equivalent to the deprecated `execute()` function. The class [`BackendSampler`](/api/qiskit/qiskit.primitives.BackendSampler "qiskit.primitives.BackendSampler") is a generic wrapper for backends that do not support primitives:
Alternatively, the `Sampler` primitive is semantically equivalent to the deprecated [`execute()`](/api/qiskit/0.46/execute#qiskit.execute_function.execute "qiskit.execute_function.execute") function. The class [`BackendSampler`](/api/qiskit/0.46/qiskit.primitives.BackendSampler "qiskit.primitives.BackendSampler") is a generic wrapper for backends that do not support primitives:
```python
from qiskit.primitives import BackendSampler
@ -342,29 +338,29 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
job = sampler.run(circuit)
```
* Implicit conversion from a dense `` BaseOperator` `` to a [`SparsePauliOp`](/api/qiskit/qiskit.quantum_info.SparsePauliOp "qiskit.quantum_info.SparsePauliOp") in `Estimator` observable arguments is deprecated as of Qiskit 0.46 and will be removed in Qiskit 1.0. You should explicitly convert to a [`SparsePauliOp`](/api/qiskit/qiskit.quantum_info.SparsePauliOp "qiskit.quantum_info.SparsePauliOp") using [`SparsePauliOp.from_operator()`](/api/qiskit/qiskit.quantum_info.SparsePauliOp#from_operator "qiskit.quantum_info.SparsePauliOp.from_operator") instead.
* Implicit conversion from a dense `` BaseOperator` `` to a [`SparsePauliOp`](/api/qiskit/0.46/qiskit.quantum_info.SparsePauliOp "qiskit.quantum_info.SparsePauliOp") in `Estimator` observable arguments is deprecated as of Qiskit 0.46 and will be removed in Qiskit 1.0. You should explicitly convert to a [`SparsePauliOp`](/api/qiskit/0.46/qiskit.quantum_info.SparsePauliOp "qiskit.quantum_info.SparsePauliOp") using [`SparsePauliOp.from_operator()`](/api/qiskit/0.46/qiskit.quantum_info.SparsePauliOp#from_operator "qiskit.quantum_info.SparsePauliOp.from_operator") instead.
* The discrete pulse library is now deprecated and will be removed in a future release. This includes:
* `constant()`
* `zero()`
* `square()`
* `sawtooth()`
* `triangle()`
* `cos()`
* `sin()`
* `gaussian()`
* `gaussian_deriv()`
* `sech()`
* `sech_deriv()`
* `gaussian_square()`
* `drag()`
* [`constant()`](/api/qiskit/0.46/pulse#qiskit.pulse.library.constant "qiskit.pulse.library.constant")
* [`zero()`](/api/qiskit/0.46/pulse#qiskit.pulse.library.zero "qiskit.pulse.library.zero")
* [`square()`](/api/qiskit/0.46/pulse#qiskit.pulse.library.square "qiskit.pulse.library.square")
* [`sawtooth()`](/api/qiskit/0.46/pulse#qiskit.pulse.library.sawtooth "qiskit.pulse.library.sawtooth")
* [`triangle()`](/api/qiskit/0.46/pulse#qiskit.pulse.library.triangle "qiskit.pulse.library.triangle")
* [`cos()`](/api/qiskit/0.46/pulse#qiskit.pulse.library.cos "qiskit.pulse.library.cos")
* [`sin()`](/api/qiskit/0.46/pulse#qiskit.pulse.library.sin "qiskit.pulse.library.sin")
* [`gaussian()`](/api/qiskit/0.46/pulse#qiskit.pulse.library.gaussian "qiskit.pulse.library.gaussian")
* [`gaussian_deriv()`](/api/qiskit/0.46/pulse#qiskit.pulse.library.gaussian_deriv "qiskit.pulse.library.gaussian_deriv")
* [`sech()`](/api/qiskit/0.46/pulse#qiskit.pulse.library.sech "qiskit.pulse.library.sech")
* [`sech_deriv()`](/api/qiskit/0.46/pulse#qiskit.pulse.library.sech_deriv "qiskit.pulse.library.sech_deriv")
* [`gaussian_square()`](/api/qiskit/0.46/pulse#qiskit.pulse.library.gaussian_square "qiskit.pulse.library.gaussian_square")
* [`drag()`](/api/qiskit/0.46/pulse#qiskit.pulse.library.drag "qiskit.pulse.library.drag")
Instead, use the corresponding `SymbolicPulse`, with [`get_waveform()`](/api/qiskit/qiskit.pulse.library.SymbolicPulse#get_waveform "qiskit.pulse.library.SymbolicPulse.get_waveform"). For example, instead of `pulse.gaussian(100,0.5,10)` use `pulse.Gaussian(100,0.5,10).get_waveform()`.
Instead, use the corresponding `SymbolicPulse`, with [`get_waveform()`](/api/qiskit/0.46/qiskit.pulse.library.SymbolicPulse#get_waveform "qiskit.pulse.library.SymbolicPulse.get_waveform"). For example, instead of `pulse.gaussian(100,0.5,10)` use `pulse.Gaussian(100,0.5,10).get_waveform()`.
Note that the phase of both `Sawtooth` and `Square` is defined such that a phase of $2\\pi$ shifts by a full cycle, contrary to the discrete counterpart. Also note that complex amplitude support is deprecated in the symbolic pulse library - use `float`, `amp` and `angle` instead.
* The `ConfigurableFakeBackend` class, which has mainly been used for internal testing, is now deprecated. It will be removed in the Qiskit 1.0.0 release. Instead, you can use the [`GenericBackendV2`](/api/qiskit/qiskit.providers.fake_provider.GenericBackendV2 "qiskit.providers.fake_provider.GenericBackendV2") class to build a similar backend for testing.
* The [`ConfigurableFakeBackend`](/api/qiskit/0.46/qiskit.providers.fake_provider.ConfigurableFakeBackend "qiskit.providers.fake_provider.ConfigurableFakeBackend") class, which has mainly been used for internal testing, is now deprecated. It will be removed in the Qiskit 1.0.0 release. Instead, you can use the [`GenericBackendV2`](/api/qiskit/0.46/qiskit.providers.fake_provider.GenericBackendV2 "qiskit.providers.fake_provider.GenericBackendV2") class to build a similar backend for testing.
* Loading library `ScalableSymbolicPulse` objects with complex `amp` parameter from qpy files of version 5 or lower (Qiskit Terra \< 0.23.0) is now deprecated. Following the removal in Qiskit 1.0.0, complex `amp` will be automatically converted to float (`amp`, `angle`). The change applies to the pulses:
@ -373,9 +369,9 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
* `Gaussian`
* `GaussianSquare`
* The `qiskit.providers.basicaer` module and all of its classes are deprecated from Qiskit 0.46 onwards. Their use should be replaced with the [`qiskit.quantum_info`](/api/qiskit/quantum_info#module-qiskit.quantum_info "qiskit.quantum_info") module and the new [`qiskit.providers.basic_provider`](/api/qiskit/providers_basic_provider#module-qiskit.providers.basic_provider "qiskit.providers.basic_provider") module.
* The [`qiskit.providers.basicaer`](/api/qiskit/0.46/providers_basicaer#module-qiskit.providers.basicaer "qiskit.providers.basicaer") module and all of its classes are deprecated from Qiskit 0.46 onwards. Their use should be replaced with the [`qiskit.quantum_info`](/api/qiskit/0.46/quantum_info#module-qiskit.quantum_info "qiskit.quantum_info") module and the new [`qiskit.providers.basic_provider`](/api/qiskit/0.46/providers_basic_provider#module-qiskit.providers.basic_provider "qiskit.providers.basic_provider") module.
The migration from using `qiskit.providers.basicaer` to [`qiskit.providers.basic_provider`](/api/qiskit/providers_basic_provider#module-qiskit.providers.basic_provider "qiskit.providers.basic_provider") can be performed as follows:
The migration from using [`qiskit.providers.basicaer`](/api/qiskit/0.46/providers_basicaer#module-qiskit.providers.basicaer "qiskit.providers.basicaer") to [`qiskit.providers.basic_provider`](/api/qiskit/0.46/providers_basic_provider#module-qiskit.providers.basic_provider "qiskit.providers.basic_provider") can be performed as follows:
```python
Migrate from | Replace with
@ -396,7 +392,7 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
backend = provider.get_backend("sim_name")
```
The following examples show the migration paths of the three simulators in `basicaer`.
The following examples show the migration paths of the three simulators in [`basicaer`](/api/qiskit/0.46/providers_basicaer#module-qiskit.providers.basicaer "qiskit.providers.basicaer").
1. Statevector simulator:
@ -465,9 +461,9 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
result = backend.run(qc).result()
```
* Using a [`PauliList`](/api/qiskit/qiskit.quantum_info.PauliList "qiskit.quantum_info.PauliList") as an observable that is implicitly converted to a [`SparsePauliOp`](/api/qiskit/qiskit.quantum_info.SparsePauliOp "qiskit.quantum_info.SparsePauliOp") with coefficients 1 when calling [`Estimator.run()`](/api/qiskit/qiskit.primitives.Estimator#run "qiskit.primitives.Estimator.run") is deprecated. Instead you should explicitly convert the argument using `SparsePauliOp(pauli_list)` first.
* Using a [`PauliList`](/api/qiskit/0.46/qiskit.quantum_info.PauliList "qiskit.quantum_info.PauliList") as an observable that is implicitly converted to a [`SparsePauliOp`](/api/qiskit/0.46/qiskit.quantum_info.SparsePauliOp "qiskit.quantum_info.SparsePauliOp") with coefficients 1 when calling [`Estimator.run()`](/api/qiskit/0.46/qiskit.primitives.Estimator#run "qiskit.primitives.Estimator.run") is deprecated. Instead you should explicitly convert the argument using `SparsePauliOp(pauli_list)` first.
<span id="relnotes-0-46-0-stable-0-46-critical-issues" />
<span id="relnotes-0-46-0-critical-issues" />
### Critical Issues
@ -481,6 +477,3 @@ If you develop a library based on Qiskit and you still have a dependency on `qis
will create a new virtual environment named `qiskit_1.0` will contain the new version of Qiskit.
<span id="relnotes-0-45-3-stable-0-45" />
<span id="id7" />

View File

@ -102,6 +102,16 @@ async function copyApiDocsAndUpdateLinks(
),
);
}
const releaseNotePath = `${getRoot()}/docs/api/${pkgName}/release-notes/${versionWithoutPatch}.md`;
if (await pathExists(releaseNotePath)) {
updateLinksFile(
pkgName,
versionWithoutPatch,
releaseNotePath,
releaseNotePath,
);
}
}
async function generateJsonFiles(

View File

@ -39,7 +39,7 @@ import {
addNewReleaseNotes,
generateReleaseNotesIndex,
updateHistoricalTocFiles,
writeSeparateReleaseNotes,
writeReleaseNoteForVersion,
} from "../lib/api/releaseNotes";
interface Arguments {
@ -241,14 +241,18 @@ async function convertHtmlToMarkdown(
}
if (pkg.hasSeparateReleaseNotes && path.endsWith("release-notes.md")) {
const baseUrl = pkg.isHistorical()
? `/api/${pkg.name}/${pkg.versionWithoutPatch}`
: `/api/${pkg.name}`;
// Convert the relative links to absolute links
result.markdown = transformLinks(result.markdown, (link, _) =>
link.startsWith("http") || link.startsWith("#") || link.startsWith("/")
? link
: `/api/${pkg.name}/${link}`,
: `${baseUrl}/${link}`,
);
await writeSeparateReleaseNotes(pkg, result.markdown);
await writeReleaseNoteForVersion(pkg, result.markdown);
continue;
}

View File

@ -1,90 +0,0 @@
// This code is a Qiskit project.
//
// (C) Copyright IBM 2023.
//
// This code is licensed under the Apache License, Version 2.0. You may
// obtain a copy of this license in the LICENSE file in the root directory
// of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
//
// Any modifications or derivative works of this code must retain this
// copyright notice, and modified files need to carry a notice indicating
// that they have been altered from the originals.
import { expect, test } from "@jest/globals";
import {
sortReleaseNotesVersions,
extractMarkdownReleaseNotesPatches,
} from "./releaseNotes";
test("Test versions have the correct order", () => {
const markdownByVersionPatch = {
"0.45.0": "",
"0.45.1": "",
"0.45.1rc1": "",
"0.46.1": "",
"0.46.1rc1": "",
"0.46.1rc2": "",
"0.47.0": "",
"0.47.1": "",
};
expect(
Object.entries(sortReleaseNotesVersions(markdownByVersionPatch)),
).toEqual([
["0.47.1", ""],
["0.47.0", ""],
["0.46.1", ""],
["0.46.1rc2", ""],
["0.46.1rc1", ""],
["0.45.1", ""],
["0.45.1rc1", ""],
["0.45.0", ""],
]);
});
test("Divide the markdown into versions", () => {
const markdown = `
# Title
This is a header
## Subtitle header
Extra information before all the versions
### Extra section before the notes
Extra section
## 0.45.2
This is a test for version 0.45.2
### New features
Example
## 0.45.0rc1
This is a test for version 0.45.0rc1
### New features
Example
## 0.45.0
This is a test for version 0.45.0`;
const [versionsFound, markdownByPatchVersionExpect] =
extractMarkdownReleaseNotesPatches(markdown);
const versionsFoundExpected = new Set(["0.45"]);
const markdownByPatchVersion: { [id: string]: string } = {};
markdownByPatchVersion[
"0.45.2"
] = `## 0.45.2\nThis is a test for version 0.45.2\n\n### New features\nExample\n`;
markdownByPatchVersion[
"0.45.0rc1"
] = `## 0.45.0rc1\nThis is a test for version 0.45.0rc1\n\n### New features\nExample\n`;
markdownByPatchVersion[
"0.45.0"
] = `## 0.45.0\nThis is a test for version 0.45.0`;
expect([versionsFound, markdownByPatchVersionExpect]).toEqual([
versionsFoundExpected,
markdownByPatchVersion,
]);
});

View File

@ -145,83 +145,10 @@ function addNewReleaseNoteToc(releaseNotesNode: any, newVersion: string) {
}
/**
* Sorts the release notes dictionary by the patch version
* in descending order, e.g. 0.25.2 then 0.25.1.
*
* Returns a dictionary with the corresponding markdown for
* each patch with the entries sorted by release.
* Creates the release note file for the minor version found in `pkg`.If the file
* already exists, it will keep the initial header and overwrite the rest of the content.
*/
export function sortReleaseNotesVersions(markdownByPatchVersion: {
[id: string]: string;
}): { [id: string]: string } {
// Sorts the entries of markdownByPathVersion by patch in descending order,
// returning an array with elements corresponding to the dictionary entries
// as arrays of two elements (key and value).
// e.g.
// makrdownByPathVersion = {"0.45.0": "test 1", "0.46.0": "test 2"}
// =>
// markdownByPatchSorted = [["0.46.0", "test 2"],["0.45.0", "test 1"]]
const markdownByPatchSorted = Object.entries(markdownByPatchVersion).sort(
([version1], [version2]) => {
const versionPatch1 = version1.split("rc").slice(0, 1)[0];
const versionPatch2 = version2.split("rc").slice(0, 1)[0];
if (versionPatch1 == versionPatch2) {
// The release candidates within the same patch should appear last.
// e.g. version 0.45.1rc1 should appear after version 0.45.1.
if (version1.length < version2.length) {
return -1;
} else if (version1.length > version2.length) {
return 1;
}
}
return version2.localeCompare(version1);
},
);
return Object.fromEntries(markdownByPatchSorted);
}
/**
* Process the markdown dividing it into small sections for each patch version
*
* Returns a tuple:
* 1. A Set of strings representing all the minor versions we found in the
* markdown.
* 2. A dictionary with the corresponding markdown for each patch version
* found.
*/
export function extractMarkdownReleaseNotesPatches(
markdown: string,
): [Set<string>, { [id: string]: string }] {
const sectionsSplit = markdown.split(/\n## (?=[0-9])/);
const sections: string[] = sectionsSplit.slice(1, sectionsSplit.length);
const minorVersionsFound = new Set<string>();
const markdownByPatchVersion: { [id: string]: string } = {};
for (let section of sections) {
const versionPatch = section.split("\n").slice(0, 1)[0];
const versionMinor = versionPatch.split(".").slice(0, 2).join(".");
minorVersionsFound.add(versionMinor);
const content = section.split("\n");
content.shift();
markdownByPatchVersion[versionPatch] = `## ${versionPatch}\n${content.join(
"\n",
)}`;
}
return [minorVersionsFound, markdownByPatchVersion];
}
/**
* Updates the release notes folder by adding the notes to their corresponding version
* file.
*/
export async function writeSeparateReleaseNotes(
export async function writeReleaseNoteForVersion(
pkg: Pkg,
releaseNoteMarkdown: string,
): Promise<void> {
@ -231,62 +158,26 @@ export async function writeSeparateReleaseNotes(
);
}
// Dictionary to store the file header in case we need to reconstruct a file from a
// previous version
const filesToInitialHeaders: { [id: string]: string } = {};
const basePath = `${getRoot()}/docs/api/${pkg.name}/release-notes`;
const versionPath = `${basePath}/${pkg.versionWithoutPatch}.md`;
const [minorVersionsFound, markdownByPatchVersion] =
extractMarkdownReleaseNotesPatches(releaseNoteMarkdown);
// Read the current release notes for each version found
for (let version of minorVersionsFound) {
const versionPath = `${basePath}/${version}.md`;
// When we're adding a new version, its release note file will not yet exist, so we
// cannot read it here to determine the prior contents. Instead, skip the release
// note since we are going to add it at the end of this function.
if (!(await pathExists(versionPath))) {
continue;
}
const versionsMarkdown = releaseNoteMarkdown
.split(/\n## (?=[0-9])/)
.slice(1)
.join("\n## ");
if (!(await pathExists(versionPath))) {
await writeFile(versionPath, releaseNoteMarkdown);
} else if (versionsMarkdown) {
// The if statement prevents us from modifying versions of Qiskit < 0.45.
// Those versions have a different structure, such as a different section
// title (`## Qiskit 0.44.0` instead of `## 0.44.0`), and they contain
// more than one version in the same file.
const currentMarkdown = await readFile(versionPath, "utf-8");
filesToInitialHeaders[version] = currentMarkdown
const initialHeader = currentMarkdown
.split(/\n## (?=[0-9])/)
.slice(0, 1)[0];
}
const markdownByPatchVersionSorted = sortReleaseNotesVersions(
markdownByPatchVersion,
);
// Generate the modified release notes files
const markdownByMinorVersion: { [id: string]: string } = {};
Object.entries(markdownByPatchVersionSorted).forEach(
([versionPatch, markdown]) => {
const versionMinor = versionPatch.split(".").slice(0, 2).join(".");
if (!markdownByMinorVersion.hasOwnProperty(versionMinor)) {
markdownByMinorVersion[versionMinor] = markdown;
} else {
markdownByMinorVersion[versionMinor] += `\n${markdown}`;
}
},
);
// Write all the modified files
for (let [versionMinor, markdown] of Object.entries(markdownByMinorVersion)) {
let fileInitialHeader = filesToInitialHeaders[versionMinor];
if (fileInitialHeader == undefined) {
fileInitialHeader = `---
title: Qiskit ${versionMinor} release notes
description: New features and bug fixes
---
# Qiskit ${versionMinor} release notes
`;
}
const versionPath = `${basePath}/${versionMinor}.md`;
await writeFile(versionPath, `${fileInitialHeader}\n${markdown}`);
await writeFile(versionPath, `${initialHeader}\n## ${versionsMarkdown}`);
}
}