リリースノート

更新履歴

下表はQiskitの メタパッケージとインストールされている各要素のバージョンの履歴です。

Table 1 更新履歴

Qiskit Metapackage Version

qiskit-terra

qiskit-aer

qiskit-ignis

qiskit-ibmq-provider

qiskit-aqua

注釈

0.7.00.7.1、および 0.7.2 メタパッケージリリースでは、バージョン管理 ポリシーはまだ正式化されていません。

注目すべき変更

Qiskit 0.20.1

Terra 0.15.2

バグ修正
  • When accessing the definition attribute of a parameterized Gate instance, the generated QuantumCircuit had been generated with an invalid ParameterTable, such that reading from QuantumCircuit.parameters or calling QuantumCircuit.bind_parameters would incorrectly report the unbound parameters. This has been resolved.

  • SXGate().inverse() had previously returned an 『sx_dg』 gate with a correct definition but incorrect to_matrix. This has been updated such that SXGate().inverse() returns an SXdgGate() and vice versa.

  • Instruction.inverse(), when not overridden by a subclass, would in some cases return a Gate instance with an incorrect to_matrix method. The instances of incorrect to_matrix methods have been removed.

  • For C3XGate with a non-zero angle, inverting the gate via C3XGate.inverse() had previously generated an incorrect inverse gate. This has been corrected.

  • The MCXGate modes have been updated to return a gate of the same mode when calling .inverse(). This resolves an issue where in some cases, transpiling a circuit containing the inverse of an MCXVChain gate would raise an error.

  • Previously, when creating a multiply controlled phase gate via PhaseGate.control, an MCU1Gate gate had been returned. This has been had corrected so that an MCPhaseGate is returned.

  • Previously, attempting to decompose a circuit containing an MCPhaseGate would raise an error due to an inconsistency in the definition of the MCPhaseGate. This has been corrected.

  • QuantumCircuit.compose and DAGCircuit.compose had, in some cases, incorrectly translated conditional gates if the input circuit contained more than one ClassicalRegister. This has been resolved.

  • Fixed an issue when creating a qiskit.result.Counts object from an empty data dictionary. Now this will create an empty Counts object. The most_frequent() method is also updated to raise a more descriptive exception when the object is empty. Fixes #5017

  • Extending circuits with differing registers updated the qregs and cregs properties accordingly, but not the qubits and clbits lists. As these are no longer generated from the registers but are cached lists, this lead to a discrepancy of registers and bits. This has been fixed and the extend method explicitly updates the cached bit lists.

  • Fix bugs of the concrete implementations of meth:~qiskit.circuit.ControlledGate.inverse method which do not preserve the ctrl_state parameter.

  • A bug was fixed that caused long pulse schedules to throw a recursion error.

Aer 0.6.1

No change

Ignis 0.4.0

No change

Aqua 0.7.5

No change

IBM Q Provider 0.8.0

No change

Qiskit 0.20.0

Terra 0.15.1

プレリュード

The 0.15.0 release includes several new features and bug fixes. Some highlights for this release are:

This release includes the introduction of arbitrary basis translation to the transpiler. This includes support for directly targeting a broader range of device basis sets, e.g. backends implementing RZ, RY, RZ, CZ or iSwap gates.

The QuantumCircuit class now tracks global phase. This means controlling a circuit which has global phase now correctly adds a relative phase, and gate matrix definitions are now exact rather than equal up to a global phase.

新機能
  • A new DAG class qiskit.dagcircuit.DAGDependency for representing the dependency form of circuit, In this DAG, the nodes are operations (gates, measure, barrier, etc…) and the edges corresponds to non-commutation between two operations.

  • Four new functions are added to qiskit.converters for converting back and forth to DAGDependency. These functions are:

    For example:

    from qiskit.converters.dagdependency_to_circuit import dagdependency_to_circuit
    from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit
    
    circuit_in = QuantumCircuit(2)
    circuit_in.h(qr[0])
    circuit_in.h(qr[1])
    
    dag_dependency = circuit_to_dagdependency(circuit_in)
    circuit_out = dagdepency_to_circuit(dag_dependency)
    
  • Two new transpiler passes have been added to qiskit.transpiler.passes The first, UnrollCustomDefinitions, unrolls all instructions in the circuit according to their definition property, stopping when reaching either the specified basis_gates or a set of gates in the provided EquivalenceLibrary. The second, BasisTranslator, uses the set of translations in the provided EquivalenceLibrary to re-write circuit instructions in a specified basis.

  • A new translation_method keyword argument has been added to transpile() to allow selection of the method to be used for translating circuits to the available device gates. For example, transpile(circ, backend, translation_method='translator'). Valid choices are:

    The default value is 'translator'.

  • A new class for handling counts result data, qiskit.result.Counts, has been added. This class is a subclass of dict and can be interacted with like any other dictionary. But, it includes helper methods and attributes for dealing with counts results from experiments and also handles post processing and formatting of binary strings at object initialization. A Counts object can be created by passing a dictionary of counts with the keys being either integers, hexadecimal strings of the form '0x4a', binary strings of the form '0b1101', a bit string formatted across register and memory slots (ie '00 10'), or a dit string. For example:

    from qiskit.result import Counts
    
    counts = Counts({"0x0': 1, '0x1', 3, '0x2': 1020})
    
  • A new method for constructing qiskit.dagcircuit.DAGCircuit objects has been added, from_networkx(). This method takes in a networkx MultiDiGraph object (in the format returned by to_networkx()) and will return a new DAGCircuit object. The intent behind this function is to enable transpiler pass authors to leverage networkx’s graph algorithm library if a function is missing from the retworkx API. Although, hopefully in such casses an issue will be opened with retworkx issue tracker (or even better a pull request submitted).

  • A new kwarg for init_qubits has been added to assemble() and execute(). For backends that support this feature init_qubits can be used to control whether the backend executing the circuits inserts any initialization sequences at the start of each shot. By default this is set to True meaning that all qubits can assumed to be in the ground state at the start of each shot. However, when init_qubits is set to False qubits will be uninitialized at the start of each experiment and between shots. Note, that the backend running the circuits has to support this feature for this flag to have any effect.

  • A new kwarg rep_delay has been added to qiskit.compiler.assemble(), qiskit.execute.execute(), and the constructor for PulseQobjtConfig.qiskit This new kwarg is used to denotes the time between program executions. It must be chosen from the list of valid values set as the rep_delays from a backend’s PulseBackendConfiguration object which can be accessed as backend.configuration().rep_delays).

    The rep_delay kwarg will only work on backends which allow for dynamic repetition time. This will also be indicated in the PulseBackendConfiguration object for a backend as the dynamic_reprate_enabled attribute. If dynamic_reprate_enabled is False then the rep_time value specified for qiskit.compiler.assemble(), qiskit.execute.execute(), or the constructor for PulseQobjtConfig will be used rather than rep_delay. rep_time only allows users to specify the duration of a program, rather than the delay between programs.

  • The qobj_schema.json JSON Schema file in qiskit.schemas has been updated to include the rep_delay as an optional configuration property for pulse qobjs.

  • The backend_configuration_schema.json JSON Schema file in mod:qiskit.schemas has been updated to include rep_delay_range and default_rep_delay as optional properties for a pulse backend configuration.

  • A new attribute, global_phase, which is is used for tracking the global phase has been added to the qiskit.circuit.QuantumCircuit class. For example:

    import math
    
    from qiskit import QuantumCircuit
    
    circ = QuantumCircuit(1, global_phase=math.pi)
    circ.u1(0)
    

    The global phase may also be changed or queried with circ.global_phase in the above example. In either case the setting is in radians. If the circuit is converted to an instruction or gate the global phase is represented by two single qubit rotations on the first qubit.

    This allows for other methods and functions which consume a QuantumCircuit object to take global phase into account. For example. with the global_phase attribute the to_matrix() method for a gate can now exactly correspond to its decompositions instead of just up to a global phase.

    The same attribute has also been added to the DAGCircuit class so that global phase can be tracked when converting between QuantumCircuit and DAGCircuit.

  • Two new classes, AncillaRegister and AncillaQubit have been added to the qiskit.circuit module. These are subclasses of QuantumRegister and Qubit respectively and enable marking qubits being ancillas. This will allow these qubits to be re-used in larger circuits and algorithms.

  • A new method, control(), has been added to the QuantumCircuit. This method will return a controlled version of the QuantumCircuit object, with both open and closed controls. This functionality had previously only been accessible via the Gate class.

  • A new method repeat() has been added to the QuantumCircuit class. It returns a new circuit object containing a specified number of repetitions of the original circuit. For example:

    from qiskit.circuit import QuantumCircuit
    
    qc = QuantumCircuit(2)
    qc.h(0)
    qc.cx(0, 1)
    repeated_qc = qc.repeat(3)
    repeated_qc.decompose().draw(output='mpl')
    
    _images/release_notes_0_0.png

    The parameters are copied by reference, meaning that if you update the parameters in one instance of the circuit all repetitions will be updated.

  • A new method reverse_bits() has been added to the QuantumCircuit class. This method will reverse the order of bits in a circuit (both quantum and classical bits). This can be used to switch a circuit from little-endian to big-endian and vice-versa.

  • A new method, combine_into_edge_map(), was added to the qiskit.transpiler.Layout class. This method enables converting converting two Layout objects into a qubit map for composing two circuits.

  • A new class, ConfigurableFakeBackend, has been added to the qiskit.test.mock.utils module. This new class enables the creation of configurable mock backends for use in testing. For example:

    from qiskit.test.mock.utils import ConfigurableFakeBackend
    
    backend = ConfigurableFakeBackend("Tashkent",
                                      n_qubits=100,
                                      version="0.0.1",
                                      basis_gates=['u1'],
                                      qubit_t1=99.,
                                      qubit_t2=146.,
                                      qubit_frequency=5.,
                                      qubit_readout_error=0.01,
                                      single_qubit_gates=['u1'])
    

    will create a backend object with 100 qubits and all the other parameters specified in the constructor.

  • A new method draw() has been added to the qiskit.circuit.EquivalenceLibrary class. This method can be used for drawing the contents of an equivalence library, which can be useful for debugging. For example:

    from numpy import pi
    
    from qiskit.circuit import EquivalenceLibrary
    from qiskit.circuit import QuantumCircuit
    from qiskit.circuit import QuantumRegister
    from qiskit.circuit import Parameter
    from qiskit.circuit.library import HGate
    from qiskit.circuit.library import U2Gate
    from qiskit.circuit.library import U3Gate
    
    my_equiv_library = EquivalenceLibrary()
    
    q = QuantumRegister(1, 'q')
    def_h = QuantumCircuit(q)
    def_h.append(U2Gate(0, pi), [q[0]], [])
    my_equiv_library.add_equivalence(HGate(), def_h)
    
    theta = Parameter('theta')
    phi = Parameter('phi')
    lam = Parameter('lam')
    def_u2 = QuantumCircuit(q)
    def_u2.append(U3Gate(pi / 2, phi, lam), [q[0]], [])
    my_equiv_library.add_equivalence(U2Gate(phi, lam), def_u2)
    
    my_equiv_library.draw()
    
    _images/release_notes_1_0.png
  • A new Phase instruction, SetPhase, has been added to qiskit.pulse. This instruction sets the phase of the subsequent pulses to the specified phase (in radians. For example:

    import numpy as np
    
    from qiskit.pulse import DriveChannel
    from qiskit.pulse import Schedule
    from qiskit.pulse import SetPhase
    
    sched = Schedule()
    sched += SetPhase(np.pi, DriveChannel(0))
    

    In this example, the phase of the pulses applied to DriveChannel(0) after the SetPhase instruction will be set to \(\pi\) radians.

  • A new pulse instruction ShiftFrequency has been added to qiskit.pulse.instructions. This instruction enables shifting the frequency of a channel from its set frequency. For example:

    from qiskit.pulse import DriveChannel
    from qiskit.pulse import Schedule
    from qiskit.pulse import ShiftFrequency
    
    sched = Schedule()
    sched += ShiftFrequency(-340e6, DriveChannel(0))
    

    In this example all the pulses applied to DriveChannel(0) after the ShiftFrequency command will have the envelope a frequency decremented by 340MHz.

  • A new method conjugate() has been added to the ParameterExpression class. This enables calling numpy.conj() without raising an error. Since a ParameterExpression object is real, it will return itself. This behaviour is analogous to Python floats/ints.

  • A new class PhaseEstimation has been added to qiskit.circuit.library. This circuit library class is the circuit used in the original formulation of the phase estimation algorithm in arXiv:quant-ph/9511026. Phase estimation is the task to to estimate the phase \(\phi\) of an eigenvalue \(e^{2\pi i\phi}\) of a unitary operator \(U\), provided with the corresponding eigenstate \(|psi\rangle\). That is

    \[U|\psi\rangle = e^{2\pi i\phi} |\psi\rangle\]

    This estimation (and thereby this circuit) is a central routine to several well-known algorithms, such as Shor’s algorithm or Quantum Amplitude Estimation.

  • The qiskit.visualization function plot_state_qsphere() has a new kwarg show_state_labels which is used to control whether each blob in the qsphere visualization is labeled. By default this kwarg is set to True and shows the basis states next to each blob by default. This feature can be disabled, reverting to the previous behavior, by setting the show_state_labels kwarg to False.

  • The qiskit.visualization function plot_state_qsphere() has a new kwarg show_state_phases which is set to False by default. When set to True it displays the phase of each basis state.

  • The qiskit.visualization function plot_state_qsphere() has a new kwarg use_degrees which is set to False by default. When set to True it displays the phase of each basis state in degrees, along with the phase circle at the bottom right.

  • A new class, QuadraticForm to the qiskit.circuit.library module for implementing a a quadratic form on binary variables. The circuit library element implements the operation

    \[|x\rangle |0\rangle \mapsto |x\rangle |Q(x) \mod 2^m\rangle\]

    for the quadratic form \(Q\) and \(m\) output qubits. The result is in the \(m\) output qubits is encoded in two’s complement. If \(m\) is not specified, the circuit will choose the minimal number of qubits required to represent the result without applying a modulo operation. The quadratic form is specified using a matrix for the quadratic terms, a vector for the linear terms and a constant offset. If all terms are integers, the circuit implements the quadratic form exactly, otherwise it is only an approximation.

    For example:

    import numpy as np
    
    from qiskit.circuit.library import QuadraticForm
    
    A = np.array([[1, 2], [-1, 0]])
    b = np.array([3, -3])
    c = -2
    m = 4
    quad_form_circuit = QuadraticForm(m, A, b, c)
    
  • Add qiskit.quantum_info.Statevector.expectation_value() and qiskit.quantum_info.DensityMatrix.expectation_value() methods for computing the expectation value of an qiskit.quantum_info.Operator.

  • For the seed kwarg in the constructor for qiskit.circuit.library.QuantumVolume numpy random Generator objects can now be used. Previously, only integers were a valid input. This is useful when integrating QuantumVolume as part of a larger function with its own random number generation, e.g. generating a sequence of QuantumVolume circuits.

  • The QuantumCircuit method compose() has a new kwarg front which can be used for prepending the other circuit before the origin circuit instead of appending. For example:

    from qiskit.circuit import QuantumCircuit
    
    circ1 = QuantumCircuit(2)
    circ2 = QuantumCircuit(2)
    
    circ2.h(0)
    circ1.cx(0, 1)
    
    circ1.compose(circ2, front=True).draw(output='mpl')
    
    _images/release_notes_2_0.png
  • Two new passes, SabreLayout and SabreSwap for layout and routing have been added to qiskit.transpiler.passes. These new passes are based on the algorithm presented in Li et al., 「Tackling the Qubit Mapping Problem for NISQ-Era Quantum Devices」, ASPLOS 2019. They can also be selected when using the transpile() function by setting the layout_method kwarg to 'sabre' and/or the routing_method to 'sabre' to use SabreLayout and SabreSwap respectively.

  • Added the method replace() to the qiskit.pulse.Schedule class which allows a pulse instruction to be replaced with another. For example:

    .. code-block:: python
    

    from qiskit import pulse

    d0 = pulse.DriveChannel(0)

    sched = pulse.Schedule()

    old = pulse.Play(pulse.Constant(100, 1.0), d0) new = pulse.Play(pulse.Constant(100, 0.1), d0)

    sched += old

    sched = sched.replace(old, new)

    assert sched == pulse.Schedule(new)

  • Added new gate classes to qiskit.circuit.library for the \(\sqrt{X}\), its adjoint \(\sqrt{X}^\dagger\), and controlled \(\sqrt{X}\) gates as SXGate, SXdgGate, and CSXGate. They can also be added to a QuantumCircuit object using the sx(), sxdg(), and csx() respectively.

  • Add support for Reset instructions to qiskit.quantum_info.Statevector.from_instruction(). Note that this involves RNG sampling in choosing the projection to the zero state in the case where the qubit is in a superposition state. The seed for sampling can be set using the seed() method.

  • The methods qiskit.circuit.ParameterExpression.subs() and qiskit.circuit.QuantumCircuit.assign_parameters() now accept ParameterExpression as the target value to be substituted.

    For example,

    from qiskit.circuit import QuantumCircuit, Parameter
    
    p = Parameter('p')
    source = QuantumCircuit(1)
    source.rz(p, 0)
    
    x = Parameter('x')
    source.assign_parameters({p: x*x})
    
         ┌──────────┐
    q_0: ┤ Rz(x**2) ├
         └──────────┘
    
  • The QuantumCircuit() method to_gate() has a new kwarg label which can be used to set a label for for the output Gate object. For example:

    from qiskit.circuit import QuantumCircuit
    
    circuit_gate = QuantumCircuit(2)
    circuit_gate.h(0)
    circuit_gate.cx(0, 1)
    custom_gate = circuit_gate.to_gate(label='My Special Bell')
    new_circ = QuantumCircuit(2)
    new_circ.append(custom_gate, [0, 1], [])
    new_circ.draw(output='mpl')
    
    _images/release_notes_3_0.png
  • Added the UGate, CUGate, PhaseGate, and CPhaseGate with the corresponding QuantumCircuit methods u(), cu(), p(), and cp(). The UGate gate is the generic single qubit rotation gate with 3 Euler angles and the CUGate gate its controlled version. CUGate has 4 parameters to account for a possible global phase of the U gate. The PhaseGate and CPhaseGate gates are the general Phase gate at an arbitrary angle and it’s controlled version.

  • A new kwarg, cregbundle has been added to the qiskit.visualization.circuit_drawer() function and the QuantumCircuit method draw(). When set to True the cregs will be bundled into a single line in circuit visualizations for the text and mpl drawers. The default value is True. Addresses issue #4290.

    For example:

    from qiskit import QuantumCircuit
    circuit = QuantumCircuit(2)
    circuit.measure_all()
    circuit.draw(output='mpl', cregbundle=True)
    
    _images/release_notes_4_0.png
  • A new kwarg, initial_state has been added to the qiskit.visualization.circuit_drawer() function and the QuantumCircuit method draw(). When set to True the initial state will now be included in circuit visualizations for all drawers. Addresses issue #4293.

    For example:

    from qiskit import QuantumCircuit
    circuit = QuantumCircuit(2)
    circuit.measure_all()
    circuit.draw(output='mpl', initial_state=True)
    
    _images/release_notes_5_0.png
  • Labels will now be displayed when using the 『mpl』 drawer. There are 2 types of labels - gate labels and control labels. Gate labels will replace the gate name in the display. Control labels will display above or below the controls for a gate. Fixes issues #3766, #4580 Addresses issues #3766 and #4580.

    For example:

    from qiskit import QuantumCircuit
    from qiskit.circuit.library.standard_gates import YGate
    circuit = QuantumCircuit(2)
    circuit.append(YGate(label='A Y Gate').control(label='Y Control'), [0, 1])
    circuit.draw(output='mpl')
    
    _images/release_notes_6_0.png
ノートをアップグレードします。
  • Implementations of the multi-controlled X Gate ( MCXGrayCode, MCXRecursive, and MCXVChain) have had their name properties changed to more accurately describe their implementation: mcx_gray, mcx_recursive, and mcx_vchain respectively. Previously, these gates shared the name mcx with MCXGate, which caused these gates to be incorrectly transpiled and simulated.

  • By default the preset passmanagers in qiskit.transpiler.preset_passmanagers are using UnrollCustomDefinitions and BasisTranslator to handle basis changing instead of the previous default Unroller. This was done because the new passes are more flexible and allow targeting any basis set, however the output may differ. To use the previous default you can set the translation_method kwarg on transpile() to 'unroller'.

  • The qiskit.converters.circuit_to_gate() and :func`qiskit.converters.circuit_to_instruction` converter functions had previously automatically included the generated gate or instruction in the active SessionEquivalenceLibrary. These converters now accept an optional equivalence_library keyword argument to specify if and where the converted instances should be registered. The default behavior has changed to not register the converted instance.

  • The default value of the cregbundle kwarg for the qiskit.circuit.QuantumCircuit.draw() method and qiskit.visualization.circuit_drawer() function has been changed to True. This means that by default the classical bits in the circuit diagram will now be bundled by default, for example:

    from qiskit.circuit import QuantumCircuit
    
    circ = QuantumCircuit(4)
    circ.x(0)
    circ.h(1)
    circ.measure_all()
    circ.draw(output='mpl')
    
    _images/release_notes_7_0.png

    If you want to have your circuit drawing retain the previous behavior and show each classical bit in the diagram you can set the cregbundle kwarg to False. For example:

    from qiskit.circuit import QuantumCircuit
    
    circ = QuantumCircuit(4)
    circ.x(0)
    circ.h(1)
    circ.measure_all()
    circ.draw(output='mpl', cregbundle=False)
    
    _images/release_notes_8_0.png
  • Schedule plotting with qiskit.pulse.Schedule.draw() and qiskit.visualization.pulse_drawer() will no longer display the event table by default. This can be reenabled by setting the table kwarg to True.

  • The pass RemoveResetInZeroState was previously included in the preset pass manager level_0_pass_manager() which was used with the optimization_level=0 for transpile() and execute() functions. However, RemoveResetInZeroState is an optimization pass and should not have been included in optimization level 0 and was removed. If you need to run transpile() with RemoveResetInZeroState either use a custom pass manager or optimization_level 1, 2, or 3.

  • The deprecated kwarg line_length for the qiskit.visualization.circuit_drawer() function and qiskit.circuit.QuantumCircuit.draw() method has been removed. It had been deprecated since the 0.10.0 release. Instead you can use the fold kwarg to adjust the width of the circuit diagram.

  • The 'mpl' output mode for the qiskit.circuit.QuantumCircuit.draw() method and circuit_drawer() now requires the pylatexenc library to be installed. This was already an optional dependency for visualization, but was only required for the 'latex' output mode before. It is now also required for the matplotlib drawer because it is needed to handle correctly sizing gates with matplotlib’s mathtext labels for gates.

  • The deprecated get_tokens methods for the qiskit.qasm.Qasm and qiskit.qasm.QasmParser has been removed. These methods have been deprecated since the 0.9.0 release. The qiskit.qasm.Qasm.generate_tokens() and qiskit.qasm.QasmParser.generate_tokens() methods should be used instead.

  • The deprecated kwarg channels_to_plot for qiskit.pulse.Schedule.draw(), qiskit.pulse.Instruction.draw(), qiskit.visualization.pulse.matplotlib.ScheduleDrawer.draw and pulse_drawer() has been removed. The kwarg has been deprecated since the 0.11.0 release and was replaced by the channels kwarg, which functions identically and should be used instead.

  • The deprecated circuit_instruction_map attribute of the qiskit.providers.models.PulseDefaults class has been removed. This attribute has been deprecated since the 0.12.0 release and was replaced by the instruction_schedule_map attribute which can be used instead.

  • The union method of Schedule and Instruction have been deprecated since the 0.12.0 release and have now been removed. Use qiskit.pulse.Schedule.insert() and qiskit.pulse.Instruction.meth() methods instead with the kwarg``time=0``.

  • The deprecated scaling argument to the draw method of Schedule and Instruction has been replaced with scale since the 0.12.0 release and now has been removed. Use the scale kwarg instead.

  • The deprecated period argument to qiskit.pulse.library functions have been replaced by freq since the 0.13.0 release and now removed. Use the freq kwarg instead of period.

  • The qiskit.pulse.commands module containing Commands classes was deprecated in the 0.13.0 release and has now been removed. You will have to upgrade your Pulse code if you were still using commands. For example:

    Old

    New

    Command(args)(channel)

    Instruction(args, channel)

    Acquire(duration)(AcquireChannel(0))
    
    Acquire(duration, AcquireChannel(0))
    
    Delay(duration)(channel)
    
    Delay(duration, channel)
    
    FrameChange(angle)(DriveChannel(0))
    
    # FrameChange was also renamed
    ShiftPhase(angle, DriveChannel(0))
    
    Gaussian(...)(DriveChannel(0))
    
    # Pulses need to be `Play`d
    Play(Gaussian(...), DriveChannel(0))
    
  • All classes and function in the qiskit.tool.qi module were deprecated in the 0.12.0 release and have now been removed. Instead use the qiskit.quantum_info module and the new methods and classes that it has for working with quantum states and operators.

  • The qiskit.quantum_info.basis_state and qiskit.quantum_info.projector functions are deprecated as of Qiskit Terra 0.12.0 as are now removed. Use the qiskit.quantum_info.QuantumState and its derivatives qiskit.quantum_info.Statevector and qiskit.quantum_info.DensityMatrix to work with states.

  • The interactive plotting functions from qiskit.visualization, iplot_bloch_multivector, iplot_state_city, iplot_state_qsphere, iplot_state_hinton, iplot_histogram, iplot_state_paulivec now are just deprecated aliases for the matplotlib based equivalents and are no longer interactive. The hosted static JS code that these functions relied on has been removed and they no longer could work. A normal deprecation wasn’t possible because the site they depended on no longer exists.

  • The validation components using marshmallow from qiskit.validation have been removed from terra. Since they are no longer used to build any objects in terra.

  • The marshmallow schema classes in qiskit.result have been removed since they are no longer used by the qiskit.result.Result class.

  • The output of the to_dict() method for the qiskit.result.Result class is no longer in a format for direct JSON serialization. Depending on the content contained in instances of these classes there may be types that the default JSON encoder doesn’t know how to handle, for example complex numbers or numpy arrays. If you’re JSON serializing the output of the to_dict() method directly you should ensure that your JSON encoder can handle these types.

  • The option to acquire multiple qubits at once was deprecated in the 0.12.0 release and is now removed. Specifically, the init args mem_slots and reg_slots have been removed from qiskit.pulse.instructions.Acquire, and channel, mem_slot and reg_slot will raise an error if a list is provided as input.

  • Support for the use of the USE_RETWORKX environment variable which was introduced in the 0.13.0 release to provide an optional fallback to the legacy networkx based qiskit.dagcircuit.DAGCircuit implementation has been removed. This flag was only intended as provide a relief valve for any users that encountered a problem with the new implementation for one release during the transition to retworkx.

  • The module within qiskit.pulse responsible for schedule->schedule transformations has been renamed from reschedule.py to transforms.py. The previous import path has been deprecated. To upgrade your code:

    from qiskit.pulse.rescheduler import <X>
    

    should be replaced by:

    from qiskit.pulse.transforms import <X>
    
  • In previous releases a PassManager did not allow TransformationPass classes to modify the PropertySet. This restriction has been lifted so a TransformationPass class now has read and write access to both the PropertySet and DAGCircuit during run(). This change was made to more efficiently facilitate TransformationPass classes that have an internal state which may be necessary for later passes in the PassManager. Without this change a second redundant AnalysisPass would have been necessary to recreate the internal state, which could add significant overhead.

非推奨通知
バグ修正
Other Notes
  • The qiskit.result.Result class which was previously constructed using the marshmallow library has been refactored to not depend on marshmallow anymore. This new implementation should be a seamless transition but some specific behavior that was previously inherited from marshmallow may not work. Please file issues for any incompatibilities found.

Aer 0.6.1

プレリュード

This 0.6.0 release includes numerous performance improvements for all simulators in the Aer provider and significant changes to the build system when building from source. The main changes are support for SIMD vectorization, approximation in the matrix product state method via bond-dimension truncation, more efficient Pauli expectation value computation, and greatly improved efficiency in Python conversion of C++ result objects. The build system was upgraded to use the Conan to manage common C++ dependencies when building from source.

新機能
  • Add density matrix snapshot support to 「statevector」 and 「statevector_gpu」 methods of the QasmSimulator.

  • Allow density matrix snapshots on specific qubits, not just all qubits. This computes the partial trace of the state over the remaining qubits.

  • Adds Pauli expectation value snapshot support to the 「density_matrix」 simulation method of the qiskit.providers.aer.QasmSimulator. Add snapshots to circuits using the qiskit.providers.aer.extensions.SnapshotExpectationValue extension.

  • Greatly improves performance of the Pauli expectation value snapshot algorithm for the 「statevector」, 「statevector_gpu, 「density_matrix」, and 「density_matrix_gpu」 simulation methods of the qiskit.providers.aer.QasmSimulator.

  • Enable the gate-fusion circuit optimization from the qiskit.providers.aer.QasmSimulator in both the qiskit.providers.aer.StatevectorSimulator and qiskit.providers.aer.UnitarySimulator backends.

  • Improve the performance of average snapshot data in simulator results. This effects probability, Pauli expectation value, and density matrix snapshots using the following extensions:

  • Add move constructor and improve memory usage of the C++ matrix class to minimize copies of matrices when moving output of simulators into results.

  • Improve performance of unitary simulator.

  • Add approximation to the 「matrix_product_state」 simulation method of the QasmSimulator to limit the bond-dimension of the MPS.

    There are two modes of approximation. Both discard the smallest Schmidt coefficients following the SVD algorithm. There are two parameters that control the degree of approximation: "matrix_product_state_max_bond_dimension" (int): Sets a limit on the number of Schmidt coefficients retained at the end of the svd algorithm. Coefficients beyond this limit will be discarded. (Default: None, i.e., no limit on the bond dimension). "matrix_product_state_truncation_threshold" (double): Discard the smallest coefficients for which the sum of their squares is smaller than this threshold. (Default: 1e-16).

  • Improve the performance of measure sampling when using the 「matrix_product_state」 QasmSimulator simulation method.

  • Add support for Delay, Phase and SetPhase pulse instructions to the qiskit.providers.aer.PulseSimulator.

  • Improve the performance of the qiskit.providers.aer.PulseSimulator by caching calls to RHS function

  • Introduce alternate DE solving methods, specifiable through backend_options in the qiskit.providers.aer.PulseSimulator.

  • Improve performance of simulator result classes by using move semantics and removing unnecessary copies that were happening when combining results from separate experiments into the final result object.

  • Greatly improve performance of pybind11 conversion of simulator results by using move semantics where possible, and by moving vector and matrix results to Numpy arrays without copies.

  • Change the RNG engine for simulators from 32-bit Mersenne twister to 64-bit Mersenne twister engine.

  • Improves the performance of the 「statevector」 simulation method of the qiskit.providers.aer.QasmSimulator and qiskit.providers.aer.StatevectorSimulator by using SIMD intrinsics on systems that support the AVX2 instruction set. AVX2 support is automatically detected and enabled at runtime.

ノートをアップグレードします。
  • Changes the build system to use the Conan package manager. This tool will handle most of the dependencies needed by the C++ source code. Internet connection may be needed for the first build or when dependencies are added or updated, in order to download the required packages if they are not in your Conan local repository.

    When building the standalone version of qiskit-aer you must install conan first with:

    pip install conan
    
  • Changes how transpilation passes are handled in the C++ Controller classes so that each pass must be explicitly called. This allows for greater customization on when each pass should be called, and with what parameters. In particular this enables setting different parameters for the gate fusion optimization pass depending on the QasmController simulation method.

  • Add gate_length_units kwarg to qiskit.providers.aer.noise.NoiseModel.from_device() for specifying custom gate_lengths in the device noise model function to handle unit conversions for internal code.

  • Add Controlled-Y (「cy」) gate to the Stabilizer simulator methods supported gateset.

  • For Aer’s backend the jsonschema validation of input qobj objects from terra is now opt-in instead of being enabled by default. If you want to enable jsonschema validation of qobj set the validate kwarg on the qiskit.providers.aer.QasmSimualtor.run() method for the backend object to True.

  • Adds an OpSet object to the base simulator State class to allow easier validation of instructions, gates, and snapshots supported by simulators.

  • Refactor OpSet class. Moved OpSet to separate header file and add contains and difference methods based on std::set::contains and std::algorithm::set_difference. These replace the removed invalid and validate instructions from OpSet, but with the order reversed. It returns a list of other ops not in current opset rather than opset instructions not in the other.

  • Improves how measurement sampling optimization is checked. The expensive part of this operation is now done once during circuit construction where rather than multiple times during simulation for when checking memory requirements, simulation method, and final execution.

バグ修正
  • Remove 「extended_stabilizer」 from the automatically selected simulation methods. This is needed as the extended stabilizer method is not exact and may give incorrect results for certain circuits unless the user knows how to optimize its configuration parameters.

    The automatic method now only selects from 「stabilizer」, 「density_matrix」, and 「statevector」 methods. If a non-Clifford circuit that is too large for the statevector method is executed an exception will be raised suggesting you could try explicitly using the 「extended_stabilizer」 or 「matrix_product_state」 methods instead.

  • Disables gate fusion for the matrix product state simulation method as this was causing issues with incorrect results being returned in some cases.

  • Fixes a bug causing incorrect channel evaluation in the qiskit.providers.aer.PulseSimulator.

  • Fixes several minor bugs for Hamiltonian parsing edge cases in the qiskit.providers.aer.pulse.system_models.hamiltonian_model.HamiltonianModel class.

Ignis 0.4.0

プレリュード

The main change made in this release is a refactor of the Randomized Benchmarking code to integrate the updated Clifford class qiskit.quantum_info.Clifford from Terra and to improve the CNOT-Dihedral class.

新機能
  • The qiskit.ignis.verification.randomized_benchmarking.randomized_benchmarking_seq() function was refactored to use the updated Clifford class Clifford, to allow efficient Randomized Benchmarking (RB) on Clifford sequences with more than 2 qubits. In addition, the code of the CNOT-Dihedral class qiskit.ignis.verification.randomized_benchmarking.CNOTDihedral was refactored to make it more efficient, by using numpy arrays, as well not using pre-generated pickle files storing all the 2-qubit group elements. The qiskit.ignis.verification.randomized_benchmarking.randomized_benchmarking_seq() function has a new kwarg rand_seed which can be used to specify a seed for the random number generator used to generate the RB circuits. This can be useful for having a reproducible circuit.

  • The qiskit.ignis.verification.qv_circuits() function has a new kwarg seed which can be used to specify a seed for the random number generator used to generate the Quantum Volume circuits. This can be useful for having a reproducible circuit.

ノートをアップグレードします。
  • The qiskit.ignis.verification.randomized_benchmarking.randomized_benchmarking_seq() function is now using the updated Clifford class Clifford and the updated CNOT-Dihedral class qiskit.ignis.verification.randomized_benchmarking.CNOTDihedral to construct its output instead of using pre-generated group tables for the Clifford and CNOT-Dihedral group elements, which were stored in pickle files. This may result in subtle differences from the output from the previous version.

  • A new requirement scikit-learn has been added to the requirements list. This dependency was added in the 0.3.0 release but wasn’t properly exposed as a dependency in that release. This would lead to an ImportError if the qiskit.ignis.measurement.discriminator.iq_discriminators module was imported. This is now correctly listed as a dependency so that scikit-learn will be installed with qiskit-ignis.

  • The qiskit.ignis.verification.qv_circuits() function is now using the circuit library class QuantumVolume to construct its output instead of building the circuit from scratch. This may result in subtle differences from the output from the previous version.

  • Tomography fitters can now also get list of Result objects instead of a single Result as requested in issue #320.

非推奨通知
  • The kwarg interleaved_gates for the qiskit.ignis.verification.randomized_benchmarking.randomized_benchmarking_seq() function has been deprecated and will be removed in a future release. It is superseded by interleaved_elem. The helper functions qiskit.ignis.verification.randomized_benchmarking.BasicUtils, qiskit.ignis.verification.randomized_benchmarking.CliffordUtils and qiskit.ignis.verification.randomized_benchmarking.DihedralUtils were deprecated. These classes are superseded by qiskit.ignis.verification.randomized_benchmarking.RBgroup that handles the group operations needed for RB. The class qiskit.ignis.verification.randomized_benchmarking.Clifford is superseded by Clifford.

  • The kwargs qr and cr for the qiskit.ignis.verification.qv_circuits() function have been deprecated and will be removed in a future release. These kwargs were documented as being used for specifying a qiskit.circuit.QuantumRegister and qiskit.circuit.ClassicalRegister to use in the generated Quantum Volume circuits instead of creating new ones. However, the parameters were never actually respected and a new Register would always be created regardless of whether they were set or not. This behavior is unchanged and these kwargs still do not have any effect, but are being deprecated prior to removal to avoid a breaking change for users who may have been setting either.

  • Support for passing in subsets of qubits as a list in the qubit_lists parameter for the qiskit.ignis.verification.qv_circuits() function has been deprecated and will removed in a future release. In the past this was used to specify a layout to run the circuit on a device. In other words if you had a 5 qubit device and wanted to run a 2 qubit QV circuit on qubits 1, 3, and 4 of that device. You would pass in [1, 3, 4] as one of the lists in qubit_lists, which would generate a 5 qubit virtual circuit and have qv applied to qubits 1, 3, and 4 in that virtual circuit. However, this functionality is not necessary and overlaps with the concept of initial_layout in the transpiler and whether a circuit has been embedded with a layout set. Moving forward instead you should just run transpile() or execute() with initial layout set to do this. For example, running the above example would become:

    from qiskit import execute
    from qiskit.ignis.verification import qv_circuits
    
    initial_layout = [1, 3, 4]
    qv_circs, _ = qv_circuits([list(range3)])
    execute(qv_circuits, initial_layout=initial_layout)
    
バグ修正
  • Fix a bug of the position of measurement pulses inserted by py:func:qiskit.ignis.characterization.calibrations.pulse_schedules.drag_schedules. Fixes #465

Aqua 0.7.5

新機能
  • Removed soft dependency on CPLEX in ADMMOptimizer. Now default optimizers used by ADMMOptimizer are MinimumEigenOptimizer for QUBO problems and SlsqpOptimizer as a continuous optimizer. You can still use CplexOptimizer as an optimizer for ADMMOptimizer, but it should be set explicitly.

  • New Yahoo! finance provider created.

  • Introduced QuadraticProgramConverter which is an abstract class for converters. Added convert/interpret methods for converters instead of encode/decode. Added to_ising and from_ising to QuadraticProgram class. Moved all parameters from convert to constructor except name. Created setter/getter for converter parameters. Added auto_define_penalty and interpret for``LinearEqualityToPenalty``. Now error messages of converters are more informative.

  • Added an SLSQP optimizer qiskit.optimization.algorithms.SlsqpOptimizer as a wrapper of the corresponding SciPy optimization method. This is a classical optimizer, does not depend on quantum algorithms and may be used as a replacement for CobylaOptimizer.

  • Cobyla optimizer has been modified to accommodate a multi start feature introduced in the SLSQP optimizer. By default, the optimizer does not run in the multi start mode.

  • The SummedOp does a mathematically more correct check for equality, where expressions such as X + X == 2*X and X + Z == Z + X evaluate to True.

非推奨通知
バグ修正
  • Changed in python version 3.8: On macOS, the spawn start method is now the default. The fork start method should be considered unsafe as it can lead to crashes in subprocesses. However P_BFGS doesn’t support spawn, so we revert to single process. Refer to #1109 <https://github.com/Qiskit/qiskit-aqua/issues/1109> for more details.

  • Binding parameters in the CircuitStateFn did not copy the value of is_measurement and always set is_measurement=False. This has been fixed.

  • Previously, SummedOp.to_matrix_op built a list MatrixOp’s (with numpy matrices) and then summed them, returning a single MatrixOp. Some algorithms (for example vqe) require summing thousands of matrices, which exhausts memory when building the list of matrices. With this change, no list is constructed. Rather, each operand in the sum is converted to a matrix, added to an accumulator, and discarded.

  • Changing backends in VQE from statevector to qasm_simulator or real device was causing an error due to CircuitSampler incompatible reuse. VQE was changed to always create a new CircuitSampler and create a new expectation in case not entered by user. Refer to #1153 <https://github.com/Qiskit/qiskit-aqua/issues/1153> for more details.

  • Exchange and Wikipedia finance providers were fixed to correctly handle Quandl data. Refer to #775 <https://github.com/Qiskit/qiskit-aqua/issues/775> for more details. Fixes a divide by 0 error on finance providers mean vector and covariance matrix calculations. Refer to #781 <https://github.com/Qiskit/qiskit-aqua/issues/781> for more details.

  • The ListOp.combo_fn property has been lost in several transformations, such as converting to another operator type, traversing, reducing or multiplication. Now this attribute is propagated to the resulting operator.

  • The evaluation of some operator expressions, such as of SummedOp``s and evaluations with the ``CircuitSampler did not treat coefficients correctly or ignored them completely. E.g. evaluating ~StateFn(0 * (I + Z)) @ Plus did not yield 0 or the normalization of ~StateFn(I) @ ((Plus + Minus) / sqrt(2)) missed a factor of sqrt(2). This has been fixed.

  • OptimizationResult included some public setters and class variables were Optional. This fix makes all class variables read-only so that mypy and pylint can check types more effectively. MinimumEigenOptimizer.solve generated bitstrings in a result as str. This fix changed the result into List[float] as the other algorithms do. Some public classes related to optimization algorithms were missing in the documentation of qiskit.optimization.algorithms. This fix added all such classes to the docstring. #1131 <https://github.com/Qiskit/qiskit-aqua/issues/1131> for more details.

  • OptimizationResult.__init__ did not check whether the sizes of x and variables match or not (they should match). This fix added the check to raise an error if they do not match and fixes bugs detected by the check. This fix also adds missing unit tests related to OptimizationResult.variable_names and OptimizationResult.variables_dict in test_converters. #1167 <https://github.com/Qiskit/qiskit-aqua/issues/1167> for more details.

  • Fix parameter binding in the OperatorStateFn, which did not bind parameters of the underlying primitive but just the coefficients.

  • op.eval(other), where op is of type OperatorBase, sometimes silently returns a nonsensical value when the number of qubits in op and other are not equal. This fix results in correct behavior, which is to throw an error rather than return a value, because the input in this case is invalid.

  • The construct_circuit method of VQE previously returned the expectation value to be evaluated as type OperatorBase. This functionality has been moved into construct_expectation and construct_circuit returns a list of the circuits that are evaluated to compute the expectation value.

IBM Q Provider 0.8.0

新機能
  • IBMQBackend now has a new reservations() method that returns reservation information for the backend, with optional filtering. In addition, you can now use provider.backends.my_reservations() to query for your own reservations.

  • qiskit.providers.ibmq.job.IBMQJob.result() raises an IBMQJobFailureError exception if the job has failed. The exception message now contains the reason the job failed, if the entire job failed for a single reason.

  • A new attribute client_version was added to IBMQJob and qiskit.result.Result object retrieved via qiskit.providers.ibmq.job.IBMQJob.result(). client_version is a dictionary with the key being the name and the value being the version of the client used to submit the job, such as Qiskit.

  • The least_busy() function now takes a new, optional parameter reservation_lookahead. If specified or defaulted to, a backend is considered unavailable if it has reservations in the next n minutes, where n is the value of reservation_lookahead. For example, if the default value of 60 is used, then any backends that have reservations in the next 60 minutes are considered unavailable.

  • ManagedResults now has a new combine_results() method that combines results from all managed jobs and returns a single Result object. This Result object can be used, for example, in qiskit-ignis fitter methods.

ノートをアップグレードします。
非推奨通知
  • Use of Qconfig.py to save IBM Quantum Experience credentials is deprecated and will be removed in the next release. You should use qiskitrc (the default) instead.

バグ修正
  • Fixes an issue wherein a call to qiskit.providers.ibmq.IBMQBackend.jobs() can hang if the number of jobs being returned is large. Fixes #674

  • Fixes an issue which would raise a ValueError when building error maps in Jupyter for backends that are offline. Fixes #706

  • qiskit.providers.ibmq.IBMQBackend.jobs() will now return the correct list of IBMQJob objects when the status kwarg is set to 'RUNNING'.

  • The package metadata has been updated to properly reflect the dependency on qiskit-terra >= 0.14.0. This dependency was implicitly added as part of the 0.7.0 release but was not reflected in the package requirements so it was previously possible to install qiskit-ibmq-provider with a version of qiskit-terra which was too old. Fixes #677

Qiskit 0.19.6

Terra 0.14.2

変更なし

Aer 0.5.2

変更なし

Ignis 0.3.3

ノートをアップグレードします。
  • A new requirement scikit-learn has been added to the requirements list. This dependency was added in the 0.3.0 release but wasn’t properly exposed as a dependency in that release. This would lead to an ImportError if the qiskit.ignis.measurement.discriminator.iq_discriminators module was imported. This is now correctly listed as a dependency so that scikit-learn will be installed with qiskit-ignis.

バグ修正
  • qiskit-ignis 0.3.2 において、cvxpy がインストールされていない状態で qiskit.ignis.verification.tomography.fitters.process_fitter がインポートされたときに``ImportError``が発生する問題を修正しました。

Aqua 0.7.3

変更なし

IBM Q Provider 0.7.2

変更なし

Qiskit 0.19.5

Terra 0.14.2

変更なし

Aer 0.5.2

変更なし

Ignis 0.3.2

バグ修正
  • The qiskit.ignis.verification.TomographyFitter.fit() method has improved detection logic for the default fitter. Previously, the cvx fitter method was used whenever cvxpy was installed. However, it was possible to install cvxpy without an SDP solver that would work for the cvx fitter method. This logic has been reworked so that the cvx fitter method is only used if cvxpy is installed and an SDP solver is present that can be used. Otherwise, the lstsq fitter is used.

  • Fixes an edge case in qiskit.ignis.mitigation.measurement.fitters.MeasurementFitter.apply() for input that has invalid or incorrect state labels that don’t match the calibration circuit. Previously, this would not error and just return an empty result. Instead now this case is correctly caught and a QiskitError exception is raised when using incorrect labels.

Aqua 0.7.3

ノートをアップグレードします。
  • The cvxpy dependency which is required for the svm classifier has been removed from the requirements list and made an optional dependency. This is because installing cvxpy is not seamless in every environment and often requires a compiler be installed to run. To use the svm classifier now you’ll need to install cvxpy by either running pip install cvxpy<1.1.0 or to install it with aqua running pip install qiskit-aqua[cvx].

バグ修正
  • The compose method of the CircuitOp used QuantumCircuit.combine which has been changed to use QuantumCircuit.compose. Using combine leads to the problem that composing an operator with a CircuitOp based on a named register does not chain the operators but stacks them. E.g. composing Z ^ 2 with a circuit based on a 2-qubit named register yielded a 4-qubit operator instead of a 2-qubit operator.

  • The MatrixOp.to_instruction method previously returned an operator and not an instruction. This method has been updated to return an Instruction. Note that this only works if the operator primitive is unitary, otherwise an error is raised upon the construction of the instruction.

  • The __hash__ method of the PauliOp class used the id() method which prevents set comparisons to work as expected since they rely on hash tables and identical objects used to not have identical hashes. Now, the implementation uses a hash of the string representation inline with the implementation in the Pauli class.

IBM Q Provider 0.7.2

変更なし

Qiskit 0.19.4

Terra 0.14.2

ノートをアップグレードします。
  • The circuit_to_gate and circuit_to_instruction converters had previously automatically included the generated gate or instruction in the active SessionEquivalenceLibrary. These converters now accept an optional equivalence_library keyword argument to specify if and where the converted instances should be registered. The default behavior is not to register the converted instance.

バグ修正
  • Implementations of the multi-controlled X Gate (MCXGrayCode, MCXRecursive and MCXVChain) have had their name properties changed to more accurately describe their implementation (mcx_gray, mcx_recursive, and mcx_vchain respectively.) Previously, these gates shared the name mcx` with ``MCXGate, which caused these gates to be incorrectly transpiled and simulated.

  • ControlledGate instances with a set ctrl_state were in some cases not being evaluated as equal, even if the compared gates were equivalent. This has been resolved.

  • Fixed the SI unit conversion for qiskit.pulse.SetFrequency. The SetFrequency instruction should be in Hz on the frontend and has to be converted to GHz when SetFrequency is converted to PulseQobjInstruction.

  • Open controls were implemented by modifying a gate's definition. However, when the gate already exists in the basis, this definition is not used, which yields incorrect circuits sent to a backend. This modifies the unroller to output the definition if it encounters a controlled gate with open controls.

Aer 0.5.2

変更なし

Ignis 0.3.0

変更なし

Aqua 0.7.2

プレリュード

VQE expectation computation with Aer qasm_simulator now defaults to a computation that has the expected shot noise behavior.

ノートをアップグレードします。
  • cvxpy is now in the requirements list as a dependency for qiskit-aqua. It is used for the quadratic program solver which is used as part of the qiskit.aqua.algorithms.QSVM. Previously cvxopt was an optional dependency that needed to be installed to use this functionality. This is no longer required as cvxpy will be installed with qiskit-aqua.

  • For state tomography run as part of qiskit.aqua.algorithms.HHL with a QASM backend the tomography fitter function qiskit.ignis.verification.StateTomographyFitter.fit() now gets called explicitly with the method set to lstsq to always use the least-squares fitting. Previously it would opportunistically try to use the cvx fitter if cvxpy were installed. But, the cvx fitter depends on a specifically configured cvxpy installation with an SDP solver installed as part of cvxpy which is not always present in an environment with cvxpy installed.

  • The VQE expectation computation using qiskit-aer’s qiskit.providers.aer.extensions.SnapshotExpectationValue instruction is not enabled by default anymore. This was changed to be the default in 0.7.0 because it is significantly faster, but it led to unexpected ideal results without shot noise (see #1013 for more details). The default has now changed back to match user expectations. Using the faster expectation computation is now opt-in by setting the new include_custom kwarg to True on the qiskit.aqua.algorithms.VQE constructor.

新機能

IBM Q Provider 0.7.2

変更なし

Qiskit 0.19.3

Terra 0.14.1

変更なし

Aer 0.5.2

バグ修正
  • Fixed bug with statevector and unitary simulators running a number of (parallel) shots equal to the number of CPU threads instead of only running a single shot.

  • Fixes the 「diagonal」 qobj gate instructions being applied incorrectly in the density matrix Qasm Simulator method.

  • Fixes bug where conditional gates were not being applied correctly on the density matrix simulation method.

  • Fix bug in CZ gate and Z gate for 「density_matrix_gpu」 and 「density_matrix_thrust」 QasmSimulator methods.

  • Fixes issue where memory requirements of simulation were not being checked on the QasmSimulator when using a non-automatic simulation method.

  • Fixed a memory leak that effected the GPU simulator methods

Ignis 0.3.0

変更なし

Aqua 0.7.1

変更なし

IBM Q Provider 0.7.2

バグ修正
  • qiskit.provider.ibmq.IBMQBackend.jobs() will now return the correct list of IBMQJob objects when the status kwarg is set to 'RUNNING'. Fixes #523

  • The package metadata has been updated to properly reflect the dependency on qiskit-terra >= 0.14.0. This dependency was implicitly added as part of the 0.7.0 release but was not reflected in the package requirements so it was previously possible to install qiskit-ibmq-provider with a version of qiskit-terra which was too old. Fixes #677

Qiskit 0.19.0

Terra 0.14.0

プレリュード

The 0.14.0 release includes several new features and bug fixes. The biggest change for this release is the introduction of a quantum circuit library in qiskit.circuit.library, containing some circuit families of interest.

The circuit library gives users access to a rich set of well-studied circuit families, instances of which can be used as benchmarks, as building blocks in building more complex circuits, or as a tool to explore quantum computational advantage over classical. The contents of this library will continue to grow and mature.

The initial release of the circuit library contains:

  • standard_gates: these are fixed-width gates commonly used as primitive building blocks, consisting of 1, 2, and 3 qubit gates. For example the XGate, RZZGate and CSWAPGate. The old location of these gates under qiskit.extensions.standard is deprecated.

  • generalized_gates: these are families that can generalize to arbitrarily many qubits, for example a Permutation or GMS (Global Molmer-Sorensen gate).

  • boolean_logic: circuits that transform basis states according to simple Boolean logic functions, such as ADD or XOR.

  • arithmetic: a set of circuits for doing classical arithmetic such as WeightedAdder and IntegerComparator.

  • basis_changes: circuits such as the quantum Fourier transform, QFT, that mathematically apply basis changes.

  • n_local: patterns to easily create large circuits with rotation and entanglement layers, such as TwoLocal which uses single-qubit rotations and two-qubit entanglements.

  • data_preparation: circuits that take classical input data and encode it in a quantum state that is difficult to simulate, e.g. PauliFeatureMap or ZZFeatureMap.

  • Other circuits that have proven interesting in the literature, such as QuantumVolume, GraphState, or IQP.

To allow easier use of these circuits as building blocks, we have introduced a compose() method of qiskit.circuit.QuantumCircuit for composition of circuits either with other circuits (by welding them at the ends and optionally permuting wires) or with other simpler gates:

>>> lhs.compose(rhs, qubits=[3, 2], inplace=True)
            ┌───┐                   ┌─────┐                ┌───┐
lqr_1_0: ───┤ H ├───    rqr_0: ──■──┤ Tdg ├    lqr_1_0: ───┤ H ├───────────────
            ├───┤              ┌─┴─┐└─────┘                ├───┤
lqr_1_1: ───┤ X ├───    rqr_1: ┤ X ├───────    lqr_1_1: ───┤ X ├───────────────
         ┌──┴───┴──┐           └───┘                    ┌──┴───┴──┐┌───┐
lqr_1_2: ┤ U1(0.1) ├  +                     =  lqr_1_2: ┤ U1(0.1) ├┤ X ├───────
         └─────────┘                                    └─────────┘└─┬─┘┌─────┐
lqr_2_0: ─────■─────                           lqr_2_0: ─────■───────■──┤ Tdg ├
            ┌─┴─┐                                          ┌─┴─┐        └─────┘
lqr_2_1: ───┤ X ├───                           lqr_2_1: ───┤ X ├───────────────
            └───┘                                          └───┘
lcr_0: 0 ═══════════                           lcr_0: 0 ═══════════════════════
lcr_1: 0 ═══════════                           lcr_1: 0 ═══════════════════════

With this, Qiskit’s circuits no longer assume an implicit initial state of \(|0\rangle\), and will not be drawn with this initial state. The all-zero initial state is still assumed on a backend when a circuit is executed.

新機能
  • A new method, has_entry(), has been added to the qiskit.circuit.EquivalenceLibrary class to quickly check if a given gate has any known decompositions in the library.

  • A new class IQP, to construct an instantaneous quantum polynomial circuit, has been added to the circuit library module qiskit.circuit.library.

  • A new compose() method has been added to qiskit.circuit.QuantumCircuit. It allows composition of two quantum circuits without having to turn one into a gate or instruction. It also allows permutations of qubits/clbits at the point of composition, as well as optional inplace modification. It can also be used in place of append(), as it allows composing instructions and operators onto the circuit as well.

  • qiskit.circuit.library.Diagonal circuits have been added to the circuit library. These circuits implement diagonal quantum operators (consisting of non-zero elements only on the diagonal). They are more efficiently simulated by the Aer simulator than dense matrices.

  • Add from_label() method to the qiskit.quantum_info.Clifford class for initializing as the tensor product of single-qubit I, X, Y, Z, H, or S gates.

  • Schedule transformer qiskit.pulse.reschedule.compress_pulses() performs an optimization pass to reduce the usage of waveform memory in hardware by replacing multiple identical instances of a pulse in a pulse schedule with a single pulse. For example:

    from qiskit.pulse import reschedule
    
    schedules = []
    for _ in range(2):
        schedule = Schedule()
        drive_channel = DriveChannel(0)
        schedule += Play(SamplePulse([0.0, 0.1]), drive_channel)
        schedule += Play(SamplePulse([0.0, 0.1]), drive_channel)
        schedules.append(schedule)
    
    compressed_schedules = reschedule.compress_pulses(schedules)
    
  • The qiskit.transpiler.Layout has a new method reorder_bits() that is used to reorder a list of virtual qubits based on the layout object.

  • Two new methods have been added to the qiskit.providers.models.PulseBackendConfiguration for interacting with channels.

    • get_channel_qubits() to get a list of all qubits operated by the given channel and

    • get_qubit_channel() to get a list of channels operating on the given qubit.

  • New qiskit.extensions.HamiltonianGate and qiskit.circuit.QuantumCircuit.hamiltonian() methods are introduced, representing Hamiltonian evolution of the circuit wavefunction by a user-specified Hermitian Operator and evolution time. The evolution time can be a Parameter, allowing the creation of parameterized UCCSD or QAOA-style circuits which compile to UnitaryGate objects if time parameters are provided. The Unitary of a HamiltonianGate with Hamiltonian Operator H and time parameter t is \(e^{-iHt}\).

  • The circuit library module qiskit.circuit.library now provides a new boolean logic AND circuit, qiskit.circuit.library.AND, and OR circuit, qiskit.circuit.library.OR, which implement the respective operations on a variable number of provided qubits.

  • New fake backends are added under qiskit.test.mock. These include mocked versions of ibmq_armonk, ibmq_essex, ibmq_london, ibmq_valencia, ibmq_cambridge, ibmq_paris, ibmq_rome, and ibmq_athens. As with 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 can be used for local testing, compilation and simulation.

  • The last_update_date parameter for BackendProperties can now also be passed in as a datetime object. Previously only a string in ISO8601 format was accepted.

  • Adds qiskit.quantum_info.Statevector.from_int() and qiskit.quantum_info.DensityMatrix.from_int() methods that allow constructing a computational basis state for specified system dimensions.

  • The methods on the qiskit.circuit.QuantumCircuit class for adding gates (for example h()) which were previously added dynamically at run time to the class definition have been refactored to be statically defined methods of the class. This means that static analyzer (such as IDEs) can now read these methods.

ノートをアップグレードします。
非推奨通知
  • The qiskit.dagcircuit.DAGCircuit.compose() method now takes a list of qubits/clbits that specify the positional order of bits to compose onto. The dictionary-based method of mapping using the edge_map argument is deprecated and will be removed in a future release.

  • The combine_into_edge_map() method for the qiskit.transpiler.Layout class has been deprecated and will be removed in a future release. Instead, the new method reorder_bits() should be used to reorder a list of virtual qubits according to the layout object.

  • Passing a qiskit.pulse.ControlChannel object in via the parameter channel for the qiskit.providers.models.PulseBackendConfiguration method control() has been deprecated and will be removed in a future release. The ControlChannel objects are now generated from the backend configuration channels attribute which has the information of all channels and the qubits they operate on. Now, the method control() is expected to take the parameter qubits of the form (control_qubit, target_qubit) and type list or tuple, and returns a list of control channels.

  • The AND and OR methods of qiskit.circuit.QuantumCircuit are deprecated and will be removed in a future release. Instead you should use the circuit library boolean logic classes qiskit.circuit.library.AND amd qiskit.circuit.library.OR and then append those objects to your class. For example:

    from qiskit import QuantumCircuit
    from qiskit.circuit.library import AND
    
    qc = QuantumCircuit(2)
    qc.h(0)
    qc.cx(0, 1)
    
    qc_and = AND(2)
    
    qc.compose(qc_and, inplace=True)
    
  • The qiskit.extensions.standard module is deprecated and will be removed in a future release. The gate classes in that module have been moved to qiskit.circuit.library.standard_gates.

バグ修正
  • The qiskit.circuit.QuantumCircuit methods inverse(), mirror() methods, as well as the QuantumCircuit.data setter would generate an invalid circuit when used on a parameterized circuit instance. This has been resolved and these methods should now work with a parameterized circuit. Fixes #4235

  • Previously when creating a controlled version of a standard qiskit gate if a ctrl_state was specified a generic ControlledGate object would be returned whereas without it a standard qiskit controlled gate would be returned if it was defined. This PR allows standard qiskit controlled gates to understand ctrl_state.

    Additionally, this PR fixes what might be considered a bug where setting the ctrl_state of an already controlled gate would assume the specified state applied to the full control width instead of the control qubits being added. For instance,:

    circ = QuantumCircuit(2)
    circ.h(0)
    circ.x(1)
    gate = circ.to_gate()
    cgate = gate.control(1)
    c3gate = cgate.control(2, ctrl_state=0)
    

    would apply ctrl_state to all three control qubits instead of just the two control qubits being added.

  • Fixed a bug in random_clifford() that stopped it from sampling the full Clifford group. Fixes #4271

  • The qiskit.circuit.Instruction method qiskit.circuit.Instruction.is_parameterized() method had previously returned True for any Instruction instance which had a qiskit.circuit.Parameter in any element of its params array, even if that Parameter had been fully bound. This has been corrected so that .is_parameterized will return False when the instruction is fully bound.

  • qiskit.circuit.ParameterExpression.subs() had not correctly detected some cases where substituting parameters would result in a two distinct Parameters objects in an expression with the same name. This has been corrected so a CircuitError will be raised in these cases.

  • Improve performance of qiskit.quantum_info.Statevector and qiskit.quantum_info.DensityMatrix for low-qubit circuit simulations by optimizing the class __init__ methods. Fixes #4281

  • The function qiskit.compiler.transpile() now correctly handles when the parameter basis_gates is set to None. This will allow any gate in the output tranpiled circuit, including gates added by the transpilation process. Note that using this parameter may have some unintended consequences during optimization. Some transpiler passes depend on having a basis_gates set. For example, qiskit.transpiler.passes.Optimize1qGates only optimizes the chains of u1, u2, and u3 gates and without basis_gates it is unable to unroll gates that otherwise could be optimized:

    from qiskit import *
    
    q = QuantumRegister(1, name='q')
    circuit = QuantumCircuit(q)
    circuit.h(q[0])
    circuit.u1(0.1, q[0])
    circuit.u2(0.1, 0.2, q[0])
    circuit.h(q[0])
    circuit.u3(0.1, 0.2, 0.3, q[0])
    
    result = transpile(circuit, basis_gates=None, optimization_level=3)
    result.draw()
    
         ┌───┐┌─────────────┐┌───┐┌─────────────────┐
    q_0: ┤ H ├┤ U2(0.1,0.3) ├┤ H ├┤ U3(0.1,0.2,0.3) ├
         └───┘└─────────────┘└───┘└─────────────────┘
    

    Fixes #3017

Other Notes

Aer 0.5.1

変更なし

Ignis 0.3.0

変更なし

Aqua 0.7.0

プレリュード

The Qiskit Aqua 0.7.0 release introduces a lot of new functionality along with an improved integration with qiskit.circuit.QuantumCircuit objects. The central contributions are the Qiskit’s optimization module, a complete refactor on Operators, using circuits as native input for the algorithms and removal of the declarative JSON API.

Optimization module

The qiskit.optimization` module now offers functionality for modeling and solving quadratic programs. It provides various near-term quantum and conventional algorithms, such as the MinimumEigenOptimizer (covering e.g. VQE or QAOA) or CplexOptimizer, as well as a set of converters to translate between different problem representations, such as QuadraticProgramToQubo. See the changelog for a list of the added features.

Operator flow

The operator logic provided in qiskit.aqua.operators` was completely refactored and is now a full set of tools for constructing physically-intuitive quantum computations. It contains state functions, operators and measurements and internally relies on Terra’s Operator objects. Computing expectation values and evolutions was heavily simplified and objects like the ExpectationFactory produce the suitable, most efficient expectation algorithm based on the Operator input type. See the changelog for a overview of the added functionality.

Native circuits

Algorithms commonly use parameterized circuits as input, for example the VQE, VQC or QSVM. Previously, these inputs had to be of type VariationalForm or FeatureMap which were wrapping the circuit object. Now circuits are natively supported in these algorithms, which means any individually constructed QuantumCircuit can be passed to these algorithms. In combination with the release of the circuit library which offers a wide collection of circuit families, it is now easy to construct elaborate circuits as algorithm input.

Declarative JSON API

The ability of running algorithms using dictionaries as parameters as well as using the Aqua interfaces GUI has been removed.

IBM Q Provider 0.7.0

新機能
ノートをアップグレードします。
非推奨通知
バグ修正
  • Fixed an issue where nest_asyncio.apply() may raise an exception if there is no asyncio loop due to threading.

Qiskit 0.18.3

Terra 0.13.0

変更なし

Aer 0.5.1

ノートをアップグレードします。
  • Changes how transpilation passes are handled in the C++ Controller classes so that each pass must be explicitly called. This allows for greater customization on when each pass should be called, and with what parameters. In particular this enables setting different parameters for the gate fusion optimization pass depending on the QasmController simulation method.

  • Add gate_length_units kwarg to qiskit.providers.aer.noise.NoiseModel.from_device() for specifying custom gate_lengths in the device noise model function to handle unit conversions for internal code.

  • Add Controlled-Y (「cy」) gate to the Stabilizer simulator methods supported gateset.

  • For Aer’s backend the jsonschema validation of input qobj objects from terra is now opt-in instead of being enabled by default. If you want to enable jsonschema validation of qobj set the validate kwarg on the qiskit.providers.aer.QasmSimualtor.run() method for the backend object to True.

バグ修正
  • Remove 「extended_stabilizer」 from the automatically selected simulation methods. This is needed as the extended stabilizer method is not exact and may give incorrect results for certain circuits unless the user knows how to optimize its configuration parameters.

    The automatic method now only selects from 「stabilizer」, 「density_matrix」, and 「statevector」 methods. If a non-Clifford circuit that is too large for the statevector method is executed an exception will be raised suggesting you could try explicitly using the 「extended_stabilizer」 or 「matrix_product_state」 methods instead.

  • Fixes Controller classes so that the ReduceBarrier transpilation pass is applied first. This prevents barrier instructions from preventing truncation of unused qubits if the only instruction defined on them was a barrier.

  • Disables gate fusion for the matrix product state simulation method as this was causing issues with incorrect results being returned in some cases.

  • Fix error in gate time unit conversion for device noise model with thermal relaxation errors and gate errors. The error probability the depolarizing error was being calculated with gate time in microseconds, while for thermal relaxation it was being calculated in nanoseconds. This resulted in no depolarizing error being applied as the incorrect units would make the device seem to be coherence limited.

  • Fix bug in incorrect composition of QuantumErrors when the qubits of composed instructions differ.

  • Fix issue where the 「diagonal」 gate is checked to be unitary with too high a tolerance. This was causing diagonals generated from Numpy functions to often fail the test.

  • Fix remove-barrier circuit optimization pass to be applied before qubit trucation. This fixes an issue where barriers inserted by the Terra transpiler across otherwise inactive qubits would prevent them from being truncated.

Ignis 0.3.0

変更なし

Aqua 0.6.6

変更なし

IBM Q Provider 0.6.1

変更なし

Qiskit 0.18.0

Terra 0.13.0

プレリュード

0.13.0リリースは数多くの大きな変更があります。このリリースの主なハイライトは以下の通りです:

トランスパイラーでは、全操作の背後にある基本的データ構造である qiskit.dagcircuit.DAGCircuit クラスを構築するため使われていたグラフ・ライブラリを、パフォーマンスを大幅に向上させるために retworkx に基づいて切り替えました。0.13.0リリースにおける回路のトランスパイレーションの速度は、以前のリリースよりも大幅に高速になるはずです。

Pulse命令を構築するスタイルが劇的に簡略化されました。数々の``Command`` が廃止され、Instruction の統合セットがサポートされました。

The qiskit.quantum_info module includes several new functions for generating random operators (such as Cliffords and quantum channels) and for computing the diamond norm of quantum channels; upgrades to the Statevector and DensityMatrix classes to support computing measurement probabilities and sampling measurements; and several new classes are based on the symplectic representation of Pauli matrices. These new classes include Clifford operators (Clifford), N-qubit matrices that are sparse in the Pauli basis (SparsePauliOp), lists of Pauli’s (PauliTable), and lists of stabilizers (StabilizerTable).

This release also has vastly improved documentation across Qiskit, including improved documentation for the qiskit.circuit, qiskit.pulse and qiskit.quantum_info modules.

Additionally, the naming of gate objects and QuantumCircuit methods have been updated to be more consistent. This has resulted in several classes and methods being deprecated as things move to a more consistent naming scheme.

For full details on all the changes made in this release see the detailed release notes below.

新機能
  • Added a new circuit library module qiskit.circuit.library. This will be a place for constructors of commonly used circuits that can be used as building blocks for larger circuits or applications.

  • The qiskit.providers.BaseJob class has four new methods:

    These methods are used to check wheter a job is in a given job status.

  • Add ability to specify control conditioned on a qubit being in the ground state. The state of the control qubits is represented by an integer. For example:

    from qiskit import QuantumCircuit
    from qiskit.extensions.standard import XGate
    
    qc = QuantumCircuit(4)
    cgate = XGate().control(3, ctrl_state=6)
    qc.append(cgate, [0, 1, 2, 3])
    

    Creates a four qubit gate where the fourth qubit gets flipped if the first qubit is in the ground state and the second and third qubits are in the excited state. If ctrl_state is None, the default, control is conditioned on all control qubits being excited.

  • A new jupyter widget, %circuit_library_info has been added to qiskit.tools.jupyter. This widget is used for visualizing details about circuits built from the circuit library. For example

    from qiskit.circuit.library import XOR
    import qiskit.tools.jupyter
    circuit = XOR(5, seed=42)
    %circuit_library_info circuit
    
  • A new kwarg option, formatted , has been added to qiskit.circuit.QuantumCircuit.qasm() . When set to True the method will print a syntax highlighted version (using pygments) to stdout and return None (which differs from the normal behavior of returning the QASM code as a string).

  • A new kwarg option, filename , has been added to qiskit.circuit.QuantumCircuit.qasm(). When set to a path the method will write the QASM code to that file. It will then continue to output as normal.

  • A new instruction SetFrequency which allows users to change the frequency of the PulseChannel. This is done in the following way:

    from qiskit.pulse import Schedule
    from qiskit.pulse import SetFrequency
    
    sched = pulse.Schedule()
    sched += SetFrequency(5.5e9, DriveChannel(0))
    

    In this example, the frequency of all pulses before the SetFrequency command will be the default frequency and all pulses applied to drive channel zero after the SetFrequency command will be at 5.5 GHz. Users of SetFrequency should keep in mind any hardware limitations.

  • A new method, assign_parameters() has been added to the qiskit.circuit.QuantumCircuit class. This method accepts a parameter dictionary with both floats and Parameters objects in a single dictionary. In other words this new method allows you to bind floats, Parameters or both in a single dictionary.

    Also, by using the inplace kwarg it can be specified you can optionally modify the original circuit in place. By default this is set to False and a copy of the original circuit will be returned from the method.

  • A new method num_nonlocal_gates() has been added to the qiskit.circuit.QuantumCircuit class. This method will return the number of gates in a circuit that involve 2 or or more qubits. These gates are more costly in terms of time and error to implement.

  • The qiskit.circuit.QuantumCircuit method iso() for adding an Isometry gate to the circuit has a new alias. You can now call qiskit.circuit.QuantumCircuit.isometry() in addition to calling iso.

  • A description attribute has been added to the CouplingMap class for storing a short description for different coupling maps (e.g. full, grid, line, etc.).

  • A new method compose() has been added to the DAGCircuit class for composing two circuits via their DAGs.

    dag_left.compose(dag_right, edge_map={right_qubit0: self.left_qubit1,
                                      right_qubit1: self.left_qubit4,
                                      right_clbit0: self.left_clbit1,
                                      right_clbit1: self.left_clbit0})
    
                ┌───┐                    ┌─────┐┌─┐
    lqr_1_0: ───┤ H ├───     rqr_0: ──■──┤ Tdg ├┤M├
                ├───┤               ┌─┴─┐└─┬─┬─┘└╥┘
    lqr_1_1: ───┤ X ├───     rqr_1: ┤ X ├──┤M├───╫─
             ┌──┴───┴──┐            └───┘  └╥┘   ║
    lqr_1_2: ┤ U1(0.1) ├  +  rcr_0: ════════╬════╩═  =
             └─────────┘                    ║
    lqr_2_0: ─────■─────     rcr_1: ════════╩══════
                ┌─┴─┐
    lqr_2_1: ───┤ X ├───
                └───┘
    lcr_0:   ═══════════
    
    lcr_1:   ═══════════
    
                ┌───┐
    lqr_1_0: ───┤ H ├──────────────────
                ├───┤        ┌─────┐┌─┐
    lqr_1_1: ───┤ X ├─────■──┤ Tdg ├┤M├
             ┌──┴───┴──┐  │  └─────┘└╥┘
    lqr_1_2: ┤ U1(0.1) ├──┼──────────╫─
             └─────────┘  │          ║
    lqr_2_0: ─────■───────┼──────────╫─
                ┌─┴─┐   ┌─┴─┐  ┌─┐   ║
    lqr_2_1: ───┤ X ├───┤ X ├──┤M├───╫─
                └───┘   └───┘  └╥┘   ║
    lcr_0:   ═══════════════════╩════╬═
                                     ║
    lcr_1:   ════════════════════════╩═
    
  • The mock backends in qiskit.test.mock now have a functional run() method that will return results similar to the real devices. If qiskit-aer is installed a simulation will be run with a noise model built from the device snapshot in the fake backend. Otherwise, qiskit.providers.basicaer.QasmSimulatorPy will be used to run an ideal simulation. Additionally, if a pulse experiment is passed to run and qiskit-aer is installed the PulseSimulator will be used to simulate the pulse schedules.

  • The qiskit.result.Result() method get_counts() will now return a list of all the counts available when there are multiple circuits in a job. This works when get_counts() is called with no arguments.

    The main consideration for this feature was for drawing all the results from multiple circuits in the same histogram. For example it is now possible to do something like:

    from qiskit import execute
    from qiskit import QuantumCircuit
    from qiskit.providers.basicaer import BasicAer
    from qiskit.visualization import plot_histogram
    
    sim = BasicAer.get_backend('qasm_simulator')
    
    qc = QuantumCircuit(2)
    qc.h(0)
    qc.cx(0, 1)
    qc.measure_all()
    result = execute([qc, qc, qc], sim).result()
    
    plot_histogram(result.get_counts())
    
    _images/release_notes_11_0.png
  • A new kwarg, initial_state has been added to the qiskit.visualization.circuit_drawer() function and the QuantumCircuit method draw(). When set to True the initial state will be included in circuit visualizations for all backends. For example:

    from qiskit import QuantumCircuit
    
    circuit = QuantumCircuit(2)
    circuit.measure_all()
    circuit.draw(output='mpl', initial_state=True)
    
    _images/release_notes_12_0.png
  • It is now possible to insert a callable into a qiskit.pulse.InstructionScheduleMap which returns a new qiskit.pulse.Schedule when it is called with parameters. For example:

    def test_func(x):
       sched = Schedule()
       sched += pulse_lib.constant(int(x), amp_test)(DriveChannel(0))
       return sched
    
    inst_map = InstructionScheduleMap()
    inst_map.add('f', (0,), test_func)
    output_sched = inst_map.get('f', (0,), 10)
    assert output_sched.duration == 10
    
  • Two new gate classes, qiskit.extensions.iSwapGate and qiskit.extensions.DCXGate, along with their QuantumCircuit methods iswap() and dcx() have been added to the standard extensions. These gates, which are locally equivalent to each other, can be used to enact particular XY interactions. A brief motivation for these gates can be found in: arxiv.org/abs/quant-ph/0209035

  • The qiskit.providers.BaseJob class now has a new method wait_for_final_state() that polls for the job status until the job reaches a final state (such as DONE or ERROR). This method also takes an optional callback kwarg which takes a Python callable that will be called during each iteration of the poll loop.

  • The search_width and search_depth attributes of the qiskit.transpiler.passes.LookaheadSwap pass are now settable when initializing the pass. A larger search space can often lead to more optimized circuits, at the cost of longer run time.

  • The number of qubits in BackendConfiguration can now be accessed via the property num_qubits. It was previously only accessible via the n_qubits attribute.

  • Two new methods, angles() and angles_and_phase(), have been added to the qiskit.quantum_info.OneQubitEulerDecomposer class. These methods will return the relevant parameters without validation, and calling the OneQubitEulerDecomposer object will perform the full synthesis with validation.

  • An RR decomposition basis has been added to the qiskit.quantum_info.OneQubitEulerDecomposer for decomposing an arbitrary 2x2 unitary into a two RGate circuit.

  • Adds the ability to set qargs to objects which are subclasses of the abstract BaseOperator class. This is done by calling the object op(qargs) (where op is an operator class) and will return a shallow copy of the original object with a qargs property set. When such an object is used with the compose() or dot() methods the internal value for qargs will be used when the qargs method kwarg is not used. This allows for subsystem composition using binary operators, for example:

    from qiskit.quantum_info import Operator
    
    init = Operator.from_label('III')
    x = Operator.from_label('X')
    h = Operator.from_label('H')
    init @ x([0]) @ h([1])
    
  • Adds qiskit.quantum_info.Clifford operator class to the quantum_info module. This operator is an efficient symplectic representation an N-qubit unitary operator from the Clifford group. This class includes a to_circuit() method for compilation into a QuantumCircuit of Clifford gates with a minimal number of CX gates for up to 3-qubits. It also providers general compilation for N > 3 qubits but this method is not optimal in the number of two-qubit gates.

  • Adds qiskit.quantum_info.SparsePauliOp operator class. This is an efficient representaiton of an N-qubit matrix that is sparse in the Pauli basis and uses a qiskit.quantum_info.PauliTable and vector of complex coefficients for its data structure.

    This class supports much of the same functionality of the qiskit.quantum_info.Operator class so SparsePauliOp objects can be tensored, composed, scalar multiplied, added and subtracted.

    Numpy arrays or Operator objects can be converted to a SparsePauliOp using the :class:`~qiskit.quantum_info.SparsePauliOp.from_operator method. SparsePauliOp can be convered to a sparse csr_matrix or dense Numpy array using the to_matrix method, or to an Operator object using the to_operator method.

    A SparsePauliOp can be iterated over in terms of its PauliTable components and coefficients, its coefficients and Pauli string labels using the label_iter() method, and the (dense or sparse) matrix components using the matrix_iter() method.

  • Add qiskit.quantum_info.diamond_norm() function for computing the diamond norm (completely-bounded trace-norm) of a quantum channel. This can be used to compute the distance between two quantum channels using diamond_norm(chan1 - chan2).

  • A new class qiskit.quantum_info.PauliTable has been added. This is an efficient symplectic representation of a list of N-qubit Pauli operators. Some features of this class are:

    • PauliTable objects may be composed, and tensored which will return a PauliTable object with the combination of the operation ( compose(), dot(), expand(), tensor()) between each element of the first table, with each element of the second table.

    • Addition of two tables acts as list concatination of the terms in each table (+).

    • Pauli tables can be sorted by lexicographic (tensor product) order or by Pauli weights (sort()).

    • Duplicate elements can be counted and deleted (unique()).

    • The PauliTable may be iterated over in either its native symplectic boolean array representation, as Pauli string labels (label_iter()), or as dense Numpy array or sparse CSR matrices (matrix_iter()).

    • Checking commutation between elements of the Pauli table and another Pauli (commutes()) or Pauli table (commutes_with_all())

    See the qiskit.quantum_info.PauliTable class API documentation for additional details.

  • Adds qiskit.quantum_info.StabilizerTable class. This is a subclass of the qiskit.quantum_info.PauliTable class which includes a boolean phase vector along with the Pauli table array. This represents a list of Stabilizer operators which are real-Pauli operators with +1 or -1 coefficient. Because the stabilizer matrices are real the "Y" label matrix is defined as [[0, 1], [-1, 0]]. See the API documentation for additional information.

  • Adds qiskit.quantum_info.pauli_basis() function which returns an N-qubit Pauli basis as a qiskit.quantum_info.PauliTable object. The ordering of this basis can either be by standard lexicographic (tensor product) order, or by the number of non-identity Pauli terms (weight).

  • Adds qiskit.quantum_info.ScalarOp operator class that represents a scalar multiple of an identity operator. This can be used to initialize an identity on arbitrary dimension subsystems and it will be implicitly converted to other BaseOperator subclasses (such as an qiskit.quantum_info.Operator or qiskit.quantum_info.SuperOp) when it is composed with, or added to, them.

    Example: Identity operator

    from qiskit.quantum_info import ScalarOp, Operator
    
    X = Operator.from_label('X')
    Z = Operator.from_label('Z')
    
    init = ScalarOp(2 ** 3)  # 3-qubit identity
    op = init @ X([0]) @ Z([1]) @ X([2])  # Op XZX
    
  • A new method, reshape(), has been added to the qiskit.quantum_innfo.Operator class that returns a shallow copy of an operator subclass with reshaped subsystem input or output dimensions. The combined dimensions of all subsystems must be the same as the original operator or an exception will be raised.

  • Adds qiskit.quantum_info.random_clifford() for generating a random qiskit.quantum_info.Clifford operator.

  • Add qiskit.quantum_info.random_quantum_channel() function for generating a random quantum channel with fixed Choi-rank in the Stinespring representation.

  • Add qiskit.quantum_info.random_hermitian() for generating a random Hermitian Operator.

  • Add qiskit.quantum_info.random_statevector() for generating a random Statevector.

  • Adds qiskit.quantum_info.random_pauli_table() for generating a random qiskit.quantum_info.PauliTable.

  • Adds qiskit.quantum_info.random_stabilizer_table() for generating a random qiskit.quantum_info.StabilizerTable.

  • Add a num_qubits attribute to qiskit.quantum_info.StateVector and qiskit.quantum_info.DensityMatrix classes. This returns the number of qubits for N-qubit states and returns None for non-qubit states.

  • Adds to_dict() and to_dict() methods to convert qiskit.quantum_info.Statevector and qiskit.quantum_info.DensityMatrix objects into Bra-Ket notation dictionary.

    Example

    from qiskit.quantum_info import Statevector
    
    state = Statevector.from_label('+0')
    print(state.to_dict())
    
    {'00': (0.7071067811865475+0j), '10': (0.7071067811865475+0j)}
    
    from qiskit.quantum_info import DensityMatrix
    
    state = DensityMatrix.from_label('+0')
    print(state.to_dict())
    
    {'00|00': (0.4999999999999999+0j), '10|00': (0.4999999999999999+0j), '00|10': (0.4999999999999999+0j), '10|10': (0.4999999999999999+0j)}
    
  • Adds probabilities() and probabilities() to qiskit.quantum_info.Statevector and qiskit.quantum_info.DensityMatrix classes which return an array of measurement outcome probabilities in the computational basis for the specified subsystems.

    Example

    from qiskit.quantum_info import Statevector
    
    state = Statevector.from_label('+0')
    print(state.probabilities())
    
    [0.5 0.  0.5 0. ]
    
    from qiskit.quantum_info import DensityMatrix
    
    state = DensityMatrix.from_label('+0')
    print(state.probabilities())
    
    [0.5 0.  0.5 0. ]
    
  • Adds probabilities_dict() and probabilities_dict() to qiskit.quantum_info.Statevector and qiskit.quantum_info.DensityMatrix classes which return a count-style dictionary array of measurement outcome probabilities in the computational basis for the specified subsystems.

    from qiskit.quantum_info import Statevector
    
    state = Statevector.from_label('+0')
    print(state.probabilities_dict())
    
    {'00': 0.4999999999999999, '10': 0.4999999999999999}
    
    from qiskit.quantum_info import DensityMatrix
    
    state = DensityMatrix.from_label('+0')
    print(state.probabilities_dict())
    
    {'00': 0.4999999999999999, '10': 0.4999999999999999}
    
  • Add sample_counts() and sample_memory() methods to the Statevector and DensityMatrix classes for sampling measurement outcomes on subsystems.

    Example:

    Generate a counts dictionary by sampling from a statevector

    from qiskit.quantum_info import Statevector
    
    psi = Statevector.from_label('+0')
    shots = 1024
    
    # Sample counts dictionary
    counts = psi.sample_counts(shots)
    print('Measure both:', counts)
    
    # Qubit-0
    counts0 = psi.sample_counts(shots, [0])
    print('Measure Qubit-0:', counts0)
    
    # Qubit-1
    counts1 = psi.sample_counts(shots, [1])
    print('Measure Qubit-1:', counts1)
    
    Measure both: {'00': 515, '10': 509}
    Measure Qubit-0: {'0': 1024}
    Measure Qubit-1: {'0': 512, '1': 512}
    

    Return the array of measurement outcomes for each sample

    from qiskit.quantum_info import Statevector
    
    psi = Statevector.from_label('-1')
    shots = 10
    
    # Sample memory
    mem = psi.sample_memory(shots)
    print('Measure both:', mem)
    
    # Qubit-0
    mem0 = psi.sample_memory(shots, [0])
    print('Measure Qubit-0:', mem0)
    
    # Qubit-1
    mem1 = psi.sample_memory(shots, [1])
    print('Measure Qubit-1:', mem1)
    
    Measure both: ['11' '11' '01' '11' '01' '11' '11' '01' '01' '11']
    Measure Qubit-0: ['1' '1' '1' '1' '1' '1' '1' '1' '1' '1']
    Measure Qubit-1: ['1' '1' '1' '1' '1' '0' '0' '0' '0' '1']
    
  • Adds a measure() method to the qiskit.quantum_info.Statevector and qiskit.quantum_info.DensityMatrix quantum state classes. This allows sampling a single measurement outcome from the specified subsystems and collapsing the statevector to the post-measurement computational basis state. For example

    from qiskit.quantum_info import Statevector
    
    psi = Statevector.from_label('+1')
    
    # Measure both qubits
    outcome, psi_meas = psi.measure()
    print("measure([0, 1]) outcome:", outcome, "Post-measurement state:")
    print(psi_meas)
    
    # Measure qubit-1 only
    outcome, psi_meas = psi.measure([1])
    print("measure([1]) outcome:", outcome, "Post-measurement state:")
    print(psi_meas)
    
    measure([0, 1]) outcome: 11 Post-measurement state:
    Statevector([0.+0.j, 0.+0.j, 0.+0.j, 1.+0.j],
                dims=(2, 2))
    measure([1]) outcome: 0 Post-measurement state:
    Statevector([-0.+0.j,  1.+0.j, -0.+0.j,  0.+0.j],
                dims=(2, 2))
    
  • Adds a reset() method to the qiskit.quantum_info.Statevector and qiskit.quantum_info.DensityMatrix quantum state classes. This allows reseting some or all subsystems to the \(|0\rangle\) state. For example

    from qiskit.quantum_info import Statevector
    
    psi = Statevector.from_label('+1')
    
    # Reset both qubits
    psi_reset = psi.reset()
    print("Post reset state: ")
    print(psi_reset)
    
    # Reset qubit-1 only
    psi_reset = psi.reset([1])
    print("Post reset([1]) state: ")
    print(psi_reset)
    
    Post reset state: 
    Statevector([1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
                dims=(2, 2))
    Post reset([1]) state: 
    Statevector([-0.+0.j,  1.+0.j, -0.+0.j,  0.+0.j],
                dims=(2, 2))
    
  • A new visualization function qiskit.visualization.visualize_transition() for visualizing single qubit gate transitions has been added. It takes in a single qubit circuit and returns an animation of qubit state transitions on a Bloch sphere. To use this function you must have installed the dependencies for and configured globally a matplotlib animtion writer. You can refer to the matplotlib documentation for more details on this. However, in the default case simply ensuring that FFmpeg is installed is sufficient to use this function.

    It supports circuits with the following gates:

    • HGate

    • XGate

    • YGate

    • ZGate

    • RXGate

    • RYGate

    • RZGate

    • SGate

    • SdgGate

    • TGate

    • TdgGate

    • U1Gate

    For example:

    from qiskit.visualization import visualize_transition
    from qiskit import *
    
    qc = QuantumCircuit(1)
    qc.h(0)
    qc.ry(70,0)
    qc.rx(90,0)
    qc.rz(120,0)
    
    visualize_transition(qc, fpg=20, spg=1, trace=True)