diff --git a/docs/apidocs/synthesis.rst b/docs/apidocs/synthesis.rst new file mode 100644 index 00000000000..794bce3f2c6 --- /dev/null +++ b/docs/apidocs/synthesis.rst @@ -0,0 +1,6 @@ +.. _qiskit-synthesis: + +.. automodule:: qiskit.synthesis + :no-members: + :no-inherited-members: + :no-special-members: diff --git a/docs/apidocs/synthesis_aqc.rst b/docs/apidocs/synthesis_aqc.rst new file mode 100644 index 00000000000..0ce100071a5 --- /dev/null +++ b/docs/apidocs/synthesis_aqc.rst @@ -0,0 +1,6 @@ +.. _qiskit-transpiler-synthesis-aqc: + +.. automodule:: qiskit.transpiler.synthesis.aqc + :no-members: + :no-inherited-members: + :no-special-members: diff --git a/docs/apidocs/terra.rst b/docs/apidocs/terra.rst index d6f0244e25d..489083d0bd5 100644 --- a/docs/apidocs/terra.rst +++ b/docs/apidocs/terra.rst @@ -21,6 +21,7 @@ Qiskit Terra API Reference providers_models pulse scheduler + synthesis qasm qobj qpy @@ -32,6 +33,7 @@ Qiskit Terra API Reference transpiler_passes transpiler_preset transpiler_plugins + transpiler_builtin_plugins utils utils_mitigation opflow diff --git a/docs/apidocs/transpiler_builtin_plugins.rst b/docs/apidocs/transpiler_builtin_plugins.rst new file mode 100644 index 00000000000..8bc2b105ed2 --- /dev/null +++ b/docs/apidocs/transpiler_builtin_plugins.rst @@ -0,0 +1,10 @@ +.. _qiskit-transpiler-builtin-plugins: + +===================================== +Built-in Transpiler Synthesis Plugins +===================================== + +.. toctree:: + :maxdepth: 2 + + synthesis_aqc diff --git a/qiskit/circuit/library/__init__.py b/qiskit/circuit/library/__init__.py index e95645d78c0..36b52c68c28 100644 --- a/qiskit/circuit/library/__init__.py +++ b/qiskit/circuit/library/__init__.py @@ -187,6 +187,15 @@ QuadraticForm +Other arithmetic functions +-------------------------- + +.. autosummary:: + :toctree: ../stubs/ + :template: autosummary/class_no_inherited_members.rst + + ExactReciprocal + Amplitude Functions =================== @@ -393,6 +402,7 @@ PiecewiseChebyshev, HRSCumulativeMultiplier, RGQFTMultiplier, + ExactReciprocal, ) from .n_local import ( diff --git a/qiskit/circuit/library/arithmetic/__init__.py b/qiskit/circuit/library/arithmetic/__init__.py index 16560b2c1a9..71c6cb7f5df 100644 --- a/qiskit/circuit/library/arithmetic/__init__.py +++ b/qiskit/circuit/library/arithmetic/__init__.py @@ -24,3 +24,4 @@ from .adders import VBERippleCarryAdder, CDKMRippleCarryAdder, DraperQFTAdder from .piecewise_chebyshev import PiecewiseChebyshev from .multipliers import HRSCumulativeMultiplier, RGQFTMultiplier +from .exact_reciprocal import ExactReciprocal diff --git a/qiskit/circuit/library/arithmetic/exact_reciprocal.py b/qiskit/circuit/library/arithmetic/exact_reciprocal.py index b7f828f1033..164f0f923f1 100644 --- a/qiskit/circuit/library/arithmetic/exact_reciprocal.py +++ b/qiskit/circuit/library/arithmetic/exact_reciprocal.py @@ -31,15 +31,18 @@ def __init__( r""" Args: num_state_qubits: The number of qubits representing the value to invert. - scaling: Scaling factor of the reciprocal function, i.e. to compute - ::math:: `scaling / x`. - neg_vals: Whether x might represent negative values. In this case the first qubit is - the sign, with |1> for negative and |0> for positive. For the negative case it is - assumed that the remaining string represents 1 - x. This is because - ::math:: `e^{-2 \pi i x} = e^{2 \pi i (1 - x)}` for ::math:: `x \in [0,1)`. + scaling: Scaling factor :math:`s` of the reciprocal function, i.e. to compute + :math:`s / x`. + neg_vals: Whether :math:`x` might represent negative values. In this case the first + qubit is the sign, with :math:`|1\rangle` for negative and :math:`|0\rangle` for + positive. For the negative case it is assumed that the remaining string represents + :math:`1 - x`. This is because :math:`e^{-2 \pi i x} = e^{2 \pi i (1 - x)}` for + :math:`x \in [0,1)`. name: The name of the object. - Note: - It is assumed that the binary string x represents a number < 1. + + .. note:: + + It is assumed that the binary string :math:`x` represents a number < 1. """ qr_state = QuantumRegister(num_state_qubits, "state") qr_flag = QuantumRegister(1, "flag") diff --git a/qiskit/circuit/library/basis_change/qft.py b/qiskit/circuit/library/basis_change/qft.py index e9f839ce8fc..8767dd2f724 100644 --- a/qiskit/circuit/library/basis_change/qft.py +++ b/qiskit/circuit/library/basis_change/qft.py @@ -111,11 +111,9 @@ def num_qubits(self) -> int: Returns: The number of qubits in the circuit. - - Note: - This method needs to be overwritten to allow adding the setter for num_qubits while - still complying to pylint. """ + # This method needs to be overwritten to allow adding the setter for num_qubits while still + # complying to pylint. return super().num_qubits @num_qubits.setter diff --git a/qiskit/extensions/__init__.py b/qiskit/extensions/__init__.py index ae6ac1da470..d2476ef27a2 100644 --- a/qiskit/extensions/__init__.py +++ b/qiskit/extensions/__init__.py @@ -25,6 +25,7 @@ UnitaryGate HamiltonianGate + SingleQubitUnitary Simulator Extensions ==================== @@ -47,7 +48,7 @@ from qiskit.circuit.library.standard_gates import * from qiskit.circuit.barrier import Barrier -from .quantum_initializer.initializer import Initialize +from .quantum_initializer import Initialize, SingleQubitUnitary from .unitary import UnitaryGate from .hamiltonian_gate import HamiltonianGate from .simulator import Snapshot diff --git a/qiskit/extensions/quantum_initializer/__init__.py b/qiskit/extensions/quantum_initializer/__init__.py index ffaebf9e190..0d45f39a716 100644 --- a/qiskit/extensions/quantum_initializer/__init__.py +++ b/qiskit/extensions/quantum_initializer/__init__.py @@ -19,3 +19,4 @@ from .diagonal import DiagonalGate from .uc import UCGate from .isometry import Isometry +from .initializer import Initialize diff --git a/qiskit/extensions/quantum_initializer/initializer.py b/qiskit/extensions/quantum_initializer/initializer.py index daa07b54ba3..fd929b57ed1 100644 --- a/qiskit/extensions/quantum_initializer/initializer.py +++ b/qiskit/extensions/quantum_initializer/initializer.py @@ -28,7 +28,6 @@ from qiskit.circuit.library.standard_gates.ry import RYGate from qiskit.circuit.library.standard_gates.rz import RZGate from qiskit.circuit.reset import Reset -from qiskit.quantum_info import Statevector _EPS = 1e-10 # global variable used to chop very small numbers to zero @@ -61,6 +60,9 @@ def __init__(self, params, num_qubits=None): and params is 3. This allows qubits 0 and 1 to be initialized to `|1>` and the remaining 3 qubits to be initialized to `|0>`. """ + # pylint: disable=cyclic-import + from qiskit.quantum_info import Statevector + if isinstance(params, Statevector): params = params.data diff --git a/qiskit/pulse/__init__.py b/qiskit/pulse/__init__.py index 1cef1af715b..d4b446e3491 100644 --- a/qiskit/pulse/__init__.py +++ b/qiskit/pulse/__init__.py @@ -10,101 +10,38 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -""" +r""" =========================== Pulse (:mod:`qiskit.pulse`) =========================== +.. currentmodule:: qiskit.pulse + Qiskit-Pulse is a pulse-level quantum programming kit. This lower level of programming offers the user more control than programming with -:py:class:`~qiskit.circuit.QuantumCircuit` s. +:py:class:`~qiskit.circuit.QuantumCircuit`\ s. Extracting the greatest performance from quantum hardware requires real-time pulse-level instructions. Pulse answers that need: it enables the quantum physicist *user* to specify the exact time dynamics of an experiment. It is especially powerful for error mitigation techniques. -The input is given as arbitrary, time-ordered signals (see: :ref:`pulse-insts`) +The input is given as arbitrary, time-ordered signals (see: :ref:`Instructions `) scheduled in parallel over multiple virtual hardware or simulator resources -(see: :ref:`pulse-channels`). The system also allows the user to recover the +(see: :ref:`Channels `). The system also allows the user to recover the time dynamics of the measured output. This is sufficient to allow the quantum physicist to explore and correct for noise in a quantum system. -.. _pulse-insts: - -Instructions (:mod:`qiskit.pulse.instructions`) -================================================ - -.. autosummary:: - :toctree: ../stubs/ - - ~qiskit.pulse.instructions - - Acquire - Call - Delay - Play - SetFrequency - ShiftFrequency - SetPhase - ShiftPhase - Snapshot - - -Pulse Library (waveforms :mod:`qiskit.pulse.library`) -===================================================== - -.. autosummary:: - :toctree: ../stubs/ - - library - library.discrete - - Waveform - Constant - Drag - Gaussian - GaussianSquare - -.. _pulse-channels: - -Channels (:mod:`qiskit.pulse.channels`) -======================================== - -Pulse is meant to be agnostic to the underlying hardware implementation, while still allowing -low-level control. Therefore, our signal channels are *virtual* hardware channels. The backend -which executes our programs is responsible for mapping these virtual channels to the proper -physical channel within the quantum control hardware. - -Channels are characterized by their type and their index. See each channel type below to learn more. - -.. autosummary:: - :toctree: ../stubs/ - - channels - - DriveChannel - MeasureChannel - AcquireChannel - ControlChannel - RegisterSlot - MemorySlot - - -Schedules -========= - -Schedules are Pulse programs. They describe instruction sequences for the control hardware. - -.. autosummary:: - :toctree: ../stubs/ - - Schedule - ScheduleBlock - Instruction +.. automodule:: qiskit.pulse.instructions +.. automodule:: qiskit.pulse.library +.. automodule:: qiskit.pulse.channels +.. automodule:: qiskit.pulse.schedule +.. automodule:: qiskit.pulse.transforms +.. automodule:: qiskit.pulse.builder +.. currentmodule:: qiskit.pulse Configuration ============= @@ -114,271 +51,10 @@ InstructionScheduleMap - -Schedule Transforms (:mod:`qiskit.pulse.transforms`) -==================================================== - -Schedule transforms take :class:`Schedule` s as input and return modified -:class:`Schedule` s. - -.. autosummary:: - :toctree: ../stubs/ - - transforms.align_measures - transforms.add_implicit_acquires - transforms.pad - Exceptions ========== -.. autosummary:: - :toctree: ../stubs/ - - PulseError - - -Pulse Builder (:mod:`~qiskit.pulse.builder`) -=================================================== - -.. warning:: - The pulse builder interface is still in active development. It may have - breaking API changes without deprecation warnings in future releases until - otherwise indicated. - -The pulse builder provides an imperative API for writing pulse programs -with less difficulty than the :class:`~qiskit.pulse.Schedule` API. -It contextually constructs a pulse schedule and then emits the schedule for -execution. For example to play a series of pulses on channels is as simple as: - - -.. jupyter-execute:: - - from qiskit import pulse - - dc = pulse.DriveChannel - d0, d1, d2, d3, d4 = dc(0), dc(1), dc(2), dc(3), dc(4) - - with pulse.build(name='pulse_programming_in') as pulse_prog: - pulse.play([1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1], d0) - pulse.play([1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0], d1) - pulse.play([1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0], d2) - pulse.play([1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0], d3) - pulse.play([1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0], d4) - - pulse_prog.draw() - - -In the future the pulse builder will be coupled to the -:class:`~qiskit.circuit.QuantumCircuit` with an equivalent circuit builder -interface. - -.. autosummary:: - :toctree: ../stubs/ - - ~qiskit.pulse.builder.build - - -Channels --------- -Methods to return the correct channels for the respective qubit indices. - -.. jupyter-execute:: - - from qiskit import pulse - from qiskit.test.mock import FakeArmonk - - backend = FakeArmonk() - - with pulse.build(backend) as drive_sched: - d0 = pulse.drive_channel(0) - print(d0) - - -.. autosummary:: - :toctree: ../stubs/ - - ~qiskit.pulse.builder.acquire_channel - ~qiskit.pulse.builder.control_channels - ~qiskit.pulse.builder.drive_channel - ~qiskit.pulse.builder.measure_channel - - -Instructions ------------- -Pulse instructions are available within the builder interface. Here's an example: - -.. jupyter-execute:: - - from qiskit import pulse - from qiskit.test.mock import FakeArmonk - - backend = FakeArmonk() - - with pulse.build(backend) as drive_sched: - d0 = pulse.drive_channel(0) - a0 = pulse.acquire_channel(0) - - pulse.play(pulse.library.Constant(10, 1.0), d0) - pulse.delay(20, d0) - pulse.shift_phase(3.14/2, d0) - pulse.set_phase(3.14, d0) - pulse.shift_frequency(1e7, d0) - pulse.set_frequency(5e9, d0) - - with pulse.build() as temp_sched: - pulse.play(pulse.library.Gaussian(20, 1.0, 3.0), d0) - pulse.play(pulse.library.Gaussian(20, -1.0, 3.0), d0) - - pulse.call(temp_sched) - pulse.acquire(30, a0, pulse.MemorySlot(0)) - - drive_sched.draw() - - -.. autosummary:: - :toctree: ../stubs/ - - ~qiskit.pulse.builder.acquire - ~qiskit.pulse.builder.barrier - ~qiskit.pulse.builder.call - ~qiskit.pulse.builder.delay - ~qiskit.pulse.builder.play - ~qiskit.pulse.builder.set_frequency - ~qiskit.pulse.builder.set_phase - ~qiskit.pulse.builder.shift_frequency - ~qiskit.pulse.builder.shift_phase - ~qiskit.pulse.builder.snapshot - - -Contexts --------- -Builder aware contexts that modify the construction of a pulse program. For -example an alignment context like :func:`~qiskit.pulse.builder.align_right` may -be used to align all pulses as late as possible in a pulse program. - -.. jupyter-execute:: - - from qiskit import pulse - - d0 = pulse.DriveChannel(0) - d1 = pulse.DriveChannel(1) - - with pulse.build() as pulse_prog: - with pulse.align_right(): - # this pulse will start at t=0 - pulse.play(pulse.Constant(100, 1.0), d0) - # this pulse will start at t=80 - pulse.play(pulse.Constant(20, 1.0), d1) - - pulse_prog.draw() - -.. autosummary:: - :toctree: ../stubs/ - - ~qiskit.pulse.builder.align_equispaced - ~qiskit.pulse.builder.align_func - ~qiskit.pulse.builder.align_left - ~qiskit.pulse.builder.align_right - ~qiskit.pulse.builder.align_sequential - ~qiskit.pulse.builder.circuit_scheduler_settings - ~qiskit.pulse.builder.frequency_offset - ~qiskit.pulse.builder.inline - ~qiskit.pulse.builder.pad - ~qiskit.pulse.builder.phase_offset - ~qiskit.pulse.builder.transpiler_settings - - -Macros ------- -Macros help you add more complex functionality to your pulse -program. - -.. jupyter-execute:: - - from qiskit import pulse - from qiskit.test.mock import FakeArmonk - - backend = FakeArmonk() - - with pulse.build(backend) as measure_sched: - mem_slot = pulse.measure(0) - print(mem_slot) - -.. autosummary:: - :toctree: ../stubs/ - - ~qiskit.pulse.builder.measure - ~qiskit.pulse.builder.measure_all - ~qiskit.pulse.builder.delay_qubits - - -Circuit Gates -------------- -To use circuit level gates within your pulse program call a circuit -with :func:`qiskit.pulse.builder.call`. - -.. warning:: - These will be removed in future versions with the release of a circuit - builder interface in which it will be possible to calibrate a gate in - terms of pulses and use that gate in a circuit. - -.. jupyter-execute:: - - import math - - from qiskit import pulse - from qiskit.test.mock import FakeArmonk - - backend = FakeArmonk() - - with pulse.build(backend) as u3_sched: - pulse.u3(math.pi, 0, math.pi, 0) - -.. autosummary:: - :toctree: ../stubs/ - - ~qiskit.pulse.builder.cx - ~qiskit.pulse.builder.u1 - ~qiskit.pulse.builder.u2 - ~qiskit.pulse.builder.u3 - ~qiskit.pulse.builder.x - - -Utilities ---------- -The utility functions can be used to gather attributes about the backend and modify -how the program is built. - -.. jupyter-execute:: - - from qiskit import pulse - - from qiskit.test.mock import FakeArmonk - - backend = FakeArmonk() - - with pulse.build(backend) as u3_sched: - print('Number of qubits in backend: {}'.format(pulse.num_qubits())) - - samples = 160 - print('There are {} samples in {} seconds'.format( - samples, pulse.samples_to_seconds(160))) - - seconds = 1e-6 - print('There are {} seconds in {} samples.'.format( - seconds, pulse.seconds_to_samples(1e-6))) - -.. autosummary:: - :toctree: ../stubs/ - - ~qiskit.pulse.builder.active_backend - ~qiskit.pulse.builder.active_transpiler_settings - ~qiskit.pulse.builder.active_circuit_scheduler_settings - ~qiskit.pulse.builder.num_qubits - ~qiskit.pulse.builder.qubit_channels - ~qiskit.pulse.builder.samples_to_seconds - ~qiskit.pulse.builder.seconds_to_samples - +.. autoclass:: PulseError """ # Builder imports. @@ -439,6 +115,7 @@ MeasureChannel, MemorySlot, RegisterSlot, + SnapshotChannel, ) from qiskit.pulse.configuration import ( Discriminator, diff --git a/qiskit/pulse/builder.py b/qiskit/pulse/builder.py index eceea8d6eec..56896e92a4f 100644 --- a/qiskit/pulse/builder.py +++ b/qiskit/pulse/builder.py @@ -10,13 +10,48 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -r"""Use the pulse builder DSL to write pulse programs with an imperative syntax. +r""" +============= +Pulse Builder +============= + +.. + We actually want people to think of these functions as being defined within the ``qiskit.pulse`` + namespace, not the submodule ``qiskit.pulse.builder``. + +.. currentmodule: qiskit.pulse + +Use the pulse builder DSL to write pulse programs with an imperative syntax. .. warning:: The pulse builder interface is still in active development. It may have breaking API changes without deprecation warnings in future releases until otherwise indicated. + +The pulse builder provides an imperative API for writing pulse programs +with less difficulty than the :class:`~qiskit.pulse.Schedule` API. +It contextually constructs a pulse schedule and then emits the schedule for +execution. For example, to play a series of pulses on channels is as simple as: + + +.. jupyter-execute:: + + from qiskit import pulse + + dc = pulse.DriveChannel + d0, d1, d2, d3, d4 = dc(0), dc(1), dc(2), dc(3), dc(4) + + with pulse.build(name='pulse_programming_in') as pulse_prog: + pulse.play([1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1], d0) + pulse.play([1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0], d1) + pulse.play([1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0], d2) + pulse.play([1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0], d3) + pulse.play([1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0], d4) + + pulse_prog.draw() + + To begin pulse programming we must first initialize our program builder context with :func:`build`, after which we can begin adding program statements. For example, below we write a simple program that :func:`play`\s @@ -33,7 +68,7 @@ pulse_prog.draw() -The builder initializes a :class:`pulse.Schedule`, ``pulse_prog`` +The builder initializes a :class:`.pulse.Schedule`, ``pulse_prog`` and then begins to construct the program within the context. The output pulse schedule will survive after the context is exited and can be executed like a normal Qiskit schedule using ``qiskit.execute(pulse_prog, backend)``. @@ -188,9 +223,220 @@ with pulse.phase_offset(math.pi, d0): pulse.play(gaussian_pulse, d0) -The above is just a small taste of what is possible with the builder. See the -rest of the module documentation for more information on its -capabilities. +The above is just a small taste of what is possible with the builder. See the rest of the module +documentation for more information on its capabilities. + +.. autosummary:: + :toctree: ../stubs/ + + build + + +Channels +======== + +Methods to return the correct channels for the respective qubit indices. + +.. jupyter-execute:: + + from qiskit import pulse + from qiskit.test.mock import FakeArmonk + + backend = FakeArmonk() + + with pulse.build(backend) as drive_sched: + d0 = pulse.drive_channel(0) + print(d0) + + +.. autosummary:: + :toctree: ../stubs/ + + acquire_channel + control_channels + drive_channel + measure_channel + + +Instructions +============ + +Pulse instructions are available within the builder interface. Here's an example: + +.. jupyter-execute:: + + from qiskit import pulse + from qiskit.test.mock import FakeArmonk + + backend = FakeArmonk() + + with pulse.build(backend) as drive_sched: + d0 = pulse.drive_channel(0) + a0 = pulse.acquire_channel(0) + + pulse.play(pulse.library.Constant(10, 1.0), d0) + pulse.delay(20, d0) + pulse.shift_phase(3.14/2, d0) + pulse.set_phase(3.14, d0) + pulse.shift_frequency(1e7, d0) + pulse.set_frequency(5e9, d0) + + with pulse.build() as temp_sched: + pulse.play(pulse.library.Gaussian(20, 1.0, 3.0), d0) + pulse.play(pulse.library.Gaussian(20, -1.0, 3.0), d0) + + pulse.call(temp_sched) + pulse.acquire(30, a0, pulse.MemorySlot(0)) + + drive_sched.draw() + + +.. autosummary:: + :toctree: ../stubs/ + + acquire + barrier + call + delay + play + set_frequency + set_phase + shift_frequency + shift_phase + snapshot + + +Contexts +======== + +Builder aware contexts that modify the construction of a pulse program. For +example an alignment context like :func:`align_right` may +be used to align all pulses as late as possible in a pulse program. + +.. jupyter-execute:: + + from qiskit import pulse + + d0 = pulse.DriveChannel(0) + d1 = pulse.DriveChannel(1) + + with pulse.build() as pulse_prog: + with pulse.align_right(): + # this pulse will start at t=0 + pulse.play(pulse.Constant(100, 1.0), d0) + # this pulse will start at t=80 + pulse.play(pulse.Constant(20, 1.0), d1) + + pulse_prog.draw() + +.. autosummary:: + :toctree: ../stubs/ + + align_equispaced + align_func + align_left + align_right + align_sequential + circuit_scheduler_settings + frequency_offset + inline + pad + phase_offset + transpiler_settings + + +Macros +====== + +Macros help you add more complex functionality to your pulse program. + +.. jupyter-execute:: + + from qiskit import pulse + from qiskit.test.mock import FakeArmonk + + backend = FakeArmonk() + + with pulse.build(backend) as measure_sched: + mem_slot = pulse.measure(0) + print(mem_slot) + +.. autosummary:: + :toctree: ../stubs/ + + measure + measure_all + delay_qubits + + +Circuit Gates +============= + +To use circuit level gates within your pulse program call a circuit +with :func:`call`. + +.. warning:: + These will be removed in future versions with the release of a circuit + builder interface in which it will be possible to calibrate a gate in + terms of pulses and use that gate in a circuit. + +.. jupyter-execute:: + + import math + + from qiskit import pulse + from qiskit.test.mock import FakeArmonk + + backend = FakeArmonk() + + with pulse.build(backend) as u3_sched: + pulse.u3(math.pi, 0, math.pi, 0) + +.. autosummary:: + :toctree: ../stubs/ + + cx + u1 + u2 + u3 + x + + +Utilities +========= + +The utility functions can be used to gather attributes about the backend and modify +how the program is built. + +.. jupyter-execute:: + + from qiskit import pulse + + from qiskit.test.mock import FakeArmonk + + backend = FakeArmonk() + + with pulse.build(backend) as u3_sched: + print('Number of qubits in backend: {}'.format(pulse.num_qubits())) + + samples = 160 + print('There are {} samples in {} seconds'.format( + samples, pulse.samples_to_seconds(160))) + + seconds = 1e-6 + print('There are {} seconds in {} samples.'.format( + seconds, pulse.seconds_to_samples(1e-6))) + +.. autosummary:: + :toctree: ../stubs/ + + active_backend + active_transpiler_settings + active_circuit_scheduler_settings + num_qubits + qubit_channels + samples_to_seconds + seconds_to_samples """ import collections import contextvars diff --git a/qiskit/pulse/channels.py b/qiskit/pulse/channels.py index a7230896c12..175d93ef8e8 100644 --- a/qiskit/pulse/channels.py +++ b/qiskit/pulse/channels.py @@ -10,15 +10,44 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -"""This module defines Pulse Channels. Channels include: +""" +.. _pulse-channels: + +======================================= +Channels (:mod:`qiskit.pulse.channels`) +======================================= + +Pulse is meant to be agnostic to the underlying hardware implementation, while still allowing +low-level control. Therefore, our signal channels are *virtual* hardware channels. The backend +which executes our programs is responsible for mapping these virtual channels to the proper +physical channel within the quantum control hardware. + +Channels are characterized by their type and their index. Channels include: + +* transmit channels, which should subclass ``PulseChannel`` +* receive channels, such as :class:`AcquireChannel` +* non-signal "channels" such as :class:`SnapshotChannel`, :class:`MemorySlot` and + :class:`RegisterChannel`. + +Novel channel types can often utilize the :class:`ControlChannel`, but if this is not sufficient, +new channel types can be created. Then, they must be supported in the PulseQobj schema and the +assembler. Channels are characterized by their type and their index. See each channel type below to +learn more. + +.. autosummary:: + :toctree: ../stubs/ + + DriveChannel + MeasureChannel + AcquireChannel + ControlChannel + RegisterSlot + MemorySlot + SnapshotChannel - - transmit channels, which should subclass ``PulseChannel`` - - receive channels, such as ``AcquireChannel`` - - non-signal "channels" such as ``SnapshotChannel``, ``MemorySlot`` and ``RegisterChannel``. +All channels are children of the same abstract base class: -Novel channel types can often utilize the ``ControlChannel``, but if this is not sufficient, new -channel types can be created. Then, they must be supported in the PulseQobj schema and the -assembler. +.. autoclass:: Channel """ from abc import ABCMeta from typing import Any, Set, Union diff --git a/qiskit/pulse/instructions/__init__.py b/qiskit/pulse/instructions/__init__.py index 9b9e05cb2ab..5a980f8c162 100644 --- a/qiskit/pulse/instructions/__init__.py +++ b/qiskit/pulse/instructions/__init__.py @@ -10,7 +10,14 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -"""The ``instruction`` module holds the various ``Instruction`` s which are supported by +r""" +.. _pulse-insts: + +=============================================== +Instructions (:mod:`qiskit.pulse.instructions`) +=============================================== + +The ``instructions`` module holds the various :obj:`Instruction`\ s which are supported by Qiskit Pulse. Instructions have operands, which typically include at least one :py:class:`~qiskit.pulse.channels.Channel` specifying where the instruction will be applied. @@ -43,13 +50,9 @@ ShiftPhase Snapshot -Abstract Classes ----------------- -.. autosummary:: - :toctree: ../stubs/ - - Instruction +These are all instances of the same base class: +.. autoclass:: Instruction """ from .acquire import Acquire from .delay import Delay diff --git a/qiskit/pulse/library/__init__.py b/qiskit/pulse/library/__init__.py index 7e20c4c3943..5ca954d3226 100644 --- a/qiskit/pulse/library/__init__.py +++ b/qiskit/pulse/library/__init__.py @@ -10,12 +10,17 @@ # copyright notice, and modified files need to carry a notice indicating # that they have been altered from the originals. -"""This library provides Pulse users with convenient methods to build Pulse waveforms. +r""" +===================================================== +Pulse Library (waveforms :mod:`qiskit.pulse.library`) +===================================================== -Arbitrary waveforms can be described with :py:class:`~qiskit.pulse.library.Waveform` s. +This library provides Pulse users with convenient methods to build Pulse waveforms. + +Arbitrary waveforms can be described with :py:class:`~qiskit.pulse.library.Waveform`\ s. The :py:mod:`~qiskit.pulse.library.discrete` module will generate -:py:class:`~qiskit.pulse.library.Waveform` s for common waveform envelopes. +:py:class:`~qiskit.pulse.library.Waveform`\ s for common waveform envelopes. The parametric pulses, :py:class:`~qiskit.pulse.library.Gaussian`, :py:class:`~qiskit.pulse.library.GaussianSquare`, :py:class:`~qiskit.pulse.library.Drag` and diff --git a/qiskit/pulse/library/discrete.py b/qiskit/pulse/library/discrete.py index 0f45076c1fd..4d14d0799a6 100644 --- a/qiskit/pulse/library/discrete.py +++ b/qiskit/pulse/library/discrete.py @@ -28,7 +28,7 @@ def constant(duration: int, amp: complex, name: Optional[str] = None) -> Waveform: - r"""Generates constant-sampled :class:`~qiskit.pulse.Waveform`. + r"""Generates constant-sampled :class:`~qiskit.pulse.library.Waveform`. For :math:`A=` ``amp``, samples from the function: @@ -48,7 +48,7 @@ def constant(duration: int, amp: complex, name: Optional[str] = None) -> Wavefor def zero(duration: int, name: Optional[str] = None) -> Waveform: - """Generates zero-sampled :class:`~qiskit.pulse.Waveform`. + """Generates zero-sampled :class:`~qiskit.pulse.library.Waveform`. Samples from the function: @@ -69,7 +69,7 @@ def zero(duration: int, name: Optional[str] = None) -> Waveform: def square( duration: int, amp: complex, freq: float = None, phase: float = 0, name: Optional[str] = None ) -> Waveform: - r"""Generates square wave :class:`~qiskit.pulse.Waveform`. + r"""Generates square wave :class:`~qiskit.pulse.library.Waveform`. For :math:`A=` ``amp``, :math:`T=` ``period``, and :math:`\phi=` ``phase``, applies the `midpoint` sampling strategy to generate a discrete pulse sampled from @@ -101,7 +101,7 @@ def square( def sawtooth( duration: int, amp: complex, freq: float = None, phase: float = 0, name: Optional[str] = None ) -> Waveform: - r"""Generates sawtooth wave :class:`~qiskit.pulse.Waveform`. + r"""Generates sawtooth wave :class:`~qiskit.pulse.library.Waveform`. For :math:`A=` ``amp``, :math:`T=` ``period``, and :math:`\phi=` ``phase``, applies the `midpoint` sampling strategy to generate a discrete pulse sampled from @@ -145,7 +145,7 @@ def sawtooth( def triangle( duration: int, amp: complex, freq: float = None, phase: float = 0, name: Optional[str] = None ) -> Waveform: - r"""Generates triangle wave :class:`~qiskit.pulse.Waveform`. + r"""Generates triangle wave :class:`~qiskit.pulse.library.Waveform`. For :math:`A=` ``amp``, :math:`T=` ``period``, and :math:`\phi=` ``phase``, applies the `midpoint` sampling strategy to generate a discrete pulse sampled from @@ -189,7 +189,7 @@ def triangle( def cos( duration: int, amp: complex, freq: float = None, phase: float = 0, name: Optional[str] = None ) -> Waveform: - r"""Generates cosine wave :class:`~qiskit.pulse.Waveform`. + r"""Generates cosine wave :class:`~qiskit.pulse.library.Waveform`. For :math:`A=` ``amp``, :math:`\omega=` ``freq``, and :math:`\phi=` ``phase``, applies the `midpoint` sampling strategy to generate a discrete pulse sampled from @@ -218,7 +218,7 @@ def cos( def sin( duration: int, amp: complex, freq: float = None, phase: float = 0, name: Optional[str] = None ) -> Waveform: - r"""Generates sine wave :class:`~qiskit.pulse.Waveform`. + r"""Generates sine wave :class:`~qiskit.pulse.library.Waveform`. For :math:`A=` ``amp``, :math:`\omega=` ``freq``, and :math:`\phi=` ``phase``, applies the `midpoint` sampling strategy to generate a discrete pulse sampled from @@ -247,7 +247,7 @@ def sin( def gaussian( duration: int, amp: complex, sigma: float, name: Optional[str] = None, zero_ends: bool = True ) -> Waveform: - r"""Generates unnormalized gaussian :class:`~qiskit.pulse.Waveform`. + r"""Generates unnormalized gaussian :class:`~qiskit.pulse.library.Waveform`. For :math:`A=` ``amp`` and :math:`\sigma=` ``sigma``, applies the ``midpoint`` sampling strategy to generate a discrete pulse sampled from the continuous function: @@ -291,7 +291,7 @@ def gaussian( def gaussian_deriv( duration: int, amp: complex, sigma: float, name: Optional[str] = None ) -> Waveform: - r"""Generates unnormalized gaussian derivative :class:`~qiskit.pulse.Waveform`. + r"""Generates unnormalized gaussian derivative :class:`~qiskit.pulse.library.Waveform`. For :math:`A=` ``amp`` and :math:`\sigma=` ``sigma`` applies the `midpoint` sampling strategy to generate a discrete pulse sampled from the continuous function: @@ -318,7 +318,7 @@ def gaussian_deriv( def sech( duration: int, amp: complex, sigma: float, name: str = None, zero_ends: bool = True ) -> Waveform: - r"""Generates unnormalized sech :class:`~qiskit.pulse.Waveform`. + r"""Generates unnormalized sech :class:`~qiskit.pulse.library.Waveform`. For :math:`A=` ``amp`` and :math:`\sigma=` ``sigma``, applies the ``midpoint`` sampling strategy to generate a discrete pulse sampled from the continuous function: @@ -358,7 +358,7 @@ def sech( def sech_deriv(duration: int, amp: complex, sigma: float, name: str = None) -> Waveform: - r"""Generates unnormalized sech derivative :class:`~qiskit.pulse.Waveform`. + r"""Generates unnormalized sech derivative :class:`~qiskit.pulse.library.Waveform`. For :math:`A=` ``amp``, :math:`\sigma=` ``sigma``, and center :math:`\mu=` ``duration/2``, applies the `midpoint` sampling strategy to generate a discrete pulse sampled from @@ -391,7 +391,7 @@ def gaussian_square( name: Optional[str] = None, zero_ends: bool = True, ) -> Waveform: - r"""Generates gaussian square :class:`~qiskit.pulse.Waveform`. + r"""Generates gaussian square :class:`~qiskit.pulse.library.Waveform`. For :math:`d=` ``duration``, :math:`A=` ``amp``, :math:`\sigma=` ``sigma``, and :math:`r=` ``risefall``, applies the ``midpoint`` sampling strategy to @@ -456,7 +456,7 @@ def drag( name: Optional[str] = None, zero_ends: bool = True, ) -> Waveform: - r"""Generates Y-only correction DRAG :class:`~qiskit.pulse.Waveform` for standard nonlinear + r"""Generates Y-only correction DRAG :class:`~qiskit.pulse.library.Waveform` for standard nonlinear oscillator (SNO) [1]. For :math:`A=` ``amp``, :math:`\sigma=` ``sigma``, and :math:`\beta=` ``beta``, applies the diff --git a/qiskit/pulse/schedule.py b/qiskit/pulse/schedule.py index a1358b376f5..be55e896f75 100644 --- a/qiskit/pulse/schedule.py +++ b/qiskit/pulse/schedule.py @@ -12,9 +12,23 @@ # pylint: disable=cyclic-import, missing-return-doc -"""The Schedule is one of the most fundamental objects to this pulse-level programming module. +""" +========= +Schedules +========= + +.. currentmodule:: qiskit.pulse + +Schedules are Pulse programs. They describe instruction sequences for the control hardware. +The Schedule is one of the most fundamental objects to this pulse-level programming module. A ``Schedule`` is a representation of a *program* in Pulse. Each schedule tracks the time of each instruction occuring in parallel over multiple signal *channels*. + +.. autosummary:: + :toctree: ../stubs/ + + Schedule + ScheduleBlock """ import abc @@ -66,30 +80,30 @@ class Schedule: - Appending an instruction to the end of a channel - .. code-block:: python + .. code-block:: python - sched = Schedule() - sched += Play(Gaussian(160, 0.1, 40), DriveChannel(0)) + sched = Schedule() + sched += Play(Gaussian(160, 0.1, 40), DriveChannel(0)) - Appending an instruction shifted in time by a given amount - .. code-block:: python + .. code-block:: python - sched = Schedule() - sched += Play(Gaussian(160, 0.1, 40), DriveChannel(0)) << 30 + sched = Schedule() + sched += Play(Gaussian(160, 0.1, 40), DriveChannel(0)) << 30 - Merge two schedules - .. code-block:: python + .. code-block:: python - sched1 = Schedule() - sched1 += Play(Gaussian(160, 0.1, 40), DriveChannel(0)) + sched1 = Schedule() + sched1 += Play(Gaussian(160, 0.1, 40), DriveChannel(0)) - sched2 = Schedule() - sched2 += Play(Gaussian(160, 0.1, 40), DriveChannel(1)) - sched2 = sched1 | sched2 + sched2 = Schedule() + sched2 += Play(Gaussian(160, 0.1, 40), DriveChannel(1)) + sched2 = sched1 | sched2 - A ``PulseError`` is immediately raised when the overlap constraint is violated. + A :obj:`.PulseError` is immediately raised when the overlap constraint is violated. In the schedule representation, we cannot parametrize the duration of instructions. Thus we need to create a new schedule object for each duration. @@ -807,13 +821,13 @@ def wrapper(self, *args, **kwargs): class ScheduleBlock: - """A ``ScheduleBlock`` is a time-ordered sequence of instructions and transform macro to + r"""A ``ScheduleBlock`` is a time-ordered sequence of instructions and transform macro to manage their relative timing. The relative position of the instructions is managed by - the ``context_alignment``. This allows ``ScheduleBlock`` to support instructions with + the ``alignment_context``. This allows ``ScheduleBlock`` to support instructions with a parametric duration and allows the lazy scheduling of instructions, i.e. allocating the instruction time just before execution. - ``ScheduleBlock`` s should be initialized with one of the following alignment contexts: + ``ScheduleBlock``\ s should be initialized with one of the following alignment contexts: - :class:`~qiskit.pulse.transforms.AlignLeft`: Align instructions in the `as-soon-as-possible` manner. Instructions are scheduled at the earliest diff --git a/qiskit/pulse/transforms/__init__.py b/qiskit/pulse/transforms/__init__.py index 75b17bff321..e30e4330a3b 100644 --- a/qiskit/pulse/transforms/__init__.py +++ b/qiskit/pulse/transforms/__init__.py @@ -9,10 +9,10 @@ # 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. -""" -=================================================== +r""" +================================================= Pulse Transforms (:mod:`qiskit.pulse.transforms`) -=================================================== +================================================= The pulse transforms provide transformation routines to reallocate and optimize pulse programs for backends. @@ -20,8 +20,8 @@ Alignments ========== -The alignment transforms define alignment policies of instructions in ``ScheduleBlock``. -These transformations are called to create ``Schedule``s from ``ScheduleBlock``s. +The alignment transforms define alignment policies of instructions in :obj:`.ScheduleBlock`. +These transformations are called to create :obj:`.Schedule`\ s from :obj:`.ScheduleBlock`\ s. .. autosummary:: :toctree: ../stubs/ @@ -32,12 +32,16 @@ AlignRight AlignSequential +These are all subtypes of the abstract base class :class:`AlignmentKind`. + +.. autoclass:: AlignmentKind + Canonicalization ================ The canonicalization transforms convert schedules to a form amenable for execution on -Openpulse backends. +OpenPulse backends. .. autosummary:: :toctree: ../stubs/ @@ -83,6 +87,7 @@ AlignLeft, AlignRight, AlignSequential, + AlignmentKind, ) from qiskit.pulse.transforms.base_transforms import target_qobj_transform diff --git a/qiskit/pulse/transforms/canonicalization.py b/qiskit/pulse/transforms/canonicalization.py index c7b28020c09..a019de2eda2 100644 --- a/qiskit/pulse/transforms/canonicalization.py +++ b/qiskit/pulse/transforms/canonicalization.py @@ -249,15 +249,15 @@ def align_measures( ) -> List[Schedule]: """Return new schedules where measurements occur at the same physical time. - This transformation will align the first :class:`qiskit.pulse.Acquire` on + This transformation will align the first :class:`.Acquire` on every channel to occur at the same time. Minimum measurement wait time (to allow for calibration pulses) is enforced and may be set with ``max_calibration_duration``. - By default only instructions containing a :class:`~qiskit.pulse.AcquireChannel` - or :class:`~qiskit.pulse.MeasureChannel` will be shifted. If you wish to keep - the relative timing of all instructions in the schedule set ``align_all=True``. + By default only instructions containing a :class:`.AcquireChannel` or :class:`.MeasureChannel` + will be shifted. If you wish to keep the relative timing of all instructions in the schedule set + ``align_all=True``. This method assumes that ``MeasureChannel(i)`` and ``AcquireChannel(i)`` correspond to the same qubit and the acquire/play instructions diff --git a/qiskit/quantum_info/__init__.py b/qiskit/quantum_info/__init__.py index 831f607b949..60c52ee329c 100644 --- a/qiskit/quantum_info/__init__.py +++ b/qiskit/quantum_info/__init__.py @@ -120,6 +120,7 @@ two_qubit_cnot_decompose Quaternion decompose_clifford + XXDecomposer """ from .operators import Operator, ScalarOp, Pauli, Clifford, SparsePauliOp @@ -160,6 +161,7 @@ two_qubit_cnot_decompose, Quaternion, decompose_clifford, + XXDecomposer, ) from .analysis import hellinger_distance, hellinger_fidelity diff --git a/qiskit/quantum_info/operators/symplectic/pauli_utils.py b/qiskit/quantum_info/operators/symplectic/pauli_utils.py index efdaa8fb257..b3578d2ec98 100644 --- a/qiskit/quantum_info/operators/symplectic/pauli_utils.py +++ b/qiskit/quantum_info/operators/symplectic/pauli_utils.py @@ -37,10 +37,11 @@ def pauli_basis(num_qubits, weight=False, pauli_list=False): pauli_1q = PauliList(["I", "X", "Y", "Z"]) else: warnings.warn( - "The pauli_basis function with PauliTable output is deprecated as of Qiskit Terra " - "0.19.0 and will be removed no sooner than 3 months after the releasedate. " - "Use PauliList by pauli_list=True instead.", - DeprecationWarning, + "The return type of 'pauli_basis' will change from PauliTable to PauliList in a " + "future release of Qiskit Terra. Returning PauliTable is deprecated as of " + "Qiskit Terra 0.19, and will be removed in a future release. To immediately switch " + "to the new behaviour, pass the keyword argument 'pauli_list=True'.", + FutureWarning, stacklevel=2, ) pauli_1q = PauliTable( diff --git a/qiskit/quantum_info/synthesis/__init__.py b/qiskit/quantum_info/synthesis/__init__.py index c2fd3eca402..b3667fbd7c7 100644 --- a/qiskit/quantum_info/synthesis/__init__.py +++ b/qiskit/quantum_info/synthesis/__init__.py @@ -16,3 +16,4 @@ from .one_qubit_decompose import OneQubitEulerDecomposer from .quaternion import Quaternion from .clifford_decompose import decompose_clifford +from .xx_decompose import XXDecomposer diff --git a/qiskit/quantum_info/synthesis/xx_decompose/decomposer.py b/qiskit/quantum_info/synthesis/xx_decompose/decomposer.py index 0ebfc5d58b7..378251cd74b 100644 --- a/qiskit/quantum_info/synthesis/xx_decompose/decomposer.py +++ b/qiskit/quantum_info/synthesis/xx_decompose/decomposer.py @@ -24,13 +24,9 @@ from qiskit.circuit.quantumcircuit import QuantumCircuit from qiskit.circuit.library.standard_gates import RXXGate, RZXGate from qiskit.exceptions import QiskitError -from qiskit.extensions import UnitaryGate -from qiskit.quantum_info.operators import Operator, average_gate_fidelity +from qiskit.quantum_info.operators import Operator from qiskit.quantum_info.synthesis.one_qubit_decompose import ONE_QUBIT_EULER_BASIS_GATES from qiskit.quantum_info.synthesis.two_qubit_decompose import TwoQubitWeylDecomposition -from qiskit.transpiler.passes.optimization.optimize_1q_decomposition import ( - Optimize1qGatesDecomposition, -) from .circuits import apply_reflection, apply_shift, canonical_xx_circuit from .utilities import EPSILON @@ -72,8 +68,9 @@ class XXDecomposer: applications of XX(pi/2), in which case standard synthesis methods provide lower 1Q gate count. - NOTE: If embodiments is not passed, or if an entry is missing, it will be populated as needed - using the method _default_embodiment. + .. note:: + If ``embodiments`` is not passed, or if an entry is missing, it will be populated as needed + using the method ``_default_embodiment``. """ def __init__( @@ -82,6 +79,10 @@ def __init__( embodiments: Optional[dict] = None, backup_optimizer: Optional[Callable] = None, ): + from qiskit.transpiler.passes.optimization.optimize_1q_decomposition import ( + Optimize1qGatesDecomposition, # pylint: disable=cyclic-import + ) + self._decomposer1q = Optimize1qGatesDecomposition(ONE_QUBIT_EULER_BASIS_GATES[euler_basis]) self.gate = RZXGate(np.pi / 2) self.embodiments = embodiments if embodiments is not None else {} @@ -110,6 +111,8 @@ def _check_embodiments(self): Checks that `self.embodiments` is populated with legal circuit embodiments: the key-value pair (angle, circuit) satisfies Operator(circuit) approx RXX(angle).to_matrix(). """ + # pylint: disable=cyclic-import + from qiskit.quantum_info.operators.measures import average_gate_fidelity for angle, embodiment in self.embodiments.items(): actual = Operator(RXXGate(angle)) @@ -220,6 +223,7 @@ def __call__(self, unitary, basis_fidelity=1.0, approximate=True): strength_to_infidelity = self._strength_to_infidelity( basis_fidelity, approximate=approximate ) + from qiskit.extensions import UnitaryGate # pylint: disable=cyclic-import # get the associated _positive_ canonical coordinate weyl_decomposition = TwoQubitWeylDecomposition(unitary) diff --git a/qiskit/result/__init__.py b/qiskit/result/__init__.py index f63900ee925..0bf48950a1f 100644 --- a/qiskit/result/__init__.py +++ b/qiskit/result/__init__.py @@ -39,6 +39,7 @@ .. autosummary:: :toctree: ../stubs/ + BaseReadoutMitigator CorrelatedReadoutMitigator LocalReadoutMitigator @@ -51,5 +52,6 @@ from .distributions.probability import ProbDistribution from .distributions.quasi import QuasiDistribution +from .mitigation.base_readout_mitigator import BaseReadoutMitigator from .mitigation.correlated_readout_mitigator import CorrelatedReadoutMitigator from .mitigation.local_readout_mitigator import LocalReadoutMitigator diff --git a/qiskit/synthesis/__init__.py b/qiskit/synthesis/__init__.py index 5541f66ebd0..76b33467ec0 100644 --- a/qiskit/synthesis/__init__.py +++ b/qiskit/synthesis/__init__.py @@ -11,9 +11,9 @@ # that they have been altered from the originals. """ -=================================================== +=========================================== Circuit Synthesis (:mod:`qiskit.synthesis`) -=================================================== +=========================================== .. currentmodule:: qiskit.synthesis diff --git a/qiskit/synthesis/evolution/lie_trotter.py b/qiskit/synthesis/evolution/lie_trotter.py index 827e7b074cf..ddcd11b8f2b 100644 --- a/qiskit/synthesis/evolution/lie_trotter.py +++ b/qiskit/synthesis/evolution/lie_trotter.py @@ -54,14 +54,15 @@ def __init__( ] = None, ) -> None: """ - reps: The number of time steps. - insert_barriers: Whether to insert barriers between the atomic evolutions. - cx_structure: How to arrange the CX gates for the Pauli evolutions, can be - "chain", where next neighbor connections are used, or "fountain", where all - qubits are connected to one. - atomic_evolution: A function to construct the circuit for the evolution of single - Pauli string. Per default, a single Pauli evolution is decomopsed in a CX chain - and a single qubit Z rotation. + Args: + reps: The number of time steps. + insert_barriers: Whether to insert barriers between the atomic evolutions. + cx_structure: How to arrange the CX gates for the Pauli evolutions, can be + "chain", where next neighbor connections are used, or "fountain", where all + qubits are connected to one. + atomic_evolution: A function to construct the circuit for the evolution of single + Pauli string. Per default, a single Pauli evolution is decomopsed in a CX chain + and a single qubit Z rotation. """ super().__init__(1, reps, insert_barriers, cx_structure, atomic_evolution) diff --git a/qiskit/synthesis/evolution/product_formula.py b/qiskit/synthesis/evolution/product_formula.py index 66b54311080..db5007f8fa2 100644 --- a/qiskit/synthesis/evolution/product_formula.py +++ b/qiskit/synthesis/evolution/product_formula.py @@ -25,7 +25,7 @@ class ProductFormula(EvolutionSynthesis): """Product formula base class for the decomposition of non-commuting operator exponentials. - Lie-Trotter and Suzuki inherit this class. + :obj:`.LieTrotter` and :obj:`.SuzukiTrotter` inherit from this class. """ def __init__( diff --git a/qiskit/synthesis/evolution/qdrift.py b/qiskit/synthesis/evolution/qdrift.py index 1021a10f592..41a2383b9c4 100644 --- a/qiskit/synthesis/evolution/qdrift.py +++ b/qiskit/synthesis/evolution/qdrift.py @@ -29,7 +29,7 @@ class QDrift(ProductFormula): References: [1]: E. Campbell, "A random compiler for fast Hamiltonian simulation" (2018). - `arXiv:quant-ph/1811.08017 `_ + `arXiv:quant-ph/1811.08017 `_ """ def __init__( diff --git a/qiskit/synthesis/evolution/suzuki_trotter.py b/qiskit/synthesis/evolution/suzuki_trotter.py index 6248c133fda..1d234cc00cf 100644 --- a/qiskit/synthesis/evolution/suzuki_trotter.py +++ b/qiskit/synthesis/evolution/suzuki_trotter.py @@ -40,7 +40,6 @@ class SuzukiTrotter(ProductFormula): e^{-it(XX + ZZ)} = e^{-it/2 ZZ}e^{-it XX}e^{-it/2 ZZ} + \mathcal{O}(t^2). References: - [1]: D. Berry, G. Ahokas, R. Cleve and B. Sanders, "Efficient quantum algorithms for simulating sparse Hamiltonians" (2006). `arXiv:quant-ph/0508139 `_ @@ -56,6 +55,18 @@ def __init__( Callable[[Union[Pauli, SparsePauliOp], float], QuantumCircuit] ] = None, ) -> None: + """ + Args: + order: The order of the product formula. + reps: The number of time steps. + insert_barriers: Whether to insert barriers between the atomic evolutions. + cx_structure: How to arrange the CX gates for the Pauli evolutions, can be "chain", + where next neighbor connections are used, or "fountain", where all qubits are connected + to one. + atomic_evolution: A function to construct the circuit for the evolution of single + Pauli string. Per default, a single Pauli evolution is decomopsed in a CX chain + and a single qubit Z rotation. + """ super().__init__(order, reps, insert_barriers, cx_structure, atomic_evolution) def synthesize(self, evolution): diff --git a/qiskit/transpiler/passes/__init__.py b/qiskit/transpiler/passes/__init__.py index 285073b95e5..f10b676eaea 100644 --- a/qiskit/transpiler/passes/__init__.py +++ b/qiskit/transpiler/passes/__init__.py @@ -69,8 +69,10 @@ Optimize1qGatesDecomposition Collect1qRuns Collect2qBlocks + CollectMultiQBlocks ConsolidateBlocks CXCancellation + InverseCancellation CommutationAnalysis CommutativeCancellation Optimize1qGatesSimpleCommutation @@ -78,6 +80,7 @@ RemoveResetInZeroState CrosstalkAdaptiveSchedule TemplateOptimization + EchoRZXWeylDecomposition Calibration ============= @@ -191,6 +194,7 @@ from .optimization import HoareOptimizer from .optimization import TemplateOptimization from .optimization import InverseCancellation +from .optimization import EchoRZXWeylDecomposition # circuit analysis from .analysis import ResourceEstimation diff --git a/qiskit/transpiler/passes/basis/decompose.py b/qiskit/transpiler/passes/basis/decompose.py index 83282b5db8b..ffbb80152be 100644 --- a/qiskit/transpiler/passes/basis/decompose.py +++ b/qiskit/transpiler/passes/basis/decompose.py @@ -49,7 +49,7 @@ def __init__( def gate(self) -> Gate: """Returns the gate""" warnings.warn( - "The gate argument is deprecated as of 0.18.0, and " + "The gate argument is deprecated as of qiskit-terra 0.19.0, and " "will be removed no earlier than 3 months after that " "release date. You should use the gates_to_decompose argument " "instead.", @@ -66,7 +66,7 @@ def gate(self, value): value (Gate): new value for gate """ warnings.warn( - "The gate argument is deprecated as of 0.18.0, and " + "The gate argument is deprecated as of qiskit-terra 0.19.0, and " "will be removed no earlier than 3 months after that " "release date. You should use the gates_to_decompose argument " "instead.", diff --git a/qiskit/transpiler/passes/optimization/__init__.py b/qiskit/transpiler/passes/optimization/__init__.py index e78eb5c6093..22d8f84820c 100644 --- a/qiskit/transpiler/passes/optimization/__init__.py +++ b/qiskit/transpiler/passes/optimization/__init__.py @@ -29,3 +29,4 @@ from .template_optimization import TemplateOptimization from .inverse_cancellation import InverseCancellation from .collect_1q_runs import Collect1qRuns +from .echo_rzx_weyl_decomposition import EchoRZXWeylDecomposition diff --git a/qiskit/transpiler/passes/optimization/collect_multiqubit_blocks.py b/qiskit/transpiler/passes/optimization/collect_multiqubit_blocks.py index c2f48cc76e2..527cdbfd087 100644 --- a/qiskit/transpiler/passes/optimization/collect_multiqubit_blocks.py +++ b/qiskit/transpiler/passes/optimization/collect_multiqubit_blocks.py @@ -24,8 +24,10 @@ class CollectMultiQBlocks(AnalysisPass): Traverse the DAG and find blocks of gates that act consecutively on groups of qubits. Write the blocks to propert_set as a list of blocks - of the form: + of the form:: + [[g0, g1, g2], [g4, g5]] + Blocks are reported in a valid topological order. Further, the gates within each block are also reported in topological order Some gates may not be present in any block (e.g. if the number diff --git a/qiskit/transpiler/passes/optimization/echo_rzx_weyl_decomposition.py b/qiskit/transpiler/passes/optimization/echo_rzx_weyl_decomposition.py index 2b896fe5d35..2477d4119b2 100644 --- a/qiskit/transpiler/passes/optimization/echo_rzx_weyl_decomposition.py +++ b/qiskit/transpiler/passes/optimization/echo_rzx_weyl_decomposition.py @@ -14,7 +14,7 @@ from typing import Tuple -from qiskit import QuantumRegister +from qiskit.circuit import QuantumRegister from qiskit.circuit.library.standard_gates import RZXGate, HGate, XGate from qiskit.transpiler.basepasses import TransformationPass @@ -24,9 +24,6 @@ from qiskit.dagcircuit import DAGCircuit from qiskit.converters import circuit_to_dag -import qiskit.quantum_info as qi -from qiskit.quantum_info.synthesis.two_qubit_decompose import TwoQubitControlledUDecomposer - class EchoRZXWeylDecomposition(TransformationPass): """Rewrite two-qubit gates using the Weyl decomposition. @@ -36,8 +33,13 @@ class EchoRZXWeylDecomposition(TransformationPass): Each pair of RZXGates forms an echoed RZXGate. """ - def __init__(self, instruction_schedule_map: "InstructionScheduleMap"): - """EchoRZXWeylDecomposition pass.""" + def __init__(self, instruction_schedule_map): + """EchoRZXWeylDecomposition pass. + + Args: + instruction_schedule_map (InstructionScheduleMap): the mapping from circuit + :class:`~.circuit.Instruction` names and arguments to :class:`.Schedule`\\ s. + """ super().__init__() self._inst_map = instruction_schedule_map @@ -90,6 +92,10 @@ def run(self, dag: DAGCircuit): TranspilerError: If the circuit cannot be rewritten. """ + # pylint: disable=cyclic-import + from qiskit.quantum_info import Operator + from qiskit.quantum_info.synthesis.two_qubit_decompose import TwoQubitControlledUDecomposer + if len(dag.qregs) > 1: raise TranspilerError( "EchoRZXWeylDecomposition expects a single qreg input DAG," @@ -102,7 +108,7 @@ def run(self, dag: DAGCircuit): for node in dag.two_qubit_ops(): - unitary = qi.Operator(node.op).data + unitary = Operator(node.op).data dag_weyl = circuit_to_dag(decomposer(unitary)) dag.substitute_node_with_dag(node, dag_weyl) diff --git a/qiskit/transpiler/passes/scheduling/time_unit_conversion.py b/qiskit/transpiler/passes/scheduling/time_unit_conversion.py index 12447a2f31e..e073023ebd6 100644 --- a/qiskit/transpiler/passes/scheduling/time_unit_conversion.py +++ b/qiskit/transpiler/passes/scheduling/time_unit_conversion.py @@ -29,6 +29,7 @@ class TimeUnitConversion(TransformationPass): If dt (dt in seconds) is known to transpiler, the unit 'dt' is chosen. Otherwise, the unit to be selected depends on what units are used in delays and instruction durations: + * 's': if they are all in SI units. * 'dt': if they are all in the unit 'dt'. * raise error: if they are a mix of SI units and 'dt'. diff --git a/qiskit/transpiler/synthesis/aqc/__init__.py b/qiskit/transpiler/synthesis/aqc/__init__.py index 1395b508aae..9a4b6e06923 100644 --- a/qiskit/transpiler/synthesis/aqc/__init__.py +++ b/qiskit/transpiler/synthesis/aqc/__init__.py @@ -9,9 +9,39 @@ # 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. + r""" +===================================================================== +Approximate Quantum Compiler (:mod:`qiskit.transpiler.synthesis.aqc`) +===================================================================== + +.. currentmodule:: qiskit.transpiler.synthesis.aqc + Implementation of Approximate Quantum Compiler as described in the paper [1]. +Interface +========= + +The main public interface of this module is reached by passing ``unitary_synthesis_method='aqc'`` to +:obj:`~.compiler.transpile`. This will swap the synthesis method to use :obj:`AQCSynthesisPlugin`. +The individual classes are: + +.. autosummary:: + :toctree: ../stubs + :template: autosummary/class_no_inherited_members.rst + + AQC + AQCSynthesisPlugin + ApproximateCircuit + ApproximatingObjective + CNOTUnitCircuit + CNOTUnitObjective + DefaultCNOTUnitObjective + + +Mathematical Detail +=================== + We are interested in compiling a quantum circuit, which we formalize as finding the best circuit representation in terms of an ordered gate sequence of a target unitary matrix :math:`U\in U(d)`, with some additional hardware constraints. In particular, we look at @@ -119,6 +149,10 @@ Now ``approximate_circuit`` is a circuit that approximates the target unitary to a certain degree and can be used instead of the original matrix. +This uses a helper function, :obj:`make_cnot_network`. + +.. autofunction:: make_cnot_network + References: [1]: Liam Madden, Andrea Simonetto, Best Approximate Quantum Compiling Problems. diff --git a/qiskit/transpiler/synthesis/aqc/aqc.py b/qiskit/transpiler/synthesis/aqc/aqc.py index 9e797817e2d..6b47eb57434 100644 --- a/qiskit/transpiler/synthesis/aqc/aqc.py +++ b/qiskit/transpiler/synthesis/aqc/aqc.py @@ -25,18 +25,20 @@ class AQC: the underlying implementation of the approximate circuit, objective, and optimizer. Users may pass corresponding implementations of the abstract classes: - * Optimizer is an instance of :class:`~qiskit.algorithms.optimizer.Optimizer` and - used to run the optimization process. A choice of optimizer may affect overall - convergence, required time for the optimization process and achieved objective value. - * Approximate circuit represents a template which parameters we want to optimize. - Currently, there's only one implementation based on 4-rotations CNOT unit blocks: - :class:`~qiskit.transpiler.aqc.CNOTUnitCircuit`. See the paper for more details. - * Approximate objective is tightly coupled with the approximate circuit implementation - and provides two methods for computing objective function and gradient with respect to - approximate circuit parameters. This objective is passed to the optimizer. Currently, - there's only one implementation based on 4-rotations CNOT unit blocks: - :class:`~qiskit.transpiler.aqc.DefaultCNOTUnitObjective`. This is a naive implementation - of the objective function and gradient and may suffer from performance issues. + * Optimizer is an instance of :class:`~qiskit.algorithms.optimizers.Optimizer` and used to run + the optimization process. A choice of optimizer may affect overall convergence, required time + for the optimization process and achieved objective value. + + * Approximate circuit represents a template which parameters we want to optimize. Currently, + there's only one implementation based on 4-rotations CNOT unit blocks: + :class:`.CNOTUnitCircuit`. See the paper for more details. + + * Approximate objective is tightly coupled with the approximate circuit implementation and + provides two methods for computing objective function and gradient with respect to approximate + circuit parameters. This objective is passed to the optimizer. Currently, there's only one + implementation based on 4-rotations CNOT unit blocks: :class:`.DefaultCNOTUnitObjective`. This + is a naive implementation of the objective function and gradient and may suffer from performance + issues. """ def __init__( @@ -47,7 +49,7 @@ def __init__( """ Args: optimizer: an optimizer to be used in the optimization procedure of the search for - the best approximate circuit. By default ``L_BFGS_B`` is used with max iterations + the best approximate circuit. By default :obj:`.L_BFGS_B` is used with max iterations is set to 1000. seed: a seed value to be user by a random number generator. """ diff --git a/qiskit/transpiler/synthesis/aqc/aqc_plugin.py b/qiskit/transpiler/synthesis/aqc/aqc_plugin.py index 10d21d1a853..0138d8e7b97 100644 --- a/qiskit/transpiler/synthesis/aqc/aqc_plugin.py +++ b/qiskit/transpiler/synthesis/aqc/aqc_plugin.py @@ -22,25 +22,35 @@ class AQCSynthesisPlugin(UnitarySynthesisPlugin): """ An AQC-based Qiskit unitary synthesis plugin. - This plugin is invoked by transpiler when `unitary_synthesis_method` parameter is set - to `"aqc"`. + This plugin is invoked by :func:`~.compiler.transpile` when the ``unitary_synthesis_method`` + parameter is set to ``"aqc"``. This plugin supports customization and additional parameters can be passed to the plugin - by passing a dictionary as the `unitary_synthesis_plugin_config` parameter of + by passing a dictionary as the ``unitary_synthesis_plugin_config`` parameter of the :func:`~qiskit.compiler.transpile` function. Supported parameters in the dictionary: - * network_layout (str): type of network geometry, one of ``{"sequ", "spin", "cart", - "cyclic_spin", "cyclic_line"}``. Default value is ``"spin"``. - * connectivity_type (str): type of inter-qubit connectivity, ``{"full", "line", "star"}``. - Default value is ``"full"``. - * depth (int): depth of the CNOT-network, i.e. the number of layers, where each layer - consists of a single CNOT-block. - * optimizer (:class:`~qiskit.algorithms.optimizers.Optimizer`): an instance of optimizer to - be used in the optimization process. - * seed (int): a random seed. - * initial_point (:class:`~numpy.ndarray`): initial values of angles/parameters to start - optimization process from. + + network_layout (str) + Type of network geometry, one of {``"sequ"``, ``"spin"``, ``"cart"``, ``"cyclic_spin"``, + ``"cyclic_line"``}. Default value is ``"spin"``. + + connectivity_type (str) + type of inter-qubit connectivity, {``"full"``, ``"line"``, ``"star"``}. Default value + is ``"full"``. + + depth (int) + depth of the CNOT-network, i.e. the number of layers, where each layer consists of a + single CNOT-block. + + optimizer (:class:`~qiskit.algorithms.optimizers.Optimizer`) + An instance of optimizer to be used in the optimization process. + + seed (int) + A random seed. + + initial_point (:class:`~numpy.ndarray`) + Initial values of angles/parameters to start the optimization process from. """ @property diff --git a/qiskit/visualization/__init__.py b/qiskit/visualization/__init__.py index caa826c5827..cce0491f681 100644 --- a/qiskit/visualization/__init__.py +++ b/qiskit/visualization/__init__.py @@ -40,6 +40,7 @@ plot_gate_map plot_error_map plot_circuit_layout + plot_coupling_map Circuit Visualizations ====================== @@ -129,7 +130,7 @@ from .circuit_visualization import circuit_drawer, HAS_PIL, HAS_PDFLATEX, HAS_PDFTOCAIRO from .dag_visualization import dag_drawer from .exceptions import VisualizationError -from .gate_map import plot_gate_map, plot_circuit_layout, plot_error_map +from .gate_map import plot_gate_map, plot_circuit_layout, plot_error_map, plot_coupling_map from .matplotlib import HAS_MATPLOTLIB, HAS_PYLATEX from .pass_manager_visualization import pass_manager_drawer from .pulse.interpolation import step_wise, linear, cubic_spline diff --git a/qiskit/visualization/circuit_visualization.py b/qiskit/visualization/circuit_visualization.py index 5da928e4814..af091086cac 100644 --- a/qiskit/visualization/circuit_visualization.py +++ b/qiskit/visualization/circuit_visualization.py @@ -384,8 +384,6 @@ def _text_circuit_drawer( text_drawing.vertical_compression = vertical_compression if filename: - if not filename.endswith(".txt"): - raise VisualizationError("ERROR: filename parameter does not use .txt extension.") text_drawing.dump(filename, encoding=encoding) return text_drawing diff --git a/qiskit/visualization/gate_map.py b/qiskit/visualization/gate_map.py index fcea33fa5a5..5794b1a2ceb 100644 --- a/qiskit/visualization/gate_map.py +++ b/qiskit/visualization/gate_map.py @@ -413,24 +413,16 @@ def plot_coupling_map( QiskitError: If length of qubit labels does not match number of qubits. Example: - .. jupyter-execute:: - :hide-code: - :hide-output: - - from qiskit.test.ibmq_mock import mock_get_backend - mock_get_backend('FakeVigo') .. jupyter-execute:: - from qiskit import QuantumCircuit, execute, IBMQ from qiskit.visualization import plot_coupling_map %matplotlib inline num_qubits = 8 coupling_map = [[0, 1], [1, 2], [2, 3], [3, 5], [4, 5], [5, 6], [2, 4], [6, 7]] - qubit_coordinates = [[0, 1], [1, 1], [1, 0], [1, 2], [2, 0], - [2, 2], [2, 1], [3, 1]] - plot_gate_map(num_qubits, coupling_map, qubit_coordinates) + qubit_coordinates = [[0, 1], [1, 1], [1, 0], [1, 2], [2, 0], [2, 2], [2, 1], [3, 1]] + plot_coupling_map(num_qubits, coupling_map, qubit_coordinates) """ if not HAS_MATPLOTLIB: diff --git a/releasenotes/notes/0.19/0.19-prelude-65c295aa9497ed48.yaml b/releasenotes/notes/0.19/0.19-prelude-65c295aa9497ed48.yaml new file mode 100644 index 00000000000..e3f5f66be14 --- /dev/null +++ b/releasenotes/notes/0.19/0.19-prelude-65c295aa9497ed48.yaml @@ -0,0 +1,34 @@ +--- +prelude: | + The Qiskit Terra 0.19 release highlights are: + + * A new version of the abstract Qiskit/hardware interface, in the form of + :class:`.BackendV2`, which comes with a new data structure + :class:`~.transpiler.Target` to allow backends to better model their + constraints for the :ref:`transpiler `. + + * An :ref:`extensible plugin interface ` to the + :class:`~.passes.UnitarySynthesis` transpiler pass, allowing users or + other packages to extend Qiskit Terra's + synthesis routines with new methods. + + * Control-flow instructions, for representing ``for`` and ``while`` loops + and ``if``/``else`` statements in :class:`.QuantumCircuit`. The + simulators in Qiskit Aer will soon be able to work with these new + instructions, allowing you to write more dynamic quantum programs. + + * Preliminary support for the evolving `OpenQASM 3 specification`_. You can + use the new :mod:`qiskit.qasm3` module to serialize your + :class:`.QuantumCircuit`\ s into OpenQASM 3, including the new control-flow + constructs. + + .. _OpenQASM 3 specification: https://qiskit.github.io/openqasm/ + + This release marks the end of support for Python 3.6 in Qiskit. This + release of Qiskit Terra, and any subsequent bugfix releases in the 0.19.x + series, will be the last to work with Python 3.6. Starting from the next + minor release (0.20.0) of Qiskit Terra, the minimum required Python version + will be 3.7. + + As always, there are many more features and fixes in this release as well, + which you can read about below. diff --git a/releasenotes/notes/0.19/7156-df1a60c608b93184.yaml b/releasenotes/notes/0.19/7156-df1a60c608b93184.yaml new file mode 100644 index 00000000000..4ff8ace4ea7 --- /dev/null +++ b/releasenotes/notes/0.19/7156-df1a60c608b93184.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Fixed a bug where many layout methods would ignore 3-or-more qubit gates, + resulting in unexpected layout-allocation decisions. The transpiler pass + :class:`.Unroll3qOrMore` is now being executed before the layout pass in all + the preset pass managers when :func:`~.compiler.transpile` is called. Fixed `#7156 + `__. diff --git a/releasenotes/notes/0.19/7274-6f57628a7995a461.yaml b/releasenotes/notes/0.19/7274-6f57628a7995a461.yaml new file mode 100644 index 00000000000..5d4e2ddb1fd --- /dev/null +++ b/releasenotes/notes/0.19/7274-6f57628a7995a461.yaml @@ -0,0 +1,11 @@ +--- +upgrade: + - | + Starting with this version, ``from qiskit import *`` will not import submodules, but + only a selected list of objects. This might break existing code using + ``from qiskit import *`` and referring to objects that are not part of the + current namespace. As a reminder, ``import *`` is considered bad practice + and it should not be used in production code. Qiskit sets ``__all__`` in + ``qiskit/__init__.py`` as a way to mitigate the effects of said bad + practice. If your code raises ``name '' is not defined``, add + ``from qiskit import `` and try again. diff --git a/releasenotes/notes/0.19/QuantumCircuit.decompose-takes-which-gate-to-decompose-d857da5d0c41fb66.yaml b/releasenotes/notes/0.19/QuantumCircuit.decompose-takes-which-gate-to-decompose-d857da5d0c41fb66.yaml new file mode 100644 index 00000000000..5e27444938b --- /dev/null +++ b/releasenotes/notes/0.19/QuantumCircuit.decompose-takes-which-gate-to-decompose-d857da5d0c41fb66.yaml @@ -0,0 +1,22 @@ +--- +features: + - | + :meth:`.QuantumCircuit.decompose` and its corresponding transpiler pass + :class:`~qiskit.transpiler.passes.Decompose` now optionally accept a + parameter containing a collection of gate names. If this parameter is given, + then only gates with matching names will be decomposed. This supports + Unix-shell-style wildcard matches. For example:: + + qc.decompose(["h", "r[xz]"]) + + will decompose any ``h``, ``rx`` or ``rz`` gates, but leave (for example) ``x`` gates untouched. + +deprecations: + - | + The ``gate`` attribute and initialization parameter of + :class:`qiskit.transpiler.passes.Decompose` is deprecated, and will be + removed in a future release. Instead of this single gate, you should pass a + list of gate names to the new parameter ``gates_to_decompose``. This was + done as the new form allows you to select more than one gate as a + decomposition target, which is more flexible, and does not need to re-run + the pass several times to decompose a set of gates. diff --git a/releasenotes/notes/SPSA-termination-callback-a1ec14892f553982.yaml b/releasenotes/notes/0.19/SPSA-termination-callback-a1ec14892f553982.yaml similarity index 80% rename from releasenotes/notes/SPSA-termination-callback-a1ec14892f553982.yaml rename to releasenotes/notes/0.19/SPSA-termination-callback-a1ec14892f553982.yaml index 04c34845446..8dbf1e86734 100644 --- a/releasenotes/notes/SPSA-termination-callback-a1ec14892f553982.yaml +++ b/releasenotes/notes/0.19/SPSA-termination-callback-a1ec14892f553982.yaml @@ -1,7 +1,7 @@ --- features: - | - Add `termination_callback` argument to :class:`qiskit.algorithms.optimizers.spsa.SPSA` optimizer. + Added the ``termination_checker`` argument to the :class:`~qiskit.algorithms.optimizers.SPSA` optimizer. This allows the user to implement a custom termination criterion. .. code-block:: python @@ -15,14 +15,17 @@ features: class TerminationChecker: def __init__(self, N : int): - """ Callback to terminate optimization when the average decrease over the last N data points is smaller than the specified tolerance """ + """ + Callback to terminate optimization when the average decrease over + the last N data points is smaller than the specified tolerance. + """ self.N = N self.values = [] def __call__(self, nfev, parameters, value, stepsize, accepted) -> bool: """ Returns: - True if the optimization loop should be terminated + True if the optimization loop should be terminated. """ self.values.append(value) @@ -38,4 +41,3 @@ features: maxiter = 400 spsa = SPSA(maxiter=maxiter, termination_checker=TerminationChecker(10)) parameters, value, niter = spsa.optimize(2, objective, initial_point=np.array([0.5, 0.5])) - print(f'SPSA completed after {niter} iterations') \ No newline at end of file diff --git a/releasenotes/notes/add-backend-v2-ce84c976fb13b038.yaml b/releasenotes/notes/0.19/add-backend-v2-ce84c976fb13b038.yaml similarity index 98% rename from releasenotes/notes/add-backend-v2-ce84c976fb13b038.yaml rename to releasenotes/notes/0.19/add-backend-v2-ce84c976fb13b038.yaml index 3138c7beed5..4b0373fc950 100644 --- a/releasenotes/notes/add-backend-v2-ce84c976fb13b038.yaml +++ b/releasenotes/notes/0.19/add-backend-v2-ce84c976fb13b038.yaml @@ -30,7 +30,7 @@ features: The other change around this is that the number of attributes exposed in the abstract :class:`~qiskit.providers.BackendV2` class is designed to be a hardware/vendor agnostic set of the required or optional fields that the - rest of Qiskit can use today with any backend. Sub-classes of the abstract + rest of Qiskit can use today with any backend. Subclasses of the abstract :class:`~qiskit.providers.BackendV2` class can add support for additional attributes and methods beyond those defined in :class:`~qiskit.providers.BackendV2`, but these will not be supported diff --git a/releasenotes/notes/0.19/add-circuit-calibrations-to-diassambler-2e68437a815cc729.yaml b/releasenotes/notes/0.19/add-circuit-calibrations-to-diassambler-2e68437a815cc729.yaml new file mode 100644 index 00000000000..0eefda65125 --- /dev/null +++ b/releasenotes/notes/0.19/add-circuit-calibrations-to-diassambler-2e68437a815cc729.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Disassembled circuits now inherit calibrations from assembled + :obj:`.QasmQobj` and experiments. Fixes `#5348 + `__. diff --git a/releasenotes/notes/add-contains_instruction-pass-dcad5f1978ee1e24.yaml b/releasenotes/notes/0.19/add-contains_instruction-pass-dcad5f1978ee1e24.yaml similarity index 93% rename from releasenotes/notes/add-contains_instruction-pass-dcad5f1978ee1e24.yaml rename to releasenotes/notes/0.19/add-contains_instruction-pass-dcad5f1978ee1e24.yaml index a4658dffa81..19e6a9d52b0 100644 --- a/releasenotes/notes/add-contains_instruction-pass-dcad5f1978ee1e24.yaml +++ b/releasenotes/notes/0.19/add-contains_instruction-pass-dcad5f1978ee1e24.yaml @@ -28,13 +28,13 @@ features: assert property_set["contains_sx"] == False upgrade: - | - The preset passmanagers for optimization levels 0, 1, 2, and 3 which are + The preset pass managers for optimization levels 0, 1, 2, and 3 which are generated by :func:`~qiskit.transpiler.preset_passmanagers.level_0_pass_manager`, :func:`~qiskit.transpiler.preset_passmanagers.level_1_pass_manager`, :func:`~qiskit.transpiler.preset_passmanagers.level_2_pass_manager`, and :func:`~qiskit.transpiler.preset_passmanagers.level_3_pass_manager` - respectively will no long unconditionally run the + respectively will no longer unconditionally run the :class:`~qiskit.transpiler.passes.TimeUnitConversion`. Previously, the preset pass managers would always run this pass regardless of the inputs to the transpiler and the circuit. Now this pass will only be run if diff --git a/releasenotes/notes/0.19/add-detach-prefix-088e96b88ba29927.yaml b/releasenotes/notes/0.19/add-detach-prefix-088e96b88ba29927.yaml new file mode 100644 index 00000000000..524413e56a0 --- /dev/null +++ b/releasenotes/notes/0.19/add-detach-prefix-088e96b88ba29927.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + Added a utility function :func:`qiskit.utils.detach_prefix` that is a + counterpart of :func:`~qiskit.utils.apply_prefix`. The new function returns + a tuple of scaled value and prefix from a given float value. For example, a + value ``1.3e8`` will be converted into ``(130, "M")`` that can be used to + display a value in the user friendly format, such as ``130 MHz``. diff --git a/releasenotes/notes/0.19/add-gate-error-objective-00a96f75055d1526.yaml b/releasenotes/notes/0.19/add-gate-error-objective-00a96f75055d1526.yaml new file mode 100644 index 00000000000..dc132318d40 --- /dev/null +++ b/releasenotes/notes/0.19/add-gate-error-objective-00a96f75055d1526.yaml @@ -0,0 +1,21 @@ +--- +features: + - | + The values ``"gate_error"`` and ``"balanced"`` are now available for the + ``objective`` option in the construction of the + :class:`~qiskit.transpiler.passes.BIPMapping` object, and ``"balanced"`` is + now the default. + + The ``"gate_error"`` objective requires passing a + :obj:`.BackendProperties` instance in the ``backend_prop`` + kwarg, which contains the 2q-gate gate errors used in the computation of the + objectives. The ``"balanced"`` objective will use the + :obj:`.BackendProperties` instance if it is given, but otherwise will assume + a CX error rate as given in the new parameter ``default_cx_error_rate``. + The relative weights of the gate-error and depth components of the balanced + objective can be controlled with the new ``depth_obj_weight`` parameter. +upgrade: + - | + The default method for :obj:`.BIPMapping` is now ``balanced`` rather than + ``depth``. This new objective generally achieves a better result, as it + factors in both the circuit depth and the gate error. diff --git a/releasenotes/notes/0.19/add-getters-and-setters-for-vqe-edc753591b368980.yaml b/releasenotes/notes/0.19/add-getters-and-setters-for-vqe-edc753591b368980.yaml new file mode 100644 index 00000000000..a1f20e92201 --- /dev/null +++ b/releasenotes/notes/0.19/add-getters-and-setters-for-vqe-edc753591b368980.yaml @@ -0,0 +1,25 @@ +--- +features: + - | + Every attribute of the :class:`~qiskit.algorithms.VQE` class that is set at + the initialization is now accessible with getters and setters. Further, the + default values of the VQE attributes :attr:`~.VQE.ansatz` and + :attr:`~.VQE.optimizer` can be reset by assigning ``None`` to them:: + + vqe = VQE(my_ansatz, my_optimizer) + vqe.ansatz = None # reset to default: RealAmplitudes ansatz + vqe.optimizer = None # reset to default: SLSQP optimizer + +fixes: + - | + Fixed setting the ``ansatz`` or ``optimizer`` attributes of a + :obj:`~qiskit.algorithms.VQE` instance to ``None`` resulting in a buggy + behavior. See `#7093 + `__ for details. + +upgrade: + - | + The ``sort_parameters_by_name`` of the :class:`~qiskit.algorithms.VQE` class + has been removed, following its deprecation in Qiskit Terra 0.18. There is + no alternative provided, as the new ordering of parameters is the more + natural sort order. diff --git a/releasenotes/notes/0.19/add-group-qubit-wise-commuting-pauli-list-7b96834068a36928.yaml b/releasenotes/notes/0.19/add-group-qubit-wise-commuting-pauli-list-7b96834068a36928.yaml new file mode 100644 index 00000000000..58b50d8371b --- /dev/null +++ b/releasenotes/notes/0.19/add-group-qubit-wise-commuting-pauli-list-7b96834068a36928.yaml @@ -0,0 +1,11 @@ +--- + +features: + - | + Added a new method :meth:`.PauliList.group_qubit_wise_commuting` that + partitions a :obj:`.PauliList` into sets of mutually qubit-wise commuting + :obj:`.Pauli` operators. For example:: + + from qiskit.quantum_info import PauliList, Pauli + pauli_list = PauliList([Pauli("IY"), Pauli("XX"), Pauli("YY"), Pauli("YX")]) + pauli_list.group_qubit_wise_commuting() diff --git a/releasenotes/notes/0.19/add-hexagonal-lattice-couplingmap-d3b65b146b6cd1d1.yaml b/releasenotes/notes/0.19/add-hexagonal-lattice-couplingmap-d3b65b146b6cd1d1.yaml new file mode 100644 index 00000000000..477ee8c38f2 --- /dev/null +++ b/releasenotes/notes/0.19/add-hexagonal-lattice-couplingmap-d3b65b146b6cd1d1.yaml @@ -0,0 +1,13 @@ +--- +features: + - | + Added a new coupling-map constructor method + :meth:`.CouplingMap.from_hexagonal_lattice` for constructing a hexagonal + lattice coupling map. For example, to construct a 2x2 hexagonal + lattice coupling map: + + .. jupyter-execute:: + + from qiskit.transpiler import CouplingMap + cmap = CouplingMap.from_hexagonal_lattice(2, 2) + cmap.draw() diff --git a/releasenotes/notes/add-new-fake-backends-3376682dc5c63557.yaml b/releasenotes/notes/0.19/add-new-fake-backends-3376682dc5c63557.yaml similarity index 82% rename from releasenotes/notes/add-new-fake-backends-3376682dc5c63557.yaml rename to releasenotes/notes/0.19/add-new-fake-backends-3376682dc5c63557.yaml index c2cec0f00c7..33509b9fbfc 100644 --- a/releasenotes/notes/add-new-fake-backends-3376682dc5c63557.yaml +++ b/releasenotes/notes/0.19/add-new-fake-backends-3376682dc5c63557.yaml @@ -1,8 +1,8 @@ --- features: - | - New fake backend classes are available under ``qiskit.test.mock`. These - included mocked versions of ``ibmq_brooklyn``, ``ibmq_manila``, + New fake backend classes are available under ``qiskit.test.mock``. These + include mocked versions of ``ibmq_brooklyn``, ``ibmq_manila``, ``ibmq_jakarta``, and ``ibmq_lagos``. As with the other fake backends, these include snapshots of calibration data (i.e. ``backend.defaults()``) and error data (i.e. ``backend.properties()``) taken from the real system, and diff --git a/releasenotes/notes/0.19/add-opflow-is-hermitian-method-6a461549e3c6b32c.yaml b/releasenotes/notes/0.19/add-opflow-is-hermitian-method-6a461549e3c6b32c.yaml new file mode 100644 index 00000000000..3cd839b8475 --- /dev/null +++ b/releasenotes/notes/0.19/add-opflow-is-hermitian-method-6a461549e3c6b32c.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Added the :meth:`.OperatorBase.is_hermitian` method to check whether the + operator is Hermitian or not. :class:`~qiskit.algorithms.NumPyEigensolver` + and :class:`~qiskit.algorithms.NumPyMinimumEigensolver` use ``eigh`` or + ``eigsh`` to solve the eigenvalue problem when the operator is Hermitian. diff --git a/releasenotes/notes/0.19/add-passmanager-config-from-backend-af5dd7d99ec053ef.yaml b/releasenotes/notes/0.19/add-passmanager-config-from-backend-af5dd7d99ec053ef.yaml new file mode 100644 index 00000000000..eeae8611bf2 --- /dev/null +++ b/releasenotes/notes/0.19/add-passmanager-config-from-backend-af5dd7d99ec053ef.yaml @@ -0,0 +1,16 @@ +--- +features: + - | + Added a new constructor method :meth:`.PassManagerConfig.from_backend`. It + constructs a :class:`~qiskit.transpiler.PassManagerConfig` object with user + options and the configuration of a backend. With this feature, a preset + passmanager can be built easier. For example:: + + from qiskit.transpiler.passmanager_config import PassManagerConfig + from qiskit.transpiler.preset_passmanagers import level_1_pass_manager + from qiskit.test.mock import FakeMelbourne + + pass_manager = level_1_pass_manager( + PassManagerConfig.from_backend(FakeMelbourne(), seed_transpiler=42) + ) + diff --git a/releasenotes/notes/0.19/add-pulse-gate-pass-dc347177ed541bcc.yaml b/releasenotes/notes/0.19/add-pulse-gate-pass-dc347177ed541bcc.yaml new file mode 100644 index 00000000000..d1fea80e3f9 --- /dev/null +++ b/releasenotes/notes/0.19/add-pulse-gate-pass-dc347177ed541bcc.yaml @@ -0,0 +1,92 @@ +--- +features: + - | + A new transpiler pass, :class:`.PulseGates`, was added, which automatically + extracts user-provided calibrations from the instruction schedule map and + attaches the gate schedule to the given (transpiled) quantum circuit as a + pulse gate. + + The :class:`.PulseGates` transpiler pass is applied to all optimization + levels from 0 to 3. No gate implementation is updated unless the end-user + explicitly overrides the ``backend.defaults().instruction_schedule_map``. + This pass saves users from individually calling + :meth:`.QuantumCircuit.add_calibration` for every circuit run on the + hardware. + + To supplement this new pass, a schedule was added to + :class:`~qiskit.pulse.InstructionScheduleMap` and is implicitly updated with + a metadata field ``"publisher"``. Backend-calibrated gate schedules have a + special publisher kind to avoid overriding circuits with calibrations of + already known schedules. Usually, end-users don't need to take care of this + metadata as it is applied automatically. You can call + :meth:`.InstructionScheduleMap.has_custom_gate` to check if the map has + custom gate calibration. + + See the below code example to learn how to apply custom gate implementation + for all circuits under execution. + + .. code-block:: python + + from qiskit.test.mock import FakeGuadalupe + from qiskit import pulse, circuit, transpile + + backend = FakeGuadalupe() + + with pulse.build(backend, name="x") as x_q0: + pulse.play(pulse.Constant(160, 0.1), pulse.drive_channel(0)) + + backend.defaults().instruction_schedule_map.add("x", (0,), x_q0) + + circs = [] + for _ in range(100): + circ = circuit.QuantumCircuit(1) + circ.sx(0) + circ.rz(1.57, 0) + circ.x(0) + circ.measure_active() + circs.append(circ) + + circs = transpile(circs, backend) + circs[0].calibrations # This returns calibration only for x gate + + Note that the instruction schedule map is a mutable object. + If you override one of the entries and use that backend for other experiments, + you may accidentally update the gate definition. + + .. code-block:: python + + backend = FakeGuadalupe() + + instmap = backend.defaults().instruction_schedule_map + instmap.add("x", (0, ), my_x_gate_schedule) + + qc = QuantumCircuit(1, 1) + qc.x(0) + qc.measure(0, 0) + + qc = transpile(qc, backend) # This backend uses custom X gate + + If you want to update the gate definitions of a specific experiment, + you need to first deepcopy the instruction schedule map + and directly pass it to the transpiler. + + +deprecations: + - | + There has been a significant transpiler pass reorganization regarding calibrations. + The import paths:: + + from qiskit.transpiler.passes.scheduling.calibration_creators import RZXCalibrationBuilder + from qiskit.transpiler.passes.scheduling.calibration_creators import RZXCalibrationBuilderNoEcho + + are deprecated, and will be removed in a future release. + The import path:: + + from qiskit.transpiler.passes.scheduling.rzx_templates import rzx_templates + + is also deprecated, and will be removed in a future release. + You should use the new import paths:: + + from qiskit.transpiler.passes import RZXCalibrationBuilder + from qiskit.transpiler.passes import RZXCalibrationBuilderNoEcho + from qiskit.transpiler.passes.calibration.rzx_templates import rzx_templates diff --git a/releasenotes/notes/add-qubit-subset-to-bip-mapper-e1c6234d04484d58.yaml b/releasenotes/notes/0.19/add-qubit-subset-to-bip-mapper-e1c6234d04484d58.yaml similarity index 96% rename from releasenotes/notes/add-qubit-subset-to-bip-mapper-e1c6234d04484d58.yaml rename to releasenotes/notes/0.19/add-qubit-subset-to-bip-mapper-e1c6234d04484d58.yaml index 374a1ac3fda..52494f55160 100644 --- a/releasenotes/notes/add-qubit-subset-to-bip-mapper-e1c6234d04484d58.yaml +++ b/releasenotes/notes/0.19/add-qubit-subset-to-bip-mapper-e1c6234d04484d58.yaml @@ -2,7 +2,7 @@ features: - | Introduced a new option ``qubit_subset`` to the constructor of - :class:`qiskit.transpiler.passes.BIPMapping`. + :class:`.BIPMapping`. The option enables us to specify physical qubits to be used (in ``coupling_map`` of the device) during the mapping in one line: diff --git a/releasenotes/notes/0.19/add-sparsepauliop-fast-path-228065a05fca4387.yaml b/releasenotes/notes/0.19/add-sparsepauliop-fast-path-228065a05fca4387.yaml new file mode 100644 index 00000000000..6d282d1b1f0 --- /dev/null +++ b/releasenotes/notes/0.19/add-sparsepauliop-fast-path-228065a05fca4387.yaml @@ -0,0 +1,25 @@ +--- +features: + - | + Added the ``ignore_pauli_phase`` and ``copy`` arguments to the constructor + of :obj:`~qiskit.quantum_info.SparsePauliOp`. ``ignore_pauli_phase`` + prevents the ``phase`` attribute of an input + :class:`~qiskit.quantum_info.PauliList` from being read, which is more + performant if the :obj:`.PauliList` is already known to have all phases as + zero in the internal ZX convention. ``copy`` allows users to avoid the copy + of the input data when they explicitly set ``copy=False``. + - | + Improved performance of the following :class:`~qiskit.quantum_info.SparsePauliOp` operations: + + * :meth:`~qiskit.quantum_info.SparsePauliOp.simplify` (see `#7122 `__) + * :meth:`~qiskit.quantum_info.SparsePauliOp.compose` + (see `#7126 `__) + * :meth:`~qiskit.quantum_info.SparsePauliOp._add` + (see `#7138 `__) + * :meth:`~qiskit.quantum_info.SparsePauliOp.from_list` and :meth:`~qiskit.quantum_info.PauliList.__init__` + (see other discussion in `#7138 `__). + +fixes: + - | + Fixed addition of :obj:`.PauliList`\ s with ``qargs``. The method used to raise a runtime error + if the operands had different numbers of qubits. diff --git a/releasenotes/notes/0.19/add-sparsepauliop-sum-d55fc817c9fded82.yaml b/releasenotes/notes/0.19/add-sparsepauliop-sum-d55fc817c9fded82.yaml new file mode 100644 index 00000000000..7b2564d4ba7 --- /dev/null +++ b/releasenotes/notes/0.19/add-sparsepauliop-sum-d55fc817c9fded82.yaml @@ -0,0 +1,19 @@ +--- +features: + - | + Added the :meth:`.SparsePauliOp.sum` method to add together many + :class:`.SparsePauliOp`\ s. This method has significantly better + performance than adding the instances together in a loop. For example, the + previous way to add several :class:`.SparsePauliOp`\ s together would be to + do:: + + from qiskit.quantum_info import SparsePauliOp, random_pauli_list + sparse_ops = [SparsePauliOp(random_pauli_list(10, 10)) for _ in [None]*1000] + + total = sparse_ops[0] + for op in sparse_ops[1:]: + total += op + + This can now be done far more efficiently (in both speed and typing!) as:: + + SparsePauliOp.sum(sparse_ops) diff --git a/releasenotes/notes/0.19/add-support-to-disable-amplitude-limit-in-parametric-pulses-ef88b77db8c1b06c.yaml b/releasenotes/notes/0.19/add-support-to-disable-amplitude-limit-in-parametric-pulses-ef88b77db8c1b06c.yaml new file mode 100644 index 00000000000..9552dd0d7f9 --- /dev/null +++ b/releasenotes/notes/0.19/add-support-to-disable-amplitude-limit-in-parametric-pulses-ef88b77db8c1b06c.yaml @@ -0,0 +1,11 @@ +--- +features: + - | + Added an argument ``limit_amplitude`` to the constructor of + ``ParametricPulse``, which is the base class of :obj:`.Gaussian`, + :obj:`.GaussianSquare`, :obj:`.Drag` and :obj:`.Constant`, to allowing + disabling the amplitude limit of 1 on a pulse-by-pulse basis. With + ``limit_amplitude=False``, individual pulses may have an amplitude exceeding + unity without raising a :class:`.PulseError`. See `#6544 + `__ for more + detail. diff --git a/releasenotes/notes/0.19/added-multiformat-support-b5d3c7c7c1536951.yaml b/releasenotes/notes/0.19/added-multiformat-support-b5d3c7c7c1536951.yaml new file mode 100644 index 00000000000..4169e2cfe32 --- /dev/null +++ b/releasenotes/notes/0.19/added-multiformat-support-b5d3c7c7c1536951.yaml @@ -0,0 +1,31 @@ +--- +features: + - | + Using :meth:`.QuantumCircuit.draw` or :func:`.circuit_drawer` with the + ``latex`` drawer will now generate a file in an image format inferred from the + filename extension, for example:: + + import qiskit + + circuit = qiskit.QuantumCircuit(2) + circuit.h(0) + circuit.cx(0, 1) + circuit.draw('latex', filename='./file.jpg') + + This will save the circuit drawing in the JPEG format. Previously, the + image always be in PNG format. Refer to `#6448 + `__ for more details. + + Now, if it encounters a filename extension which is not supported, for example:: + + circuit.draw('latex', filename='./file.spooky') + + it will raise a ``ValueError`` to change the filename extension to a supported image format. +upgrade: + - | + The circuit drawers :meth:`.QuantumCircuit.draw` and + :func:`.circuit_drawer` with the ``latex`` option will now save their images + in a format determined the file extension (if a file name is provided). + Previously, they would always save in PNG format. They now raise + ``ValueError`` if the image format is not known. This was done to make it + easier to save the image in different formats. diff --git a/releasenotes/notes/0.19/added-snapshot-tests-for-backend-mapping-functions-5961300e09f05be0.yaml b/releasenotes/notes/0.19/added-snapshot-tests-for-backend-mapping-functions-5961300e09f05be0.yaml new file mode 100644 index 00000000000..8abf6d1814d --- /dev/null +++ b/releasenotes/notes/0.19/added-snapshot-tests-for-backend-mapping-functions-5961300e09f05be0.yaml @@ -0,0 +1,7 @@ +--- +features: + - | + Added the parameter ``filename`` to + :func:`~qiskit.visualization.plot_gate_map` and + :func:`~qiskit.visualization.plot_coupling_map`, which allows saving the + resulting images to a file. diff --git a/releasenotes/notes/0.19/approxiamte-quantum-compiler-3c74652d4c5e9fa6.yaml b/releasenotes/notes/0.19/approxiamte-quantum-compiler-3c74652d4c5e9fa6.yaml new file mode 100644 index 00000000000..5063b0f6b91 --- /dev/null +++ b/releasenotes/notes/0.19/approxiamte-quantum-compiler-3c74652d4c5e9fa6.yaml @@ -0,0 +1,10 @@ +--- +features: + - | + Introduced an approximate quantum compiler and a corresponding unitary + synthesis plugin implementation. The main AQC class is + :class:`~qiskit.transpiler.synthesis.aqc.AQC` for a standalone version that + compiles a unitary matrix into an approximate circuit. The plugin may be + invoked by :func:`~.compiler.transpile` when the + ``unitary_synthesis_method`` argument is set to ``'aqc'``. See + :mod:`qiskit.transpiler.synthesis.aqc` for full details. diff --git a/releasenotes/notes/0.19/bugfix-6918-4b3cc4056df39e48.yaml b/releasenotes/notes/0.19/bugfix-6918-4b3cc4056df39e48.yaml new file mode 100644 index 00000000000..9f0bf0e806e --- /dev/null +++ b/releasenotes/notes/0.19/bugfix-6918-4b3cc4056df39e48.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Fixed an issue causing an error when trying to compute a gradient with the + :class:`~qiskit.opflow.gradients.CircuitGradient` class for a gate that was + not a supported gate. This bugfix transpiles a given gate to the set of + supported gates for a requested gradient method. Fixes `#6918 + `__. diff --git a/releasenotes/notes/bump-retworkx-0.10.1-1fcf4fc746bd754a.yaml b/releasenotes/notes/0.19/bump-retworkx-0.10.1-1fcf4fc746bd754a.yaml similarity index 100% rename from releasenotes/notes/bump-retworkx-0.10.1-1fcf4fc746bd754a.yaml rename to releasenotes/notes/0.19/bump-retworkx-0.10.1-1fcf4fc746bd754a.yaml diff --git a/releasenotes/notes/0.19/calibration_results-ac2f9f75479e8d64.yaml b/releasenotes/notes/0.19/calibration_results-ac2f9f75479e8d64.yaml new file mode 100644 index 00000000000..a32c657dfb3 --- /dev/null +++ b/releasenotes/notes/0.19/calibration_results-ac2f9f75479e8d64.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Removed calibration results when using error mitigation with the + :meth:`~qiskit.utils.QuantumInstance.execute` method of + :class:`~qiskit.utils.QuantumInstance`. Fixes `#7129 + `__. diff --git a/releasenotes/notes/0.19/circuit-size-depth-filter-function-2177a8a71588f915.yaml b/releasenotes/notes/0.19/circuit-size-depth-filter-function-2177a8a71588f915.yaml new file mode 100644 index 00000000000..9ecbf311146 --- /dev/null +++ b/releasenotes/notes/0.19/circuit-size-depth-filter-function-2177a8a71588f915.yaml @@ -0,0 +1,15 @@ +--- +features: + - | + Added a ``filter_function`` argument to + :meth:`.QuantumCircuit.depth` and + :meth:`.QuantumCircuit.size` in order to + analyze circuit operations according to some criteria. + + For example, to get the number of two-qubit gates, you can do:: + + circuit.size(lambda x: x[0].num_qubits == 2) + + Or to get the depth of T gates acting on the zeroth qubit:: + + circuit.depth(lambda x: x[0].name == 't' and circuit.qubits[0] in x[1]) diff --git a/releasenotes/notes/collect-block-pass-b15031aa9749d735.yaml b/releasenotes/notes/0.19/collect-block-pass-b15031aa9749d735.yaml similarity index 100% rename from releasenotes/notes/collect-block-pass-b15031aa9749d735.yaml rename to releasenotes/notes/0.19/collect-block-pass-b15031aa9749d735.yaml diff --git a/releasenotes/notes/0.19/control-flow-builder-interface-63910843f8bea5e0.yaml b/releasenotes/notes/0.19/control-flow-builder-interface-63910843f8bea5e0.yaml new file mode 100644 index 00000000000..648969ca023 --- /dev/null +++ b/releasenotes/notes/0.19/control-flow-builder-interface-63910843f8bea5e0.yaml @@ -0,0 +1,42 @@ +--- +features: + - | + There is a builder interface for the new control-flow operations on + :obj:`.QuantumCircuit`, such as the new :obj:`.ForLoopOp`, :obj:`.IfElseOp`, + and :obj:`.WhileLoopOp`. The interface uses the same circuit methods, + *i.e.* :meth:`.QuantumCircuit.for_loop`, :meth:`.QuantumCircuit.if_test` and + :meth:`.QuantumCircuit.while_loop`, which are overloaded so that if the + ``body`` parameter is not given, they return a context manager. Entering + one of these context managers pushes a scope into the circuit, and captures + all gate calls (and other scopes) and the resources these use, and builds up + the relevant operation at the end. For example, you can now do:: + + qc = QuantumCircuit(2, 2) + with qc.for_loop(range(5)) as i: + qc.rx(i * math.pi / 4, 0) + + This will produce a :obj:`.ForLoopOp` on ``qc``, which knows that qubit 0 is + the only resource used within the loop body. These context managers can be + nested, and will correctly determine their widths. You can use + :meth:`.QuantumCircuit.break_loop` and :meth:`.QuantumCircuit.continue_loop` + within a context, and it will expand to be the correct width for its + containing loop, even if it is nested in further + :meth:`.QuantumCircuit.if_test` blocks. + + The :meth:`~.QuantumCircuit.if_test` context manager provides a chained + manager which, if desired, can be used to create an ``else`` block, such as + by:: + + qreg = QuantumRegister(2) + creg = ClassicalRegister(2) + qc = QuantumCircuit(qreg, creg) + qc.h(0) + qc.cx(0, 1) + qc.measure(0, 0) + with qc.if_test((creg, 0)) as else_: + qc.x(1) + with else_: + qc.z(1) + + The manager will ensure that the ``if`` and ``else`` bodies are defined over + the same set of resources. diff --git a/releasenotes/notes/cx-cancellation-pass-generalization-538fb7cfe49b3fd5.yaml b/releasenotes/notes/0.19/cx-cancellation-pass-generalization-538fb7cfe49b3fd5.yaml similarity index 69% rename from releasenotes/notes/cx-cancellation-pass-generalization-538fb7cfe49b3fd5.yaml rename to releasenotes/notes/0.19/cx-cancellation-pass-generalization-538fb7cfe49b3fd5.yaml index 2db152e3ac4..09b12e6ac42 100644 --- a/releasenotes/notes/cx-cancellation-pass-generalization-538fb7cfe49b3fd5.yaml +++ b/releasenotes/notes/0.19/cx-cancellation-pass-generalization-538fb7cfe49b3fd5.yaml @@ -1,14 +1,15 @@ --- features: - | - Introduced a new feature ``InverseCancellation`` that generalizes the ``CXInverseCancellation`` + Introduced a new transpiler pass :obj:`.InverseCancellation` that generalizes the :obj:`.CXCancellation` pass to cancel any self-inverse gates or gate-inverse pairs. It can be used by - initializing ``InverseCancellation`` and passing a gate to cancel, for example:: + initializing :obj:`.InverseCancellation` and passing a gate to cancel, for example:: from qiskit.transpiler.passes import InverseCancellation from qiskit import QuantumCircuit from qiskit.circuit.library import HGate from qiskit.transpiler import PassManager + qc = QuantumCircuit(2, 2) qc.h(0) qc.h(0) diff --git a/releasenotes/notes/0.19/dag_node_to_op_in_out_node-af2cf9c3e7686285.yaml b/releasenotes/notes/0.19/dag_node_to_op_in_out_node-af2cf9c3e7686285.yaml new file mode 100644 index 00000000000..1eae9ee232c --- /dev/null +++ b/releasenotes/notes/0.19/dag_node_to_op_in_out_node-af2cf9c3e7686285.yaml @@ -0,0 +1,18 @@ +--- +deprecations: + - | + The :class:`~qiskit.dagcircuit.DAGNode` class is being deprecated as a + standalone class and will be used in the future only as the parent class for + :class:`~qiskit.dagcircuit.DAGOpNode`, + :class:`~qiskit.dagcircuit.DAGInNode`, and + :class:`~qiskit.dagcircuit.DAGOutNode`. As part of this deprecation, the + following kwargs and associated attributes in :obj:`.DAGNode` are also being + deprecated: ``type``, ``op``, and ``wire``. +upgrade: + - | + The previously deprecated ``condition`` kwarg, which was deprecated as part + of the 0.15.0 release, has been removed from + :meth:`.DAGCircuit.apply_operation_back` and + :meth:`.DAGCircuit.apply_operation_front`. Instead set the ``condition`` + attribute on the :class:`~qiskit.circuit.Instruction` instances being added + to the :class:`~qiskit.dagcircuit.DAGCircuit` using :meth:`.Instruction.c_if`. diff --git a/releasenotes/notes/deprecate-backend-rzx-cal-build-8eda1526725d7e7d.yaml b/releasenotes/notes/0.19/deprecate-backend-rzx-cal-build-8eda1526725d7e7d.yaml similarity index 95% rename from releasenotes/notes/deprecate-backend-rzx-cal-build-8eda1526725d7e7d.yaml rename to releasenotes/notes/0.19/deprecate-backend-rzx-cal-build-8eda1526725d7e7d.yaml index a669f40f610..1e686a1262a 100644 --- a/releasenotes/notes/deprecate-backend-rzx-cal-build-8eda1526725d7e7d.yaml +++ b/releasenotes/notes/0.19/deprecate-backend-rzx-cal-build-8eda1526725d7e7d.yaml @@ -15,7 +15,7 @@ deprecations: For the constructor of the :class:`~qiskit.transpiler.passes.RZXCalibrationBuilder` passing a backend either as the first positional argument or with the named ``backend`` kwarg - is deprecated and will no longer work in a future release. Instead a + is deprecated and will no longer work in a future release. Instead a :class:`~qiskit.pulse.InstructionScheduleMap` should be passed directly to the ``instruction_schedule_map`` kwarg and a list of channel name lists for each qubit should be passed directly to ``qubit_channel_mapping``. For example, @@ -41,6 +41,6 @@ deprecations: ) This change is necessary because as a general rule backend objects are not - pickle serializeable and it would break when it was used with multiple - processes inside of :func:`~qiskit.compiler.transpile` when compliing + pickle serializable and it would break when it was used with multiple + processes inside of :func:`~qiskit.compiler.transpile` when compiling multiple circuits at once. diff --git a/releasenotes/notes/deprecate-mcmt-label-12865e041ce67658.yaml b/releasenotes/notes/0.19/deprecate-mcmt-label-12865e041ce67658.yaml similarity index 66% rename from releasenotes/notes/deprecate-mcmt-label-12865e041ce67658.yaml rename to releasenotes/notes/0.19/deprecate-mcmt-label-12865e041ce67658.yaml index a1bedd69350..7abc9c4cd9c 100644 --- a/releasenotes/notes/deprecate-mcmt-label-12865e041ce67658.yaml +++ b/releasenotes/notes/0.19/deprecate-mcmt-label-12865e041ce67658.yaml @@ -2,16 +2,19 @@ deprecations: - | The ``label`` property of class - :class:`~qiskit.circuit.library.generalized_gates.mcmt.MCMT` and subclass - :class:`~qiskit.circuit.library.generalized_gates.mcmt.MCMTVChain` has been + :class:`~qiskit.circuit.library.MCMT` and subclass + :class:`~qiskit.circuit.library.MCMTVChain` has been deprecated and will be removed in a future release. Consequently, the ``label`` kwarg on the constructor for both classes is also deprecated, - along with the ``label`` kwarg of method - :meth:`~qiskit.circuit.library.generalized_gates.mcmt.MCMT.control`. + along with the ``label`` kwarg of method :meth:`.MCMT.control`. Currently, the ``label`` property is used to name the controlled target when it is comprised of more than one target qubit, however, this was never intended to be user-specifiable, and can result in an incorrect MCMT gate if the name of a well-known operation is used. After deprecation, the ``label`` property will no longer be user-specifiable. However, you can get the generated name of the controlled - target via ``MCMT.data[0][0].base_gate.name``. + target via + + :: + + MCMT.data[0][0].base_gate.name diff --git a/releasenotes/notes/deprecate-subgraph-coupling_map-93af284f5410e4b0.yaml b/releasenotes/notes/0.19/deprecate-subgraph-coupling_map-93af284f5410e4b0.yaml similarity index 84% rename from releasenotes/notes/deprecate-subgraph-coupling_map-93af284f5410e4b0.yaml rename to releasenotes/notes/0.19/deprecate-subgraph-coupling_map-93af284f5410e4b0.yaml index 48bd46bea87..f36e05e349b 100644 --- a/releasenotes/notes/deprecate-subgraph-coupling_map-93af284f5410e4b0.yaml +++ b/releasenotes/notes/0.19/deprecate-subgraph-coupling_map-93af284f5410e4b0.yaml @@ -5,7 +5,7 @@ deprecations: :class:`~qiskit.transpiler.CouplingMap` class is deprecated and will be removed in a future release. Instead the :meth:`~qiskit.transpiler.CouplingMap.reduce` method should be used, which - does the same thing except it preserves the nodelist order for the output + does the same thing except it preserves the node list order for the output :class:`~qiskit.transpiler.CouplingMap` (while :meth:`~qiskit.transpiler.CouplingMap.subgraph` did not preserve list order). diff --git a/releasenotes/notes/deprecation-cleanup-3d3e203e2d6e6f31.yaml b/releasenotes/notes/0.19/deprecation-cleanup-3d3e203e2d6e6f31.yaml similarity index 70% rename from releasenotes/notes/deprecation-cleanup-3d3e203e2d6e6f31.yaml rename to releasenotes/notes/0.19/deprecation-cleanup-3d3e203e2d6e6f31.yaml index bb51a1aad4f..161c6ad7867 100644 --- a/releasenotes/notes/deprecation-cleanup-3d3e203e2d6e6f31.yaml +++ b/releasenotes/notes/0.19/deprecation-cleanup-3d3e203e2d6e6f31.yaml @@ -3,12 +3,12 @@ upgrade: - | The ``DAGCircuit.extend_back()`` method has been removed. It was originally deprecated in the 0.13.0 release. Instead you can use the - :meth:`~qiskit.dagcircuit.DAGCircuit.compose` method which is more general + :meth:`.DAGCircuit.compose` method which is more general and provides the same functionality. - | - ``DAGCircuit.compose_back`` method has been removed. It was originally + The ``DAGCircuit.compose_back()`` method has been removed. It was originally deprecated in the 0.13.0 release. Instead you can use the - :meth:`~qiskit.dagcircuit.DAGCircuit.compose` method which is more general + :meth:`.DAGCircuit.compose` method which is more general and provides the same functionality. - | The ``edge_map`` kwarg of the :class:`~qiskit.dagcircuit.DAGCircuit` method @@ -16,28 +16,27 @@ upgrade: originally deprecated in the 0.14.0 release. The method takes a ``qubits`` and ``clbits`` kwargs to specify the positional order of bits to compose onto instead of using a dictionary mapping that ``edge_map`` previously - provided + provided. - | - The ``DAGCircuit.twoQ_gates`` has been removed. It was originally - deprecated in the 0.13.0 release. Instead the - :meth:`~qiskit.dagcircuit.DAGCircuit.two_qubit_ops` should be used instead. + The ``DAGCircuit.twoQ_gates()`` method has been removed. It was originally + deprecated in the 0.13.0 release. Instead, + :meth:`.DAGCircuit.two_qubit_ops` should be used. - | - The ``DAGCircuit.threeQ_or_more_gates`` has been removed. It was originally - deprecated in the 0.13.0 release. Instead the - :meth:`~qiskit.dagcircuit.DAGCircuit.multi_qubit_ops` should be used - instead. + The ``DAGCircuit.threeQ_or_more_gates()`` method has been removed. It was + originally deprecated in the 0.13.0 release. Instead, + :meth:`.DAGCircuit.multi_qubit_ops` method should be used. - | Named access for the first positional argument for the constructor of - the ``SingleQubitUnitary`` class with ``u`` has been removed - It was originally deprecated in the 0.14.0 release. Instead the first - positional argument can be set using the name ``unitary_matrix`` instead + the :class:`.SingleQubitUnitary` class with ``u`` has been removed. + It was originally deprecated in the 0.14.0 release. Instead, the first + positional argument can be set using the name ``unitary_matrix`` (or just set it positionally instead of by name). - | Named access for the first positional argument for the :class:`~qiskit.circuit.QuantumCircuit` method - :class:`~qiskit.circuit.QuantumCircuit.squ` with ``u`` has been removed + :class:`~qiskit.circuit.QuantumCircuit.squ` with ``u`` has been removed. It was originally deprecated in the 0.14.0 release. Instead the first - positional argument can be set using the name ``unitary_matrix`` instead + positional argument can be set using the name ``unitary_matrix`` (or just set it positionally instead of by name). - | The unused ``proc`` and ``nested_scope`` kwargs for the ``qasm()`` method diff --git a/releasenotes/notes/0.19/draw-statevector-in-ket-notation-0726959d1f6ea3ce.yaml b/releasenotes/notes/0.19/draw-statevector-in-ket-notation-0726959d1f6ea3ce.yaml new file mode 100644 index 00000000000..9ffeac808a4 --- /dev/null +++ b/releasenotes/notes/0.19/draw-statevector-in-ket-notation-0726959d1f6ea3ce.yaml @@ -0,0 +1,29 @@ +--- +features: + - | + The :obj:`.Statevector`\ s of states comprised only of qubits can now be + drawn in LaTeX in ket notation. In ket notation the entries of the + statevector are processed such that exact factors like fractions or square + roots of two are drawn as such. The particular convention can be chosen by + passing the ``convention`` keyword argument as either ``"ket"`` or + ``"vector"`` as appropriate:: + + import math + from qiskit.quantum_info import Statevector + + sv = Statevector([math.sqrt(0.5), 0, 0, -math.sqrt(0.5)]) + sv.draw("latex", convention="ket") + sv.draw("latex", convention="vector") +upgrade: + - | + The output of :meth:`.Statevector.draw` when using ``"latex"`` output is + now the new ``"ket"`` convention if plotting a state comprised purely of qubits. + This was changed to make reading the output clearer, especially in + educational contexts, because it shows the ket labels, and only displays the + nonzero elements. +issues: + - | + The ``"ket"`` convention in the ``"latex"`` drawer of :meth:`.Statevector.draw` + is only valid for states comprising purely of qubits. If you are using states + with some spaces of dimension greater than two, you should either pass + ``convention="vector"``, or use a different drawer. diff --git a/releasenotes/notes/0.19/echo-rzx-weyl-decomposition-ef72345a58bea9e0.yaml b/releasenotes/notes/0.19/echo-rzx-weyl-decomposition-ef72345a58bea9e0.yaml new file mode 100644 index 00000000000..c091a6af4e7 --- /dev/null +++ b/releasenotes/notes/0.19/echo-rzx-weyl-decomposition-ef72345a58bea9e0.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + Added a new transpiler pass :class:`.EchoRZXWeylDecomposition` that allows + users to decompose an arbitrary two-qubit gate in terms of echoed RZX-gates + by leveraging Cartan's decomposition. In combination with other transpiler + passes, this can be used to transpile arbitrary circuits to RZX-gate-based + and pulse-efficient circuits that implement the same unitary. diff --git a/releasenotes/notes/ensure-qnspsa-batching-e48f7ec72412c071.yaml b/releasenotes/notes/0.19/ensure-qnspsa-batching-e48f7ec72412c071.yaml similarity index 71% rename from releasenotes/notes/ensure-qnspsa-batching-e48f7ec72412c071.yaml rename to releasenotes/notes/0.19/ensure-qnspsa-batching-e48f7ec72412c071.yaml index 40b0634b56b..1b51e1a434d 100644 --- a/releasenotes/notes/ensure-qnspsa-batching-e48f7ec72412c071.yaml +++ b/releasenotes/notes/0.19/ensure-qnspsa-batching-e48f7ec72412c071.yaml @@ -2,12 +2,14 @@ features: - | The :class:`~qiskit.algorithms.optimizers.SPSA` and - :class:`~qiskit.algorithms.optimizers.QNSPSA` optimizer classes are now capable of - batching as many circuit evaluations as possible for both the iterations and the initial - calibrations. This can be leveraged by setting the ``max_evals_grouped`` kwarg on - the constructor for :class:`~qiskit.algorithms.VQE` when using either + :class:`~qiskit.algorithms.optimizers.QNSPSA` optimizer classes are now + capable of batching as many circuit evaluations as possible for both the + iterations and the initial calibrations. This can be leveraged by setting + the ``max_evals_grouped`` kwarg on the constructor for + :class:`~qiskit.algorithms.VQE` when using either :class:`~qiskit.algorithms.optimizers.SPSA` or - :class:`~qiskit.algorithms.optimizers.QNSPSA` as the ``optimizer`` parameter. For example:: + :class:`~qiskit.algorithms.optimizers.QNSPSA` as the ``optimizer`` parameter. + For example:: from qiskit.circuit.library import TwoLocal from qiskit.algorithms import VQE diff --git a/releasenotes/notes/execute-fix-108e835dc4f4593d.yaml b/releasenotes/notes/0.19/execute-fix-108e835dc4f4593d.yaml similarity index 71% rename from releasenotes/notes/execute-fix-108e835dc4f4593d.yaml rename to releasenotes/notes/0.19/execute-fix-108e835dc4f4593d.yaml index afeb440ff27..86c4f989619 100644 --- a/releasenotes/notes/execute-fix-108e835dc4f4593d.yaml +++ b/releasenotes/notes/0.19/execute-fix-108e835dc4f4593d.yaml @@ -1,14 +1,14 @@ --- upgrade: - | - When running the :func:`qiskit.execute_function.execute` with a + When running :func:`~qiskit.execute_function.execute` with a :class:`~qiskit.providers.BackendV1` backend the default values for the - kwargs, ``shots``, ``max_credits``, ``meas_level``, ``meas_return``, + kwargs ``shots``, ``max_credits``, ``meas_level``, ``meas_return`` and ``memory_slot_size`` will now be whatever the set default is on the target backend's :attr:`~qiskit.providers.BackendV1.options` attribute. Previously these defaults were set to match the default values when - calling :func:`qiskit.execute_function.execute` with a legacy - :class:`~qiskit.providers.BaseBackend` backend. For example running:: + calling :func:`~qiskit.execute_function.execute` with a legacy + :class:`~qiskit.providers.BaseBackend` backend. For example:: from qiskit.test.mock import FakeMumbai from qiskit import QuantumCircuit, execute diff --git a/releasenotes/notes/0.19/expr_free_symbols_deprecation-72e4db5c178efcff.yaml b/releasenotes/notes/0.19/expr_free_symbols_deprecation-72e4db5c178efcff.yaml new file mode 100644 index 00000000000..bd615ac762e --- /dev/null +++ b/releasenotes/notes/0.19/expr_free_symbols_deprecation-72e4db5c178efcff.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Fixed a deprecation warning emitted when running + :meth:`.QuantumCircuit.draw` or :func:`.circuit_drawer` with Sympy 1.9 + installed, mentioning the Sympy function ``expr_free_symbols()``. + The circuit drawers previously made use of this method when finding + instances of symbolic constants. diff --git a/releasenotes/notes/0.19/feature-rzx-decomposition-c3b5a36b88303c1f.yaml b/releasenotes/notes/0.19/feature-rzx-decomposition-c3b5a36b88303c1f.yaml new file mode 100644 index 00000000000..eb7dfee0f3f --- /dev/null +++ b/releasenotes/notes/0.19/feature-rzx-decomposition-c3b5a36b88303c1f.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + This release introduces a decomposition method for two-qubit gates which + targets user-defined sets of RZX gates. Transpiler users can enable + decomposition for {``RZX(pi/2)``, ``RZX(pi/4)``, and ``RZX(pi/6)``} specifically by including + ``'rzx'`` in their ``basis_gates`` list when calling + :func:`~qiskit.compiler.transpile`. Quantum information package users can + find the method itself under the :obj:`.XXDecomposer` class. diff --git a/releasenotes/notes/feature_optimize_1q_commutation-28530970f58fb21e.yaml b/releasenotes/notes/0.19/feature_optimize_1q_commutation-28530970f58fb21e.yaml similarity index 61% rename from releasenotes/notes/feature_optimize_1q_commutation-28530970f58fb21e.yaml rename to releasenotes/notes/0.19/feature_optimize_1q_commutation-28530970f58fb21e.yaml index 940b818a862..21473b2830f 100644 --- a/releasenotes/notes/feature_optimize_1q_commutation-28530970f58fb21e.yaml +++ b/releasenotes/notes/0.19/feature_optimize_1q_commutation-28530970f58fb21e.yaml @@ -1,6 +1,6 @@ --- features: - | - Added a transpiler pass `Optimize1qGatesSimpleCommutation`, which optimizes + Added a transpiler pass :obj:`.Optimize1qGatesSimpleCommutation`, which optimizes a circuit according to a strategy of commuting single-qubit gates around to discover resynthesis opportunities. diff --git a/releasenotes/notes/fix-ax-figwidth-scaling-mpl-drawer-dc480ccf82dc1007.yaml b/releasenotes/notes/0.19/fix-ax-figwidth-scaling-mpl-drawer-dc480ccf82dc1007.yaml similarity index 86% rename from releasenotes/notes/fix-ax-figwidth-scaling-mpl-drawer-dc480ccf82dc1007.yaml rename to releasenotes/notes/0.19/fix-ax-figwidth-scaling-mpl-drawer-dc480ccf82dc1007.yaml index cb4f567237c..3459409575a 100644 --- a/releasenotes/notes/fix-ax-figwidth-scaling-mpl-drawer-dc480ccf82dc1007.yaml +++ b/releasenotes/notes/0.19/fix-ax-figwidth-scaling-mpl-drawer-dc480ccf82dc1007.yaml @@ -3,9 +3,9 @@ fixes: - | Fixed an issue where the ``ax`` kwarg and the ``figwidth`` option in the ``style`` kwarg for the ``mpl`` circuit drawer did not scale properly. - Users can now pass an ``ax`` from a matplotlib subplot to the ``mpl`` + Users can now pass an ``ax`` from a Matplotlib subplot to the ``mpl`` circuit drawer and the circuit will be drawn within the boundaries of that subplot. Alternatively, users can set the ``figwidth`` in inches in the ``style`` dict kwarg and the drawing will scale to the width in inches that was set. - Fixed `#6367 `__ + Fixed `#6367 `__. diff --git a/releasenotes/notes/fix-bit-failures-circuit-drawers-cc502c9cb7f90e2b.yaml b/releasenotes/notes/0.19/fix-bit-failures-circuit-drawers-cc502c9cb7f90e2b.yaml similarity index 98% rename from releasenotes/notes/fix-bit-failures-circuit-drawers-cc502c9cb7f90e2b.yaml rename to releasenotes/notes/0.19/fix-bit-failures-circuit-drawers-cc502c9cb7f90e2b.yaml index 0efe0361afa..2f2e8a2a109 100644 --- a/releasenotes/notes/fix-bit-failures-circuit-drawers-cc502c9cb7f90e2b.yaml +++ b/releasenotes/notes/0.19/fix-bit-failures-circuit-drawers-cc502c9cb7f90e2b.yaml @@ -6,7 +6,6 @@ fixes: :class:`~qiskit.circuit.QuantumCircuit`. When displaying a ``measure`` instruction targeted on a classical bit instead of a register, using the ``latex`` drawer option, the drawer would fail. -fixes: - | Fixed an issue with the :func:`~qiskit.visualization.circuit_drawer` function and :meth:`~qiskit.circuit.QuantumCircuit.draw` method of @@ -14,7 +13,6 @@ fixes: options, ``mpl``, ``latex``, or ``text``, if a gate with a classical condition was encountered that was conditioned on a classical bit without a register, the drawer would fail. -fixes: - | Fixed an issue with the :func:`~qiskit.visualization.circuit_drawer` function and :meth:`~qiskit.circuit.QuantumCircuit.draw` method of diff --git a/releasenotes/notes/0.19/fix-c3sxgate-7138e004a2b05ca8.yaml b/releasenotes/notes/0.19/fix-c3sxgate-7138e004a2b05ca8.yaml new file mode 100644 index 00000000000..73d2fbd0e2f --- /dev/null +++ b/releasenotes/notes/0.19/fix-c3sxgate-7138e004a2b05ca8.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + :obj:`~qiskit.circuit.library.C3SXGate` now has a correct decomposition and + matrix representation. Previously it was equivalent to + ``SdgXGate().control(3)``, rather than the intended ``SXGate().control(3)``. diff --git a/releasenotes/notes/fix-configurable-fake-backend-6a07ca5a6159baf5.yaml b/releasenotes/notes/0.19/fix-configurable-fake-backend-6a07ca5a6159baf5.yaml similarity index 55% rename from releasenotes/notes/fix-configurable-fake-backend-6a07ca5a6159baf5.yaml rename to releasenotes/notes/0.19/fix-configurable-fake-backend-6a07ca5a6159baf5.yaml index fef574f306d..08d5ad868ba 100644 --- a/releasenotes/notes/fix-configurable-fake-backend-6a07ca5a6159baf5.yaml +++ b/releasenotes/notes/0.19/fix-configurable-fake-backend-6a07ca5a6159baf5.yaml @@ -2,11 +2,10 @@ fixes: - | The member ``name`` of ``qiskit.test.mock.utils.ConfigurableFakeBackend`` - has been changed to ``backend_name``. This was done to avoid a conflict with the - :meth:`~qiskit.providers.BackendV1.name` method inherited from the parent abstract - :class:`~qiskit.providers.BackendV1` class. This makes + has been changed to ``backend_name``. This was done to avoid a conflict with + the :meth:`~qiskit.providers.BackendV1.name` method inherited from the + parent abstract :class:`~qiskit.providers.BackendV1` class. This makes ``ConfigurableFakeBackend`` compatible with anything expecting a :class:`~qiskit.providers.BackendV1` object. However, if you were using the - ``name`` attribute directly before you will now need to either call it as a method or - access the ``backend_name`` attribute instead. - in several unittests because string is not callable. + ``name`` attribute directly before you will now need to either call it as a + method or access the ``backend_name`` attribute instead. diff --git a/releasenotes/notes/0.19/fix-decompose-empty-gate-71455847dcaaea26.yaml b/releasenotes/notes/0.19/fix-decompose-empty-gate-71455847dcaaea26.yaml new file mode 100644 index 00000000000..95c4a879116 --- /dev/null +++ b/releasenotes/notes/0.19/fix-decompose-empty-gate-71455847dcaaea26.yaml @@ -0,0 +1,18 @@ +--- +fixes: + - | + Fixed an issue where calling :meth:`.QuantumCircuit.decompose()` on a + circuit containing an :class:`~qiskit.circuit.Instruction` whose + :attr:`~.Instruction.definition` attribute was empty would leave the + instruction in place, instead of decomposing it into zero operations. For + example, with a circuit:: + + from qiskit.circuit import QuantumCircuit + empty = QuantumCircuit(1, name="decompose me!") + circuit = QuantumCircuit(1) + circuit.append(empty.to_gate(), [0]) + + Previously, calling ``circuit.decompose()`` would not change the circuit. + Now, the decomposition will correct decompose ``empty`` into zero + instructions. + See `#6997 `__ for more. diff --git a/releasenotes/notes/fix-display-measure-condition-139ddbb8c7ae4071.yaml b/releasenotes/notes/0.19/fix-display-measure-condition-139ddbb8c7ae4071.yaml similarity index 99% rename from releasenotes/notes/fix-display-measure-condition-139ddbb8c7ae4071.yaml rename to releasenotes/notes/0.19/fix-display-measure-condition-139ddbb8c7ae4071.yaml index 3e2e8bba3ed..3b83e9f5ddb 100644 --- a/releasenotes/notes/fix-display-measure-condition-139ddbb8c7ae4071.yaml +++ b/releasenotes/notes/0.19/fix-display-measure-condition-139ddbb8c7ae4071.yaml @@ -7,7 +7,6 @@ fixes: instruction containing a classical ``condition`` using the ``mpl`` or ``latex`` options, the ``condition`` information would sometimes overwrite the ``measure`` display. -fixes: - | Fixed an issue with the :func:`~qiskit.visualization.circuit_drawer` function and :meth:`~qiskit.circuit.QuantumCircuit.draw` method of diff --git a/releasenotes/notes/0.19/fix-hoare-optimizer-0ef5ac330fc80cc4.yaml b/releasenotes/notes/0.19/fix-hoare-optimizer-0ef5ac330fc80cc4.yaml new file mode 100644 index 00000000000..a918de2e0b5 --- /dev/null +++ b/releasenotes/notes/0.19/fix-hoare-optimizer-0ef5ac330fc80cc4.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixed a bug in the Hoare optimizer transpilation pass where it could attempt + to remove a gate twice if it could be separately combined with both its + predecessor and its successor to form the identity. Refer to `#7271 + `__ for more details. diff --git a/releasenotes/notes/fix-infinite-job-submissions-d6f6a583535ca798.yaml b/releasenotes/notes/0.19/fix-infinite-job-submissions-d6f6a583535ca798.yaml similarity index 100% rename from releasenotes/notes/fix-infinite-job-submissions-d6f6a583535ca798.yaml rename to releasenotes/notes/0.19/fix-infinite-job-submissions-d6f6a583535ca798.yaml diff --git a/releasenotes/notes/0.19/fix-instruction-c_if-3334bc8bcc38a327.yaml b/releasenotes/notes/0.19/fix-instruction-c_if-3334bc8bcc38a327.yaml new file mode 100644 index 00000000000..01698b607ae --- /dev/null +++ b/releasenotes/notes/0.19/fix-instruction-c_if-3334bc8bcc38a327.yaml @@ -0,0 +1,59 @@ +--- +deprecations: + - | + Creating an instance of :obj:`.InstructionSet` with the ``circuit_cregs`` + keyword argument is deprecated. In general, these classes never need to be + constructed by users (but are used internally), but should you need to, you + should pass a callable as the ``resource_requester`` keyword argument. 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)) + + +fixes: + - | + Making an instruction conditional with the standard + :meth:`.InstructionSet.c_if` method with integer indices is now consistent + with the numbering scheme used by the :obj:`.QuantumCircuit` the + instructions are part of. Previously, if there were two + :obj:`.ClassicalRegister`\ s with overlapping :obj:`.Clbit`\ s, the + numbering would be incorrect. See `#7246 + `__ for more detail. + - | + Making an instruction conditional with the standard + :meth:`.InstructionSet.c_if` method will now succeed, even if there are no + :obj:`.ClassicalRegister`\ s in the circuit. + See `#7250 `__ for more detail. + - | + Making an instruction conditional with the standard + :meth:`.InstructionSet.c_if` method when using a :obj:`.Clbit` that is + contained in a :obj:`.ClassicalRegister` of size one will now correctly + create a condition on the bit, not the register. + See `#7255 `__ for more detail. + - | + Trying to make an instruction conditional with the standard + :meth:`.InstructionSet.c_if` method will now correctly raise an error if the + classical resource is not present in the circuit. + See `#7255 `__ for more detail. diff --git a/releasenotes/notes/fix-latex-drawer-bit-cond-d629c04a08e81d6d.yaml b/releasenotes/notes/0.19/fix-latex-drawer-bit-cond-d629c04a08e81d6d.yaml similarity index 58% rename from releasenotes/notes/fix-latex-drawer-bit-cond-d629c04a08e81d6d.yaml rename to releasenotes/notes/0.19/fix-latex-drawer-bit-cond-d629c04a08e81d6d.yaml index f69db978640..88db4e50ab5 100644 --- a/releasenotes/notes/fix-latex-drawer-bit-cond-d629c04a08e81d6d.yaml +++ b/releasenotes/notes/0.19/fix-latex-drawer-bit-cond-d629c04a08e81d6d.yaml @@ -1,8 +1,8 @@ --- features: - | - The ``latex`` output method for the :func:`qiskit.visualization.circuit_drawer` - function and the :meth:`~qiskit.circuit.QuantumCircuit.draw` method can now + The ``latex`` output method for the :func:`~qiskit.visualization.circuit_drawer` + function and the :meth:`.QuantumCircuit.draw` method can now draw circuits that contain gates with single bit condition. This was added for compatibility of latex drawer with the new feature of supporting classical conditioning of gates on single classical bits. diff --git a/releasenotes/notes/0.19/fix-matplotlib-3.5-40f6d1a109ae06fe.yaml b/releasenotes/notes/0.19/fix-matplotlib-3.5-40f6d1a109ae06fe.yaml new file mode 100644 index 00000000000..75f0925a734 --- /dev/null +++ b/releasenotes/notes/0.19/fix-matplotlib-3.5-40f6d1a109ae06fe.yaml @@ -0,0 +1,6 @@ +fixes: + - | + Fixed a compatibility issue with Matplotlib 3.5, where the Bloch sphere + would fail to render if it had any vectors attached, such as by using + :obj:`~qiskit.visualization.plot_bloch_vector`. See `#7272 + `__ for more detail. diff --git a/releasenotes/notes/0.19/fix-mpl-drawer-bit-condition-90c4dac2defdd8c6.yaml b/releasenotes/notes/0.19/fix-mpl-drawer-bit-condition-90c4dac2defdd8c6.yaml new file mode 100644 index 00000000000..0e2493e2bf7 --- /dev/null +++ b/releasenotes/notes/0.19/fix-mpl-drawer-bit-condition-90c4dac2defdd8c6.yaml @@ -0,0 +1,7 @@ +features: + - | + The ``"mpl"`` output method for the :func:`~qiskit.visualization.circuit_drawer` + function and the :meth:`.QuantumCircuit.draw` method can now + draw circuits that contain gates with single bit condition. This was added for + compatibility of the ``"mpl"`` drawer with the new feature of supporting classical + conditioning of gates on single classical bits. diff --git a/releasenotes/notes/0.19/fix-nlocal-add_layer-c3cb0b5a49c2b04e.yaml b/releasenotes/notes/0.19/fix-nlocal-add_layer-c3cb0b5a49c2b04e.yaml new file mode 100644 index 00000000000..44a52ac796c --- /dev/null +++ b/releasenotes/notes/0.19/fix-nlocal-add_layer-c3cb0b5a49c2b04e.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixed an issue with the :meth:`.NLocal.add_layer` method incorrectly + appending layers if the :obj:`.NLocal` object had already been built. diff --git a/releasenotes/notes/0.19/fix-pickle-support-instmap-9f90cbcb4078f988.yaml b/releasenotes/notes/0.19/fix-pickle-support-instmap-9f90cbcb4078f988.yaml new file mode 100644 index 00000000000..b252ccc1154 --- /dev/null +++ b/releasenotes/notes/0.19/fix-pickle-support-instmap-9f90cbcb4078f988.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixed an issue with pickling :class:`~.pulse.InstructionScheduleMap` object + when using Python 3.6. See `#6944 + `__ for details. diff --git a/releasenotes/notes/fix-pulse-parameter-formatter-c9ff103f1a7181e0.yaml b/releasenotes/notes/0.19/fix-pulse-parameter-formatter-c9ff103f1a7181e0.yaml similarity index 66% rename from releasenotes/notes/fix-pulse-parameter-formatter-c9ff103f1a7181e0.yaml rename to releasenotes/notes/0.19/fix-pulse-parameter-formatter-c9ff103f1a7181e0.yaml index 644273e32e0..004e1dbeb8b 100644 --- a/releasenotes/notes/fix-pulse-parameter-formatter-c9ff103f1a7181e0.yaml +++ b/releasenotes/notes/0.19/fix-pulse-parameter-formatter-c9ff103f1a7181e0.yaml @@ -15,6 +15,7 @@ fixes: pulse.play(pulse.Gaussian(160, amp * np.exp(1j * phase), 40), pulse.DriveChannel(0)) sched.assign_parameters({amp: 0.1, phase: 1.57}, inplace=True) - The assigned amplitude has been shown as ``ParameterExpression(0.1*exp(1.57*I))`` - after symengine is introduced in #6270. This is now correctly - evaluated and shown as 7.96327e-05+0.0999999683j. + The assigned amplitude has been shown as + ``ParameterExpression(0.1*exp(1.57*I))`` after the use of ``symengine`` was + introduced in the 0.18.0 release. This is now correctly evaluated and shown + as ``7.96327e-05 + 0.0999999683j``. diff --git a/releasenotes/notes/0.19/fix-qaoa-construct-da37faf75f29fc35.yaml b/releasenotes/notes/0.19/fix-qaoa-construct-da37faf75f29fc35.yaml new file mode 100644 index 00000000000..f95b1b3b566 --- /dev/null +++ b/releasenotes/notes/0.19/fix-qaoa-construct-da37faf75f29fc35.yaml @@ -0,0 +1,13 @@ +--- +fixes: + - | + Fixed an issue where :meth:`.QAOA.construct_circuit` with different + operators with same number of qubits would generate the same circuit each + time. See `#7223 `__ + for more detail. + - | + Fixed an issue where :class:`~qiskit.circuit.library.QAOAAnsatz` had an + incorrect number of parameters if identities of + :class:`~qiskit.opflow.PauliSumOp` were given, e.g., + ``PauliSumOp.from_list([("III", 1)])``. See `#7225 + `__ for more detail. diff --git a/releasenotes/notes/0.19/fix-qasm-invalid-names-04a935a3a14e045c.yaml b/releasenotes/notes/0.19/fix-qasm-invalid-names-04a935a3a14e045c.yaml new file mode 100644 index 00000000000..3322d6bf46b --- /dev/null +++ b/releasenotes/notes/0.19/fix-qasm-invalid-names-04a935a3a14e045c.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixed a bug where the :meth:`.QuantumCircuit.qasm` method could + return OpenQASM 2 instructions with invalid identifiers. The same bug was fixed + for :obj:`~qiskit.extensions.UnitaryGate`. diff --git a/releasenotes/notes/fix-registerless-one-bit-displays-4deb8f7cecf3f602.yaml b/releasenotes/notes/0.19/fix-registerless-one-bit-displays-4deb8f7cecf3f602.yaml similarity index 50% rename from releasenotes/notes/fix-registerless-one-bit-displays-4deb8f7cecf3f602.yaml rename to releasenotes/notes/0.19/fix-registerless-one-bit-displays-4deb8f7cecf3f602.yaml index 378bb40c52a..67b80a4822b 100644 --- a/releasenotes/notes/fix-registerless-one-bit-displays-4deb8f7cecf3f602.yaml +++ b/releasenotes/notes/0.19/fix-registerless-one-bit-displays-4deb8f7cecf3f602.yaml @@ -1,13 +1,13 @@ --- fixes: - | - Fixed an issue where trying to display registerless bits would cause - a failure of the ``mpl`` and the ``latex`` circuit drawers. Also the - display of registerless bits in the ``text`` drawer had an ``_`` in - front of the number, which has been removed. - Fixed `#6732 `__ + Fixed an issue where trying to display registerless bits would cause a + failure of the ``mpl`` and the ``latex`` circuit drawers. A leading ``_`` + has been removed from the display of registerless bits' numbers in the + ``text`` drawer. Fixed `#6732 + `__. - | For one-bit registers, all of the circuit drawers now display only the register name and no longer show the ``0`` subscript. - Fixed `#5784 `__ + Fixed `#5784 `__. diff --git a/releasenotes/notes/fix-registerless-qasm-output-7a497dd8e9a0706b.yaml b/releasenotes/notes/0.19/fix-registerless-qasm-output-7a497dd8e9a0706b.yaml similarity index 81% rename from releasenotes/notes/fix-registerless-qasm-output-7a497dd8e9a0706b.yaml rename to releasenotes/notes/0.19/fix-registerless-qasm-output-7a497dd8e9a0706b.yaml index 75cf70d4363..00cf702cabd 100644 --- a/releasenotes/notes/fix-registerless-qasm-output-7a497dd8e9a0706b.yaml +++ b/releasenotes/notes/0.19/fix-registerless-qasm-output-7a497dd8e9a0706b.yaml @@ -1,7 +1,7 @@ --- fixes: - | - Fix naming collisions of implicit registers in :obj:`.QuantumCircuit.qasm` + Fixed naming collisions of implicit registers in :obj:`.QuantumCircuit.qasm` when dealing with registerless qubits and clbits. Previously, registerless qubits and clbits were put into corresponding ``qreg`` and ``creg`` both called ``regless``, despite the collision. They will now have separate, diff --git a/releasenotes/notes/fix-scheduling-circuits-with-clbits-operations-e5d8bfa90e9a3ae1.yaml b/releasenotes/notes/0.19/fix-scheduling-circuits-with-clbits-operations-e5d8bfa90e9a3ae1.yaml similarity index 98% rename from releasenotes/notes/fix-scheduling-circuits-with-clbits-operations-e5d8bfa90e9a3ae1.yaml rename to releasenotes/notes/0.19/fix-scheduling-circuits-with-clbits-operations-e5d8bfa90e9a3ae1.yaml index 1c3ddc5d5be..f199b76f8f7 100644 --- a/releasenotes/notes/fix-scheduling-circuits-with-clbits-operations-e5d8bfa90e9a3ae1.yaml +++ b/releasenotes/notes/0.19/fix-scheduling-circuits-with-clbits-operations-e5d8bfa90e9a3ae1.yaml @@ -9,4 +9,4 @@ fixes: The updated schedulers assume all clbits I/O operations take no time, ``measure`` writes the measured value to a clbit at the end, and ``c_if`` reads the conditional value in clbit(s) at the beginning. - Fixed `#7006 `__ + Fixed `#7006 `__. diff --git a/releasenotes/notes/0.19/fix-text-drawer-bit-cond-a3b02f0b0b6e3ec2.yaml b/releasenotes/notes/0.19/fix-text-drawer-bit-cond-a3b02f0b0b6e3ec2.yaml new file mode 100644 index 00000000000..c0062e01972 --- /dev/null +++ b/releasenotes/notes/0.19/fix-text-drawer-bit-cond-a3b02f0b0b6e3ec2.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + The ``text`` output method for the :func:`~qiskit.visualization.circuit_drawer` + function and the :meth:`.QuantumCircuit.draw` method can now + draw circuits that contain gates with single bit condition. This was added for + compatibility of text drawer with the new feature of supporting classical + conditioning of gates on single classical bits. diff --git a/releasenotes/notes/0.19/fix-transpile-empty-list-c93a41d4145a01c3.yaml b/releasenotes/notes/0.19/fix-transpile-empty-list-c93a41d4145a01c3.yaml new file mode 100644 index 00000000000..f65cb65d25e --- /dev/null +++ b/releasenotes/notes/0.19/fix-transpile-empty-list-c93a41d4145a01c3.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Calling :obj:`~qiskit.compiler.transpile` on an empty list will now + correctly return an empty list without issuing a warning. Fixed `#7287 + `__. diff --git a/releasenotes/notes/0.19/fix_pwchebysev_constant_fx-93e8a3d2880f68ac.yaml b/releasenotes/notes/0.19/fix_pwchebysev_constant_fx-93e8a3d2880f68ac.yaml new file mode 100644 index 00000000000..db124694500 --- /dev/null +++ b/releasenotes/notes/0.19/fix_pwchebysev_constant_fx-93e8a3d2880f68ac.yaml @@ -0,0 +1,12 @@ +--- +fixes: + - | + Fixed an issue in :obj:`.PiecewiseChebyshev` when the function to be + approximated was constant. In these cases, you should now pass the constant + directly as the ``f_x`` argument, rather than using a function, such as:: + + from qiskit.circuit.library.arithmetic import PiecewiseChebyshev + + PiecewiseChebyshev(1.0, degree=3) + + See `#6707 `__ for more details. diff --git a/releasenotes/notes/0.19/full_prec_sympy-aeee8210091ef20f.yaml b/releasenotes/notes/0.19/full_prec_sympy-aeee8210091ef20f.yaml new file mode 100644 index 00000000000..07734e70028 --- /dev/null +++ b/releasenotes/notes/0.19/full_prec_sympy-aeee8210091ef20f.yaml @@ -0,0 +1,12 @@ +--- +other: + - | + The string cast for :class:`qiskit.circuit.ParameterExpression` does not + have full precision anymore. This removes the trailing 0s when printing + parameters that are bound to floats. This has consequences for QASM + serialization and the circuit text drawer:: + + >>> from qiskit.circuit import Parameter + >>> x = Parameter('x') + >>> str(x.bind({x:0.5})) + '0.5' # instead of '0.500000000000000' diff --git a/releasenotes/notes/gates-in-basis-pass-337f6637e61919db.yaml b/releasenotes/notes/0.19/gates-in-basis-pass-337f6637e61919db.yaml similarity index 100% rename from releasenotes/notes/gates-in-basis-pass-337f6637e61919db.yaml rename to releasenotes/notes/0.19/gates-in-basis-pass-337f6637e61919db.yaml diff --git a/releasenotes/notes/heavy-hex-heavy-square-coupling-map-29f459b93cd18518.yaml b/releasenotes/notes/0.19/heavy-hex-heavy-square-coupling-map-29f459b93cd18518.yaml similarity index 73% rename from releasenotes/notes/heavy-hex-heavy-square-coupling-map-29f459b93cd18518.yaml rename to releasenotes/notes/0.19/heavy-hex-heavy-square-coupling-map-29f459b93cd18518.yaml index d7d74beb4df..8d14f2944e3 100644 --- a/releasenotes/notes/heavy-hex-heavy-square-coupling-map-29f459b93cd18518.yaml +++ b/releasenotes/notes/0.19/heavy-hex-heavy-square-coupling-map-29f459b93cd18518.yaml @@ -6,8 +6,7 @@ features: :meth:`~qiskit.transpiler.CouplingMap.from_heavy_square`, to the :class:`~qiskit.transpiler.CouplingMap` class. These constructor methods are used to create a :class:`~qiskit.transpiler.CouplingMap` that are - a heavy hex or heavy square graph as described in: - https://journals.aps.org/prx/abstract/10.1103/PhysRevX.10.011022 + a heavy hex or heavy square graph as described in |Chamberland2020|_. For example: @@ -25,3 +24,6 @@ features: cmap = CouplingMap.from_heavy_square(5) cmap.draw() + + .. |Chamberland2020| replace:: Chamberland *et al.*, 2020 + .. _Chamberland2020: https://journals.aps.org/prx/abstract/10.1103/PhysRevX.10.011022 diff --git a/releasenotes/notes/0.19/hhl-negative-eigenvalues-ef11d231181e8043.yaml b/releasenotes/notes/0.19/hhl-negative-eigenvalues-ef11d231181e8043.yaml new file mode 100644 index 00000000000..df4276e8359 --- /dev/null +++ b/releasenotes/notes/0.19/hhl-negative-eigenvalues-ef11d231181e8043.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + The :obj:`.HHL` algorithm can now find solutions when its matrix has negative eigenvalues. + To enable this, the algorithm now adds an extra qubit to represent the sign of the value, + and the helper algorithm :obj:`.ExactReciprocal` was updated to process this + new information. See `#6971 + `__ for more details. diff --git a/releasenotes/notes/0.19/hhl_qi_fix-d0ada86abaa2dba5.yaml b/releasenotes/notes/0.19/hhl_qi_fix-d0ada86abaa2dba5.yaml new file mode 100644 index 00000000000..cfed43d6145 --- /dev/null +++ b/releasenotes/notes/0.19/hhl_qi_fix-d0ada86abaa2dba5.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + If an :class:`~qiskit.algorithms.HHL` algorithm instance was constructed + without a :obj:`.QuantumInstance` (the default), attempts to use the getter + and setter properties to read or set an instance later would fail. The + getters and setters now work as expected. diff --git a/releasenotes/notes/ignis-mitigators-70492690cbcf99ca.yaml b/releasenotes/notes/0.19/ignis-mitigators-70492690cbcf99ca.yaml similarity index 95% rename from releasenotes/notes/ignis-mitigators-70492690cbcf99ca.yaml rename to releasenotes/notes/0.19/ignis-mitigators-70492690cbcf99ca.yaml index 1ca0e3ee1c7..3e4c1581b8a 100644 --- a/releasenotes/notes/ignis-mitigators-70492690cbcf99ca.yaml +++ b/releasenotes/notes/0.19/ignis-mitigators-70492690cbcf99ca.yaml @@ -24,6 +24,6 @@ deprecations: no longer be supported in the near future. It's worth noting that unlike the equivalent classes from ``qiskit-ignis`` the versions from :mod:`qiskit.utils.mitigation` are supported only in - their use with :class:`~qiskit.utils.QuantumInstance` (ie as a class not + their use with :class:`~qiskit.utils.QuantumInstance` (i.e. as a class not an instance with the ``measurement_error_mitigation_cls`` kwarg) and not intended for standalone use. diff --git a/releasenotes/notes/0.19/listops-coeffs-1e04a34b46b2fd23.yaml b/releasenotes/notes/0.19/listops-coeffs-1e04a34b46b2fd23.yaml new file mode 100644 index 00000000000..b8bef3030f1 --- /dev/null +++ b/releasenotes/notes/0.19/listops-coeffs-1e04a34b46b2fd23.yaml @@ -0,0 +1,11 @@ +--- +features: + - | + The :obj:`.ListOp` class in :mod:`qiskit.opflow` now has a + :attr:`~.ListOp.coeffs` attribute, which returns a list of the coefficients + of the operator list, with the overall coefficient (:obj:`.ListOp.coeff`) + distributed multiplicatively into the list. Note that :obj:`.ListOp` + objects may be nested (contained in ``oplist`` of a :obj:`.ListOp` object), + and in these cases an exception is raised if the `coeffs` method is called. + The :obj:`.ListOp.coeffs` method conveniently duck-types against the + ``coeffs`` property method of the non-nesting :obj:`.PauliSumOp` class. diff --git a/releasenotes/notes/0.19/make-statevector-subscriptable-and-add-inner-product_method-a0337393d9a5b666.yaml b/releasenotes/notes/0.19/make-statevector-subscriptable-and-add-inner-product_method-a0337393d9a5b666.yaml new file mode 100644 index 00000000000..945f08e3ece --- /dev/null +++ b/releasenotes/notes/0.19/make-statevector-subscriptable-and-add-inner-product_method-a0337393d9a5b666.yaml @@ -0,0 +1,15 @@ +--- +features: + - | + The :class:`~qiskit.quantum_info.Statevector` class is now subscriptable. + User can now retrieve the nth coefficient in a + :class:`~qiskit.quantum_info.Statevector` by index as ``statevec[n]``. + - | + Added the :obj:`.Statevector.inner` method to calculate inner products of + :class:`.Statevector` instances. For example:: + + statevec_inner_other = statevec.inner(other) + + will return the inner product of ``statevec`` with ``other``. While + ``statevec`` must be a :class:`.Statevector`, ``other`` can be anything + that can be constructed into a :class:`.Statevector`, such as a Numpy array. diff --git a/releasenotes/notes/0.19/measure_all-add_bits-8525317935197b90.yaml b/releasenotes/notes/0.19/measure_all-add_bits-8525317935197b90.yaml new file mode 100644 index 00000000000..d5737bba8e5 --- /dev/null +++ b/releasenotes/notes/0.19/measure_all-add_bits-8525317935197b90.yaml @@ -0,0 +1,17 @@ +--- +features: + - | + Added a new parameter, ``add_bits``, to :meth:`.QuantumCircuit.measure_all`. + By default it is set to ``True`` to maintain the previous behaviour of adding a new :obj:`.ClassicalRegister` of the same size as the number of qubits to store the measurements. + If set to ``False``, the measurements will be stored in the already existing classical bits. + For example, if you created a circuit with existing classical bits like:: + + from qiskit.circuit import QuantumCircuit, QuantumRegister, ClassicalRegister + + qr = QuantumRegister(2) + cr = ClassicalRegister(2, "meas") + circuit = QuantumCircuit(qr, cr) + + calling ``circuit.measure_all(add_bits=False)`` will use the existing + classical register ``cr`` as the output target of the + :class:`~qiskit.circuit.Measurement` objects added to the circuit. diff --git a/releasenotes/notes/0.19/modify-copy-instruction-in-qasm-abd5c9767f2a7f38.yaml b/releasenotes/notes/0.19/modify-copy-instruction-in-qasm-abd5c9767f2a7f38.yaml new file mode 100644 index 00000000000..a70ee6b7085 --- /dev/null +++ b/releasenotes/notes/0.19/modify-copy-instruction-in-qasm-abd5c9767f2a7f38.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + The :meth:`.QuantumCircuit.qasm` method now edits the names of copies of the + instructions present in the circuit, not the original instructions that live + in ``circuit.data``. Refer to `#6952 + `__ for more details. diff --git a/releasenotes/notes/more-forgiving-numeric-conversions-in-ParameterExpression-6cd7316c32c67c55.yaml b/releasenotes/notes/0.19/more-forgiving-numeric-conversions-in-ParameterExpression-6cd7316c32c67c55.yaml similarity index 82% rename from releasenotes/notes/more-forgiving-numeric-conversions-in-ParameterExpression-6cd7316c32c67c55.yaml rename to releasenotes/notes/0.19/more-forgiving-numeric-conversions-in-ParameterExpression-6cd7316c32c67c55.yaml index be683506544..2017dab991d 100644 --- a/releasenotes/notes/more-forgiving-numeric-conversions-in-ParameterExpression-6cd7316c32c67c55.yaml +++ b/releasenotes/notes/0.19/more-forgiving-numeric-conversions-in-ParameterExpression-6cd7316c32c67c55.yaml @@ -1,9 +1,9 @@ features: - | - :obj:`~qiskit.cicuit.ParameterExpression` now delegates its numeric + :obj:`~qiskit.circuit.ParameterExpression` now delegates its numeric conversions to the underlying symbolic library, even if there are potentially unbound parameters. This allows conversions of expressions such - as :: + as:: >>> from qiskit.circuit import Parameter >>> x = Parameter('x') diff --git a/releasenotes/notes/mpl-bump-33a1240266e66508.yaml b/releasenotes/notes/0.19/mpl-bump-33a1240266e66508.yaml similarity index 66% rename from releasenotes/notes/mpl-bump-33a1240266e66508.yaml rename to releasenotes/notes/0.19/mpl-bump-33a1240266e66508.yaml index a0ca1374900..16e636ab7c9 100644 --- a/releasenotes/notes/mpl-bump-33a1240266e66508.yaml +++ b/releasenotes/notes/0.19/mpl-bump-33a1240266e66508.yaml @@ -1,14 +1,14 @@ --- upgrade: - | - The minimum supported version of matplotlib has been raised from 2.1.0 to - 3.3.0. You will now need to have matplotlib 3.3.0 installed if you're using - matplotlib based visualization functions such as the ``'mpl'`` backend for + The minimum supported version of Matplotlib has been raised from 2.1.0 to + 3.3.0. You will now need to have Matplotlib 3.3.0 installed if you're using + Matplotlib-based visualization functions such as the ``'mpl'`` backend for the :func:`~qiskit.visualization.circuit_drawer` function or the :func:`~qiskit.visualization.plot_bloch_vector` function. This was done for - two reasons, the first is because recent versions of matplotlib have + two reasons, the first is because recent versions of Matplotlib have deprecated the use of APIs around 3D visualizations that were compatible - with older releases and second installing older versions of matplotlib + with older releases and second installing older versions of Matplotlib was becoming increasingly difficult as matplotlib's upstream dependencies have caused incompatiblities that made testing moving forward more difficult. diff --git a/releasenotes/notes/0.19/optimizer-minimize-5a5a1e9d67db441a.yaml b/releasenotes/notes/0.19/optimizer-minimize-5a5a1e9d67db441a.yaml new file mode 100644 index 00000000000..5f637563c46 --- /dev/null +++ b/releasenotes/notes/0.19/optimizer-minimize-5a5a1e9d67db441a.yaml @@ -0,0 +1,57 @@ +--- +features: + - | + Added an :meth:`.Optimizer.minimize` method to all optimizers: + :class:`~qiskit.algorithms.optimizers.Optimizer` and derived classes. + This method mimics the signature of SciPy's ``minimize()`` function and + returns an :class:`~qiskit.algorithms.optimizers.OptimizerResult`. + + For example + + .. code-block:: python + + import numpy as np + from qiskit.algorithms.optimizers import COBYLA + + def loss(x): + return -(x[0] - 1) ** 2 - (x[1] + 1) ** 3 + + initial_point = np.array([0, 0]) + optimizer = COBYLA() + result = optimizer.minimize(loss, initial_point) + + optimal_parameters = result.x + minimum_value = result.fun + num_function_evals = result.nfev + +deprecations: + - | + The :meth:`.Optimizer.optimize` method for all the optimizers + (:class:`~qiskit.algorithms.optimizers.Optimizer` and derived classes) is + now deprecated and will be removed in a future release. Instead, the + :meth:`.Optimizer.minimize` method should be used which mimics the signature + of SciPy's ``minimize()`` function. + + To replace the current `optimize` call with `minimize` you can replace + + .. code-block:: python + + xopt, fopt, nfev = optimizer.optimize( + num_vars, + objective_function, + gradient_function, + variable_bounds, + initial_point, + ) + + with + + .. code-block:: python + + result = optimizer.minimize( + fun=objective_function, + x0=initial_point, + jac=gradient_function, + bounds=variable_bounds, + ) + xopt, fopt, nfev = result.x, result.fun, result.nfev diff --git a/releasenotes/notes/0.19/pauli-evolution-gate-ad767a3e43714fa7.yaml b/releasenotes/notes/0.19/pauli-evolution-gate-ad767a3e43714fa7.yaml new file mode 100644 index 00000000000..74a431d46cd --- /dev/null +++ b/releasenotes/notes/0.19/pauli-evolution-gate-ad767a3e43714fa7.yaml @@ -0,0 +1,31 @@ +--- +features: + - | + Added a :class:`~qiskit.circuit.library.PauliEvolutionGate` to the circuit + library (:mod:`qiskit.circuit.library`) which defines a gate performing time + evolution of (sums or sums-of-sums of) :obj:`.Pauli`\ s. The synthesis of + this gate is performed by :class:`~qiskit.synthesis.EvolutionSynthesis` and + is decoupled from the gate itself. Currently available synthesis methods + are: + + * :class:`~qiskit.synthesis.LieTrotter`: first order Trotterization + * :class:`~qiskit.synthesis.SuzukiTrotter`: higher order Trotterization + * :class:`~qiskit.synthesis.MatrixExponential`: exact, matrix-based evolution + + For example:: + + from qiskit.circuit import QuantumCircuit + from qiskit.circuit.library import PauliEvolutionGate + from qiskit.quantum_info import SparsePauliOp + from qiskit.synthesis import SuzukiTrotter + + operator = SparsePauliOp.from_list([ + ("XIZ", 0.5), ("ZZX", 0.5), ("IYY", -1) + ]) + time = 0.12 # evolution time + synth = SuzukiTrotter(order=4, reps=2) + + evo = PauliEvolutionGate(operator, time=time, synthesis=synth) + + circuit = QuantumCircuit(3) + circuit.append(evo, range(3)) diff --git a/releasenotes/notes/pauli-op-permute-fix-d244a1145093369d.yaml b/releasenotes/notes/0.19/pauli-op-permute-fix-d244a1145093369d.yaml similarity index 100% rename from releasenotes/notes/pauli-op-permute-fix-d244a1145093369d.yaml rename to releasenotes/notes/0.19/pauli-op-permute-fix-d244a1145093369d.yaml diff --git a/releasenotes/notes/plot_coupling_map-new-function-deb973b1bf0ad92f.yaml b/releasenotes/notes/0.19/plot_coupling_map-new-function-deb973b1bf0ad92f.yaml similarity index 83% rename from releasenotes/notes/plot_coupling_map-new-function-deb973b1bf0ad92f.yaml rename to releasenotes/notes/0.19/plot_coupling_map-new-function-deb973b1bf0ad92f.yaml index c8e18ab7637..8ca01d1a3b4 100644 --- a/releasenotes/notes/plot_coupling_map-new-function-deb973b1bf0ad92f.yaml +++ b/releasenotes/notes/0.19/plot_coupling_map-new-function-deb973b1bf0ad92f.yaml @@ -3,6 +3,6 @@ features: - | A new function :func:`~qiskit.visualization.plot_coupling_map()` has been introduced, which extends the functionality of the existing function - :func:`~qiskit.visualization.plot_gate_map()`, by accepting three parameters; ``num_qubit``, - ``qubit_coordinates``, and ``coupling_map`` (instead of ``backend``) to allow an arbitrary + :func:`~qiskit.visualization.plot_gate_map()`, by accepting three parameters: ``num_qubit``, + ``qubit_coordinates``, and ``coupling_map`` (instead of ``backend``), to allow an arbitrary qubit coupling map to be plotted. diff --git a/releasenotes/notes/0.19/qaoa-parameters-49e4524ed2d3e875.yaml b/releasenotes/notes/0.19/qaoa-parameters-49e4524ed2d3e875.yaml new file mode 100644 index 00000000000..197ce031f4a --- /dev/null +++ b/releasenotes/notes/0.19/qaoa-parameters-49e4524ed2d3e875.yaml @@ -0,0 +1,10 @@ +--- +fixes: + - | + Fixed a bug where the parameter bounds for the mixer parameters in the + :class:`~qiskit.circuit.library.QAOAAnsatz` were not been set. +other: + - | + The :class:`~qiskit.circuit.library.QAOAAnsatz` has been updated to use the parameter + symbol ``γ`` for the cost operator and ``β`` for the mixer operator, as is the standard + notation in QAOA literature. diff --git a/releasenotes/notes/qasm3-limitations-ebfdedab3f4ab6e1.yaml b/releasenotes/notes/0.19/qasm3-limitations-ebfdedab3f4ab6e1.yaml similarity index 58% rename from releasenotes/notes/qasm3-limitations-ebfdedab3f4ab6e1.yaml rename to releasenotes/notes/0.19/qasm3-limitations-ebfdedab3f4ab6e1.yaml index 248c4a7b66e..64afeb35c67 100644 --- a/releasenotes/notes/qasm3-limitations-ebfdedab3f4ab6e1.yaml +++ b/releasenotes/notes/0.19/qasm3-limitations-ebfdedab3f4ab6e1.yaml @@ -2,7 +2,7 @@ issues: - | The OpenQASM 3 export capabilities are in a beta state, and some features of - Terra's :obj:`.QuantumCircuit` are not yet supported. In particular, you + Qiskit Terra's :obj:`.QuantumCircuit` are not yet supported. In particular, you may see errors if you try to export custom subroutines with classical parameters, and there is no provision yet for exporting pulse-calibrated - operations into OpenPulse. + operations into `OpenPulse `__. diff --git a/releasenotes/notes/0.19/qasm3_dumps-7475de655e1acb24.yaml b/releasenotes/notes/0.19/qasm3_dumps-7475de655e1acb24.yaml new file mode 100644 index 00000000000..4beba8b97fd --- /dev/null +++ b/releasenotes/notes/0.19/qasm3_dumps-7475de655e1acb24.yaml @@ -0,0 +1,46 @@ +--- +features: + - | + Qiskit Terra now has initial support for serializing + :class:`.QuantumCircuit`\ s to `OpenQASM 3 `__: + + .. jupyter-execute:: + + from qiskit.circuit import QuantumCircuit, QuantumRegister, ClassicalRegister + from qiskit import qasm3 + + qc = QuantumCircuit(2) + qc.h(0) + qc.cx(0, 1) + + print(qasm3.dumps(qc)) + + This initial release has limited support for named registers, basic built-in + instructions (such as measure, barrier and reset), user-defined gates, + user-defined instructions (as subroutines), and the new control-flow constructs + also introduced in this release: + + .. jupyter-execute:: + + from qiskit.circuit import QuantumCircuit, QuantumRegister, ClassicalRegister + from qiskit import qasm3 + import math + + composite_circ_qreg = QuantumRegister(2) + composite_circ = QuantumCircuit(composite_circ_qreg, name="composite_circ") + composite_circ.h(0) + composite_circ.x(1) + composite_circ.cx(0, 1) + composite_circ_gate = composite_circ.to_gate() + + qr = QuantumRegister(2, "qr") + cr = ClassicalRegister(2, "cr") + qc = QuantumCircuit(qr, cr) + with qc.for_loop(range(4)) as i: + qc.rx(i * math.pi / 4, 0) + qc.cx(0, 1) + qc.barrier() + qc.append(composite_circ_gate, [0, 1]) + qc.measure([0, 1], [0, 1]) + + print(qasm3.dumps(qc)) diff --git a/releasenotes/notes/0.19/qdrift-as-product-formula-044a37a106a45a47.yaml b/releasenotes/notes/0.19/qdrift-as-product-formula-044a37a106a45a47.yaml new file mode 100644 index 00000000000..fc97e88bd39 --- /dev/null +++ b/releasenotes/notes/0.19/qdrift-as-product-formula-044a37a106a45a47.yaml @@ -0,0 +1,22 @@ +--- +features: + - | + The :class:`~qiskit.opflow.evolutions.QDrift` class was reformulated as a + synthesis method for :obj:`.PauliEvolutionGate`, deriving from + :obj:`~qiskit.opflow.evolutions.TrotterizationBase`. + + .. code-block:: python + + from qiskit.circuit import QuantumCircuit + from qiskit.circuit.library import PauliEvolutionGate + from qiskit.synthesis import QDrift + from qiskit.opflow import X, Y, Z + + qdrift = QDrift(reps=2) + operator = (X ^ 3) + (Y ^ 3) + (Z ^ 3) + time = 2.345 # evolution time + + evolution_gate = PauliEvolutionGate(operator, time, synthesis=qdrift) + + circuit = QuantumCircuit(3) + circuit.append(evolution_gate, range(3)) diff --git a/releasenotes/notes/qiskit.util-louder-deprecation-135d9e9ead7ab396.yaml b/releasenotes/notes/0.19/qiskit.util-louder-deprecation-135d9e9ead7ab396.yaml similarity index 100% rename from releasenotes/notes/qiskit.util-louder-deprecation-135d9e9ead7ab396.yaml rename to releasenotes/notes/0.19/qiskit.util-louder-deprecation-135d9e9ead7ab396.yaml diff --git a/releasenotes/notes/qpy-v2-f1c380b40936cccf.yaml b/releasenotes/notes/0.19/qpy-v2-f1c380b40936cccf.yaml similarity index 87% rename from releasenotes/notes/qpy-v2-f1c380b40936cccf.yaml rename to releasenotes/notes/0.19/qpy-v2-f1c380b40936cccf.yaml index e89b04242ce..f43f4a26cc9 100644 --- a/releasenotes/notes/qpy-v2-f1c380b40936cccf.yaml +++ b/releasenotes/notes/0.19/qpy-v2-f1c380b40936cccf.yaml @@ -3,7 +3,7 @@ features: - | QPY serialization is now capable of representing :attr:`~qiskit.circuit.QuantumCircuit.global_phase` attributes of a - :class:`~qiskit.circuit.QuantumCircuit` object that are a ``int``, + :class:`~qiskit.circuit.QuantumCircuit` object that are an ``int``, :class:`~qiskit.circuit.Parameter` object, or :class:`~qiskit.circuit.ParameterExpression` object. Previous versions of QPY would only accept a :attr:`~qiskit.circuit.QuantumCircuit.global_phase` diff --git a/releasenotes/notes/quantumcircuit-consolidate-bit_indices-c4ee90e831f1aed2.yaml b/releasenotes/notes/0.19/quantumcircuit-consolidate-bit_indices-c4ee90e831f1aed2.yaml similarity index 99% rename from releasenotes/notes/quantumcircuit-consolidate-bit_indices-c4ee90e831f1aed2.yaml rename to releasenotes/notes/0.19/quantumcircuit-consolidate-bit_indices-c4ee90e831f1aed2.yaml index 1791b85cf44..e5d2ddd7363 100644 --- a/releasenotes/notes/quantumcircuit-consolidate-bit_indices-c4ee90e831f1aed2.yaml +++ b/releasenotes/notes/0.19/quantumcircuit-consolidate-bit_indices-c4ee90e831f1aed2.yaml @@ -2,7 +2,7 @@ features: - | A new :meth:`~qiskit.circuit.QuantumCircuit.find_bit` method has - been added to the :class:`~qiskit.circuit.QuantumCircuit` class + been added to the :class:`~qiskit.circuit.QuantumCircuit` class, which allows lookups of the index and registers of a provided :class:`~qiskit.circuit.Bit` on the given circuit. The method returns a two-element ``namedtuple`` containing 0) the index of the ``Bit`` diff --git a/releasenotes/notes/quantumcircuit-dynamic-instructions-a69db25665739004.yaml b/releasenotes/notes/0.19/quantumcircuit-dynamic-instructions-a69db25665739004.yaml similarity index 53% rename from releasenotes/notes/quantumcircuit-dynamic-instructions-a69db25665739004.yaml rename to releasenotes/notes/0.19/quantumcircuit-dynamic-instructions-a69db25665739004.yaml index 9d1e9513570..63456c39f4d 100644 --- a/releasenotes/notes/quantumcircuit-dynamic-instructions-a69db25665739004.yaml +++ b/releasenotes/notes/0.19/quantumcircuit-dynamic-instructions-a69db25665739004.yaml @@ -2,19 +2,19 @@ features: - | Three new :class:`~qiskit.circuit.Instruction` subclasses have been added - to support control flow operations in dynamic circuits, - :class:`~qiskit.circuit.controlflow.WhileLoopOp`, - :class:`~qiskit.circuit.controlflow.ForLoopOp`, - and :class:`~qiskit.circuit.controlflow.IfElseOp`. Additionally, two - subclasses, :class:`~qiskit.circuit.controlflow.BreakLoopOp`, - and :class:`~qiskit.circuit.controlflow.ContinueLoopOp`, have been added to + to support control flow operations in dynamic circuits: + :class:`~qiskit.circuit.WhileLoopOp`, + :class:`~qiskit.circuit.ForLoopOp`, + and :class:`~qiskit.circuit.IfElseOp`. Additionally, two + subclasses, :class:`~qiskit.circuit.BreakLoopOp`, + and :class:`~qiskit.circuit.ContinueLoopOp`, have been added to support breaking from and continuing to the next iteration of a loop context, respectively. - These can be created as stand alone :class:`~qiskit.circuit.Instruction` s, + These can be created as stand-alone :class:`~qiskit.circuit.Instruction`\ s, or appended to an existing :class:`~qiskit.circuit.QuantumCircuit` instance via their respective methods, - :meth:`~qiskit.circuit.QuantumCircuit.while_loop`, + :meth:`.QuantumCircuit.while_loop`, :meth:`~qiskit.circuit.QuantumCircuit.for_loop`, :meth:`~qiskit.circuit.QuantumCircuit.if_test`, :meth:`~qiskit.circuit.QuantumCircuit.if_else`, diff --git a/releasenotes/notes/random-shift-38532a7321cd8313.yaml b/releasenotes/notes/0.19/random-shift-38532a7321cd8313.yaml similarity index 61% rename from releasenotes/notes/random-shift-38532a7321cd8313.yaml rename to releasenotes/notes/0.19/random-shift-38532a7321cd8313.yaml index 0391761d863..38dd3ddfa42 100644 --- a/releasenotes/notes/random-shift-38532a7321cd8313.yaml +++ b/releasenotes/notes/0.19/random-shift-38532a7321cd8313.yaml @@ -2,12 +2,12 @@ upgrade: - | The internal use of the random number generator in - :func:`~qiskit.circuit.random.random_circuit` was adjusted which will + :func:`~qiskit.circuit.random.random_circuit` was adjusted, which will change the output from previous versions, even with a fixed seed. This was done to greatly improve the runtime scaling with the number of qubits being used. If you were depending on an identical output from a previous version it is recommended that you use - :func:`~qiskit.circuit.qpy_serialization.dump` to save the random + :func:`.qpy_serialization.dump` to save the random circuit generated with a previous version and instead of re-generating it - with the new release instead just use - :func:`~qiskit.circuit.qpy_serialization.load` to load that saved circuit. + with the new release, and instead just use + :func:`.qpy_serialization.load` to load that saved circuit. diff --git a/releasenotes/notes/0.19/readout-mitigation-classes-2ef175e232d791ae.yaml b/releasenotes/notes/0.19/readout-mitigation-classes-2ef175e232d791ae.yaml new file mode 100644 index 00000000000..69d60ee1545 --- /dev/null +++ b/releasenotes/notes/0.19/readout-mitigation-classes-2ef175e232d791ae.yaml @@ -0,0 +1,55 @@ +--- +features: + - | + Added the :class:`~qiskit.result.BaseReadoutMitigator` abstract base class + for implementing classical measurement error mitigators. These objects + are intended for mitigation measurement errors in + :class:`~qiskit.result.Counts` objects returned from execution of circuits + on backends with measurement errors. + + Readout mitigator classes have two main methods: + + * :meth:`~.BaseReadoutMitigator.expectation_value` which computes an + mitigated expectation value and standard error of a diagonal operator from + a noisy :class:`~qiskit.result.Counts` object. + + * :meth:`~.BaseReadoutMitigator.quasi_probabilities` that computes an error + mitigated :class:`~qiskit.result.QuasiDistribution`, including standard + error, from a noisy counts object. + + Note that currently the :mod:`qiskit.algorithms` module and the + :class:`~qiskit.utils.QuantumInstance` class still use the legacy mitigators + migrated from Qiskit Ignis in :mod:`qiskit.utils.mitigation`. It is planned + to upgrade the module to use the new mitigator classes and deprecate the legacy + mitgation code in a future release. + - | + Added the :class:`~qiskit.result.LocalReadoutMitigator` class for + performing measurement readout error mitigation of local measurement + errors. Local measuerment errors are those that are described by a + tensor-product of single-qubit measurement errors. + + This class can be initialized with a list of :math:`N` single-qubit of + measurement error assignment matrices or from a backend using the readout + error information in the backend properties. + + Mitigation is implemented using local assignment-matrix inversion which has + complexity of :math:`O(2^N)` for :math:`N`-qubit mitigation of + :class:`~qiskit.result.QuasiDistribution` and expectation values. + - | + Added the :class:`~qiskit.result.CorrelatedReadoutMitigator` class for + performing measurement readout error mitigation of correlated measurement + errors. This class can be initialized with a single :math:`2^N \times 2^N` + measurement error assignment matrix that descirbes the error probabilities. + Mitigation is implemented via inversion of assigment matrix which has + mitigation complexity of :math:`O(4^N)` of + :class:`~qiskit.result.QuasiDistribution` and expectation values. + - | + Added a :attr:`.QuasiDistribution.stddev_upper_bound` + attribute and a kwarg to the constructor of the :class:`.QuasiDistribution` + class, which is used for storing standard errors in quasi-probability + estimates. This is used by :class:`~qiskit.result.BaseReadoutMitigator` + classes to store the standard error in mitigated quasi probabilities. + - | + Added a :meth:`~qiskit.result.Counts.shots` method to + :class:`qiskit.result.Counts` to return the sum of all outcomes in + the counts. diff --git a/releasenotes/notes/0.19/refactor-grover-isgoodstate-check-54fdb61f899e5158.yaml b/releasenotes/notes/0.19/refactor-grover-isgoodstate-check-54fdb61f899e5158.yaml new file mode 100644 index 00000000000..95dc8ff8928 --- /dev/null +++ b/releasenotes/notes/0.19/refactor-grover-isgoodstate-check-54fdb61f899e5158.yaml @@ -0,0 +1,27 @@ +features: + - | + When running the :class:`~qiskit.algorithms.Grover` algorithm class if the + optimal power is known and only a single circuit is run, the + :attr:`.AmplificationProblem.is_good_state` callback function is no longer + required to be set and the Grover search will return the most likely + bitstring. Generally, if the optimal power of the Grover operator is not + known, the :class:`~qiskit.algorithms.Grover` algorithm checks different + powers (i.e. iterations) and applies the + :attr:`~qiskit.algorithms.AmplificationProblem.is_good_state` function to + check whether a good bitstring has been measured. For example, you are now + able to run something like:: + + from qiskit.algorithms import Grover, AmplificationProblem + from qiskit.providers.aer import AerSimulator + from qiskit.quantum_info import Statevector + + # Fixed Grover power: 2. + grover = Grover(iterations=2, quantum_instance=AerSimulator()) + + # The ``is_good_state`` argument not required here since Grover search + # will be run only once, with a power of 2. + problem = AmplificationProblem(Statevector.from_label("111")) + + # Run Grover search and print the best measurement + result = grover.amplify(problem) + print(result.top_measurement) # should print 111 diff --git a/releasenotes/notes/remove-deprecated-assign-parameters-args-9712d7d01e82c390.yaml b/releasenotes/notes/0.19/remove-deprecated-assign-parameters-args-9712d7d01e82c390.yaml similarity index 66% rename from releasenotes/notes/remove-deprecated-assign-parameters-args-9712d7d01e82c390.yaml rename to releasenotes/notes/0.19/remove-deprecated-assign-parameters-args-9712d7d01e82c390.yaml index d3a6c67e54c..3d978c5d2f9 100644 --- a/releasenotes/notes/remove-deprecated-assign-parameters-args-9712d7d01e82c390.yaml +++ b/releasenotes/notes/0.19/remove-deprecated-assign-parameters-args-9712d7d01e82c390.yaml @@ -5,17 +5,17 @@ upgrade: :meth:`~qiskit.circuit.QuantumCircuit.assign_parameters` method of the :class:`~qiskit.circuit.QuantumCircuit` class has been removed and no longer exists. This argument was deprecated as part of the 0.17.0 release. - Instead you should use the ``parameters`` argument on the method. + Instead you should use the ``parameters`` argument of the method. - | The deprecated argument ``value_dict`` - of the :meth:`qiskit.circuit.QuantumCircuit.bind_parameters` method of the + of the :meth:`~qiskit.circuit.QuantumCircuit.bind_parameters` method of the :class:`~qiskit.circuit.QuantumCircuit` class has been removed and no longer exist. These arguments were deprecated as part of the 0.17.0 release. - Instead you should use the ``values`` argument on the method. + Instead you should use the ``values`` argument of the method. fixes: - | - Fix the statement about the parameter order if the parameters are provided as + Fixed a statement about the parameter order if the parameters are provided as iterable and not dictionary in - :meth:`qiskit.circuit.QuantumCircuit.assign_parameters`. The parameters are not + :meth:`.QuantumCircuit.assign_parameters`. The parameters are not sorted by insertion but by name, with the special case that the order of a :class:`~qiskit.circuit.ParameterVector` is maintained. diff --git a/releasenotes/notes/remove-deprecated-ops-2fbd27abaee98c68.yaml b/releasenotes/notes/0.19/remove-deprecated-ops-2fbd27abaee98c68.yaml similarity index 100% rename from releasenotes/notes/remove-deprecated-ops-2fbd27abaee98c68.yaml rename to releasenotes/notes/0.19/remove-deprecated-ops-2fbd27abaee98c68.yaml diff --git a/releasenotes/notes/0.19/remove-deprecated-pulse-code-57ec531224e45b5f.yaml b/releasenotes/notes/0.19/remove-deprecated-pulse-code-57ec531224e45b5f.yaml new file mode 100644 index 00000000000..8e8a48cd748 --- /dev/null +++ b/releasenotes/notes/0.19/remove-deprecated-pulse-code-57ec531224e45b5f.yaml @@ -0,0 +1,75 @@ +--- +upgrade: + - | + Various methods of assigning parameters to operands of pulse program + instructions have been removed, having been deprecated in Qiskit Terra 0.17. + These include: + + * the ``assign()`` method of :obj:`.pulse.Instruction`. + * the ``assign()`` method of ``Channel``, which is the base of + :obj:`.AcquireChannel`, :obj:`.SnapshotChannel`, :obj:`.MemorySlot` and + :obj:`.RegisterSlot`. + * the ``assign()`` and ``assign_parameters()`` methods of + ``ParametricPulse``, which is the base of :obj:`.pulse.Gaussian`, + :obj:`.pulse.GaussianSquare`, :obj:`.pulse.Drag` and :obj:`.pulse.Constant`. + + These parameters should be assigned from the pulse program + (:class:`.pulse.Schedule` and :class:`.pulse.ScheduleBlock`) rather than + operands of the pulse program instruction. + - | + The ``flatten()`` method of :class:`.pulse.Instruction` and + :class:`qiskit.pulse.Schedule` has been removed and no longer exists as per + the deprecation notice from Qiskit Terra 0.17. This transformation is + defined as a standalone function in + :func:`qiskit.pulse.transforms.canonicalization.flatten`. + - | + ``qiskit.pulse.interfaces.ScheduleComponent`` has been removed and no longer + exists as per the deprecation notice from Qiskit Terra 0.15. No alternative + class will be provided. + - | + Legacy pulse drawer arguments have been removed from + :meth:`.pulse.Waveform.draw`, :meth:`.Schedule.draw` and + :meth:`.ScheduleBlock.draw` and no longer exist as per the deprecation + notice from Qiskit Terra 0.16. Now these draw methods support only V2 pulse + drawer arguments. See method documentations for details. + - | + The ``qiskit.pulse.reschedule`` module has been removed and this import path + no longer exist as per the deprecation notice from Qiskit Terra 0.14. Use + :mod:`qiskit.pulse.transforms` instead. + - | + A protected method ``Schedule._children()`` has been removed and replaced by + a protected instance variable as per the deprecation notice from Qiskit + Terra 0.17. This is now provided as a public attribute + :obj:`.Schedule.children`. + - | + Timeslot relevant methods and properties have been removed and no longer + exist in :class:`~.pulse.ScheduleBlock` as per the deprecation notice from + Qiskit Terra 0.17. Since this representation doesn't have notion of + instruction time ``t0``, the timeslot information will be available after it + is transformed to a :obj:`~.pulse.Schedule`. Corresponding attributes have + been provided after this conversion, but they are no longer supported. The + following attributes are removed: + + * ``timeslots`` + * ``start_time`` + * ``stop_time`` + * ``ch_start_time`` + * ``ch_stop_time`` + * ``shift`` + * ``insert`` + - | + Alignment pulse schedule transforms have been removed and no longer exist as + per the deprecation notice from Qiskit Terra 0.17. These transforms are + integrated and implemented in the ``AlignmentKind`` context of the schedule + block. The following explicit transform functions are removed: + + * ``qiskit.pulse.transforms.align_equispaced`` + * ``qiskit.pulse.transforms.align_func`` + * ``qiskit.pulse.transforms.align_left`` + * ``qiskit.pulse.transforms.align_right`` + * ``qiskit.pulse.transforms.align_sequential`` + - | + Redundant pulse builder commands have been removed and no longer exist as + per the deprecation notice from Qiskit Terra 0.17. + ``pulse.builder.call_schedule`` and ``pulse.builder.call_circuit`` have been + integrated into :func:`.pulse.builder.call`. diff --git a/releasenotes/notes/remove-final-measure-rewrite-37d26dbba7385ebc.yaml b/releasenotes/notes/0.19/remove-final-measure-rewrite-37d26dbba7385ebc.yaml similarity index 95% rename from releasenotes/notes/remove-final-measure-rewrite-37d26dbba7385ebc.yaml rename to releasenotes/notes/0.19/remove-final-measure-rewrite-37d26dbba7385ebc.yaml index c5cb2af3807..2a24b336af4 100644 --- a/releasenotes/notes/remove-final-measure-rewrite-37d26dbba7385ebc.yaml +++ b/releasenotes/notes/0.19/remove-final-measure-rewrite-37d26dbba7385ebc.yaml @@ -36,10 +36,10 @@ fixes: handling of registers with shared underlying bits. - | Fixed an issue with :obj:`~qiskit.transpiler.passes.RemoveFinalMeasurements` - which could cause the resulting :obj:`DAGCircuit` to become invalid. See + which could cause the resulting :obj:`.DAGCircuit` to become invalid. See `#7196 `__ for more details. - | Fixed an issue with method :meth:`~qiskit.circuit.QuantumCircuit.remove_final_measurements` - of class :class:`~qiskit.circuit.QuantumCircuit` that caused ``QuantumCircuit.clbits`` + of class :class:`~qiskit.circuit.QuantumCircuit` that caused :attr:`.QuantumCircuit.clbits` to be incorrect after invocation. Refer to `#7089 `__ for details. diff --git a/releasenotes/notes/0.19/remove-manual-warning-filters-028646b73bb86860.yaml b/releasenotes/notes/0.19/remove-manual-warning-filters-028646b73bb86860.yaml new file mode 100644 index 00000000000..15ee5cc07ce --- /dev/null +++ b/releasenotes/notes/0.19/remove-manual-warning-filters-028646b73bb86860.yaml @@ -0,0 +1,23 @@ +--- +upgrade: + - | + An internal filter override that caused all Qiskit deprecation warnings to + be displayed has been removed. This means that the behaviour will now + revert to the standard Python behaviour for deprecations; you should only + see a ``DeprecationWarning`` if it was triggered by code in the main script + file, interpreter session or Jupyter notebook. The user will no longer be + blamed with a warning if internal Qiskit functions call deprecated + behaviour. If you write libraries, you should occasionally run with the + default warning filters disabled, or have tests which always run with them + disabled. See the `Python documentation on warnings`_, and in particular the + `section on testing for deprecations`_ for more information on how to do this. + + .. _Python documentation on warnings: https://docs.python.org/3/library/warnings.html + .. _section on testing for deprecations: https://docs.python.org/3/library/warnings.html#updating-code-for-new-versions-of-dependencies + - | + Certain warnings used to be only issued once, even if triggered from + multiple places. This behaviour has been removed, so it is possible that if + you call deprecated functions, you may see more warnings than you did + before. You should change any deprecated function calls to the suggested + versions, because the deprecated forms will be removed in future Qiskit + releases. diff --git a/releasenotes/notes/remove-schemas-ca9f3f2e0f08bca8.yaml b/releasenotes/notes/0.19/remove-schemas-ca9f3f2e0f08bca8.yaml similarity index 69% rename from releasenotes/notes/remove-schemas-ca9f3f2e0f08bca8.yaml rename to releasenotes/notes/0.19/remove-schemas-ca9f3f2e0f08bca8.yaml index 8b508bed64d..d2dcc5e13e7 100644 --- a/releasenotes/notes/remove-schemas-ca9f3f2e0f08bca8.yaml +++ b/releasenotes/notes/0.19/remove-schemas-ca9f3f2e0f08bca8.yaml @@ -4,9 +4,8 @@ upgrade: The deprecated ``qiskit.schemas`` module and the ``qiskit.validation`` module which build jsonschema validator from the schemas have been removed. This was deprecated in the 0.17.0 release and has been replaced with a - dedicated repository for the IBM Quantum API payload schemas: - - https://github.com/Qiskit/ibm-quantum-schemas + `dedicated repository for the IBM Quantum API payload schemas + `__. If you were relying on the schema files previously packaged in ``qiskit.schemas`` or the validators built on them you should use that @@ -14,23 +13,23 @@ upgrade: - | The functions ``qiskit.qobj.validate_qobj_against_schema`` and ``qiskit.qobj.common.validator`` along with the ``validate`` kwarg of - the methods :meth:`qiskit.qobj.QasmQobj.to_dict`, - :meth:`qiskit.qobj.PulseQobj.to_dict`, and :meth:`qiskit.qobj.Qobj.to_dict` + the methods :meth:`.QasmQobj.to_dict`, + :meth:`.PulseQobj.to_dict`, and :meth:`.Qobj.to_dict` have been removed. These were deprecated in the 0.17.0 release. If you were using these function you will have to manually build jsonschema validation - functions for ``Qobj`` objects using the jsonschema files from: - https://github.com/Qiskit/ibm-quantum-schemas + functions for ``Qobj`` objects using the jsonschema files from + `the dedicated repository for the IBM Quantum API payload schemas `__. - | - The ``fastjsonschema`` and ``jsonschema`` are no longer in the requirements + The ``fastjsonschema`` and ``jsonschema`` packages are no longer in the requirements list for qiskit-terra. The internal use of jsonschema has been removed and they are no longer required to use qiskit-terra. - | - The exception raised by the :func:`qiskit.compiler.assemble` function when + The exception raised by the :func:`~.compiler.assemble` function when invalid parameters are passed in for constructing a - :class:`~qiskit.qobj.PulseQobj` have changed from a ``SchemaValidationError` - to a :class:`qiskit.execeptions.QiskitError`. This was necessary because + :class:`~qiskit.qobj.PulseQobj` have changed from a ``SchemaValidationError`` + to a :class:`.QiskitError`. This was necessary because the ``SchemaValidationError`` class was removed along with the rest of the deprecated ``qiskit.schemas`` and ``qiskit.validation``. This also makes it more consistent with other error conditions from :func:`~qiskit.compiler.assemble` which were already raising a - :class:`qiskit.execeptions.QiskitError`. + :class:`.QiskitError`. diff --git a/releasenotes/notes/replace-block-with-op-e0d387f6d860d586.yaml b/releasenotes/notes/0.19/replace-block-with-op-e0d387f6d860d586.yaml similarity index 90% rename from releasenotes/notes/replace-block-with-op-e0d387f6d860d586.yaml rename to releasenotes/notes/0.19/replace-block-with-op-e0d387f6d860d586.yaml index 6f44f8b40e6..90587d1d556 100644 --- a/releasenotes/notes/replace-block-with-op-e0d387f6d860d586.yaml +++ b/releasenotes/notes/0.19/replace-block-with-op-e0d387f6d860d586.yaml @@ -4,7 +4,7 @@ features: Added a new method, :meth:`~qiskit.dagcircuit.DAGCircuit.replace_block_with_op`, to the :class:`~qiskit.dagcircuit.DAGCircuit` class. This method is used to replace - a block of nodes in the DAG with a single operation. The cannonical example + a block of nodes in the DAG with a single operation. The canonical example is for the :class:`~qiskit.transpiler.passes.ConsolidateBlocks` pass which replaces blocks of nodes with equivalent :class:`~qiskit.extensions.UnitaryGate` nodes. @@ -12,7 +12,7 @@ features: Added a new analysis transpiler pass, :class:`~qiskit.transpiler.passes.Collect1qRuns`, to the :mod:`qiskit.transpiler.passes` module. This pass is used to find sequences - of uninterrupted gates acting on a single qubit. It's similar to the + of uninterrupted gates acting on a single qubit. It is similar to the :class:`~qiskit.transpiler.passes.Collect2qBlocks` and :class:`~qiskit.transpiler.passes.CollectMultiQBlocks` but optimized for single qubit runs instead of multiple qubit blocks. diff --git a/releasenotes/notes/retworkx-substitute_node_with_dag-speedup-d7d1f0d33716131d.yaml b/releasenotes/notes/0.19/retworkx-substitute_node_with_dag-speedup-d7d1f0d33716131d.yaml similarity index 73% rename from releasenotes/notes/retworkx-substitute_node_with_dag-speedup-d7d1f0d33716131d.yaml rename to releasenotes/notes/0.19/retworkx-substitute_node_with_dag-speedup-d7d1f0d33716131d.yaml index bac8c876fd6..a9a9f13a7d4 100644 --- a/releasenotes/notes/retworkx-substitute_node_with_dag-speedup-d7d1f0d33716131d.yaml +++ b/releasenotes/notes/0.19/retworkx-substitute_node_with_dag-speedup-d7d1f0d33716131d.yaml @@ -4,6 +4,6 @@ features: Various transpilation internals now use new features in `retworkx `__ 0.10 when operating on the internal circuit representation. This can often result in speedups in calls to - :obj:`~qiskit.transpile` of around 10-40%, with greater effects at higher - optimisation levels. See `#6302 + :obj:`~.compiler.transpile` of around 10-40%, with greater effects at higher + optimization levels. See `#6302 `__ for more details. diff --git a/releasenotes/notes/sabre-opt-lvl3-default-550924470d683112.yaml b/releasenotes/notes/0.19/sabre-opt-lvl3-default-550924470d683112.yaml similarity index 91% rename from releasenotes/notes/sabre-opt-lvl3-default-550924470d683112.yaml rename to releasenotes/notes/0.19/sabre-opt-lvl3-default-550924470d683112.yaml index 330fe5ffb0b..85e2e389564 100644 --- a/releasenotes/notes/sabre-opt-lvl3-default-550924470d683112.yaml +++ b/releasenotes/notes/0.19/sabre-opt-lvl3-default-550924470d683112.yaml @@ -1,7 +1,7 @@ --- upgrade: - | - The default routing pass and layout pass for optimization level 3 has + The default routing pass and layout pass for transpiler optimization level 3 has changed to use :class:`~qiskit.transpiler.passes.SabreSwap` and :class:`~qiskit.transpiler.passes.SabreLayout` respectively. This was done to improve the quality of the output result, as using the sabre diff --git a/releasenotes/notes/0.19/sparse-pauli-internal-8226b4f57a61b982.yaml b/releasenotes/notes/0.19/sparse-pauli-internal-8226b4f57a61b982.yaml new file mode 100644 index 00000000000..4ce25f21146 --- /dev/null +++ b/releasenotes/notes/0.19/sparse-pauli-internal-8226b4f57a61b982.yaml @@ -0,0 +1,16 @@ +deprecations: + - | + The property :attr:`~qiskit.quantum_info.SparsePauliOp.table` is deprecated, + and will be removed in a future release. This is because + :class:`~qiskit.quantum_info.SparsePauliOp` has been updated to internally use + :class:`~qiskit.quantum_info.operators.PauliList` instead of + :class:`~qiskit.quantum_info.PauliTable`. This is in order to significantly + improve performance. You should now access the :obj:`.PauliList` data by + using the :attr:`.SparsePauliOp.paulis` attribute. +upgrade: + - | + The return type of :func:`~qiskit.quantum_info.pauli_basis` will change from + :class:`~qiskit.quantum_info.PauliTable` to + :class:`~qiskit.quantum_info.PauliList` in a future release of Qiskit Terra. + To immediately swap to the new behaviour, pass the keyword argument + ``pauli_list=True``. diff --git a/releasenotes/notes/squ-gate-name-785b7896300a92ef.yaml b/releasenotes/notes/0.19/squ-gate-name-785b7896300a92ef.yaml similarity index 100% rename from releasenotes/notes/squ-gate-name-785b7896300a92ef.yaml rename to releasenotes/notes/0.19/squ-gate-name-785b7896300a92ef.yaml diff --git a/releasenotes/notes/0.19/support-dict-for-aux-operators-c3c9ad380c208afd.yaml b/releasenotes/notes/0.19/support-dict-for-aux-operators-c3c9ad380c208afd.yaml new file mode 100644 index 00000000000..5fef8f5d648 --- /dev/null +++ b/releasenotes/notes/0.19/support-dict-for-aux-operators-c3c9ad380c208afd.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + The :obj:`.Eigensolver` and :obj:`.MinimumEigensolver` interfaces now support the type + ``Dict[str, Optional[OperatorBase]]`` for the ``aux_operators`` parameter in their respective + :meth:`~.Eigensolver.compute_eigenvalues` and :meth:`~.MinimumEigensolver.compute_minimum_eigenvalue` methods. + In this case, the auxiliary eigenvalues are also stored in a dictionary under the same keys + provided by the ``aux_operators`` dictionary. Keys that correspond to an operator that does not commute + with the main operator are dropped. diff --git a/releasenotes/notes/0.19/symengine-bump-20dedd5204870e7a.yaml b/releasenotes/notes/0.19/symengine-bump-20dedd5204870e7a.yaml new file mode 100644 index 00000000000..86a51bb47c5 --- /dev/null +++ b/releasenotes/notes/0.19/symengine-bump-20dedd5204870e7a.yaml @@ -0,0 +1,10 @@ +--- +upgrade: + - | + The minimum version of Symengine__ required for installing has been increased + to 0.8.0. This was necessary to fix some issues with the handling of + ``numpy.float16`` and ``numpy.float32`` values when running + :meth:`~qiskit.circuit.ParameterExpression.bind` to bind parameters in a + :class:`~qiskit.circuit.ParameterExpression`. + + .. __: https://pypi.org/project/symengine diff --git a/releasenotes/notes/taper_empty_operator_fix-53ce20e5d2b68fd6.yaml b/releasenotes/notes/0.19/taper_empty_operator_fix-53ce20e5d2b68fd6.yaml similarity index 69% rename from releasenotes/notes/taper_empty_operator_fix-53ce20e5d2b68fd6.yaml rename to releasenotes/notes/0.19/taper_empty_operator_fix-53ce20e5d2b68fd6.yaml index 16e49452d3b..b02a9dde71a 100644 --- a/releasenotes/notes/taper_empty_operator_fix-53ce20e5d2b68fd6.yaml +++ b/releasenotes/notes/0.19/taper_empty_operator_fix-53ce20e5d2b68fd6.yaml @@ -1,11 +1,11 @@ --- fixes: - | - When tapering an empty/zero operator, the code, on detecting it was zero, logged a + When tapering an empty zero operator in :mod:`qiskit.opflow`, the code, on detecting it was zero, logged a warning and returned the original operator. Such operators are commonly found in - the auxiliary operators, when using Qiskit Nature, and the above behavior caused VQE + the auxiliary operators, when using Qiskit Nature, and the above behavior caused :obj:`.VQE` to throw an exception as tapered non-zero operators were a different number of qubits from the tapered zero operators (since taper has returned the input operator unchanged). The code will now correctly taper a zero operator such that the number of qubits is - reduced as expected and matches to tapered non-zero operators e.g 0*"IIII" when we are - tapering by 3 qubits will become 0*"I". + reduced as expected and matches to tapered non-zero operators e.g ```0*"IIII"``` when we are + tapering by 3 qubits will become ``0*"I"``. diff --git a/releasenotes/notes/target-in-transpiler-c0a97bd33ad9417d.yaml b/releasenotes/notes/0.19/target-in-transpiler-c0a97bd33ad9417d.yaml similarity index 74% rename from releasenotes/notes/target-in-transpiler-c0a97bd33ad9417d.yaml rename to releasenotes/notes/0.19/target-in-transpiler-c0a97bd33ad9417d.yaml index c6d2a07c161..aca239ec33a 100644 --- a/releasenotes/notes/target-in-transpiler-c0a97bd33ad9417d.yaml +++ b/releasenotes/notes/0.19/target-in-transpiler-c0a97bd33ad9417d.yaml @@ -4,21 +4,21 @@ features: The :class:`~qiskit.transpiler.passes.BasisTranslator`, :class:`~qiskit.transpiler.passes.GateDirection`, and :class:`~qiskit.transpiler.passes.CheckGateDirection` transpiler passes have - a new kwarg on the constructor, ``target`` which can be used to set + a new ``target`` kwarg in their constructors, which can be used to set a :class:`~qiskit.transpiler.Target` object as the target for the pass. If - it is set it will be used instead of the ``basis_gates`` (in the case of + it is set it will be used instead of the ``target_basis`` (in the case of the :class:`~qiskit.transpiler.passes.BasisTranslator` pass) or ``coupling_map`` (in the case of the :class:`~qiskit.transpiler.passes.GateDirection` and :class:`~qiskit.transpiler.passes.CheckGateDirection` passes) arguments. issues: - | - When running the :class:`~qiskit.transpiler.pass.BasisTranslator` in + When running the :class:`~qiskit.transpiler.passes.BasisTranslator` in isolation with the ``target`` argument set to a - :class:`~qiskit.transpiler.Target` object set with non-overlapping sets - of single qubit operations on different qubits the output circuit might - incorrectly include operations outside the set defined on that single qubit. - For example, if you ran:: + :class:`~qiskit.transpiler.Target` object, where some single-qubit gates + can only apply to non-overlapping sets of qubits, the output circuit might + incorrectly include operations on a qubit that are not allowed by the + :class:`~qiskit.transpiler.Target`. For example, if you ran:: from qiskit.circuit import QuantumCircuit, Parameter from qiskit.circuit.library import UGate, RZGate, XGate, SXGate, CXGate @@ -73,9 +73,9 @@ issues: qc.iswap(0, 1) output = bt_pass(qc) - ``output`` will have `RZGate` and ``SXGate`` on qubit 0. To correct this - you can normally run the basis translator a second time (i.e. - ``output = bt_pass(output)`` in the above example) to correct this. This - should not effect the output of running the + ``output`` will have :class:`.RZGate` and :class:`.SXGate` on qubit 0, even + though this is forbidden. To correct this you can normally run the basis + translator a second time (i.e. ``output = bt_pass(output)`` in the above + example) to correct this. This should not affect the output of running the :func:`~qiskit.compiler.transpile` function and is only an issue if you run the pass by itself. diff --git a/releasenotes/notes/two-step-transpile-f20d709a7a0c42dd.yaml b/releasenotes/notes/0.19/two-step-transpile-f20d709a7a0c42dd.yaml similarity index 96% rename from releasenotes/notes/two-step-transpile-f20d709a7a0c42dd.yaml rename to releasenotes/notes/0.19/two-step-transpile-f20d709a7a0c42dd.yaml index a45824b13bd..fec0234933f 100644 --- a/releasenotes/notes/two-step-transpile-f20d709a7a0c42dd.yaml +++ b/releasenotes/notes/0.19/two-step-transpile-f20d709a7a0c42dd.yaml @@ -4,7 +4,7 @@ features: Allow two transpiler stages in the :class:`~qiskit.utils.QuantumInstance`, one for parameterized circuits and a second one for bound circuits (i.e. no free parameters) only. If a quantum instance with passes for unbound and bound circuits is passed into a - :class:`~qiskit.opflow.CircuitSampler`, the sampler will attempt to apply the unbound pass + :class:`.CircuitSampler`, the sampler will attempt to apply the unbound pass once on the parameterized circuit, cache it, and only apply the bound pass for all future evaluations. @@ -17,7 +17,7 @@ features: For example, this feature allows using the pulse-efficient CX decomposition in the VQE, as - .. code-block::python + .. code-block:: python from qiskit.algorithms import VQE from qiskit.opflow import Z diff --git a/releasenotes/notes/unitary-synthesis-plugin-a5ec21a1906149fa.yaml b/releasenotes/notes/0.19/unitary-synthesis-plugin-a5ec21a1906149fa.yaml similarity index 87% rename from releasenotes/notes/unitary-synthesis-plugin-a5ec21a1906149fa.yaml rename to releasenotes/notes/0.19/unitary-synthesis-plugin-a5ec21a1906149fa.yaml index 660d3e85d23..07a1b581b4e 100644 --- a/releasenotes/notes/unitary-synthesis-plugin-a5ec21a1906149fa.yaml +++ b/releasenotes/notes/0.19/unitary-synthesis-plugin-a5ec21a1906149fa.yaml @@ -16,17 +16,17 @@ features: transpile(qc, unitary_synthesis_method='special_synth', optimization_level=3) - this will replace all uses of the :class:`~qiskit.transpiler.passes.UnitarySynthesis` + This will replace all uses of the :class:`~qiskit.transpiler.passes.UnitarySynthesis` with the method included in the external package that exports the ``special_synth`` plugin. The plugin interface is built around setuptools `entry points `__ - which enables packages external to Qiskit to advertise they include a + which enable packages external to Qiskit to advertise they include a synthesis plugin. For details on writing a new plugin refer to the :mod:`qiskit.transpiler.passes.synthesis.plugin` module documentation. upgrade: - | A new dependency `stevedore `__ has been added to the requirements list. This is required by qiskit-terra as - it's used to build the unitary synthesis plugin interface. + it is used to build the unitary synthesis plugin interface. diff --git a/releasenotes/notes/0.19/user-config-mpl-style-a9ae4eb7ce072fcd.yaml b/releasenotes/notes/0.19/user-config-mpl-style-a9ae4eb7ce072fcd.yaml new file mode 100644 index 00000000000..36e23012da3 --- /dev/null +++ b/releasenotes/notes/0.19/user-config-mpl-style-a9ae4eb7ce072fcd.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Fixed an issue with the :meth:`~qiskit.circuit.QuantumCircuit.draw` method and + :func:`~qiskit.visualization.circuit_drawer` function, where a custom style set via the + user config file (i.e. ``settings.conf``) would ignore the set value of the + ``circuit_mpl_style`` field if the ``style`` kwarg on the function/method was not + set. diff --git a/releasenotes/notes/0.19/vf2layout-4cea88087c355769.yaml b/releasenotes/notes/0.19/vf2layout-4cea88087c355769.yaml new file mode 100644 index 00000000000..07c0ce9178d --- /dev/null +++ b/releasenotes/notes/0.19/vf2layout-4cea88087c355769.yaml @@ -0,0 +1,13 @@ +--- +features: + - | + Added a new transpiler pass, :class:`~qiskit.transpiler.passes.VF2Layout`. + This pass models the layout allocation problem as a subgraph isomorphism + problem and uses the `VF2 algorithm`_ implementation in `retworkx + `__ + to find a perfect layout (a layout which would not require additional + routing) if one exists. The functionality exposed by this new pass is very + similar to exisiting :class:`~qiskit.transpiler.passes.CSPLayout` but + :class:`~qiskit.transpiler.passes.VF2Layout` is significantly faster. + + .. _VF2 algorithm: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.101.5342&rep=rep1&type=pdf diff --git a/releasenotes/notes/7156-df1a60c608b93184.yaml b/releasenotes/notes/7156-df1a60c608b93184.yaml deleted file mode 100644 index 86cefa690c7..00000000000 --- a/releasenotes/notes/7156-df1a60c608b93184.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -fixes: - - | - Fixed `#7156 `__ . - Many layout methods ignore 3-or-more qubit gates resulting in expected layout allocation decisions. - The pass :class:`qiskit.transpiler.passes.Unroll3qOrMore` is now being executed before the layout pass. diff --git a/releasenotes/notes/7274-6f57628a7995a461.yaml b/releasenotes/notes/7274-6f57628a7995a461.yaml deleted file mode 100644 index 004ddd4e71f..00000000000 --- a/releasenotes/notes/7274-6f57628a7995a461.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -upgrade: - - | - In this version, ``from qiskit import *`` will not import submodules, but only a selected list of objects. - This might break existing code using ``from qiskit import *`` and referring to objects that are not part of the current namespace. - As a reminder, ``import *`` is considered bad practice and it should not be used in production code. - Qiskit sets ``__all__`` in ``qiskit/__init__.py`` as a way to mitigate the effects of said bad practice. - If your code raises ``name '' is not defined``, add ``from qiskit import `` and try again. diff --git a/releasenotes/notes/QuantumCircuit.decompose-takes-which-gate-to-decompose-d857da5d0c41fb66.yaml b/releasenotes/notes/QuantumCircuit.decompose-takes-which-gate-to-decompose-d857da5d0c41fb66.yaml deleted file mode 100644 index 8a144f7b51c..00000000000 --- a/releasenotes/notes/QuantumCircuit.decompose-takes-which-gate-to-decompose-d857da5d0c41fb66.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -features: - - | - Allows specification of gates to decompose inside `circuit.decompose()` (and - in the :class:`qiskit.transpiler.passes.basis.Decompose` pass). - It takes input as a list of strings or gates as well as single strings or gates - and also supports wildcards. - - For example:: - circ.decompose(['cz','h']) - - See `#2906 `__ for more information. - -deprecations: - - | - There is a deprecation of the `gate` param for - the :class:`qiskit.transpiler.passes.basis.Decompose` and is replaced by `gates_to_decompose`. diff --git a/releasenotes/notes/add-circuit-calibrations-to-diassambler-2e68437a815cc729.yaml b/releasenotes/notes/add-circuit-calibrations-to-diassambler-2e68437a815cc729.yaml deleted file mode 100644 index 5444fb6b2ba..00000000000 --- a/releasenotes/notes/add-circuit-calibrations-to-diassambler-2e68437a815cc729.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -fixes: - - | - Disassembled circuits now inherit calibrations from assembled qobj and experiment. - Fixes `#5348 ` diff --git a/releasenotes/notes/add-detach-prefix-088e96b88ba29927.yaml b/releasenotes/notes/add-detach-prefix-088e96b88ba29927.yaml deleted file mode 100644 index ba8b3ac21c3..00000000000 --- a/releasenotes/notes/add-detach-prefix-088e96b88ba29927.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -features: - - | - Add utility function :py:func:`~qiskit.utils.units.detach_prefix` that is a counterpart of - :py:func:`~qiskit.utils.units.apply_prefix`. - The new function returns a tuple of scaled value and prefix from a given float value. - For example, a value ``1.3e8`` will be converted into ``(130, "M")`` that can be - used to display a value in the user friendly format, such as `130 MHz`. diff --git a/releasenotes/notes/add-gate-error-objective-00a96f75055d1526.yaml b/releasenotes/notes/add-gate-error-objective-00a96f75055d1526.yaml deleted file mode 100644 index e3c31d6b51f..00000000000 --- a/releasenotes/notes/add-gate-error-objective-00a96f75055d1526.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -features: - - | - The values ``"gate_error"`` and ``"balanced"`` are newly available for - ``objective`` option in the construction of - :class:`qiskit.transpiler.passes.BIPMapping` object. - Those objectives require ``backend_prop``, which contains the 2q-gate gate errors - used in the computation of the objectives. diff --git a/releasenotes/notes/add-getters-and-setters-for-vqe-edc753591b368980.yaml b/releasenotes/notes/add-getters-and-setters-for-vqe-edc753591b368980.yaml deleted file mode 100644 index 020612dbd56..00000000000 --- a/releasenotes/notes/add-getters-and-setters-for-vqe-edc753591b368980.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -features: - - | - Every attribute of the :class:`~qiskit.circuit.algorithms.VQE` class that is set at the initialization is now - accessible with getters and setters. Further, the default values of the VQE attributes such as `ansatz`, - `optimizer` or `quantum_instance` can be reset by setting the attribute to `None`. - - .. code-block:: python - - vqe = VQE(my_ansatz, my_optimizer) - vqe.ansatz = None # reset to default: RealAmplitudes ansatz - vqe.optimizer = None # reset to default: SLSQP optimizer - -fixes: - - | - Fixes the fact that setting the `ansatz` or `optimizer` attributes of a `VQE` instance to `None` resulted in a buggy behavior, as explained in `#7093 `. - -upgrade: - - | - The `sort_parameters_by_name` of the :class:`~qiskit.circuit.algorithms.VQE` class has been removed, following its deprecation on July, 12th. diff --git a/releasenotes/notes/add-group-qubit-wise-commuting-pauli-list-7b96834068a36928.yaml b/releasenotes/notes/add-group-qubit-wise-commuting-pauli-list-7b96834068a36928.yaml deleted file mode 100644 index 36b129ddede..00000000000 --- a/releasenotes/notes/add-group-qubit-wise-commuting-pauli-list-7b96834068a36928.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- - -features: - - | - Added a new function, `group_qubit_wise_commuting()`, which partitions a - ``PauliList`` into sets of mutually qubit-wise commuting ``Pauli`` strings. - for example:: - - from qiskit.quantum_info import PauliList,Pauli - pauli_list=PauliList([Pauli("IY"), Pauli("XX"),Pauli("YY"),Pauli("YX")]) - pauli_list.group_qubit_wise_commuting() - diff --git a/releasenotes/notes/add-hexagonal-lattice-couplingmap-d3b65b146b6cd1d1.yaml b/releasenotes/notes/add-hexagonal-lattice-couplingmap-d3b65b146b6cd1d1.yaml deleted file mode 100644 index c09e1275cfa..00000000000 --- a/releasenotes/notes/add-hexagonal-lattice-couplingmap-d3b65b146b6cd1d1.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -features: - - | - Add a new constructor method, :meth: `~qiskit.transpiler.CouplingMap.from_hexagonal_lattice`, to - the :class:`~qiskit.transpiler.CouplingMap` class. - - For example: - - .. jupyter-execute:: - - from qiskit.transpiler import CouplingMap - cmap = CouplingMap.from_hexagonal_lattice(2, 2) - cmap.draw() diff --git a/releasenotes/notes/add-opflow-is-hermitian-method-6a461549e3c6b32c.yaml b/releasenotes/notes/add-opflow-is-hermitian-method-6a461549e3c6b32c.yaml deleted file mode 100644 index d5d98fc106b..00000000000 --- a/releasenotes/notes/add-opflow-is-hermitian-method-6a461549e3c6b32c.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -features: - - | - The :meth:`~qiskit.opflow.OperatorBase.is_hermitian` method is added to :obj:`~qiskit.opflow.OperatorBase` to check whether - the operator is Hermitian or not. :class:`~qiskit.algorithms.NumPyEigensolver` and - :class:`~qiskit.algorithms.NumPyMinimumEigensolver` use eigh or eigsh to solve the - eigenvalue problem when the operator is Hermitian. diff --git a/releasenotes/notes/add-passmanager-config-from-backend-af5dd7d99ec053ef.yaml b/releasenotes/notes/add-passmanager-config-from-backend-af5dd7d99ec053ef.yaml deleted file mode 100644 index 5deed46d018..00000000000 --- a/releasenotes/notes/add-passmanager-config-from-backend-af5dd7d99ec053ef.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -features: - - | - Add a new constructor method :meth:`~qiskit.transpiler.PassManagerConfig.from_backend` to - the :class:`qiskit.transpiler.PassManagerConfig` class. It constructs a - :class:`~qiskit.transpiler.PassManagerConfig` object with user options and the configuration of a - backend. With this feature, a preset passmanager can be built easier, for - example:: - - from qiskit.transpiler.passmanager_config import PassManagerConfig - from qiskit.transpiler.preset_passmanagers import level_1_pass_manager - from qiskit.test.mock import FakeMelbourne - - pass_manager = level_1_pass_manager( - PassManagerConfig.from_backend(FakeMelbourne(), seed_transpiler=42) - ) - diff --git a/releasenotes/notes/add-pulse-gate-pass-dc347177ed541bcc.yaml b/releasenotes/notes/add-pulse-gate-pass-dc347177ed541bcc.yaml deleted file mode 100644 index fa5f284b67c..00000000000 --- a/releasenotes/notes/add-pulse-gate-pass-dc347177ed541bcc.yaml +++ /dev/null @@ -1,94 +0,0 @@ ---- -features: - - | - A new transpiler pass group :mod:`~qiskit.transpiler.passes.calibration` has been added. - This group consists of - - - :class:`~qiskit.transpiler.passes.calibration.creators.RZXCalibrationBuilder` - - :class:`~qiskit.transpiler.passes.calibration.creators.RZXCalibrationBuilderNoEcho` - - :func:`~qiskit.transpiler.passes.calibration.rzx_templates.rzx_templates`. - - :class:`~qiskit.transpiler.passes.calibration.creators.PulseGates` - - ``RZXCalibrationBuilder``, ``RZXCalibrationBuilderNoEcho``, and ``rzx_templates`` are - moved from :mod:`qiskit/transpiler/passes/scheduling`, whereas ``PulseGates`` - is the new pass that automatically extracts user-provided calibrations - from the instruction schedule map and attaches the gate schedule to the - given (transpiled) quantum circuit as a pulse gate. - Any transpiler pass that interacts with the pulse gate feature will be grouped to - :mod:`qiskit.transpiler.passes.calibration`. - - This pass is applied to all optimization levels from 0 to 3. - No gate implementation is updated unless the end-user explicitly overrides - the ``backend.defaults().instruction_schedule_map``. - - This pass saves users from individually calling :meth:`~qiskit.circuit.quantumcircuit.\ - QuantumCircuit#add_calibration` method for every circuit run on the hardware. - - Along with this change, a schedule was added to :class:`qiskit.pulse.instruction_schedule_map.\ - InstructionScheduleMap` and is implicitly updated with a metadata "publisher". - Backend calibrated gate schedules have a special publisher kind to avoid overriding - circuits with calibrations of already known schedules. - Usually, end-users don't need to take care of this metadata as it is applied automatically. - You can call - :py:meth:`~qiskit.pulse.instruction_schedule_map.InstructionScheduleMap#has_custom_gate` - to check if the map has custom gate calibration. - - See below code example to learn how to apply custom gate implementation - for all circuits under execution. - - .. code-block:: python - - from qiskit.test.mock import FakeGuadalupe - from qiskit import pulse, circuit, transpile - - backend = FakeGuadalupe() - - with pulse.build(backend, name="x") as x_q0: - pulse.play(pulse.Constant(160, 0.1), pulse.drive_channel(0)) - - backend.defaults().instruction_schedule_map.add("x", (0,), x_q0) - - circs = [] - for _ in range(100): - circ = circuit.QuantumCircuit(1) - circ.sx(0) - circ.rz(1.57, 0) - circ.x(0) - circ.measure_active() - circs.append(circ) - - circs = transpile(circs, backend) - circs[0].calibrations # This returns calibration only for x gate - - Note that the instruction schedule map is a mutable object. - If you override one of the entries and use that backend for other experiments, - you may accidentally update the gate definition. - - .. code-block:: python - - backend = FakeGuadalupe() - - instmap = backend.defaults().instruction_schedule_map - instmap.add("x", (0, ), my_x_gate_schedule) - - qc = QuantumCircuit(1, 1) - qc.x(0) - qc.measure(0, 0) - - qc = transpile(qc, backend) # This backend uses custom X gate - - If you want to update the gate definitions of a specific experiment, - you need to first deepcopy the instruction schedule map - and directly pass it to the transpiler. - - -deprecations: - - | - Transpiler pass reorganization regarding calibrations. - The import path for :class:`~qiskit.transpiler.passes.scheduling.calibration_creators.\ - RZXCalibrationBuilder` and :class:`~qiskit.transpiler.passes.scheduling.\ - calibration_creators.RZXCalibrationBuilderNoEcho` are deprecated. - The import path for :func:`qiskit.transpiler.passes.scheduling.rzx_templates.\ - rzx_templates.rzx_templates` is also deprecated. - - Use new import path under :mod:`~qiskit.transpiler.passes.calibration`. diff --git a/releasenotes/notes/add-sparsepauliop-fast-path-228065a05fca4387.yaml b/releasenotes/notes/add-sparsepauliop-fast-path-228065a05fca4387.yaml deleted file mode 100644 index c37be6a78d1..00000000000 --- a/releasenotes/notes/add-sparsepauliop-fast-path-228065a05fca4387.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -features: - - | - Added ``ignore_pauli_phase`` and ``copy`` arguments to the constructor of :obj:`~qiskit.quantum_info.SparsePauliOp`. - ``ignore_pauli_phase`` allows users to avoid the phase conversion of :class:`~qiskit.quantum_info.PauliList` - to be compatible with the internal ZX-phase convention. - ``copy`` allows users to avoid the copy of the input data when they explicitly set ``copy=False``. - - | - Improved performance of :class:`qiskit.quantum_info.SparsePauliOp` operations as follows. - - * :meth:`~qiskit.quantum_info.SparsePauliOp.simplify` - `#7122 `__. - * :meth:`~qiskit.quantum_info.SparsePauliOp.compose` - `#7126 `__. - * :meth:`~qiskit.quantum_info.SparsePauliOp._add` - `#7138 `__. - * :meth:`~qiskit.quantum_info.SparsePauliOp.from_list` and :meth:`~qiskit.quantum_info.PauliList.__init__` - `#7138 `__. - -fixes: - - | - Fixed :meth:`~qiskit.quantum_info.PauliList._add` with ``qargs``. The method used to raise a runtime error - if ``self`` and ``other`` have different numbers of paulis. diff --git a/releasenotes/notes/add-sparsepauliop-sum-d55fc817c9fded82.yaml b/releasenotes/notes/add-sparsepauliop-sum-d55fc817c9fded82.yaml deleted file mode 100644 index 71df41276f3..00000000000 --- a/releasenotes/notes/add-sparsepauliop-sum-d55fc817c9fded82.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -features: - - | - Added :meth:`~qiskit.quantum_info.SparsePauliOp.sum` as a specialized function of the builtin - function ``sum`` for a list of :class:`~qiskit.quantum_info.SparsePauliOp`. - This method has better scaling than repeated calls to :meth:`~qiskit.quantum_info.SparsePauliOp._add`. diff --git a/releasenotes/notes/add-support-to-disable-amplitude-limit-in-parametric-pulses-ef88b77db8c1b06c.yaml b/releasenotes/notes/add-support-to-disable-amplitude-limit-in-parametric-pulses-ef88b77db8c1b06c.yaml deleted file mode 100644 index 106aeedf531..00000000000 --- a/releasenotes/notes/add-support-to-disable-amplitude-limit-in-parametric-pulses-ef88b77db8c1b06c.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -features: - - | - Adds an argument ``limit_amplitude`` to the constructor of ParametricPulse - class, and derived classes Gaussian, GaussianSquare, Drag and Constant, to - enable or disable the amplitude limit of 1 on the pulse. Fixes #6544. This - option gets propagated to the parent class Pulse. With this option enabled, - ParametricPulse class and its subclasses do not allow amplitudes larger - than 1. By default, the value of ``limit_amplitude`` is true, so that the - amplitude is constrained to be less than 1. diff --git a/releasenotes/notes/added-multiformat-support-b5d3c7c7c1536951.yaml b/releasenotes/notes/added-multiformat-support-b5d3c7c7c1536951.yaml deleted file mode 100644 index c0cf03286e2..00000000000 --- a/releasenotes/notes/added-multiformat-support-b5d3c7c7c1536951.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -features: - - | - Using ``QuantumCircuit.draw()`` function with ``latex`` will now generate the file - in the correct image format determined from the filename extension, - for example:: - - import qiskit - - circuit = qiskit.QuantumCircuit(2) - circuit.h(0) - circuit.cx(0, 1) - circuit.draw('latex', filename='./file.jpg') - - This will save the circuit in the JPEG format (earlier it always used to save it in PNG). - Refer to `#6448 ` for more details. - - Now, if it encountered a filename extension which is not supported, - - for example:: - - circuit.draw('latex', filename='./file.spooky') - - It will give user a `ValueError` to change the filename extension to a supported image format:: - - "ERROR: This image format is not supported. Please change file extension to a supported image format." - - Similarly, if a user tries to save a file using the ``text`` option in ``QuantumCircuit.draw()`` - without using a ``.txt`` filename extension, another `ValueError` will be thrown. - - for example:: - - circuit.draw('text', filename'./file.nottxt') - - will generate:: - - "ERROR: Filename extension is not .txt. Please use a .txt file extension to save in text format." diff --git a/releasenotes/notes/added-snapshot-tests-for-backend-mapping-functions-5961300e09f05be0.yaml b/releasenotes/notes/added-snapshot-tests-for-backend-mapping-functions-5961300e09f05be0.yaml deleted file mode 100644 index 51b07b16d54..00000000000 --- a/releasenotes/notes/added-snapshot-tests-for-backend-mapping-functions-5961300e09f05be0.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -features: - - | - Added the parameter, `filename`, to :func:`~qiskit.visualization.gate_map.plot_gate_map` and :func:`~qiskit.visualization.gate_map.plot_coupling_name` which - allows to save the gate_map and coupling_map as an image file. - - - | - Added the snapshot testing feature for the functions plot_gate_map and plot_coupling_map - for different use cases. diff --git a/releasenotes/notes/approxiamte-quantum-compiler-3c74652d4c5e9fa6.yaml b/releasenotes/notes/approxiamte-quantum-compiler-3c74652d4c5e9fa6.yaml deleted file mode 100644 index 786485cb67e..00000000000 --- a/releasenotes/notes/approxiamte-quantum-compiler-3c74652d4c5e9fa6.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -features: - - | - Introduced an approximate quantum compiler and a corresponding unitary synthesis plugin - implementation. The main AQC class is :class:`~qiskit.transpiler.synthesis.AQC` for - a standalone version that compiles a unitary matrix into an approximate circuit. The plugin - may be invoked by the transpiler when the ``unitary_synthesis_method`` is set to ``'aqc'``. diff --git a/releasenotes/notes/bip-improvement-34cd623294a30d83.yaml b/releasenotes/notes/bip-improvement-34cd623294a30d83.yaml deleted file mode 100644 index ab84e996cea..00000000000 --- a/releasenotes/notes/bip-improvement-34cd623294a30d83.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -features: - - | - The ``balanced`` objective function of the ``BIPMapping`` no longer - requires a ``BackendProperties``. It will use ``BackendProperties`` if - available, otherwise it assumes a CX error rate as given in the new - parameter ``default_cx_error_rate``. A new parameter ``depth_obj_weight`` - now controls the weight of the two objectives combined in the ``balanced`` - objective. -upgrade: - - | - The default method for ``BIPMapping`` is now ``balanced`` rather than - ``depth``. diff --git a/releasenotes/notes/bugfix-6918-4b3cc4056df39e48.yaml b/releasenotes/notes/bugfix-6918-4b3cc4056df39e48.yaml deleted file mode 100644 index 7ee532ec1ee..00000000000 --- a/releasenotes/notes/bugfix-6918-4b3cc4056df39e48.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -fixes: - - | - Fixed an issue causing an error when trying to compute a gradient with the - :class:`~qiskit.opflow.gradients.CircuitGradient` class for a gate that was not - a supported gate. This bugfix transpiles a given gate to the set of supported gates for - a requested gradient method. - Fixes `#6918 `__. \ No newline at end of file diff --git a/releasenotes/notes/calibration_results-ac2f9f75479e8d64.yaml b/releasenotes/notes/calibration_results-ac2f9f75479e8d64.yaml deleted file mode 100644 index 5b588092ffa..00000000000 --- a/releasenotes/notes/calibration_results-ac2f9f75479e8d64.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -fixes: - - | - Removed calibration results when using error mitigation with the :meth:`~qiskit.utils.QuantumInstance.execute` method of - :class:`~qiskit.utils.QuantumInstance`. - Fixes `#7129 `__. \ No newline at end of file diff --git a/releasenotes/notes/circuit-size-depth-filter-function-2177a8a71588f915.yaml b/releasenotes/notes/circuit-size-depth-filter-function-2177a8a71588f915.yaml deleted file mode 100644 index 37204b8d383..00000000000 --- a/releasenotes/notes/circuit-size-depth-filter-function-2177a8a71588f915.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -features: - - | - A `filter_function` argument is added to - :func:`~qiskit.circuit.QuantumCircuit.depth` and - :func:`~qiskit.circuit.QuantumCircuit.size` in order to - analyze circuit operations according to some criteria. - The function should take a tuple of (Instruction, list[Qubit], list[Clbit]) - and return `True` (whitelist) or `False` (blacklist). - - For example, to get the number of two-qubit gates, you can do - - .. code-block:: python - - circuit.size(lambda x: x[0].num_qubits == 2) - - Or to get the depth of T gates acting on the zeroth qubit - - .. code-block:: python - - circuit.depth(lambda x: x[0].name == 't' and circuit.qubits[0] in x[1]) - - diff --git a/releasenotes/notes/completemeasfitter-386e94a271ba0180.yaml b/releasenotes/notes/completemeasfitter-386e94a271ba0180.yaml deleted file mode 100644 index e36c053ca6e..00000000000 --- a/releasenotes/notes/completemeasfitter-386e94a271ba0180.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -fixes: - - | - Fixed an issue where the :class:`~qiskit.utils.QuantumInstance` class would potentially - try to use the :class:`~qiskit.ignis.mitigation.CompleteMeasFitter` class - before it was imported resulting in an error. - Fixed `#6774 `__ diff --git a/releasenotes/notes/control-flow-builder-interface-63910843f8bea5e0.yaml b/releasenotes/notes/control-flow-builder-interface-63910843f8bea5e0.yaml deleted file mode 100644 index b86fad3757c..00000000000 --- a/releasenotes/notes/control-flow-builder-interface-63910843f8bea5e0.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -features: - - | - There is a new builder interface for control-flow operations on :obj:`.QuantumCircuit`, such as the new :obj:`.ForLoopOp`, :obj:`.IfElseOp`, and :obj:`.WhileLoopOp`. - The interface uses the same circuit methods, and they are overloaded so that if the ``body`` parameter is not given, they return a context manager. - Entering one of these context managers pushes a scope into the circuit, and captures all gate calls (and other scopes) and the resources these use, and builds up the relevant operation at the end. - For example, you can now do:: - - qc = QuantumCircuit(2, 2) - with qc.for_loop(range(5)) as i: - qc.rx(i * math.pi / 4, 0) - - This will produce a :obj:`.ForLoopOp` on ``qc``, which knows that qubit 0 is the only resource used within the loop body. - These context managers can be nested, and will correctly determine their widths. - You can use :meth:`.QuantumCircuit.break_loop` and :meth:`.QuantumCircuit.continue_loop` within a context, and it will expand to be the correct width for its containing loop, even if it is nested in further :meth:`.QuantumCircuit.if_test` blocks. - - The :meth:`~.QuantumCircuit.if_test` context manager provides a chained manager which, if desired, can be used to create an ``else`` block, such as by:: - - qreg = QuantumRegister(2) - creg = ClassicalRegister(2) - qc = QuantumCircuit(qreg, creg) - qc.h(0) - qc.cx(0, 1) - qc.measure(0, 0) - with qc.if_test((creg, 0)) as else_: - qc.x(1) - with else_: - qc.z(1) - - The manager will ensure that the ``if`` and ``else`` bodies are defined over the same set of resources. diff --git a/releasenotes/notes/dag_node_to_op_in_out_node-af2cf9c3e7686285.yaml b/releasenotes/notes/dag_node_to_op_in_out_node-af2cf9c3e7686285.yaml deleted file mode 100644 index 35582b9506e..00000000000 --- a/releasenotes/notes/dag_node_to_op_in_out_node-af2cf9c3e7686285.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -deprecations: - - | - The :class:`qiskit.dagcircuit.dagnode.DAGNode` is being deprecated as a standalone - class and will be used in the future only as the parent class for - :class:`qiskit.dagcircuit.dagnode.DAGOpNode`, :class:`qiskit.dagcircuit.dagnode.DAGInNode`, - and :class:`qiskit.dagcircuit.dagnode.DAGOutNode`. As part of this deprecation, the - following kwargs and associated attributes in DAGNode are being deprecated - ``type``, - ``op``, and ``wire``. - - The previously deprecated `condition` kwarg has been removed from - :meth:`qiskit.dagcircuit.dagcircuit.apply_operation_back` and - :meth:`qiskit.dagcircuit.dagcircuit.apply_operation_front`. diff --git a/releasenotes/notes/draw-statevector-in-ket-notation-0726959d1f6ea3ce.yaml b/releasenotes/notes/draw-statevector-in-ket-notation-0726959d1f6ea3ce.yaml deleted file mode 100644 index 1c359725f05..00000000000 --- a/releasenotes/notes/draw-statevector-in-ket-notation-0726959d1f6ea3ce.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -features: - - | - Allow drawing of a Statevector in latex both in vector and ket notation. - In ket notation the entries of the statevector are processed such that - exact factors like fractions or sqrt of two are drawn as such. - The old notation is still available as an option by setting the `convention` argument. - - .. code-block:: python - - from numpy import sqrt, pi, e - from qiskit.quantum_info import Statevector - sv=Statevector([sqrt(2)/2, 0, 0, -1/sqrt(2)]) - sv.draw(output='latex') - sv.draw(output='latex', convention='vector') # old behaviour diff --git a/releasenotes/notes/echo-rzx-weyl-decomposition-ef72345a58bea9e0.yaml b/releasenotes/notes/echo-rzx-weyl-decomposition-ef72345a58bea9e0.yaml deleted file mode 100644 index 44fcb9695ea..00000000000 --- a/releasenotes/notes/echo-rzx-weyl-decomposition-ef72345a58bea9e0.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -features: - - | - Added a new transpiler pass :class:`qiskit.transpiler.passes.optimization.EchoRZXWeylDecomposition` that allows users to decompose an arbitrary two-qubit gate in terms of echoed RZX-gates by leveraging Cartan's decomposition. In combination with other transpiler passes this can be used to transpile arbitrary circuits to RZX-gate-based and pulse-efficient circuits that implement the same unitary. diff --git a/releasenotes/notes/expr_free_symbols_deprecation-72e4db5c178efcff.yaml b/releasenotes/notes/expr_free_symbols_deprecation-72e4db5c178efcff.yaml deleted file mode 100644 index 81bddefa03c..00000000000 --- a/releasenotes/notes/expr_free_symbols_deprecation-72e4db5c178efcff.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -fixes: - - | - Sympy 1.9 is deprecating the use of ``expr_free_symbols``. The circuit drawers made - use of this method when finding instances of constants, via - ``pi_check()``. The deprecated call was rewritten and the - logic around it was simplified. diff --git a/releasenotes/notes/feature-rzx-decomposition-c3b5a36b88303c1f.yaml b/releasenotes/notes/feature-rzx-decomposition-c3b5a36b88303c1f.yaml deleted file mode 100644 index e0e9cbde4b8..00000000000 --- a/releasenotes/notes/feature-rzx-decomposition-c3b5a36b88303c1f.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -features: - - | - This release introduces a decomposition method for two-qubit gates which - targets user-defined sets of RZX gates. Transpiler users can enable - decomposition for {RZX(pi/2), RZX(pi/4), and RZX(pi/6)} specifically by including - `'rzx'` in their `basis_gates` list. Quantum information package users can - find the method itself under the `XXDecomposer` class. diff --git a/releasenotes/notes/fix-ScheduleBlock-exceution-012973439c95d8c0.yaml b/releasenotes/notes/fix-ScheduleBlock-exceution-012973439c95d8c0.yaml deleted file mode 100644 index 1512714ee1f..00000000000 --- a/releasenotes/notes/fix-ScheduleBlock-exceution-012973439c95d8c0.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -fixes: - - | - Fixed `#7004 `__ where - ``AttributeError`` was raised when executing - :obj:`~qiskit.pulse.ScheduleBlock` on a pulse backend. These blocks are now - correctly treated as pulse jobs, like :obj:`~qiskit.pulse.Schedule`. diff --git a/releasenotes/notes/fix-aarch64-e75601c0b8f2da2c.yaml b/releasenotes/notes/fix-aarch64-e75601c0b8f2da2c.yaml deleted file mode 100644 index 89a488eafb8..00000000000 --- a/releasenotes/notes/fix-aarch64-e75601c0b8f2da2c.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -fixes: - - | - Fixed the missing Linux aarch64 wheels which were not published for the - 0.18.0 release. They should now continue to be built as expected for all - future releases. diff --git a/releasenotes/notes/fix-assemble-parametric-pulse-eea8fba73c56a69f.yaml b/releasenotes/notes/fix-assemble-parametric-pulse-eea8fba73c56a69f.yaml deleted file mode 100644 index e922727867d..00000000000 --- a/releasenotes/notes/fix-assemble-parametric-pulse-eea8fba73c56a69f.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -fixes: - - | - Fixed an issue with the :func:`~qiskit.compiler.assemble` function when - called with the ``backend`` kwarg set and the ``parametric_pulses`` kwarg - was set to an empty list the output qobj would contain the - ``parametric_pulses`` setting from the given backend's - :class:`~qiskit.providers.models.BackendConfiguration` instead of the - expected empty list. - Fixed `#6898 `__ diff --git a/releasenotes/notes/fix-bip-mapper-requirements-930c7dcd5a3b82ba.yaml b/releasenotes/notes/fix-bip-mapper-requirements-930c7dcd5a3b82ba.yaml deleted file mode 100644 index de3e4e51e1b..00000000000 --- a/releasenotes/notes/fix-bip-mapper-requirements-930c7dcd5a3b82ba.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -upgrade: - - | - ``pip install qiskit-terra[all]`` will no longer attempt to install the - ``bip-mapper`` extra. This is because the dependency ``cplex`` is not well - supported on the range of Python versions and OSes that Terra supports, and - a failed extra dependency would fail the entire package resolution. If you - are using Python 3.7 or 3.8 and are on Linux-x64 or -ppc64le, macOS-x64 or - Windows-x64 you should be able to install ``qiskit-terra[bip-mapper]`` - explicitly, if desired, while other combinations of OS, platform - architectures and Python versions will likely fail. diff --git a/releasenotes/notes/fix-c3sxgate-7138e004a2b05ca8.yaml b/releasenotes/notes/fix-c3sxgate-7138e004a2b05ca8.yaml deleted file mode 100644 index 246c621efec..00000000000 --- a/releasenotes/notes/fix-c3sxgate-7138e004a2b05ca8.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -fixes: - - | - :obj:`~qiskit.circuit.library.C3SXGate` now has a correct decomposition and matrix representation. - Previously it was equivalent to ``SdgXGate().control(3)``, rather than the intended ``SXGate().control(3)``. diff --git a/releasenotes/notes/fix-complex-param-binding-0fcad20135aa7382.yaml b/releasenotes/notes/fix-complex-param-binding-0fcad20135aa7382.yaml deleted file mode 100644 index 3888666c082..00000000000 --- a/releasenotes/notes/fix-complex-param-binding-0fcad20135aa7382.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -fixes: - - | - Fixed an issue causing an error when binding a complex parameter value to an operator's - coefficient. Casts to ``float`` in :class:`~qiskit.opflow.primitive_ops.PrimitiveOp` - were generalized to casts to ``complex`` if necessary, but will remain ``float`` if - there is no imaginary component. - Fixes `#6976 `__. diff --git a/releasenotes/notes/fix-compute-variance-type-error-2eb47903620b4b08.yaml b/releasenotes/notes/fix-compute-variance-type-error-2eb47903620b4b08.yaml deleted file mode 100644 index b6e2cd1d39c..00000000000 --- a/releasenotes/notes/fix-compute-variance-type-error-2eb47903620b4b08.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -fixes: - - | - Fixes a `TypeError` occurring during `PauliExpectation.compute_variance` - when computing multiple variances at once. Previously, lists were attempted - to be subtracted, requiring them to be wrapped into numpy arrays to work as - expected. diff --git a/releasenotes/notes/fix-decompose-empty-gate-71455847dcaaea26.yaml b/releasenotes/notes/fix-decompose-empty-gate-71455847dcaaea26.yaml deleted file mode 100644 index 24357f9e718..00000000000 --- a/releasenotes/notes/fix-decompose-empty-gate-71455847dcaaea26.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -fixes: - - | - Fix a bug where upon decomposing a circuit gates, whose definition were - an empty circuit, were not decomposed. diff --git a/releasenotes/notes/fix-duplicate-mpl-drawer-ipykernel6-c64d9178e31ab9fe.yaml b/releasenotes/notes/fix-duplicate-mpl-drawer-ipykernel6-c64d9178e31ab9fe.yaml deleted file mode 100644 index 6e00a1dca36..00000000000 --- a/releasenotes/notes/fix-duplicate-mpl-drawer-ipykernel6-c64d9178e31ab9fe.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -fixes: - - | - The Matplotlib circuit drawer will no longer duplicate drawings when using - ``ipykernel>=6.0.0``. - Fixes `#6889 `__. diff --git a/releasenotes/notes/fix-hoare-optimizer-0ef5ac330fc80cc4.yaml b/releasenotes/notes/fix-hoare-optimizer-0ef5ac330fc80cc4.yaml deleted file mode 100644 index aa2cd1d86f3..00000000000 --- a/releasenotes/notes/fix-hoare-optimizer-0ef5ac330fc80cc4.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -fixes: - - | - Fixed a bug in the Hoare optimizer transpilation pass where it could attempt to remove a gate twice if it could be separately combined with both its predecessor and its successor to form the identity. - Refer to `#7271 `__ for more details. diff --git a/releasenotes/notes/fix-instruction-c_if-3334bc8bcc38a327.yaml b/releasenotes/notes/fix-instruction-c_if-3334bc8bcc38a327.yaml deleted file mode 100644 index d46341eb70f..00000000000 --- a/releasenotes/notes/fix-instruction-c_if-3334bc8bcc38a327.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -deprecations: - - | - Creating an instance of :obj:`.InstructionSet` with the ``circuit_cregs`` keyword argument is deprecated. - In general, these classes never need to be constructed by users (but are used internally), but should you need to, you should pass a callable as the ``resource_requester`` keyword argument. - 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)) - - -fixes: - - | - Making an instruction conditional with the standard :meth:`.InstructionSet.c_if` method with integer indices is now consistent with the numbering scheme used by the :obj:`.QuantumCircuit` the instructions are part of. - Previously, if there were two :obj:`.ClassicalRegister`\ s with overlapping :obj:`.Clbit`\ s, the numbering would be incorrect. - See `#7246 `__ for more detail. - - | - Making an instruction conditional with the standard :meth:`.InstructionSet.c_if` method will now succeed, even if there are no :obj:`.ClassicalRegister`\ s in the circuit. - See `#7250 `__ for more detail. - - | - Making an instruction conditional with the standard :meth:`.InstructionSet.c_if` method when using a :obj:`.Clbit` that is contained in a :obj:`.ClassicalRegister` of size one will now correctly create a condition on the bit, not the register. - See `#7255 `__ for more detail. - - | - Trying to make an instruction conditional with the standard :meth:`.InstructionSet.c_if` method will now correctly raise an error if the classical resource is not present in the circuit. - See `#7255 `__ for more detail. diff --git a/releasenotes/notes/fix-kwargs-mock-f581d5118a1c7589.yaml b/releasenotes/notes/fix-kwargs-mock-f581d5118a1c7589.yaml deleted file mode 100644 index 2b979612660..00000000000 --- a/releasenotes/notes/fix-kwargs-mock-f581d5118a1c7589.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -fixes: - - | - Fixed an issue with the mock backends located in ``qiskit.test.mock`` where - in some situations (mainly fake backends with stored - :class:`~qiskit.providers.models.BackendProperties` running a - :class:`~qiskit.circuit.QuantumCircuit` with ``qiskit-aer`` installed) - passing run time options to the ``run()`` method of a fake backend object - would not actually be passed to the simulator underlying the ``run()`` - method and not have any effect. - Fixed `#6741 `__ diff --git a/releasenotes/notes/fix-matplotlib-3.5-40f6d1a109ae06fe.yaml b/releasenotes/notes/fix-matplotlib-3.5-40f6d1a109ae06fe.yaml deleted file mode 100644 index 07062479072..00000000000 --- a/releasenotes/notes/fix-matplotlib-3.5-40f6d1a109ae06fe.yaml +++ /dev/null @@ -1,4 +0,0 @@ -fixes: - - | - Fixed a compatibility issue with Matplotlib 3.5, where the Bloch sphere would fail to render if it had any vectors attached, such as by using :obj:`~qiskit.visualization.plot_bloch_vector`. - See `#7272 `__ for more detail. diff --git a/releasenotes/notes/fix-mpl-drawer-bit-condition-90c4dac2defdd8c6.yaml b/releasenotes/notes/fix-mpl-drawer-bit-condition-90c4dac2defdd8c6.yaml deleted file mode 100644 index e7e5be94b9c..00000000000 --- a/releasenotes/notes/fix-mpl-drawer-bit-condition-90c4dac2defdd8c6.yaml +++ /dev/null @@ -1,7 +0,0 @@ -features: - - | - The ``mpl`` output method for the :func:`qiskit.visualization.circuit_drawer` - function and the :meth:`~qiskit.circuit.QuantumCircuit.draw` method can now - draw circuits that contain gates with single bit condition. This was added for - compatibility of mpl drawer with the new feature of supporting classical - conditioning of gates on single classical bits. \ No newline at end of file diff --git a/releasenotes/notes/fix-nlocal-add_layer-c3cb0b5a49c2b04e.yaml b/releasenotes/notes/fix-nlocal-add_layer-c3cb0b5a49c2b04e.yaml deleted file mode 100644 index 63f9f6518df..00000000000 --- a/releasenotes/notes/fix-nlocal-add_layer-c3cb0b5a49c2b04e.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -fixes: - - | - Fix :meth:`~qiskit.circuit.library.NLocal.add_layer` to append layers correctly - when :obj:`~qiskit.circuit.library.NLocal._data` is built already. diff --git a/releasenotes/notes/fix-pickle-support-instmap-9f90cbcb4078f988.yaml b/releasenotes/notes/fix-pickle-support-instmap-9f90cbcb4078f988.yaml deleted file mode 100644 index 9ef72510041..00000000000 --- a/releasenotes/notes/fix-pickle-support-instmap-9f90cbcb4078f988.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -fixes: - - | - Fix :py:class:`~qiskit.pulse.instruction_schedule_map.InstructionScheduleMap` - pickling bug in Python3.6. See #6944 for details. diff --git a/releasenotes/notes/fix-qaoa-construct-da37faf75f29fc35.yaml b/releasenotes/notes/fix-qaoa-construct-da37faf75f29fc35.yaml deleted file mode 100644 index 3ec7ef9983a..00000000000 --- a/releasenotes/notes/fix-qaoa-construct-da37faf75f29fc35.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -fixes: - - | - Fixed the issue that :meth:`~qiskit.algorithms.QAOA.construct_circuit` - with different operators with same number of qubits generates an identical circuit. - - | - Fixed the issue that :class:`~qiskit.circuit.library.QAOAAnsatz` has - a wrong number of parameters if identities of :class:`~qiskit.opflow.PauliSumOp` are given, - e.g., ``PauliSumOp.from_list([("III", 1)])``. diff --git a/releasenotes/notes/fix-qaoa-to-qpy-6364c96671bc8f36.yaml b/releasenotes/notes/fix-qaoa-to-qpy-6364c96671bc8f36.yaml deleted file mode 100644 index 84d857c3a5f..00000000000 --- a/releasenotes/notes/fix-qaoa-to-qpy-6364c96671bc8f36.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -fixes: - - | - Fix a bug in :class:`~qiskit.circuit.library.EvolvedOperatorAnsatz` when the - global phase is 0 (such as for :class:`~qiskit.circuit.library.QAOAAnsatz`) but - was still a :class:`~qiskit.circuit.ParameterExpression`. diff --git a/releasenotes/notes/fix-qasm-invalid-names-04a935a3a14e045c.yaml b/releasenotes/notes/fix-qasm-invalid-names-04a935a3a14e045c.yaml deleted file mode 100644 index 3a2b5d15cd2..00000000000 --- a/releasenotes/notes/fix-qasm-invalid-names-04a935a3a14e045c.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -fixes: - - | - Fix bug where the :meth:`~qiskit.circuit.QuantumCircuit.qasm` method could - return OpenQASM 2 instructions with invalid identifiers. Same bug was fixed - for the :attr:`~qiskit.extensions.unitary.UnitaryGate._qasm_name` attribute - of :obj:`~qiskit.extensions.unitary.UnitaryGate`. diff --git a/releasenotes/notes/fix-qnspsa-settings-91d5a9553706cc72.yaml b/releasenotes/notes/fix-qnspsa-settings-91d5a9553706cc72.yaml deleted file mode 100644 index 93611da114b..00000000000 --- a/releasenotes/notes/fix-qnspsa-settings-91d5a9553706cc72.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -fixes: - - | - Fixed an issue with the :attr:`~qiskit.algorithms.optimizers.QNSPSA.settings` - attribute of :obj:`~qiskit.algorithms.optimizers.QNSPSA`, which was missing - the ``fidelity`` argument from the output. This is now correctly included - in the attribute's output. diff --git a/releasenotes/notes/fix-subgraph-cmap-47021596d94bb39f.yaml b/releasenotes/notes/fix-subgraph-cmap-47021596d94bb39f.yaml deleted file mode 100644 index 0e656b998a9..00000000000 --- a/releasenotes/notes/fix-subgraph-cmap-47021596d94bb39f.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -fixes: - - | - Fixed an issue with the :meth:`~qiskit.transpiler.CouplingMap.subgraph` - method of the :class:`~qiskit.transpiler.CouplingMap` class where it would - incorrectly add nodes to the output :class:`~qiskit.transpiler.CouplingMap` - object when the ``nodelist`` argument contained a non-contiguous list - of qubit indices. This has been fixed so regardless of the input - indices in ``nodelist`` the output - :class:`~qiskit.transpiler.CouplingMap` will only contained the specified - nodes reindexed starting at 0. - Fixes `#6736 `__ diff --git a/releasenotes/notes/fix-text-drawer-bit-cond-a3b02f0b0b6e3ec2.yaml b/releasenotes/notes/fix-text-drawer-bit-cond-a3b02f0b0b6e3ec2.yaml deleted file mode 100644 index 6b4f9e2565b..00000000000 --- a/releasenotes/notes/fix-text-drawer-bit-cond-a3b02f0b0b6e3ec2.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -features: - - | - The ``text`` output method for the :func:`qiskit.visualization.circuit_drawer` - function and the :meth:`~qiskit.circuit.QuantumCircuit.draw` method can now - draw circuits that contain gates with single bit condition. This was added for - compatibility of text drawer with the new feature of supporting classical - conditioning of gates on single classical bits. \ No newline at end of file diff --git a/releasenotes/notes/fix-transpile-empty-list-c93a41d4145a01c3.yaml b/releasenotes/notes/fix-transpile-empty-list-c93a41d4145a01c3.yaml deleted file mode 100644 index ab658b53a71..00000000000 --- a/releasenotes/notes/fix-transpile-empty-list-c93a41d4145a01c3.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -fixes: - - | - Calling :obj:`~qiskit.compiler.transpile` on an empty list will now correctly return an empty list without issuing a warning. - Fix of `#7287 `__. diff --git a/releasenotes/notes/fix_pwchebysev_constant_fx-93e8a3d2880f68ac.yaml b/releasenotes/notes/fix_pwchebysev_constant_fx-93e8a3d2880f68ac.yaml deleted file mode 100644 index 7a1c04ded76..00000000000 --- a/releasenotes/notes/fix_pwchebysev_constant_fx-93e8a3d2880f68ac.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -fixes: - - | - There was a problem when the function to be approximated was constant. - The error came from trying to approximate such function with - numpy.polynomial.chebyshev.interpolate, which is used to approximate the - input function. The fix avoids calling interpolate for constant functions - but this means that such functions cannot be given in lambda type. - Added a fix and an error message explaining how to declare constant - functions. - Also updated the documentation with a message on how to declare a constant - function. diff --git a/releasenotes/notes/full_prec_sympy-aeee8210091ef20f.yaml b/releasenotes/notes/full_prec_sympy-aeee8210091ef20f.yaml deleted file mode 100644 index e20a67ebb2d..00000000000 --- a/releasenotes/notes/full_prec_sympy-aeee8210091ef20f.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -other: - - | - The string cast for :class:`qiskit.circuit.ParameterExpression` does not have full precision - anymore. This removes the trailing 0s when printing parameters that are bound to floats. - This has consequence down to, for example, QASM serialization and circuit text drawer. - - .. code-block:: python - - >>> from qiskit.circuit import Parameter - >>> x = Parameter('x') - >>> str(x.bind({x:0.5})) - '0.5' // instead of '0.500000000000000' diff --git a/releasenotes/notes/gate-type-hints-b287215190144ceb.yaml b/releasenotes/notes/gate-type-hints-b287215190144ceb.yaml deleted file mode 100644 index c91a8bdb9e8..00000000000 --- a/releasenotes/notes/gate-type-hints-b287215190144ceb.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -upgrade: - - | - Type hints are now included for all standard gates, and the gate methods in - :obj:`.QuantumCircuit`. diff --git a/releasenotes/notes/hhl-negative-eigenvalues-ef11d231181e8043.yaml b/releasenotes/notes/hhl-negative-eigenvalues-ef11d231181e8043.yaml deleted file mode 100644 index bc6b0803e42..00000000000 --- a/releasenotes/notes/hhl-negative-eigenvalues-ef11d231181e8043.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -features: - - | - Modified the HHL class within the linear solvers package and the ExactReciprocal - class in the arithmetics package so that the quantum algorithm for linear systems - can find the solution when the matrix has negative eigenvalues. The modification - was required because the eigenvalues are represented digitally within the algorithm - but there was no logic in place to store the sign. Now there is an additional qubit - storing the sign and the appropriate logic in ExactReciprocal to process the right - value. diff --git a/releasenotes/notes/hhl_qi_fix-d0ada86abaa2dba5.yaml b/releasenotes/notes/hhl_qi_fix-d0ada86abaa2dba5.yaml deleted file mode 100644 index 1589bc061b1..00000000000 --- a/releasenotes/notes/hhl_qi_fix-d0ada86abaa2dba5.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -fixes: - - | - If an :class:`~qiskit.algorithms.HHL` algorithm instance was constructed without a - QuantumInstance (the default) then attempts to use the getter and setter properties, to read - or set an instance later, would fail. The getter/setter now work as expected. diff --git a/releasenotes/notes/listops-coeffs-1e04a34b46b2fd23.yaml b/releasenotes/notes/listops-coeffs-1e04a34b46b2fd23.yaml deleted file mode 100644 index 22fa162b763..00000000000 --- a/releasenotes/notes/listops-coeffs-1e04a34b46b2fd23.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -features: - - | - opflow.ListOp class now supports a property method `coeffs` which returns - a list of the coefficients of the operator list, with the overall - coefficient (`ListOp.coeff`) distributed multiplicatively into the list. - Note that `ListOp` objects may be nested (contained in `oplist` of a - `ListOp` object), and in these cases an exception is raised if the - `coeffs` method is called. - The `ListOp.coeffs` method conveniently duck-types against the - `coeffs` property method of the non-nesting `PauliSumOp` class. \ No newline at end of file diff --git a/releasenotes/notes/make-statevector-subscriptable-and-add-inner-product_method-a0337393d9a5b666.yaml b/releasenotes/notes/make-statevector-subscriptable-and-add-inner-product_method-a0337393d9a5b666.yaml deleted file mode 100644 index 678b89bd029..00000000000 --- a/releasenotes/notes/make-statevector-subscriptable-and-add-inner-product_method-a0337393d9a5b666.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -features: - - | - Make :class:`~qiskit.quantum_info.Statevector` subscriptable. - User can now retrieve the nth element in a :class:`~qiskit.quantum_info.Statevector` by index as ``statevec[n]``. - - See `#4916 `__ from more information. - - - | - Add inner product method to :class:`~qiskit.quantum_info.Statevector`. - It takes as input another statevector and outputs the inner product. - - For example:: - - statevec_inner_other = statevec.inner(other) - - See `#4934 `__ from more information. diff --git a/releasenotes/notes/measure_all-add_bits-8525317935197b90.yaml b/releasenotes/notes/measure_all-add_bits-8525317935197b90.yaml deleted file mode 100644 index 6ae4be41b2a..00000000000 --- a/releasenotes/notes/measure_all-add_bits-8525317935197b90.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -features: - - | - Added a new parameter, ``add_bits``, to :obj:`.QuantumCircuit.measure_all`. - By default it is set to ``True`` to maintain the previous behaviour of adding a new :obj:`.ClassicalRegister` of the same size as the number of qubits to store the measurements. - If set to ``False``, the measurements will be stored in the already existing classical bits. - See `#7305 `__. diff --git a/releasenotes/notes/modify-copy-instruction-in-qasm-abd5c9767f2a7f38.yaml b/releasenotes/notes/modify-copy-instruction-in-qasm-abd5c9767f2a7f38.yaml deleted file mode 100644 index 079074dcd6d..00000000000 --- a/releasenotes/notes/modify-copy-instruction-in-qasm-abd5c9767f2a7f38.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -fixes: - - | - The ``QuantumCircuit.qasm()`` function now edits the names of copies of the - instructions present in the circuit, not the original instructions that live in ``circuit.data``. - Refer to `#6952 `__ for more - details. diff --git a/releasenotes/notes/one-gate-identity-optimization-fix-d6d1496d9f5409a6.yaml b/releasenotes/notes/one-gate-identity-optimization-fix-d6d1496d9f5409a6.yaml deleted file mode 100644 index 22bac34af3c..00000000000 --- a/releasenotes/notes/one-gate-identity-optimization-fix-d6d1496d9f5409a6.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -fixes: - - | - Previously, :obj:`~qiskit.transpiler.passes.Optimize1qGatesDecomposition` - failed to properly optimize one qubit gates that are sufficiently close to - the identity matrix. This was fixed so that any gates that differ from the - identity by less than 1e-15 are removed. diff --git a/releasenotes/notes/optimizer-minimize-5a5a1e9d67db441a.yaml b/releasenotes/notes/optimizer-minimize-5a5a1e9d67db441a.yaml deleted file mode 100644 index 78bb5941aac..00000000000 --- a/releasenotes/notes/optimizer-minimize-5a5a1e9d67db441a.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -features: - - | - Add a `minimize` methods to all optimizers; - :class:`~qiskit.algorithms.optimizers.Optimizer` and derived classes. - This method mimics the signature of SciPy's `minimize` function and returns an - :class:`~qiskit.algorithms.optimizers.OptimizerResult`. - - For example - - .. code-block::python - - import numpy as np - from qiskit.algorithms.optimizers import COBYLA - - def loss(x): - return -(x[0] - 1) ** 2 - (x[1] + 1) ** 3 - - initial_point = np.array([0, 0]) - optimizer = COBYLA() - result = optimizer.minimize(loss, initial_point) - - optimal_parameters = result.x - minimum_value = result.fun - num_function_evals = result.nfev -deprecations: - - | - Deprecate the `optimize` method for all the optimizers - (:class:`~qiskit.algorithms.optimizers.Optimizer` and derived classes). Instead - the `minimize` method should be used which mimics the signature of SciPy's `minimize` - function. - - To replace the current `optimize` call with `minimize` you can replace - - .. code-block::python - - xopt, fopt, nfev = optimizer.optimize(num_vars, objective_function, gradient_function, - variable_bounds, initial_point) - - with - - .. code-block::python - - result = optimizer.minimize(fun=objective_function, x0=initial_point, - jac=gradient_function, bounds=variable_bounds) - xopt, fopt, nfev = result.x, result.fun, result.nfev diff --git a/releasenotes/notes/pauli-evolution-gate-ad767a3e43714fa7.yaml b/releasenotes/notes/pauli-evolution-gate-ad767a3e43714fa7.yaml deleted file mode 100644 index ce866aea6ee..00000000000 --- a/releasenotes/notes/pauli-evolution-gate-ad767a3e43714fa7.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -features: - - | - Add a :class:`~qiskit.circuit.library.PauliEvolutionGate` to the circuit - library which defines a gate performing time evolution of - (sums of or sums-of-sums of) Paulis. The synthesis of this gate is - performed by :class:`~qiskit.synthesis.EvolutionSynthesis` and is decoupled - from the gate itself. Currently available synthesis methods are as follows. - - * :class:`~qiskit.synthesis.LieTrotter` - first order Trotterization - * :class:`~qiskit.synthesis.SuzukiTrotter` - higher order Trotterization - * :class:`~qiskit.synthesis.MatrixExponentiation` - exact, matrix-based evolution - - For example: - - .. code-block:: - - from qiskit.circuit import QuantumCircuit - from qiskit.circuit.library import PauliEvolutionGate - from qiskit.quantum_info import SparsePauliOp - from qiskit.synthesis import SuzukiTrotter - - operator = SparsePauliOp.from_list([ - ("XIZ", 0.5), ("ZZX", 0.5), ("IYY", -1) - ]) - time = 0.12 # evolution time - synth = SuzukiTrotter(order=4, reps=2) - - evo = PauliEvolutionGate(operator, time=time, synthesis=synth) - - circuit = QuantumCircuit(3) - circuit.append(evo, range(3)) - - print(circuit.draw()) diff --git a/releasenotes/notes/qaoa-parameters-49e4524ed2d3e875.yaml b/releasenotes/notes/qaoa-parameters-49e4524ed2d3e875.yaml deleted file mode 100644 index d6eb9d6f115..00000000000 --- a/releasenotes/notes/qaoa-parameters-49e4524ed2d3e875.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- -fixes: - - | - Fix a bug where the parameter bounds for the mixer parameters in the - :class:`~qiskit.circuit.library.QAOAAnsatz` have not been set. -other: - - | - Use the QAOA notation for the cost operator (`γ`) and mixer (`β`) operator parameters in - :class:`~qiskit.circuit.library.QAOAAnsatz`. - diff --git a/releasenotes/notes/qasm3_dumps-7475de655e1acb24.yaml b/releasenotes/notes/qasm3_dumps-7475de655e1acb24.yaml deleted file mode 100644 index 3cb9af4d7eb..00000000000 --- a/releasenotes/notes/qasm3_dumps-7475de655e1acb24.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -features: - - | - Initial support for OpenQASM3 serializer. - - .. jupyter-execute:: - - from qiskit.circuit import QuantumCircuit, QuantumRegister, ClassicalRegister - from qiskit import qasm3 - - qc = QuantumCircuit(2) - qc.h(0) - qc.cx(0, 1) - - print(qasm3.dumps(qc)) - - This initial release has limited support for named registers, basic builtin instructions - (just as measure and barriers), user-defined gates, user-defined instructions (as - subroutines), and opaque gates/instructions as ``defcal``. - - .. jupyter-execute:: - - composite_circ_qreg = QuantumRegister(2) - composite_circ = QuantumCircuit(composite_circ_qreg, name="composite_circ") - composite_circ.h(0) - composite_circ.x(1) - composite_circ.cx(0, 1) - composite_circ_instr = composite_circ.to_instruction() - - qr = QuantumRegister(2, "qr") - cr = ClassicalRegister(2, "cr") - qc = QuantumCircuit(qr, cr) - qc.h(0) - qc.cx(0, 1) - qc.barrier() - qc.append(composite_circ_instr, [0, 1]) - qc.measure([0, 1], [0, 1]) - - print(qasm3.dumps(qc)) diff --git a/releasenotes/notes/qdrift-as-product-formula-044a37a106a45a47.yaml b/releasenotes/notes/qdrift-as-product-formula-044a37a106a45a47.yaml deleted file mode 100644 index 614f94c088a..00000000000 --- a/releasenotes/notes/qdrift-as-product-formula-044a37a106a45a47.yaml +++ /dev/null @@ -1,28 +0,0 @@ ---- -features: - - | - Reformulate the former :class:`~qiskit.opflow.evolutions.trotterizations.QDrift` - as a synthesis method instead of a :obj:`~qiskit.opflow.evolutions.TrotterizationBase`. The - other available synthesis methods are - - * :class:`~qiskit.synthesis.LieTrotter` - first order Trotterization - * :class:`~qiskit.synthesis.SuzukiTrotter` - higher order Trotterization - * :class:`~qiskit.synthesis.MatrixExponentiation` - exact, matrix-based evolution - - .. code-block:: python - - from qiskit.circuit import QuantumCircuit - from qiskit.circuit.library import PauliEvolutionGate - from qiskit.synthesis import QDrift - - qdrift = QDrift(reps=2) - operator = (X ^ 3) + (Y ^ 3) + (Z ^ 3) - time = 2.345 # evolution time - - evolution_gate = PauliEvolutionGate(operator, time, synthesis=qdrift) - - circuit = QuantumCircuit(3) - circuit.append(evolution_gate, range(3)) - - print(circuit.draw()) - diff --git a/releasenotes/notes/readout-mitigation-classes-2ef175e232d791ae.yaml b/releasenotes/notes/readout-mitigation-classes-2ef175e232d791ae.yaml deleted file mode 100644 index 3ceb7971209..00000000000 --- a/releasenotes/notes/readout-mitigation-classes-2ef175e232d791ae.yaml +++ /dev/null @@ -1,55 +0,0 @@ ---- -features: - - | - Adds a :class:`~qiskit.result.BaseReadoutMitigator` abstract base class - for implementing classical measurement error mitigators. These objects - are intended for mitigation measurement errors in - :class:`~qiskit.result.Counts` objects returned from execution of circuits - on backends with measurement errors. - - Readout mitigator classes have two main methods - - * :meth:`expectation_value` which computes an mitigated expectation - value and standard error of a diagonal operator from a noisy - :class:`~qiskit.result.Counts` object. - - * :meth:`quasi_probabilities` that computes an error mitigated - :class:`~qiskit.result.QuasiDistribution`, including standard error, - from a noisy counts object. - - Note that current :mod:`qiskit.algorithms` and the - :class:`~qiskit.utils.QuantumInstance` class still use the legacy mitigators - migrated from qiskit-ignis in :mod:`qiskit.utils.mitigation`. It is planned - to upgrade code to use the new mitigator classes and deprecate the legacy - mitgation code in a future release. - - | - Adds a :class:`~qiskit.result.LocalReadoutMitigator` class for - performing measurement readout error mitigation of local measurement - errors. Local measuerment errors are those that are described by a - tensor-product of single-qubit measurement errors. - - This class can be initialized with a list of *N* single-qubit of measurement - error assignment matrices or from a backend using the readout error - information in the backend properties. - - Mitigation is implemented using local assignment-matrix inversion which has - complexity of :math:`O(2^N)` for *N*-qubit mitigation of - :class:`~qiskit.result.QuasiDistribution` and expectation values. - - | - Adds a :class:`~qiskit.result.CorrelatedReadoutMitigator` class for - performing measurement readout error mitigation of correlated measurement - errors. This class can be initialized with a single :math:`2^N x 2^N` - measurement error assignment matrix that descirbes the error probabilities. - Mitigation is implemented via inversion of assigment matrix which has - mitigation complexity of :math:`O(4^N)` of - :class:`~qiskit.result.QuasiDistribution` and expectation values. - - | - Adds :meth:`~qiskit.result.QuasiDistribution.stddev_upper_bound` - property and init kwarg to :meth:`qiskit.result.QuasiDistribution` for - storing standard error in quasi probability estimates. This is used by - :class:`~qiskit.result.BaseReadoutMitigator` classes to store the - standard error in mitigated quasi probabilities. - - | - Adds :meth:`~qiskit.result.Counts.shots` method to - :class:`qiskit.result.Counts` to return the sum of all outcomes in - the counts. diff --git a/releasenotes/notes/refactor-grover-isgoodstate-check-54fdb61f899e5158.yaml b/releasenotes/notes/refactor-grover-isgoodstate-check-54fdb61f899e5158.yaml deleted file mode 100644 index 1eb4cbe818b..00000000000 --- a/releasenotes/notes/refactor-grover-isgoodstate-check-54fdb61f899e5158.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -features: - - | - Adapted :class:`~qiskit.algorithms.Grover` and - :class:`~qiskit.algorithms.AmplificationProblem` to allow running the - algorithm without an ``is_good_state`` argument if the number of iterations - is provided. diff --git a/releasenotes/notes/refactor-set-qft-num-qubits-82e6df88448c2f22.yaml b/releasenotes/notes/refactor-set-qft-num-qubits-82e6df88448c2f22.yaml deleted file mode 100644 index d71859b7389..00000000000 --- a/releasenotes/notes/refactor-set-qft-num-qubits-82e6df88448c2f22.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -fixes: - - | - Refactored the QFT ``num_qubits`` setter to avoid potential problems when changing the number of qubits of the QFT circuit. \ No newline at end of file diff --git a/releasenotes/notes/remove-deprecated-pulse-code-57ec531224e45b5f.yaml b/releasenotes/notes/remove-deprecated-pulse-code-57ec531224e45b5f.yaml deleted file mode 100644 index 97ede308897..00000000000 --- a/releasenotes/notes/remove-deprecated-pulse-code-57ec531224e45b5f.yaml +++ /dev/null @@ -1,58 +0,0 @@ ---- -upgrade: - - | - :meth:`assign_parameters` method of :class:`qiskit.pulse.instructions.instruction.Instruction` - has been removed and no longer exist as per the deprecation notice from 0.17 release. - :meth:`assign` method of :class:`~qiskit.pulse.channels.Channel`, - :meth:`assign` method and :meth:`assign_parameters` method of :class:`~qiskit.pulse.library.\ - parametric_pulses.ParametricPulse` have also been removed. - These parameters should be assigned from the pulse program (:class:`qiskit.pulse.schedule.\ - Schedule` and :class:`qiskit.pulse.schedule.ScheduleBlock`) rather than operands of - the pulse program instruction. - - | - :meth:`flatten` method of :class:`qiskit.pulse.instructions.instruction.Instruction` and - :class:`qiskit.pulse.schedule.Schedule` has been removed and no longer exist as per the - deprecation notice from 0.17 release. This transformation is defined as a standalone - function in :func:`qiskit.pulse.transforms.canonicalization.flatten`. - - | - :class:`qiskit.pulse.interfaces.ScheduleComponent` has been removed and no longer exist - as per the deprecation notice from 0.15 release. No alternative class will be provided. - - | - Legacy pulse drawer arguments have been removed from :meth:`qiskit.pulse.library.\ - pulse.Pulse#draw`, :meth:`qiskit.pulse.schedule.Schedule#draw` and - :meth:`qiskit.pulse.schedule.ScheduleBlock#draw` and no longer exist as per - the deprecation notice from 0.16 release. Now these draw methods support only - V2 pulse drawer arguments. See method documentations for details. - - | - :mod:`qiskit.pulse.reschedule` has been removed and this import path no longer exist - as per the deprecation notice from 0.14 release. Use :mod:`qiskit.pulse.transforms` instead. - - | - A protecte method :meth:`qiskit.pulse.schedule.Schedule#_children` has been removed and - replaced by a protected instance variable as per the deprecation notice from - 0.17 release. This is now provided as a public method :meth:`qiskit.pulse.schedule.\ - Schedule#children`. - - | - Timeslot relevant methods and properties have been removed and no longer exist in - :class:`qiskit.pulse.schedule.ScheduleBlock` as per the deprecation notice - from 0.17 release. Since this representation doesn't have notion of instruction time t0, - the timeslot information will be available after it is transformed by - :func:`~qiskit.pulse.transforms.canonicalization.block_to_schedule` function. - Corresponding attributes have been provided by the implicit program conversion into - :class:`qiskit.pulse.schedule.Schedule` with the function, but they are no longer supported. - Following attributes are removed: ``timeslots``, ``start_time``, ``stop_time``, - ``ch_start_time``, ``ch_stop_time``, ``shift``, and ``insert``. - - | - Alignment pulse schedule transforms have been removed and no longer exist as per - the deprecation notice from 0.17 relase. These transforms are integrated and implemented - in the :class:`~qiskit.pulse.transforms.alignments.AlignmentKind` context of the schedule block. - Following explicit transform functions are removed: - :func:`qiskit.pulse.transforms.align_equispaced`, - :func:`qiskit.pulse.transforms.align_func`, - :func:`qiskit.pulse.transforms.align_left`, - :func:`qiskit.pulse.transforms.align_right`, - and :func:`qiskit.pulse.transforms.align_sequential`. - - | - Redundant pulse builder commands have been removed and no longer exist as per the - deprecation notice from 0.17. The :func:`qiskit.pulse.builder.call_schedule` and - :func:`qiskit.pulse.builder.call_circuit` command has been integrated into - :func:`~qiskit.pulse.builder.call` command. diff --git a/releasenotes/notes/remove-manual-warning-filters-028646b73bb86860.yaml b/releasenotes/notes/remove-manual-warning-filters-028646b73bb86860.yaml deleted file mode 100644 index eb25d1a2033..00000000000 --- a/releasenotes/notes/remove-manual-warning-filters-028646b73bb86860.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -upgrade: - - | - An internal filter override that caused all Qiskit deprecation warnings to be displayed has been removed. - This means that the behaviour will now revert to the standard Python behaviour for deprecations; you should only see a ``DeprecationWarning`` if it was triggered by code in the main script file, interpreter session or Jupyter notebook. - The user will no longer be blamed with a warning if internal Qiskit functions call deprecated behaviour. - If you write libraries, you should occasionally run with the default warning filters disabled, or have tests which always run with them disabled. - - | - Certain warnings used to be only issued once, even if triggered from multiple places. - This behaviour has been removed, so it is possible that if you call deprecated functions, you may see more warnings than you did before. - You should change any deprecated function calls to the suggested versions, because the deprecated forms will be removed in future Qiskit releases. diff --git a/releasenotes/notes/single-qubit-conditions-qpy-39a5a9a7204a27dd.yaml b/releasenotes/notes/single-qubit-conditions-qpy-39a5a9a7204a27dd.yaml deleted file mode 100644 index 8410fbb00b8..00000000000 --- a/releasenotes/notes/single-qubit-conditions-qpy-39a5a9a7204a27dd.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -fixes: - - | - Fixed the generation and loading of QPY files with - :func:`qiskit.circuit.qpy_serialization.dump` and - :func:`qiskit.circuit.qpy_serialization.load` for - :class:`~qiskit.circuit.QuantumCircuit` objects that contain instructions - with classical conditions on a single :class:`~qiskit.circuit.Clbit` instead - of a :class:`~qiskit.circuit.ClassicalRegister`. While the use of single - :class:`~qiskit.circuit.Clbit` conditions is not yet fully supported, if you - were using them in a circuit they are now correctly serialized by QPY. diff --git a/releasenotes/notes/sparse-pauli-internal-8226b4f57a61b982.yaml b/releasenotes/notes/sparse-pauli-internal-8226b4f57a61b982.yaml deleted file mode 100644 index 218922d5376..00000000000 --- a/releasenotes/notes/sparse-pauli-internal-8226b4f57a61b982.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -upgrade: - - | - The internal data of :class:`~qiskit.quantum_info.SparsePauliOp` has been changed - from :class:`~qiskit.quantum_info.PauliTable` to - :class:`~qiskit.quantum_info.operators.PauliList`. -deprecations: - - | - Deprecate the property :meth:`~qiskit.quantum_info.SparsePauliOp.table` as the - :class:`~qiskit.quantum_info.SparsePauliOp` has been updated to internally use - :class:`~qiskit.quantum_info.operators.PauliList` instead of - :class:`~qiskit.quantum_info.PauliTable`. - Also, returning `~qiskit.quantum_info.PauliTable` for - :func:`~qiskit.quantum_info.pauli_basis` has been deprecated. diff --git a/releasenotes/notes/support-dict-for-aux-operators-c3c9ad380c208afd.yaml b/releasenotes/notes/support-dict-for-aux-operators-c3c9ad380c208afd.yaml deleted file mode 100644 index a487e76601a..00000000000 --- a/releasenotes/notes/support-dict-for-aux-operators-c3c9ad380c208afd.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -features: - - | - The ``EigenSolver`` and ``MinimumEigenSolver`` interfaces now support the type - ``Dict[str, Optional[OperatorBase]]`` for the ``aux_operators`` parameter in the respective - ``compute_eigenvalues`` and ``compute_minimum_eigenvalue`` methods. - In this case, the auxiliary eigenvalues are also stored in a dictionary under the same keys - provided by the `aux_operators` dictionary. Keys that correspond to an operator that does not commute - with the main operator are dropped. \ No newline at end of file diff --git a/releasenotes/notes/sx-error-map-408f28a6a0c05fd2.yaml b/releasenotes/notes/sx-error-map-408f28a6a0c05fd2.yaml deleted file mode 100644 index b8e4454fe67..00000000000 --- a/releasenotes/notes/sx-error-map-408f28a6a0c05fd2.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -fixes: - - | - Update the 1-qubit gate errors in - :obj:`~qiskit.visualization.plot_error_map` to use the `'sx'` gate instead - of the `'u2`' gate, consistent with IBMQ backends. diff --git a/releasenotes/notes/symengine-bump-20dedd5204870e7a.yaml b/releasenotes/notes/symengine-bump-20dedd5204870e7a.yaml deleted file mode 100644 index 8b650874756..00000000000 --- a/releasenotes/notes/symengine-bump-20dedd5204870e7a.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -upgrade: - - | - The minimum version of syengine required for installing has been increased - to 0.8.0. This was neccessary to fix some issues with the handling of - ``numpy.float16`` and ``numpy.float32`` values when running - :meth:`qiskit.circuit.ParameterExpression.bind` to bind parameters in a - :class:`~qiskit.circuit.ParameterExpression`. diff --git a/releasenotes/notes/user-config-mpl-style-a9ae4eb7ce072fcd.yaml b/releasenotes/notes/user-config-mpl-style-a9ae4eb7ce072fcd.yaml deleted file mode 100644 index 47f41a65e41..00000000000 --- a/releasenotes/notes/user-config-mpl-style-a9ae4eb7ce072fcd.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -fixes: - - | - Fixed small bug where the circuit drawer would ignore the matplotlib style - specified in ``settings.conf``. diff --git a/releasenotes/notes/vf2layout-4cea88087c355769.yaml b/releasenotes/notes/vf2layout-4cea88087c355769.yaml deleted file mode 100644 index f89c415c64b..00000000000 --- a/releasenotes/notes/vf2layout-4cea88087c355769.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -features: - - | - A new pass :class:`qiskit.transpiler.passes.VF2Layout` is - introduced. This pass models the layout allocation problem as a subgraph - isomorphism problem. For this, it uses VF2, a state of the art heuristic to find - subgraphs. The pass works very much like :class:`qiskit.transpiler.passes.CSPLayout`. diff --git a/test/python/visualization/test_circuit_text_drawer.py b/test/python/visualization/test_circuit_text_drawer.py index 090c5716beb..26d9c1181e3 100644 --- a/test/python/visualization/test_circuit_text_drawer.py +++ b/test/python/visualization/test_circuit_text_drawer.py @@ -45,7 +45,6 @@ CPhaseGate, ) from qiskit.transpiler.passes import ApplyLayout -from qiskit.visualization.exceptions import VisualizationError from .visualization import path_to_diagram_reference, QiskitVisualizationTestCase @@ -4865,16 +4864,6 @@ def test_text_drawer_cp437(self): self.assertFilesAreEqual(filename, self.text_reference_cp437, "cp437") os.remove(filename) - def test_filename_extension_error_message(self): - """Test that the error message shown for wrong file extension is correct.""" - circuit = self.sample_circuit() - with self.assertRaises(VisualizationError) as ve: - _text_circuit_drawer(circuit, filename="file.spooky") - self.assertEqual( - str(ve.exception), - "ERROR: filename parameter does not use .txt extension.", - ) - if __name__ == "__main__": unittest.main()