From 2b423d04dfb799650c1459b0e0d8a70dc1d095f3 Mon Sep 17 00:00:00 2001 From: qiskit-bot <54866446+qiskit-bot@users.noreply.github.com> Date: Thu, 27 Jul 2023 18:47:40 -0400 Subject: [PATCH] Bump Meta (#1785) Bump the meta repo version to include: qiskit-terra==0.25.0 --------- Co-authored-by: Matthew Treinish --- .github/workflows/main.yml | 4 +- docs/conf.py | 3 +- docs/release_notes.rst | 1324 ++++++++++++++++++++++++++++++++++++ requirements-dev.txt | 1 + setup.py | 6 +- test/test_simulation.py | 36 - 6 files changed, 1331 insertions(+), 43 deletions(-) delete mode 100644 test/test_simulation.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4405456d76bc..535ce813f3cf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - python-version: [3.7, 3.8, 3.9, "3.10"] + python-version: [3.8, 3.9, "3.10", "3.11"] os: ["ubuntu-latest"] steps: - uses: actions/checkout@v2 @@ -80,7 +80,7 @@ jobs: run: | set -e git clone https://github.com/Qiskit/qiskit-tutorials - pip install -c constraints.txt -U jupyter sphinx nbsphinx networkx qiskit_sphinx_theme 'matplotlib>=3.3.0' qiskit-terra[visualization] cvxpy 'pyscf<1.7.4' scikit-learn + pip install -c constraints.txt -U jupyter sphinx nbsphinx networkx qiskit_sphinx_theme 'matplotlib>=3.3.0' qiskit-terra[visualization] cvxpy 'pyscf<1.7.4' scikit-learn qiskit-aer pip install -c constraints.txt -U . sudo apt-get install -y pandoc graphviz - name: Run tutorials diff --git a/docs/conf.py b/docs/conf.py index 753aa576c999..15dab3cfe568 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -36,7 +36,7 @@ # The short X.Y version version = "" # The full version, including alpha/beta/rc tags -release = "0.43.3" +release = "0.44.0" docs_url_prefix = "documentation" # i.e., www.qiskit.org/documentation/ @@ -197,6 +197,7 @@ # Only add type hints from signature to description body if the parameter has documentation. The # return type is always added to the description (if in the signature). autodoc_typehints_description_target = "documented_params" +add_module_name = True # Plot directive configuration # ---------------------------- diff --git a/docs/release_notes.rst b/docs/release_notes.rst index 7d50ad522808..ae77fa0cbc74 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -21,6 +21,1330 @@ This table tracks the meta-package versions and the version of each Qiskit eleme Notable Changes ############### +************* +Qiskit 0.44.0 +************* + +This release officially marks the end of support for the Qiskit IBMQ Provider +package and the removal of Qiskit Aer from the Qiskit metapackage. After this +release the metapackage only contains Qiskit Terra, so this is the final +release we will refer to the Qiskit metapackage and Qiskit Terra as separate +things. Starting in the next release Qiskit 0.45.0 the Qiskit package will +just be what was previously Qiskit Terra and there will no longer be a +separation between them. + +If you're still using the ``qiskit-ibmq-provider`` package it has now been +retired and is no longer supported. You should follow the links to the migration +guides in the README for the package on how to switch over to the new replacement +packages ``qiskit-ibm-provider``, ``qiskit-ibm-runtime``, and +``qiskit-ibm-experiment``: + +https://github.com/Qiskit/qiskit-ibmq-provider#migration-guides + +The Qiskit Aer project is still active and maintained moving forward it is +just no longer included as part of the ``qiskit`` package. To continue using +``qiskit-aer`` you will need to explicitly install ``qiskit-aer`` and import the +package from ``qiskit_aer``. + +As this is the final release of the Qiskit metapackage the following setuptools +extras used to install optional dependencies will no longer work in the next +release Qiskit 0.45.0: + + * ``nature`` + * ``machine-learning`` + * ``finance`` + * ``optimization`` + * ``experiments`` + +If you're using the extras to install any packages you should migrate to using +the packages directly instead of the extra. For example if you were using +``pip install qiskit[experiments]`` previously you should switch to +``pip install qiskit qiskit-experiments`` to install both packages. +Similarly the ``all`` extra (what gets installed via +``pip install "qiskit[all]"``) will no longer include these packages in Qiskit +0.45.0. + +.. _Release Notes_0.25.0: + +Terra 0.25.0 +============ + +.. _Release Notes_0.25.0_Prelude: + +Prelude +------- + +.. releasenotes/notes/prepare-0.25-2efd7230b0ae0719.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +The Qiskit Terra 0.25.0 release highlights are: + +* Control-flow operations are now supported through the transpiler at + all optimization levels, including levels 2 and 3 (e.g. calling + :func:`.transpile` or :func:`.generate_preset_pass_manager` with + keyword argument ``optimization_level`` specified as 2 or 3 is now + supported). + +* The fields :attr:`.IfElseOp.condition`, :attr:`.WhileLoopOp.condition` and + :attr:`.SwitchCaseOp.target` can now be instances of the new runtime classical-expression type + :class:`.expr.Expr`. This is distinct from :class:`.ParameterExpression` because it is + evaluated *at runtime* for backends that support such operations. + + These new expressions have significantly more power than the old two-tuple form of supplying + classical conditions. For example, one can now represent equality constraints between two + different classical registers, or the logic "or" of two classical bits. These two examples + would look like:: + + from qiskit.circuit import QuantumCircuit, ClassicalRegister, QuantumRegister + from qiskit.circuit.classical import expr + + qr = QuantumRegister(4) + cr1 = ClassicalRegister(2) + cr2 = ClassicalRegister(2) + qc = QuantumCircuit(qr, cr1, cr2) + qc.h(0) + qc.cx(0, 1) + qc.h(2) + qc.cx(2, 3) + qc.measure([0, 1, 2, 3], [0, 1, 2, 3]) + + # If the two registers are equal to each other. + with qc.if_test(expr.equal(cr1, cr2)): + qc.x(0) + + # While either of two bits are set. + with qc.while_loop(expr.logic_or(cr1[0], cr1[1])): + qc.reset(0) + qc.reset(1) + qc.measure([0, 1], cr1) + + For more examples, see the documentation for :mod:`qiskit.circuit.classical`. + + This feature is new for both Qiskit and the available quantum hardware that + Qiskit works with. As the features are still being developed there are likely + to be places where there are unexpected edge cases that will need some time to + be worked out. If you encounter any issue around classical expression support + or usage please open an issue with Qiskit or your hardware vendor. + + In this initial release, Qiskit has added the operations: + + * :func:`~.expr.bit_not` + * :func:`~.expr.logic_not` + * :func:`~.expr.bit_and` + * :func:`~.expr.bit_or` + * :func:`~.expr.bit_xor` + * :func:`~.expr.logic_and` + * :func:`~.expr.logic_or` + * :func:`~.expr.equal` + * :func:`~.expr.not_equal` + * :func:`~.expr.less` + * :func:`~.expr.less_equal` + * :func:`~.expr.greater` + * :func:`~.expr.greater_equal` + + These can act on Python integer and Boolean literals, or on :class:`.ClassicalRegister` + and :class:`.Clbit` instances. + + All these classical expressions are fully supported through the Qiskit transpiler stack, through + QPY serialisation (:mod:`qiskit.qpy`) and for export to OpenQASM 3 (:mod:`qiskit.qasm3`). Import + from OpenQASM 3 is currently managed by `a separate package `__ + (which is re-exposed via :mod:`qiskit.qasm3`), which we hope will be extended to match the new + features in Qiskit. + +* The :mod:`qiskit.algorithms` module has been deprecated and will be removed + in a future release. It has been superseded by a new standalone library + ``qiskit-algorithms`` which can be found on PyPi or on Github here: + + https://github.com/qiskit-community/qiskit-algorithms + + The :mod:`qiskit.algorithms` module will continue to work as before and bug fixes + will be made to it until its future removal, but active development + of new features has moved to the new package. + If you're relying on :mod:`qiskit.algorithms` you should update your + Python requirements to also include ``qiskit-algorithms`` and update the imports + from ``qiskit.algorithms`` to ``qiskit_algorithms``. Please note that this + new package does not include already deprecated algorithms code, including + ``opflow`` and ``QuantumInstance``-based algorithms. If you have not yet + migrated from ``QuantumInstance``-based to primitives-based algorithms, + you should follow the migration guidelines in https://qisk.it/algo_migration. + The decision to migrate the :mod:`~.algorithms` module to a + separate package was made to clarify the purpose Qiskit and + make a distinction between the tools and libraries built on top of it. + +Qiskit Terra 0.25 has dropped support for Python 3.7 following +deprecation warnings started in Qiskit Terra 0.23. This is consistent +with Python 3.7’s end-of-life on the 27th of June, 2023. To continue +using Qiskit, you must upgrade to a more recent version of Python. + +.. _Release Notes_0.25.0_New Features: + +New Features +------------ + +.. releasenotes/notes/0.25/add-abs-to-parameterexpression-347ffef62946b38b.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The following features have been added in this release. + + +.. _Release Notes_0.25.0_Transpiler Features: + +Transpiler Features +^^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/add-block-collection-options-359d5e496313acdb.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added two new options to :class:`~qiskit.dagcircuit.BlockCollector`. + + The first new option ``split_layers`` allows collected blocks to be split into sub-blocks + over disjoint qubit subsets, i.e. into depth-1 sub-blocks. + + The second new option ``collect_from_back`` allows blocks to be greedily collected starting + from the outputs of the circuit. This is important in combination with ALAP-scheduling passes + where we may prefer to put gates in the later rather than earlier blocks. + +.. releasenotes/notes/0.25/add-block-collection-options-359d5e496313acdb.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added new options ``split_layers`` and ``collect_from_back`` to + :class:`~qiskit.transpiler.passes.CollectLinearFunctions` and + :class:`~qiskit.transpiler.passes.CollectCliffords` transpiler passes. + + When ``split_layers`` is `True`, the collected blocks are split into + into sub-blocks over disjoint qubit subsets, i.e. into depth-1 sub-blocks. + Consider the following example:: + + from qiskit.circuit import QuantumCircuit + from qiskit.transpiler.passes import CollectLinearFunctions + + circuit = QuantumCircuit(5) + circuit.cx(0, 2) + circuit.cx(1, 4) + circuit.cx(2, 0) + circuit.cx(0, 3) + circuit.swap(3, 2) + circuit.swap(4, 1) + + # Collect all linear gates, without splitting into layers + qct = CollectLinearFunctions(split_blocks=False, min_block_size=1, split_layers=False)(circuit) + assert qct.count_ops()["linear_function"] == 1 + + # Collect all linear gates, with splitting into layers + qct = CollectLinearFunctions(split_blocks=False, min_block_size=1, split_layers=True)(circuit) + assert qct.count_ops()["linear_function"] == 4 + + The original circuit is linear. When collecting linear gates without splitting into layers, + we should end up with a single linear function. However, when collecting linear gates and + splitting into layers, we should end up with 4 linear functions. + + When ``collect_from_back`` is `True`, the blocks are greedily collected from the outputs towards + the inputs of the circuit. Consider the following example:: + + from qiskit.circuit import QuantumCircuit + from qiskit.transpiler.passes import CollectLinearFunctions + + circuit = QuantumCircuit(3) + circuit.cx(1, 2) + circuit.cx(1, 0) + circuit.h(2) + circuit.swap(1, 2) + + # This combines the CX(1, 2) and CX(1, 0) gates into a single linear function + qct = CollectLinearFunctions(collect_from_back=False)(circuit) + + # This combines the CX(1, 0) and SWAP(1, 2) gates into a single linear function + qct = CollectLinearFunctions(collect_from_back=True)(circuit) + + The original circuit contains a Hadamard gate, so that the `CX(1, 0)` gate can be + combined either with `CX(1, 2)` or with `SWAP(1, 2)`, but not with both. When + ``collect_from_back`` is `False`, the linear blocks are greedily collected from the start + of the circuit, and thus `CX(1, 0)` is combined with `CX(1, 2)`. When + ``collect_from_back`` is `True`, the linear blocks are greedily collected from the end + of the circuit, and thus `CX(1, 0)` is combined with `SWAP(1, 2)`. + +.. releasenotes/notes/0.25/add-classical-predecessors-9ecef0561822e934.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added :meth:`.DAGCircuit.classical_predecessors` and + :meth:`.DAGCircuit.classical_successors`, an alternative to selecting classical + wires that doesn't require accessing the inner graph of a DAG node directly. + The following example illustrates the new functionality:: + + from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister + from qiskit.converters import circuit_to_dag + from qiskit.circuit.library import RZGate + + q = QuantumRegister(3, 'q') + c = ClassicalRegister(3, 'c') + circ = QuantumCircuit(q, c) + circ.h(q[0]) + circ.cx(q[0], q[1]) + circ.measure(q[0], c[0]) + circ.rz(0.5, q[1]).c_if(c, 2) + circ.measure(q[1], c[0]) + dag = circuit_to_dag(circ) + + rz_node = dag.op_nodes(RZGate)[0] + # Contains the "measure" on clbit 0, and the "wire start" nodes for clbits 1 and 2. + classical_predecessors = list(dag.classical_predecessors(rz_node)) + # Contains the "measure" on clbit 0, and the "wire end" nodes for clbits 1 and 2. + classical_successors = list(dag.classical_successors(rz_node)) + +.. releasenotes/notes/0.25/add-control-flow-to-commutative-cancellation-pass-85fe310d911d9a00.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Enabled support for :class:`~qiskit.circuit.ControlFlowOp` operations in the + :class:`~qiskit.transpiler.passes.CommutativeCancellation` pass. + Previously, the blocks in control flow operations were skipped by this pass. + +.. releasenotes/notes/0.25/add-control-flow-to-consolidate-blocks-e013e28007170377.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Enabled support for :class:`.ControlFlowOp` operations in the :class:`.ConsolidateBlocks` pass. + +.. releasenotes/notes/0.25/add-dag-causal-cone-5a19311e40fbb3af.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added :meth:`.DAGCircuit.quantum_causal_cone` to obtain the causal cone of a qubit + in a :class:`~.DAGCircuit`. + The following example shows its correct usage:: + + from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister + from qiskit.circuit.library import CXGate, CZGate + from qiskit.dagcircuit import DAGCircuit + + # Build a DAGCircuit + dag = DAGCircuit() + qreg = QuantumRegister(5) + creg = ClassicalRegister(5) + dag.add_qreg(qreg) + dag.add_creg(creg) + dag.apply_operation_back(CXGate(), qreg[[1, 2]], []) + dag.apply_operation_back(CXGate(), qreg[[0, 3]], []) + dag.apply_operation_back(CZGate(), qreg[[1, 4]], []) + dag.apply_operation_back(CZGate(), qreg[[2, 4]], []) + dag.apply_operation_back(CXGate(), qreg[[3, 4]], []) + + # Get the causal cone of qubit at index 0 + result = dag.quantum_causal_cone(qreg[0]) + +.. releasenotes/notes/0.25/add-method-for-mapping-qubit-clbit-to-positional-index-6cd43a42f56eb549.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- A new method :meth:`~qiskit.dagcircuit.DAGCircuit.find_bit` has + been added to the :class:`~qiskit.dagcircuit.DAGCircuit` class, + which returns the bit locations of the given :class:`.Qubit` or + :class:`.Clbit` as a tuple of the positional index of the bit within + the circuit and a list of tuples which locate the bit in the circuit's + registers. + +.. releasenotes/notes/0.25/add-pauli-equivalences-74c635ec5c23ee33.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The transpiler's built-in :class:`.EquivalenceLibrary` + (``qiskit.circuit.equivalence_library.SessionEquivalenceLibrary``) + has been taught the circular Pauli + relations :math:`X = iYZ`, :math:`Y = iZX` and :math:`Z = iXY`. This should make transpiling + to constrained, and potentially incomplete, basis sets more reliable. + See `#10293 `__ for more detail. + +.. releasenotes/notes/0.25/ctrl-flow-o2-o3-83f660d704226848.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Control-flow operations are now supported through the transpiler at + all optimization levels, including levels 2 and 3 (e.g. calling + :func:`.transpile` or :func:`.generate_preset_pass_manager` with + keyword argument ``optimization_level=3``). + +.. releasenotes/notes/0.25/dag-substitute-node-propagate-condition-898052b53edb1f17.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- :meth:`.DAGCircuit.substitute_node` gained a ``propagate_condition`` keyword argument that is + analogous to the same argument in :meth:`~.DAGCircuit.substitute_node_with_dag`. Setting this + to ``False`` opts out of the legacy behaviour of copying a condition on the ``node`` onto the + new ``op`` that is replacing it. + + This option is ignored for general control-flow operations, which will never propagate their + condition, nor accept a condition from another node. + +.. releasenotes/notes/0.25/dagcircuit-separable-circuits-142853e69f530a16.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Introduced a new method, :meth:`.DAGCircuit.separable_circuits`, which returns a + list of :class:`.DAGCircuit` objects, one for each set of connected qubits + which have no gates connecting them to another set. + + Each :class:`.DAGCircuit` instance returned by this method will contain the same + number of clbits as ``self``. This method will not return :class:`.DAGCircuit` + instances consisting solely of clbits. + +.. releasenotes/notes/0.25/enable_target_aware_meas_map-0d8542402a74e9d8.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added the attribute :attr:`.Target.concurrent_measurements` which represents a hardware + constraint of qubits measured concurrently. This constraint is provided in a nested list form, + in which each element represents a qubit group to be measured together. + In an example below:: + + [[0, 1], [2, 3, 4]] + + qubits 0 and 1, and 2, 3 and 4 are measured together on the device. + This constraint doesn't block measuring an individual qubit, but you may + need to consider the alignment of measure operations for these qubits when + working with the + `Qiskit Pulse scheduler `__ + and when authoring new transpiler passes that are timing-aware (i.e. passes + that perform scheduling). + +.. releasenotes/notes/0.25/fixes_8060-ae91e0da9d53a288.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The transpiler pass :class:`~qiskit.transpiler.passes.SetLayout` can now + be constructed with a list of integers that represent the physical qubits + on which the quantum circuit will be mapped on. That is, the first qubit + in the circuit will be allocated to the physical qubit in position zero + of the list, and so on. + +.. releasenotes/notes/0.25/pauli-rotation-equivalences-6b2449c93c042dc9.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The transpiler's built-in :class:`.EquivalenceLibrary` has been taught more Pauli-rotation + equivalences between the one-qubit :math:`R_X`, :math:`R_Y` and :math:`R_Z` gates, and between + the two-qubit :math:`R_{XX}`, :math:`R_{YY}` and :math:`R_{ZZ}` gates. This should make + simple basis translations more reliable, especially circuits that use :math:`Y` rotations. + See `#7332 `__. + +.. releasenotes/notes/0.25/sabre-control-flow-3772af2c5b02c6d5.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Control-flow operations are now supported by the Sabre family + of transpiler passes, namely layout pass :class:`.SabreLayout` + and routing pass :class:`.SabreSwap`. Function :func:`.transpile` + keyword arguments ``layout_method`` and ``routing_method`` now + accept the option ``"sabre"`` for circuits with control flow, + which was previously unsupported. + +.. _Release Notes_0.25.0_Circuits Features: + +Circuits Features +^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/expr-rvalue-conditions-8b5d5f7c015658c0.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The fields :attr:`.IfElseOp.condition`, :attr:`.WhileLoopOp.condition` and + :attr:`.SwitchCaseOp.target` can now be instances of the new runtime classical-expression type + :class:`.expr.Expr`. This is distinct from :class:`.ParameterExpression` because it is + evaluated *at runtime* for backends that support such operations. + + These new expressions have significantly more power than the old two-tuple form of supplying + classical conditions. For example, one can now represent equality constraints between two + different classical registers, or the logic "or" of two classical bits. These two examples + would look like:: + + from qiskit.circuit import QuantumCircuit, ClassicalRegister, QuantumRegister + from qiskit.circuit.classical import expr + + qr = QuantumRegister(4) + cr1 = ClassicalRegister(2) + cr2 = ClassicalRegister(2) + qc = QuantumCircuit(qr, cr1, cr2) + qc.h(0) + qc.cx(0, 1) + qc.h(2) + qc.cx(2, 3) + qc.measure([0, 1, 2, 3], [0, 1, 2, 3]) + + # If the two registers are equal to each other. + with qc.if_test(expr.equal(cr1, cr2)): + qc.x(0) + + # While either of two bits are set. + with qc.while_loop(expr.logic_or(cr1[0], cr1[1])): + qc.reset(0) + qc.reset(1) + qc.measure([0, 1], cr1) + + For more examples, see the documentation for :mod:`qiskit.circuit.classical`. + + This feature is new for both Qiskit and the available quantum hardware that + Qiskit works with. As the features are still being developed there are likely + to be places where there are unexpected edge cases that will need some time to + be worked out. If you encounter any issue around classical expression support + or usage please open an issue with Qiskit or your hardware vendor. + + In this initial release, Qiskit has added the operations: + + * :func:`~.expr.bit_not` + * :func:`~.expr.logic_not` + * :func:`~.expr.bit_and` + * :func:`~.expr.bit_or` + * :func:`~.expr.bit_xor` + * :func:`~.expr.logic_and` + * :func:`~.expr.logic_or` + * :func:`~.expr.equal` + * :func:`~.expr.not_equal` + * :func:`~.expr.less` + * :func:`~.expr.less_equal` + * :func:`~.expr.greater` + * :func:`~.expr.greater_equal` + + These can act on Python integer and Boolean literals, or on :class:`.ClassicalRegister` + and :class:`.Clbit` instances. + + All these classical expressions are fully supported through the Qiskit transpiler stack, through + QPY serialisation (:mod:`qiskit.qpy`) and for export to OpenQASM 3 (:mod:`qiskit.qasm3`). Import + from OpenQASM 3 is currently managed by `a separate package `__ + (which is re-exposed via :mod:`qiskit.qasm3`), which we hope will be extended to match the new + features in Qiskit. + +.. releasenotes/notes/expr-rvalue-conditions-8b5d5f7c015658c0.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Tooling for working with the new representations of classical runtime expressions + has been added. + A general :class:`~.expr.ExprVisitor` is provided for + consumers of these expressions to subclass. Two utilities based on this structure, + :func:`~.expr.iter_vars` and :func:`~.expr.structurally_equivalent`, are also provided, which + respectively produce an iterator through the :class:`~.expr.Var` nodes and check whether two + :class:`~.expr.Expr` instances are structurally the same, up to some mapping of the + :class:`~.expr.Var` nodes contained. + +.. releasenotes/notes/expr-rvalue-conditions-8b5d5f7c015658c0.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added function :func:`~.expr.lift_legacy_condition` which can be used to convert old-style + conditions into new-style :class:`~.expr.Expr` nodes. + Note that these expression nodes are not permitted in old-style :attr:`.Instruction.condition` + fields, which are due to be replaced by more advanced classical handling such as :class:`.IfElseOp`. + +.. releasenotes/notes/0.25/add-abs-to-parameterexpression-347ffef62946b38b.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added support for taking absolute values of :class:`.ParameterExpression`\s. For example, + the following is now possible:: + + from qiskit.circuit import QuantumCircuit, Parameter + + x = Parameter("x") + circuit = QuantumCircuit(1) + circuit.rx(abs(x), 0) + + bound = circuit.bind_parameters({x: -1}) + + +.. releasenotes/notes/0.25/faster-parameter-rebind-3c799e74456469d9.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The performance of :meth:`.QuantumCircuit.assign_parameters` and :meth:`~.QuantumCircuit.bind_parameters` + has significantly increased for large circuits with structures typical of applications uses. + This includes most circuits based on the :class:`.NLocal` structure, such as + :class:`.EfficientSU2`. See `#10282 `__ for more + detail. + +.. releasenotes/notes/0.25/faster-parameter-rebind-3c799e74456469d9.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The method :meth:`.QuantumCircuit.assign_parameters` has gained two new keywords arguments: ``flat_input`` + and ``strict``. These are advanced options that can be used to speed up the method when passing the + parameter bindings as a dictionary; ``flat_input=True`` is a guarantee that the dictionary keys contain + only :class:`.Parameter` instances (not :class:`.ParameterVector`\ s), and ``strict=False`` allows the + dictionary to contain parameters that are not present in the circuit. Using these two options can + reduce the overhead of input normalisation in this function. + +.. releasenotes/notes/0.25/flatten-nlocal-family-292b23b99947f3c9.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added a new keyword argument ``flatten`` to the constructor for the + following classes: + + * :class:`~.EfficientSU2` + * :class:`~.ExcitationPreserving` + * :class:`~.NLocal` + * :class:`~.RealAmplitudes` + * :class:`~.TwoLocal` + * :class:`~.EvolvedOperatorAnsatz` + * :class:`~.QAOAAnsatz` + + If this argument is set to ``True`` the :class:`~.QuantumCircuit` subclass + generated will not wrap the implementation into :class:`~.Gate` or + :class:`~.circuit.Instruction` objects. While this isn't optimal for visualization + it typically results in much better runtime performance, especially with + :meth:`.QuantumCircuit.bind_parameters` and + :meth:`.QuantumCircuit.assign_parameters` which can see a substatial + runtime improvement with a flattened output compared to the nested + wrapped default output. + +.. releasenotes/notes/0.25/linear-functions-usability-45265f293a80a6e5.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added support for constructing :class:`.LinearFunction`\ s from more general quantum circuits, + that may contain: + + * Barriers (of type :class:`.Barrier`) and delays (:class:`~qiskit.circuit.Delay`), + which are simply ignored + * Permutations (of type :class:`~qiskit.circuit.library.PermutationGate`) + * Other linear functions + * Cliffords (of type :class:`.Clifford`), when the Clifford represents a linear function + (and a ``CircuitError`` exception is raised if not) + * Nested quantum circuits of this form + +.. releasenotes/notes/0.25/linear-functions-usability-45265f293a80a6e5.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added :meth:`.LinearFunction.__eq__` method. Two objects of type :class:`.LinearFunction` + are considered equal when their representations as binary invertible matrices are equal. + +.. releasenotes/notes/0.25/linear-functions-usability-45265f293a80a6e5.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added :meth:`.LinearFunction.extend_with_identity` method, which allows to extend + a linear function over ``k`` qubits to a linear function over ``n >= k`` qubits, + specifying the new positions of the original qubits and padding with identities on the + remaining qubits. + +.. releasenotes/notes/0.25/linear-functions-usability-45265f293a80a6e5.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added two methods for pretty-printing :class:`.LinearFunction` objects: + :meth:`.LinearFunction.mat_str`, which returns the string representation of the linear + function viewed as a matrix with 0/1 entries, and + :meth:`.LinearFunction.function_str`, which returns the string representation of the + linear function viewed as a linear transformation. + +.. releasenotes/notes/0.25/normalize-stateprep-e21972dce8695509.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The instructions :class:`.StatePreparation` and :class:`~.extensions.Initialize`, + and their associated circuit methods :meth:`.QuantumCircuit.prepare_state` and :meth:`~.QuantumCircuit.initialize`, + gained a keyword argument ``normalize``, which can be set to ``True`` to automatically normalize + an array target. By default this is ``False``, which retains the current behaviour of + raising an exception when given non-normalized input. + + +.. _Release Notes_0.25.0_Algorithms Features: + +Algorithms Features +^^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/umda-callback-eb644a49c5a9ad37.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added the option to pass a callback to the :class:`.UMDA` optimizer, which allows + keeping track of the number of function evaluations, the current parameters, and the + best achieved function value. + + +.. _Release Notes_0.25.0_OpenQASM Features: + +OpenQASM Features +^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/qasm3-alias-refactor-3389bfce3e29e4cf.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The OpenQASM 3 exporters (:func:`.qasm3.dump`, :func:`~.qasm3.dumps` and :class:`~.qasm3.Exporter`) + have a new ``allow_aliasing`` argument, which will eventually replace the ``alias_classical_registers`` + argument. This controls whether aliasing is permitted for either classical bits or qubits, rather + than the option only being available for classical bits. + + +.. _Release Notes_0.25.0_Quantum Information Features: + +Quantum Information Features +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/add-feature-negativity-logarithmic-negativity-fce5d8392460a0e9.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added a new function :func:`~qiskit.quantum_info.negativity` that calculates + the entanglement measure of negativity of a quantum state. + Example usage of the above function is given below:: + + from qiskit.quantum_info.states.densitymatrix import DensityMatrix + from qiskit.quantum_info.states.statevector import Statevector + from qiskit.quantum_info import negativity + import numpy as np + + # Constructing a two-qubit bell state vector + state = np.array([0, 1/np.sqrt(2), -1/np.sqrt(2), 0]) + # Calculating negativity of statevector + negv = negativity(Statevector(state), [1]) + + # Creating the Density Matrix (DM) + rho = DensityMatrix.from_label("10+") + # Calculating negativity of DM + negv2 = negativity(rho, [0, 1]) + +.. releasenotes/notes/0.25/add-schmidt-decomposition-c196cff16381b305.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added the function :func:`~qiskit.quantum_info.schmidt_decomposition`. + This function works with the :class:`~qiskit.quantum_info.Statevector` + and :class:`~qiskit.quantum_info.DensityMatrix` classes for bipartite + pure states. + +.. releasenotes/notes/0.25/support-SparsePauliOp-Parameter-multiplication-245173f0b232f59b.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Adds support for multiplication of :class:`.SparsePauliOp` objects + with :class:`.Parameter` objects by using the * operator, for example:: + + from qiskit.circuit import Parameter + from qiskit.quantum_info import SparsePauliOp + + param = Parameter("a") + op = SparsePauliOp("X") + param * op + + +.. _Release Notes_0.25.0_Pulse Features: + +Pulse Features +^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/discrete-pulse-library-deprecation-3a95eba7e29d8d49.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- + The :class:`~qiskit.pulse.library.SymbolicPulse` library was extended. The new pulse functions + in the library are: + + * :func:`~qiskit.pulse.library.GaussianDeriv` + * :func:`~qiskit.pulse.library.Sech` + * :func:`~qiskit.pulse.library.SechDeriv` + * :func:`~qiskit.pulse.library.Square` + + The new functions return a :class:`~qiskit.pulse.library.ScalableSymbolicPulse` instance, and match the functionality + of the corresponding functions in the discrete pulse library, with the exception of + :func:`~qiskit.pulse.library.Square` for which a phase of :math:`2\pi` shifts by a full cycle (contrary to the + discrete :func:`~qiskit.pulse.library.square` where such a shift was induced by a :math:`\pi` phase). + +.. releasenotes/notes/0.25/filter-schedule-block-29d392ca351f1fb1.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The method :meth:`~qiskit.pulse.schedule.ScheduleBlock.filter` is activated + in the :class:`~qiskit.pulse.schedule.ScheduleBlock` class. + This method enables users to retain only :class:`~qiskit.pulse.instructions.Instruction` + objects which pass through all the provided filters. + As builtin filter conditions, pulse :class:`~qiskit.pulse.channels.Channel` + subclass instance and :class:`~qiskit.pulse.instructions.Instruction` + subclass type can be specified. + User-defined callbacks taking :class:`~qiskit.pulse.instructions.Instruction` instance + can be added to the filters, too. + +.. releasenotes/notes/0.25/filter-schedule-block-29d392ca351f1fb1.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The method :meth:`~qiskit.pulse.schedule.ScheduleBlock.exclude` is activated + in the :class:`~qiskit.pulse.schedule.ScheduleBlock` class. + This method enables users to retain only :class:`~qiskit.pulse.instructions.Instruction` + objects which do not pass at least one of all the provided filters. + As builtin filter conditions, pulse :class:`~qiskit.pulse.channels.Channel` + subclass instance and :class:`~qiskit.pulse.instructions.Instruction` + subclass type can be specified. + User-defined callbacks taking :class:`~qiskit.pulse.instructions.Instruction` instance + can be added to the filters, too. + This method is the complement of :meth:`~qiskit.pulse.schedule.ScheduleBlock.filter`, so + the following condition is always satisfied: + ``block.filter(*filters) + block.exclude(*filters) == block`` in terms of + instructions included, where ``block`` is a :class:`~qiskit.pulse.schedule.ScheduleBlock` + instance. + +.. releasenotes/notes/0.25/gaussian-square-echo-pulse-84306f1a02e2bb28.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added a new function :func:`~qiskit.pulse.library.gaussian_square_echo` to the + pulse library. The returned pulse + is composed of three :class:`~qiskit.pulse.library.GaussianSquare` pulses. The + first two are echo pulses with duration half of the total duration and + implement rotary tones. The third pulse is a cancellation tone that lasts + the full duration of the pulse and implements correcting single qubit + rotations. + +.. releasenotes/notes/0.25/qpy_supports_discriminator_and_kernel-3b6048bf1499f9d3.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- QPY supports the :class:`~qiskit.pulse.configuration.Discriminator` and + :class:`~qiskit.pulse.configuration.Kernel` objects. + This feature enables users to serialize and deserialize the + :class:`~qiskit.pulse.instructions.Acquire` instructions with these objects + using QPY. + + +.. _Release Notes_0.25.0_Synthesis Features: + +Synthesis Features +^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/cx_cz_synthesis-3d5ec98372ce1608.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Added a new synthesis function :func:`~qiskit.synthesis.synth_cx_cz_depth_line_my` + which produces the circuit form of a CX circuit followed by a CZ circuit for linear + nearest neighbor (LNN) connectivity in 2-qubit depth of at most 5n, using CX and + phase gates (S, Sdg or Z). The synthesis algorithm is based on the paper of Maslov + and Yang, `arXiv:2210.16195 `__. + + The algorithm accepts a binary invertible matrix ``mat_x`` representing the CX-circuit, + a binary symmetric matrix ``mat_z`` representing the CZ-circuit, and returns a quantum circuit + with 2-qubit depth of at most 5n computing the composition of the CX and CZ circuits. + The following example illustrates the new functionality:: + + import numpy as np + from qiskit.synthesis.linear_phase import synth_cx_cz_depth_line_my + mat_x = np.array([[0, 1], [1, 1]]) + mat_z = np.array([[0, 1], [1, 0]]) + qc = synth_cx_cz_depth_line_my(mat_x, mat_z) + + This function is now used by default in the Clifford synthesis algorithm + :func:`~qiskit.synthesis.synth_clifford_depth_lnn` that optimizes 2-qubit depth + for LNN connectivity, improving the 2-qubit depth from 9n+4 to 7n+2. + The clifford synthesis algorithm can be used as follows:: + + from qiskit.quantum_info import random_clifford + from qiskit.synthesis import synth_clifford_depth_lnn + + cliff = random_clifford(3) + qc = synth_clifford_depth_lnn(cliff) + + The above synthesis can be further improved as described in the paper by Maslov and Yang, + using local optimization between 2-qubit layers. This improvement is left for follow-up + work. + + +.. _Release Notes_0.25.0_Visualization Features: + +Visualization Features +^^^^^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/display-control-flow-mpl-drawer-2dbc7b57ac52d138.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- :meth:`.QuantumCircuit.draw` and function :func:`~qiskit.visualization.circuit_drawer` + when using option ``output='mpl'`` now support drawing the nested circuit blocks of + :class:`~qiskit.circuit.ControlFlowOp` operations, including + ``if``, ``else``, ``while``, ``for``, and ``switch/case``. Circuit blocks are + wrapped with boxes to delineate the circuits. + +.. releasenotes/notes/0.25/relax_wire_order_restrictions-ffc0cfeacd7b8d4b.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Some restrictions when using ``wire_order`` in the circuit drawers have been relaxed. + Now, ``wire_order`` can list just qubits and, in that case, it can be used + with ``cregbundle=True``, since it will not affect the classical bits. + + .. code-block:: + + from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister + + qr = QuantumRegister(4, "q") + cr = ClassicalRegister(4, "c") + cr2 = ClassicalRegister(2, "ca") + circuit = QuantumCircuit(qr, cr, cr2) + circuit.h(0) + circuit.h(3) + circuit.x(1) + circuit.x(3).c_if(cr, 10) + circuit.draw('text', wire_order=[2, 3, 0, 1], cregbundle=True) + + .. parsed-literal:: + + q_2: ──────────── + ┌───┐ ┌───┐ + q_3: ┤ H ├─┤ X ├─ + ├───┤ └─╥─┘ + q_0: ┤ H ├───╫─── + ├───┤ ║ + q_1: ┤ X ├───╫─── + └───┘┌──╨──┐ + c: 4/═════╡ 0xa ╞ + └─────┘ + ca: 2/════════════ + + +.. _Release Notes_0.25.0_Misc. Features: + +Misc. Features +^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/has-pygments-tester-3fb9f9c34907d45d.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- A new lazy import tester, :data:`.HAS_PYGMENTS`, is available for testing for the presence of + `the Pygments syntax highlighting library `__. + +.. releasenotes/notes/0.25/qiskit_version-956916f7b8d7bbb9.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The magic ``%qiskit_version_table`` from ``qiskit.tools.jupyter`` now includes all + imported modules with ``qiskit`` in their name. + +.. _Release Notes_0.25.0_Upgrade Notes: + +Upgrade Notes +------------- + +.. releasenotes/notes/0.25/drop-python3.7-8689e1fa349a49df.yaml @ b'a8faffb120d2b08968bf444acbe6b55ad0c37f39' + +- Qiskit Terra 0.25 has dropped support for Python 3.7 following deprecation warnings started in + Qiskit Terra 0.23. This is consistent with Python 3.7's end-of-life on the 27th of June, 2023. + To continue using Qiskit, you must upgrade to a more recent version of Python. + +.. releasenotes/notes/0.25/token-swapper-rustworkx-9e02c0ab67a59fe8.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Qiskit Terra 0.25 now requires versison 0.13.0 of ``rustworkx``. + +.. releasenotes/notes/0.25/use-abi3-4a935e0557d3833b.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- By default Qiskit builds its compiled extensions using the + `Python Stable ABI `__ + with support back to the oldest version of Python supported by Qiskit + (currently 3.8). This means that moving forward there + will be a single precompiled wheel that is shipped on release that + works with all of Qiskit's supported Python versions. There isn't any + expected runtime performance difference using the limited API so it is + enabled by default for all builds now. + Previously, the compiled extensions were built using the version specific API and + would only work with a single Python version. This change was made + to reduce the number of package files we need to build and publish in each + release. When building Qiskit from source, there should be no changes + necessary to the build process except that the default tags in the output + filenames will be different to reflect the use of the limited API. + + +.. _Release Notes_0.25.0_Transpiler Upgrade Notes: + +Transpiler Upgrade Notes +^^^^^^^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/remove-transpile-broadcast-1dfde28d508efa0d.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Support for passing in lists of argument values to the :func:`~.transpile` + function is removed. This functionality was deprecated as part of the + 0.23.0 release. You are still able to pass in a + list of :class:`~.QuantumCircuit` objects for the first positional argument. + What has been removed is list broadcasting of the other arguments to + each circuit in that input list. Removing this functionality was necessary + to greatly reduce the overhead for parallel execution for transpiling + multiple circuits at once. If you’re using this functionality + currently you can call :func:`~.transpile` multiple times instead. For + example if you were previously doing something like:: + + from qiskit.transpiler import CouplingMap + from qiskit import QuantumCircuit + from qiskit import transpile + + qc = QuantumCircuit(2) + qc.h(0) + qc.cx(0, 1) + qc.measure_all() + + cmaps = [CouplingMap.from_heavy_hex(d) for d in range(3, 15, 2)] + results = transpile([qc] * 6, coupling_map=cmaps) + + instead you should now run something like:: + + from qiskit.transpiler import CouplingMap + from qiskit import QuantumCircuit + from qiskit import transpile + + qc = QuantumCircuit(2) + qc.h(0) + qc.cx(0, 1) + qc.measure_all() + + cmaps = [CouplingMap.from_heavy_hex(d) for d in range(3, 15, 2)] + results = [transpile(qc, coupling_map=cm) for cm in cmap] + + You can also leverage :func:`~.parallel_map` or ``multiprocessing`` from + the Python standard library if you want to run this in parallel. + +.. releasenotes/notes/0.25/sabre-ctrl-flow-o1-431cd25a19adbcdc.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The Sabre family of transpiler passes (namely :class:`.SabreLayout` + and :class:`.SabreSwap`) are now used by default for all circuits + when invoking the transpiler at optimization level 1 (e.g. calling + :func:`.transpile` or :func:`.generate_preset_pass_manager` with + keyword argument ``optimization_level=1``). Previously, circuits + with control flow operations used :class:`.DenseLayout` and + :class:`.StochasticSwap` with this profile. + + +.. _Release Notes_0.25.0_Circuits Upgrade Notes: + +Circuits Upgrade Notes +^^^^^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/new-circuit-qasm2-methods-b1a06ee2859e2cce.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The OpenQASM 2 constructor methods on :class:`.QuantumCircuit` + (:meth:`~.QuantumCircuit.from_qasm_str` and :meth:`~.QuantumCircuit.from_qasm_file`) have been + switched to use the Rust-based parser added in Qiskit Terra 0.24. This should result in + significantly faster parsing times (10 times or more is not uncommon) and massively reduced + intermediate memory usage. + + The :class:`.QuantumCircuit` methods are kept with the same interface for continuity; the + preferred way to access the OpenQASM 2 importer is to use :func:`.qasm2.load` and + :func:`.qasm2.loads`, which offer an expanded interface to control the parsing and construction. + +.. releasenotes/notes/0.25/remove-deprecate-instructionset-circuit-cregs-91617e4b0993db9a.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The deprecated ``circuit_cregs`` argument to the constructor for the + :class:`~.InstructionSet` class has been removed. It was deprecated in the + 0.19.0 release. If you were using this argument and manually constructing + an :class:`~.InstructionSet` object (which should be quite uncommon as it's + mostly used internally) you should pass a callable to the + ``resource_requester`` keyword argument instead. For example:: + + from qiskit.circuit import Clbit, ClassicalRegister, InstructionSet + from qiskit.circuit.exceptions import CircuitError + + def my_requester(bits, registers): + bits_set = set(bits) + bits_flat = tuple(bits) + registers_set = set(registers) + + def requester(specifier): + if isinstance(specifer, Clbit) and specifier in bits_set: + return specifier + if isinstance(specifer, ClassicalRegster) and specifier in register_set: + return specifier + if isinstance(specifier, int) and 0 <= specifier < len(bits_flat): + return bits_flat[specifier] + raise CircuitError(f"Unknown resource: {specifier}") + + return requester + + my_bits = [Clbit() for _ in [None]*5] + my_registers = [ClassicalRegister(n) for n in range(3)] + + InstructionSet(resource_requester=my_requester(my_bits, my_registers)) + + +.. _Release Notes_0.25.0_OpenQASM Upgrade Notes: + +OpenQASM Upgrade Notes +^^^^^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/new-circuit-qasm2-methods-b1a06ee2859e2cce.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The OpenQASM 2 constructor methods on :class:`.QuantumCircuit` + (:meth:`~.QuantumCircuit.from_qasm_str` and :meth:`~.QuantumCircuit.from_qasm_file`) have been + switched to use the Rust-based parser added in Qiskit Terra 0.24. This should result in + significantly faster parsing times (10 times or more is not uncommon) and massively reduced + intermediate memory usage. + + The :class:`.QuantumCircuit` methods are kept with the same interface for continuity; the + preferred way to access the OpenQASM 2 importer is to use :func:`.qasm2.load` and + :func:`.qasm2.loads`, which offer an expanded interface to control the parsing and construction. + +.. releasenotes/notes/0.25/qasm3-alias-refactor-3389bfce3e29e4cf.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The OpenQASM 3 exporters (:func:`.qasm3.dump`, :func:`~.qasm3.dumps` and :class:`~.qasm3.Exporter`) + will now use fewer "register alias" definitions in its output. The circuit described will not + change, but it will now preferentially export in terms of direct ``bit``, ``qubit`` and + ``qubit[n]`` types rather than producing a ``_loose_bits`` register and aliasing more registers + off this. This is done to minimise the number of advanced OpenQASM 3 features in use, and to + avoid introducing unnecessary array structure into programmes that do not require it. + + +.. _Release Notes_0.25.0_Quantum Information Upgrade Notes: + +Quantum Information Upgrade Notes +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/clifford-no-circuly-c7c4a1c9c5472af7.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- :meth:`.Clifford.from_circuit` will no longer attempt to resolve instructions whose + :attr:`~.circuit.Instruction.definition` fields are mutually recursive with some other object. + Such recursive definitions are already a violation of the strictly hierarchical ordering that + the :attr:`~.circuit.Instruction.definition` field requires, and code should not rely on this + being possible at all. If you want to define equivalences that are permitted to have (mutual) + cycles, use an :class:`.EquivalenceLibrary`. + + +.. _Release Notes_0.25.0_Visualization Upgrade Notes: + +Visualization Upgrade Notes +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/remove-deprecated-mpl-drawer-9d6eaa40d5a86777.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- In the internal ``~qiskit.visualization.circuit.matplotlib.MatplotlibDrawer`` object, the arguments + ``layout``, ``global_phase``, ``qregs`` and ``cregs`` have been removed. They were originally + deprecated in Qiskit Terra 0.20. These objects are simply inferred from the given ``circuit`` + now. + + This is an internal worker class of the visualization routines. It is unlikely you will + need to change any of your code. + + +.. _Release Notes_0.25.0_Misc. Upgrade Notes: + +Misc. Upgrade Notes +^^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/remove-util-3cd9eae2efc95176.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The ``qiskit.util`` import location has been removed, as it had + been deprecated since Qiskit Terra 0.17. Users should use the new + import location, ``qiskit.utils``. + + +.. _Release Notes_0.25.0_Deprecation Notes: + +Deprecation Notes +----------------- + +.. releasenotes/notes/0.25/deprecate-namespace-a2ac600f140755e2.yaml @ b'a8faffb120d2b08968bf444acbe6b55ad0c37f39' + +- Extensions of the ``qiskit`` and ``qiskit.providers`` namespaces by external + packages are now deprecated and the hook points enabling this will be + removed in a future release. In the past, the Qiskit project was composed + of elements that extended a shared namespace and these hook points enabled + doing that. However, it was not intended for these interfaces to ever be + used by other packages. Now that the overall Qiskit package is no longer + using that packaging model, leaving the possibility for these extensions + carry more risk than benefits and is therefore being deprecated for + future removal. If you're maintaining a package that extends the Qiskit + namespace (i.e. your users import from ``qiskit.x`` or + ``qiskit.providers.y``) you should transition to using a standalone + Python namespace for your package. No warning will be raised as part of this + because there is no method to inject a warning at the packaging level that + would be required to warn external packages of this change. + +.. releasenotes/notes/0.25/qiskit_version-956916f7b8d7bbb9.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The dictionary ``qiskit.__qiskit_version__`` is deprecated, as Qiskit is defined with a single package (``qiskit-terra``). + In the future, ``qiskit.__version__`` will be the single point to query the Qiskit version, as a standard string. + + +.. _Release Notes_0.25.0_Transpiler Deprecations: + +Transpiler Deprecations +^^^^^^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/deprecate-get_vf2_call_limit-826e0f9212fb27b9.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The function ``get_vf2_call_limit`` available via the module + :mod:`qiskit.transpiler.preset_passmanagers.common` has been + deprecated. This will likely affect very few users since this function was + neither explicitly exported nor documented. Its functionality has been + replaced and extended by a function in the same module. + + +.. _Release Notes_0.25.0_Circuits Deprecations: + +Circuits Deprecations +^^^^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/deprecate-instruction-qasm-9380f721e7bdaf6b.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The method :meth:`~qiskit.circuit.Instruction.qasm` and all overriding methods of subclasses + of `:class:~qiskit.circuit.Instruction` are deprecated. There is no replacement for generating + an OpenQASM2 string for an isolated instruction as typically + a single instruction object has insufficient context to completely + generate a valid OpenQASM2 string. If you're relying on this + method currently you'll have to instead rely on the OpenQASM2 + exporter: :meth:`.QuantumCircuit.qasm` to generate the OpenQASM2 + for an entire circuit object. + + +.. _Release Notes_0.25.0_Algorithms Deprecations: + +Algorithms Deprecations +^^^^^^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/deprecate-algorithms-7149dee2da586549.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The :mod:`qiskit.algorithms` module has been deprecated and will be removed + in a future release. It has been superseded by a new standalone library + ``qiskit-algorithms`` which can be found on PyPi or on Github here: + + https://github.com/qiskit-community/qiskit-algorithms + + The :mod:`qiskit.algorithms` module will continue to work as before and bug fixes + will be made to it until its future removal, but active development + of new features has moved to the new package. + If you're relying on :mod:`qiskit.algorithms` you should update your + Python requirements to also include ``qiskit-algorithms`` and update the imports + from ``qiskit.algorithms`` to ``qiskit_algorithms``. Please note that this + new package does not include already deprecated algorithms code, including + ``opflow`` and ``QuantumInstance``-based algorithms. If you have not yet + migrated from ``QuantumInstance``-based to primitives-based algorithms, + you should follow the migration guidelines in https://qisk.it/algo_migration. + The decision to migrate the :mod:`~.algorithms` module to a + separate package was made to clarify the purpose Qiskit and + make a distinction between the tools and libraries built on top of it. + + +.. _Release Notes_0.25.0_Pulse Deprecations: + +Pulse Deprecations +^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/deprecate-complex-amp-41381bd9722bc878.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Initializing a :class:`~qiskit.pulse.library.ScalableSymbolicPulse` with complex value for ``amp``. + This change also affects the following library pulses: + + * :class:`~qiskit.pulse.library.Gaussian` + * :class:`~qiskit.pulse.library.GaussianSquare` + * :class:`~qiskit.pulse.library.Drag` + * :class:`~qiskit.pulse.library.Constant` + + Initializing ``amp`` for these with a complex value is now deprecated as well. + + Instead, use two floats when specifying the ``amp`` and ``angle`` parameters, where ``amp`` represents the + magnitude of the complex amplitude, and `angle` represents the angle of the complex amplitude. i.e. the + complex amplitude is given by :math:`\texttt{amp} \times \exp(i \times \texttt{angle})`. + +.. releasenotes/notes/0.25/deprecate-pulse-Call-instruction-538802d8fad7e257.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The :class:`~qiskit.pulse.instructions.Call` instruction has been deprecated and will + be removed in a future release. + Instead, use function :func:`~qiskit.pulse.builder.call` from module + :mod:`qiskit.pulse.builder` within an active building context. + + +.. _Release Notes_0.25.0_Misc. Deprecations: + +Misc. Deprecations +^^^^^^^^^^^^^^^^^^ + +.. releasenotes/notes/0.25/deprecate-circuit-library-jupyter-629f927e8dd5cc22.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The Jupyter magic ``%circuit_library_info`` and the objects in ``qiskit.tools.jupyter.library`` + it calls in turn: + + - ``circuit_data_table`` + - ``properties_widget`` + - ``qasm_widget`` + - ``circuit_digram_widget`` + - ``circuit_library_widget`` + + are deprecated and will be removed in a future release. These objects were only intended for use in + the documentation build. They are no longer used there, so are no longer supported or maintained. + + +.. _Release Notes_0.25.0_Known Issues: + +Known Issues +------------ + +.. releasenotes/notes/expr-rvalue-conditions-8b5d5f7c015658c0.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Circuits containing classical expressions made with the :mod:`~.classical.expr` module are not + yet supported by the circuit visualizers. + + +.. _Release Notes_0.25.0_Bug Fixes: + +Bug Fixes +--------- + +.. releasenotes/notes/channel-validation-bug-fix-c06f8445cecc8478.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Fixed a bug in :class:`~qiskit.pulse.channels.Channel` where index validation was done incorrectly and only + raised an error when the index was both non-integer and negative, instead of either. + +.. releasenotes/notes/fix-final-layout-in-apply-layout-dfbdbde593cf7929.yaml @ b'04c810861f54c06e2a32a67ac42c299d169b91ef' + +- Fixed an issue with the :func:`~.transpile` function and all the preset + pass managers generated via :func:`~.generate_preset_pass_manager` where + the output :class:`~.QuantumCircuit` object's :attr:`~.QuantumCircuit.layout` + attribute would have an invalid :attr:`.TranspileLayout.final_layout` + attribute. This would occur in scenarios when the :class:`~.VF2PostLayout` + pass would run and find an alternative initial layout that has lower + reported error rates. When altering the initial layout the + :attr:`~.TranspileLayout.final_layout` attribute was never updated to + reflect this change. This has been corrected so that the ``final_layout`` + is always correctly reflecting the output permutation caused by the routing + stage. + Fixed `#10457 `__ + +.. releasenotes/notes/qasm2-fix-zero-op-barrier-4af211b119d5b24d.yaml @ b'f1ea299c328a895079550065fafe94b85c705f7c' + +- The OpenQASM 2 parser (:func:`.qasm2.load` and :func:`~.qasm2.loads`) running in ``strict`` mode + will now correctly emit an error if a ``barrier`` statement has no arguments. When running in + the (default) more permissive mode, an argument-less ``barrier`` statement will continue to + cause a barrier on all qubits currently in scope (the qubits a gate definition affects, or all + the qubits defined by a program, if the statement is in a gate body or in the global scope, + respectively). + +.. releasenotes/notes/qasm2-fix-zero-op-barrier-4af211b119d5b24d.yaml @ b'f1ea299c328a895079550065fafe94b85c705f7c' + +- The OpenQASM 2 exporter (:meth:`.QuantumCircuit.qasm`) will now no longer attempt + to output ``barrier`` statements that act on no qubits. Such a barrier statement has no effect + in Qiskit either, but is invalid OpenQASM 2. + +.. releasenotes/notes/qasm_invalid_custom_instruction-7738db7ba1a1a5cf.yaml @ b'97e1808067ac61e42ee6cbf97632c5d540126db2' + +- Qiskit can represent custom instructions that act on zero qubits, or on a non-zero number of + classical bits. These cannot be exported to OpenQASM 2, but previously :meth:`.QuantumCircuit.qasm` + would try, and output invalid OpenQASM 2. Instead, a :exc:`.QASM2ExportError` will now correctly + be raised. See `#7351 `__ and + `#10435 `__. + +.. releasenotes/notes/0.25/ancilla_allocation_no_cmap-ac3ff65b3639988e.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Fixed an issue with using :class:`~.Target`\ s without coupling maps with the :class:`~.FullAncillaAllocation` transpiler pass. + In this case, :class:`~.FullAncillaAllocation` will now add + ancilla qubits so that the number of qubits in the :class:`~.DAGCircuit` matches + that of :attr:`Target.num_qubits`. + +.. releasenotes/notes/0.25/dag-substitute-node-propagate-condition-898052b53edb1f17.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- :meth:`.DAGCircuit.substitute_node` will no longer silently overwrite an existing condition on + the given replacement ``op``. If ``propagate_condition`` is set to ``True`` (the default), a + :exc:`.DAGCircuitError` will be raised instead. + +.. releasenotes/notes/0.25/faster-parameter-rebind-3c799e74456469d9.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- A parametrised circuit that contains a custom gate whose definition has a parametrised global phase + can now successfully bind the parameter in the inner global phase. + See `#10283 `__ for more detail. + +.. releasenotes/notes/0.25/fix-0q-operator-statevector-79199c65c24637c4.yaml @ b'a8faffb120d2b08968bf444acbe6b55ad0c37f39' + +- Construction of a :class:`~.quantum_info.Statevector` from a :class:`.QuantumCircuit` containing + zero-qubit operations will no longer raise an error. These operations impart a global phase on + the resulting statevector. + +.. releasenotes/notes/0.25/fix-controlflow-builder-nested-switch-008b8c43b2153a1f.yaml @ b'a8faffb120d2b08968bf444acbe6b55ad0c37f39' + +- The control-flow builder interface will now correctly include :class:`.ClassicalRegister` + resources from nested switch statements in their containing circuit scopes. See `#10398 + `__. + +.. releasenotes/notes/0.25/fix-decompose-name-f83f5e4e64918aa9.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Fixed an issue in :meth:`.QuantumCircuit.decompose` + where passing a circuit name to the function that matched a + composite gate name would not decompose the gate if it had a label + assigned to it as well. + Fixed `#9136 `__ + +.. releasenotes/notes/0.25/fix-plot-legend-not-showing-up-3202bec143529e49.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Fixed an issue with :func:`qiskit.visualization.plot_histogram` where the relative legend + did not show up when the given dataset had a zero value in the first position. + See `#10158 `__ for more details. + +.. releasenotes/notes/0.25/fix-update-from-instruction-schedule-map-d1cba4e4db4b679e.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Fixed a failure with method :meth:`.Target.update_from_instruction_schedule_map` + triggered by the given ``inst_map`` containing a :class:`~qiskit.pulse.Schedule` + with unassigned durations. + +.. releasenotes/notes/0.25/fix_9016-2e8bc2cb10b5e204.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- When the parameter ``conditional=True`` is specified in + :func:`~qiskit.circuit.random.random_circuit`, conditional operations + in the resulting circuit will + now be preceded by a full mid-circuit measurment. + Fixes `#9016 `__ + +.. releasenotes/notes/0.25/improve-quantum-circuit-assign-parameters-typing-70c9623405cbd420.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Improved the type annotations on the + :meth:`.QuantumCircuit.assign_parameters` + method to reflect the change in return type depending on the ``inplace`` + argument. + +.. releasenotes/notes/0.25/new-circuit-qasm2-methods-b1a06ee2859e2cce.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The OpenQASM 2 circuit-constructor methods (:meth:`.QuantumCircuit.from_qasm_str` and + :meth:`~.QuantumCircuit.from_qasm_file`) will no longer error when encountering a ``gate`` + definition that contains ``U`` or ``CX`` instructions. See `#5536 + `__. + +.. releasenotes/notes/0.25/optimize-consolidate-blocks-3ea60c18bc546273.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Reduced overhead of the :class:`.ConsolidateBlocks` pass by performing matrix operations + on all two-qubit blocks instead of creating an instance of :class:`.QuantumCircuit` and + passing it to an :class:`.Operator`. + The speedup will only be applicable when consolidating two-qubit blocks. Anything higher + than that will still be handled by the :class:`.Operator` class. + Check `#8779 `__ for details. + +.. releasenotes/notes/0.25/qasm3-no-subroutine-b69c5ed7c65ce9ac.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- The OpenQASM 3 exporter (:mod:`qiskit.qasm3`) will no longer output invalid OpenQASM 3 for + non-unitary :class:`~.circuit.Instruction` instances, but will instead raise a + :exc:`.QASM3ExporterError` explaining that these are not yet supported. This feature is + slated for a later release of Qiskit, when there are more classical-processing facilities + throughout the library. + +.. releasenotes/notes/0.25/support-SparsePauliOp-Parameter-multiplication-245173f0b232f59b.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Fixes issue `#10185 `__. + +.. releasenotes/notes/0.25/unintended-rounding-with-max-size-1498af5f9a467990.yaml @ b'fa0491b87736f5244c0e604df71cfcd91683aa43' + +- Fixed an issue with function :func:`~qiskit.visualization.state_visualization.state_to_latex`. + Previously, it produced invalid LaTeX with unintended coefficient rounding, which resulted in + errors when calling :func:`~qiskit.visualization.state_visualization.state_drawer`. + Fixed `#9297 `__. + ************* Qiskit 0.43.3 ************* diff --git a/requirements-dev.txt b/requirements-dev.txt index 44b3ab148159..bcd09066a60a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,5 @@ qiskit-ibmq-provider[visualization] +qiskit-aer numpy>=1.17 Sphinx>=6.0 qiskit-sphinx-theme~=1.13.0 diff --git a/setup.py b/setup.py index d52633888a5c..96bd1c5929e7 100755 --- a/setup.py +++ b/setup.py @@ -24,9 +24,7 @@ # putting multiple requirements on the same line will prevent qiskit-bot # from correctly updating the versions for the qiskit packages. requirements = [ - "qiskit-terra==0.24.2", - "qiskit-aer==0.12.2", - "qiskit-ibmq-provider==0.20.2", + "qiskit-terra==0.25.0", ] @@ -66,7 +64,7 @@ setup( name="qiskit", - version="0.43.3", + version="0.44.0", description="Software for developing quantum computing programs", long_description=README, long_description_content_type="text/markdown", diff --git a/test/test_simulation.py b/test/test_simulation.py deleted file mode 100644 index 7cbc316d84b3..000000000000 --- a/test/test_simulation.py +++ /dev/null @@ -1,36 +0,0 @@ -# -*- coding: utf-8 -*- - -# This code is part of Qiskit. -# -# (C) Copyright IBM 2018. -# -# This code is licensed under the Apache License, Version 2.0. You may -# obtain a copy of this license in the LICENSE.txt file in the root directory -# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. -# -# Any modifications or derivative works of this code must retain this -# copyright notice, and modified files need to carry a notice indicating -# that they have been altered from the originals. - -"""Tests for Aer simulation""" - -import qiskit - -from .base import QiskitTestCase - - -class TestAerSimulation(QiskitTestCase): - """Tests for Aer simulation""" - - def test_execute_in_aer(self): - """Test executing a circuit in an Aer simulator""" - qr = qiskit.QuantumRegister(1) - cr = qiskit.ClassicalRegister(1) - circuit = qiskit.QuantumCircuit(qr, cr) - circuit.h(qr[0]) - circuit.measure(qr, cr) - - backend = qiskit.Aer.get_backend("qasm_simulator") - shots = 2000 - results = qiskit.execute(circuit, backend, shots=shots).result() - self.assertDictAlmostEqual({"0": 1000, "1": 1000}, results.get_counts(), delta=100)