Qiskit 0.20 release notes
0.20.1
Terra 0.15.2
Bug Fixes
- When accessing the
definition
attribute of a parameterizedGate
instance, the generatedQuantumCircuit
had been generated with an invalidParameterTable
, such that reading fromQuantumCircuit.parameters
or callingQuantumCircuit.bind_parameters
would incorrectly report the unbound parameters. This has been resolved. SXGate().inverse()
had previously returned an ‘sx_dg’ gate with a correctdefinition
but incorrectto_matrix
. This has been updated such thatSXGate().inverse()
returns anSXdgGate()
and vice versa.Instruction.inverse()
, when not overridden by a subclass, would in some cases return aGate
instance with an incorrectto_matrix
method. The instances of incorrectto_matrix
methods have been removed.- For
C3XGate
with a non-zeroangle
, inverting the gate viaC3XGate.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 anMCXVChain
gate would raise an error. - Previously, when creating a multiply controlled phase gate via
PhaseGate.control
, anMCU1Gate
gate had been returned. This has been had corrected so that anMCPhaseGate
is returned. - Previously, attempting to decompose a circuit containing an
MCPhaseGate
would raise an error due to an inconsistency in the definition of theMCPhaseGate
. This has been corrected. QuantumCircuit.compose
andDAGCircuit.compose
had, in some cases, incorrectly translated conditional gates if the input circuit contained more than oneClassicalRegister
. This has been resolved.- Fixed an issue when creating a
qiskit.result.Counts
object from an empty data dictionary. Now this will create an emptyCounts
object. Themost_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
andcregs
properties accordingly, but not thequbits
andclbits
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 theextend
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
0.20.0
Terra 0.15.1
Prelude
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.
New Features
-
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 toDAGDependency
. These functions are:circuit_to_dagdependency()
to convert from aQuantumCircuit
object to aDAGDependency
object.dagdependency_to_circuit()
to convert from aDAGDependency
object to aQuantumCircuit
object.dag_to_dagdependency()
to convert from aDAGCircuit
object to aDAGDependency
object.dagdependency_to_dag()
to convert from aDAGDependency
object to aDAGCircuit
object.
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 theirdefinition
property, stopping when reaching either the specifiedbasis_gates
or a set of gates in the providedEquivalenceLibrary
. The second,BasisTranslator
, uses the set of translations in the providedEquivalenceLibrary
to re-write circuit instructions in a specified basis. -
A new
translation_method
keyword argument has been added totranspile()
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:'unroller'
: to use theUnroller
pass'translator'
: to use theBasisTranslator
pass.'synthesis'
: to use theUnitarySynthesis
pass.
The default value is
'translator'
. -
A new class for handling counts result data,
qiskit.result.Counts
, has been added. This class is a subclass ofdict
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. ACounts
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 networkxMultiDiGraph
object (in the format returned byto_networkx()
) and will return a newDAGCircuit
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 toassemble()
andexecute()
. For backends that support this featureinit_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 toTrue
meaning that all qubits can assumed to be in the ground state at the start of each shot. However, wheninit_qubits
is set toFalse
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 toqiskit.compiler.assemble()
,qiskit.execute.execute()
, and the constructor forPulseQobjtConfig
.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 therep_delays
from a backend’sPulseBackendConfiguration
object which can be accessed asbackend.configuration().rep_delays
).The
rep_delay
kwarg will only work on backends which allow for dynamic repetition time. This will also be indicated in thePulseBackendConfiguration
object for a backend as thedynamic_reprate_enabled
attribute. Ifdynamic_reprate_enabled
isFalse
then therep_time
value specified forqiskit.compiler.assemble()
,qiskit.execute.execute()
, or the constructor forPulseQobjtConfig
will be used rather thanrep_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 inqiskit.schemas
has been updated to include therep_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 includerep_delay_range
anddefault_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 theqiskit.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 theglobal_phase
attribute theto_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 betweenQuantumCircuit
andDAGCircuit
. -
Two new classes,
AncillaRegister
andAncillaQubit
have been added to theqiskit.circuit
module. These are subclasses ofQuantumRegister
andQubit
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 theQuantumCircuit
. This method will return a controlled version of theQuantumCircuit
object, with both open and closed controls. This functionality had previously only been accessible via theGate
class. -
A new method
repeat()
has been added to theQuantumCircuit
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')
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 theQuantumCircuit
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 theqiskit.transpiler.Layout
class. This method enables converting converting twoLayout
objects into a qubit map for composing two circuits. -
A new class,
ConfigurableFakeBackend
, has been added to theqiskit.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 theqiskit.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()
-
A new Phase instruction,
SetPhase
, has been added toqiskit.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 theSetPhase
instruction will be set to radians. -
A new pulse instruction
ShiftFrequency
has been added toqiskit.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 theShiftFrequency
command will have the envelope a frequency decremented by 340MHz. -
A new method
conjugate()
has been added to theParameterExpression
class. This enables callingnumpy.conj()
without raising an error. Since aParameterExpression
object is real, it will return itself. This behaviour is analogous to Python floats/ints. -
A new class
PhaseEstimation
has been added toqiskit.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 of an eigenvalue of a unitary operator , provided with the corresponding eigenstate . That isThis 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
functionplot_state_qsphere()
has a new kwargshow_state_labels
which is used to control whether each blob in the qsphere visualization is labeled. By default this kwarg is set toTrue
and shows the basis states next to each blob by default. This feature can be disabled, reverting to the previous behavior, by setting theshow_state_labels
kwarg toFalse
. -
The
qiskit.visualization
functionplot_state_qsphere()
has a new kwargshow_state_phases
which is set toFalse
by default. When set toTrue
it displays the phase of each basis state. -
The
qiskit.visualization
functionplot_state_qsphere()
has a new kwarguse_degrees
which is set toFalse
by default. When set toTrue
it displays the phase of each basis state in degrees, along with the phase circle at the bottom right. -
A new class,
QuadraticForm
to theqiskit.circuit.library
module for implementing a a quadratic form on binary variables. The circuit library element implements the operationfor the quadratic form and output qubits. The result is in the output qubits is encoded in two’s complement. If 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()
andqiskit.quantum_info.DensityMatrix.expectation_value()
methods for computing the expectation value of anqiskit.quantum_info.Operator
. -
For the
seed
kwarg in the constructor forqiskit.circuit.library.QuantumVolume
numpy random Generator objects can now be used. Previously, only integers were a valid input. This is useful when integratingQuantumVolume
as part of a larger function with its own random number generation, e.g. generating a sequence ofQuantumVolume
circuits. -
The
QuantumCircuit
methodcompose()
has a new kwargfront
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')
-
Two new passes,
SabreLayout
andSabreSwap
for layout and routing have been added toqiskit.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 thetranspile()
function by setting thelayout_method
kwarg to'sabre'
and/or therouting_method
to'sabre'
to useSabreLayout
andSabreSwap
respectively. -
Added the method
replace()
to theqiskit.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 , its adjoint , and controlled gates asSXGate
,SXdgGate
, andCSXGate
. They can also be added to aQuantumCircuit
object using thesx()
,sxdg()
, andcsx()
respectively. -
Add support for
Reset
instructions toqiskit.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 theseed()
method. -
The methods
qiskit.circuit.ParameterExpression.subs()
andqiskit.circuit.QuantumCircuit.assign_parameters()
now acceptParameterExpression
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()
methodto_gate()
has a new kwarglabel
which can be used to set a label for for the outputGate
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')
-
Added the
UGate
,CUGate
,PhaseGate
, andCPhaseGate
with the correspondingQuantumCircuit
methodsu()
,cu()
,p()
, andcp()
. TheUGate
gate is the generic single qubit rotation gate with 3 Euler angles and theCUGate
gate its controlled version.CUGate
has 4 parameters to account for a possible global phase of the U gate. ThePhaseGate
andCPhaseGate
gates are the general Phase gate at an arbitrary angle and it’s controlled version. -
A new kwarg,
cregbundle
has been added to theqiskit.visualization.circuit_drawer()
function and theQuantumCircuit
methoddraw()
. When set toTrue
the cregs will be bundled into a single line in circuit visualizations for thetext
andmpl
drawers. The default value isTrue
. Addresses issue #4290.For example:
from qiskit import QuantumCircuit circuit = QuantumCircuit(2) circuit.measure_all() circuit.draw(output='mpl', cregbundle=True)
-
A new kwarg,
initial_state
has been added to theqiskit.visualization.circuit_drawer()
function and theQuantumCircuit
methoddraw()
. When set toTrue
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)
-
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')
Upgrade Notes
-
Implementations of the multi-controlled X Gate (
MCXGrayCode
,MCXRecursive
, andMCXVChain
) have had theirname
properties changed to more accurately describe their implementation:mcx_gray
,mcx_recursive
, andmcx_vchain
respectively. Previously, these gates shared the namemcx
withMCXGate
, which caused these gates to be incorrectly transpiled and simulated. -
By default the preset passmanagers in
qiskit.transpiler.preset_passmanagers
are usingUnrollCustomDefinitions
andBasisTranslator
to handle basis changing instead of the previous defaultUnroller
. 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 thetranslation_method
kwarg ontranspile()
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 activeSessionEquivalenceLibrary
. These converters now accept an optionalequivalence_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 theqiskit.circuit.QuantumCircuit.draw()
method andqiskit.visualization.circuit_drawer()
function has been changed toTrue
. 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')
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 toFalse
. 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)
-
Schedule
plotting withqiskit.pulse.Schedule.draw()
andqiskit.visualization.pulse_drawer()
will no longer display the event table by default. This can be reenabled by setting thetable
kwarg toTrue
. -
The pass
RemoveResetInZeroState
was previously included in the preset pass managerlevel_0_pass_manager()
which was used with theoptimization_level=0
fortranspile()
andexecute()
functions. However,RemoveResetInZeroState
is an optimization pass and should not have been included in optimization level 0 and was removed. If you need to runtranspile()
withRemoveResetInZeroState
either use a custom pass manager oroptimization_level
1, 2, or 3. -
The deprecated kwarg
line_length
for theqiskit.visualization.circuit_drawer()
function andqiskit.circuit.QuantumCircuit.draw()
method has been removed. It had been deprecated since the 0.10.0 release. Instead you can use thefold
kwarg to adjust the width of the circuit diagram. -
The
'mpl'
output mode for theqiskit.circuit.QuantumCircuit.draw()
method andcircuit_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 theqiskit.qasm.Qasm
andqiskit.qasm.QasmParser
has been removed. These methods have been deprecated since the 0.9.0 release. Theqiskit.qasm.Qasm.generate_tokens()
andqiskit.qasm.QasmParser.generate_tokens()
methods should be used instead. -
The deprecated kwarg
channels_to_plot
forqiskit.pulse.Schedule.draw()
,qiskit.pulse.Instruction.draw()
,qiskit.visualization.pulse.matplotlib.ScheduleDrawer.draw
andpulse_drawer()
has been removed. The kwarg has been deprecated since the 0.11.0 release and was replaced by thechannels
kwarg, which functions identically and should be used instead. -
The deprecated
circuit_instruction_map
attribute of theqiskit.providers.models.PulseDefaults
class has been removed. This attribute has been deprecated since the 0.12.0 release and was replaced by theinstruction_schedule_map
attribute which can be used instead. -
The
union
method ofSchedule
andInstruction
have been deprecated since the 0.12.0 release and have now been removed. Useqiskit.pulse.Schedule.insert()
andqiskit.pulse.Instruction.meth()
methods instead with the kwarg``time=0``. -
The deprecated
scaling
argument to thedraw
method ofSchedule
andInstruction
has been replaced withscale
since the 0.12.0 release and now has been removed. Use thescale
kwarg instead. -
The deprecated
period
argument toqiskit.pulse.library
functions have been replaced byfreq
since the 0.13.0 release and now removed. Use thefreq
kwarg instead ofperiod
. -
The
qiskit.pulse.commands
module containingCommands
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)
```python Acquire(duration)(AcquireChannel(0)) ``` ```python Acquire(duration, AcquireChannel(0)) | ```python Delay(duration)(channel) ``` | ```python Delay(duration, channel) ``` | | ```python FrameChange(angle)(DriveChannel(0)) ``` | ```python # FrameChange was also renamed ShiftPhase(angle, DriveChannel(0)) ``` | | ```python Gaussian(...)(DriveChannel(0)) ``` | ```python # 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 theqiskit.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
andqiskit.quantum_info.projector
functions are deprecated as of Qiskit Terra 0.12.0 as are now removed. Use theqiskit.quantum_info.QuantumState
and its derivativesqiskit.quantum_info.Statevector
andqiskit.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 theqiskit.result.Result
class. -
The output of the
to_dict()
method for theqiskit.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 theto_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
andreg_slots
have been removed fromqiskit.pulse.instructions.Acquire
, andchannel
,mem_slot
andreg_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 basedqiskit.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 fromreschedule.py
totransforms.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 allowTransformationPass
classes to modify thePropertySet
. This restriction has been lifted so aTransformationPass
class now has read and write access to both thePropertySet
andDAGCircuit
duringrun()
. This change was made to more efficiently facilitateTransformationPass
classes that have an internal state which may be necessary for later passes in thePassManager
. Without this change a second redundantAnalysisPass
would have been necessary to recreate the internal state, which could add significant overhead.
Deprecation Notes
-
The name of the first positional parameter for the
qiskit.visualization
functionsplot_state_hinton()
,plot_bloch_multivector()
,plot_state_city()
,plot_state_paulivec()
, andplot_state_qsphere()
has been renamed fromrho
tostate
. Passing in the value by name torho
is deprecated and will be removed in a future release. Instead you should either pass the argument positionally or use the new parameter namestate
. -
The
qiskit.pulse.pulse_lib
module has been deprecated and will be removed in a future release. It has been renamed toqiskit.pulse.library
which should be used instead. -
The
qiskit.circuit.QuantumCircuit
methodmirror()
has been deprecated and will be removed in a future release. The methodqiskit.circuit.QuantumCircuit.reverse_ops()
should be used instead, since mirroring could be confused with swapping the output qubits of the circuit. Thereverse_ops()
method only reverses the order of gates that are applied instead of mirroring. -
The
qubits()
andclbits()
methods ofqiskit.dagcircuit.DAGCircuit
have been deprecated and will be removed in a future release. They have been replaced with properties of the same name,qiskit.dagcircuit.DAGCircuit.qubits
andqiskit.dagcircuit.DAGCircuit.clbits
, and are cached so accessing them is much faster. -
The
get_sample_pulse
method forqiskit.pulse.library.ParametricPulse
derived classes (for exampleGaussianSquare
) has been deprecated and will be removed in a future release. It has been replaced by theget_waveform
method (for exampleget_waveform()
) which should behave identically. -
The use of the optional
condition
argument onqiskit.dagcircuit.DAGNode
,qiskit.dagcircuit.DAGCircuit.apply_operation_back()
, andqiskit.dagcircuit.DAGCircuit.apply_operation_front()
has been deprecated and will be removed in a future release. Instead thecontrol
set inqiskit.circuit.Instruction
instances being added to aDAGCircuit
should be used. -
The
set_atol
andset_rtol
class methods of theqiskit.quantum_info.BaseOperator
andqiskit.quantum_info.QuantumState
classes (and their subclasses such asOperator
andqiskit.quantum_info.DensityMatrix
) are deprecated and will be removed in a future release. Instead the value for the attributes.atol
and.rtol
should be set on the class instead. For example:from qiskit.quantum_info import ScalarOp ScalarOp.atol = 3e-5 op = ScalarOp(2)
-
The interactive plotting functions from
qiskit.visualization
,iplot_bloch_multivector
,iplot_state_city
,iplot_state_qsphere
,iplot_state_hinton
,iplot_histogram
,iplot_state_paulivec
have been deprecated and will be removed in a future release. The matplotlib based equivalent functions fromqiskit.visualization
,plot_bloch_multivector()
,plot_state_city()
,plot_state_qsphere()
,plot_state_hinton()
,plot_state_histogram()
, andplot_state_paulivec()
should be used instead. -
The properties
acquires
,mem_slots
, andreg_slots
of theqiskit.pulse.instructions.Acquire
pulse instruction have been deprecated and will be removed in a future release. They are just duplicates ofchannel
,mem_slot
, andreg_slot
respectively now that previously deprecated support for using multiple qubits in a singleAcquire
instruction has been removed. -
The
SamplePulse
class fromqiskit.pulse
has been renamed toWaveform
.SamplePulse
is deprecated and will be removed in a future release. -
The style dictionary key
cregbundle
has been deprecated and will be removed in a future release. This has been replaced by the kwargcregbundle
added to theqiskit.visualization.circuit_drawer()
function and theQuantumCircuit
methoddraw()
.
Bug Fixes
-
The
qiskit.circuit.QuantumCircuit
methodnum_nonlocal_gates
previously included multi-qubitqiskit.circuit.Instruction
objects (for example,Barrier
) in its count of non-local gates. This has been corrected so that only non-localGate
objects are counted. Fixes #4500 -
ControlledGate
instances with a setctrl_state
were in some cases not being evaluated as equal, even if the compared gates were equivalent. This has been resolved so that Fixes #4573 -
When accessing a bit from a
qiskit.circuit.QuantumRegister
orqiskit.circuit.ClassicalRegister
by index when using numpy integer types <https://numpy.org/doc/stable/user/basics.types.html>`__ would previously raise aCircuitError
exception. This has been resolved so numpy types can be used in addition to Python’s built-inint
type. Fixes #3929. -
A bug was fixed where only the first
qiskit.pulse.configuration.Kernel
orqiskit.pulse.configuration.Discriminator
for anqiskit.pulse.Acquire
was used when there were multiple Acquires at the same time in aqiskit.pulse.Schedule
. -
The SI unit use for constructing
qiskit.pulse.SetFrequency
objects is in Hz, but when aPulseQobjInstruction
object is created from aSetFrequency
instance it needs to be converted to GHz. This conversion was missing from previous releases and has been fixed. -
Previously it was possible to set the number of control qubits to zero in which case the the original, potentially non-controlled, operation would be returned. This could cause an
AttributeError
to be raised if the caller attempted to access an attribute which onlyControlledGate
object have. This has been fixed by adding a getter and setter fornum_ctrl_qubits
to validate that a valid value is being used. Fixes #4576 -
Open controls were implemented by modifying a
Gate
objectsdefinition
. However, when the gate already exists in the basis set, this definition was not used, which resulted in incorrect circuits being sent to a backend after transpilation. This has been fixed by modifying theUnroller
pass to use the definition if it encounters a controlled gate with open controls. Fixes #4437 -
The
insert_barriers
keyword argument in theZZFeatureMap
class didn’t actually insert barriers in between the Hadamard layers and evolution layers. This has been fixed so that barriers are now properly inserted. -
Fixed issue where some gates with three or more qubits would fail to compile in certain instances. Refer to #4577 <https://github.com/Qiskit/qiskit/issues/4577 for more detail.
-
The matplotlib (
'mpl'
) output backend for theqiskit.circuit.QuantumCircuit
methoddraw()
and theqiskit.visualization.circuit_drawer()
function was not properly scaling when the kwargscale
was set. Fonts and line widths did not scale with the rest of the image. This has been fixed and all elements of the circuit diagram now scale properly. For example:from qiskit import QuantumCircuit circuit = QuantumCircuit(2) circuit.h(0) circuit.cx(0, 1) circuit.draw(output='mpl', scale=0.5)
Fixes #4179.
-
Fixes issue where initializing or evolving
qiskit.quantum_info.Statevector
andqiskit.quantum_info.DensityMatrix
classes by circuits by circuit containingBarrier
instructions would raise an exception. Fixes #4461 -
Previously when a
QuantumCircuit
contained aGate
with a classical condition the transpiler would sometimes fail when usingoptimization_level=3
ontranspile()
orexecute()
raising anUnboundLocalError
. This has been fixed by updating theConsolidateBlocks
pass to account for the classical condition. Fixes #4672. -
In some situations long gate and register names would overflow, or leave excessive empty space around them when using the
'mpl'
output backend for theqiskit.circuit.QuantumCircuit.draw()
method andqiskit.visualization.circuit_drawer()
function. This has been fixed by using correct text widths for a proportional font. Fixes #4611, #4605, #4545, #4497, #4449, and #3641. -
When using the
style` kwarg on the :meth:`qiskit.circuit.QuantumCircuit.draw` or :func:`qiskit.visualization.circuit_drawer` with the ``'mpl'
output backend the dictionary key'showindex'
set toTrue
, the index numbers at the top of the column did not line up properly. This has been fixed. -
When using
cregbunde=True
with the'mpl'
output backend for theqiskit.circuit.QuantumCircuit.draw()
method andqiskit.visualization.circuit_drawer()
function and measuring onto a second fold, the measure arrow would overwrite the creg count. The count was moved to the left to prevent this. Fixes #4148. -
When using the
'mpl'
output backend for theqiskit.circuit.QuantumCircuit.draw()
method andqiskit.visualization.circuit_drawer()
functionCSwapGate
gates and a controlledRZZGate
gates now display with their appropriate symbols instead of in a box. -
When using the
'mpl'
output backend for theqiskit.circuit.QuantumCircuit.draw()
method andqiskit.visualization.circuit_drawer()
function controlled gates created using theto_gate()
method were not properly spaced and could overlap with other gates in the circuit diagram. This issue has been fixed. -
When using the
'mpl'
output backend for theqiskit.circuit.QuantumCircuit.draw()
method andqiskit.visualization.circuit_drawer()
function gates with arrays as parameters, such asHamiltonianGate
, no longer display with excessive space around them. Fixes #4352. -
When using the
'mpl'
output backend for theqiskit.circuit.QuantumCircuit.draw()
method andqiskit.visualization.circuit_drawer()
function generic gates created by directly instantiatingqiskit.circuit.Gate
method now display the proper background color for the gate. Fixes #4496. -
When using the
'mpl'
output backend for theqiskit.circuit.QuantumCircuit.draw()
method andqiskit.visualization.circuit_drawer()
function anAttributeError
that occurred when usingIsometry
orInitialize
has been fixed. Fixes #4439. -
When using the
'mpl'
output backend for theqiskit.circuit.QuantumCircuit.draw()
method andqiskit.visualization.circuit_drawer()
function some open-controlled gates did not properly display the open controls. This has been corrected so that open controls are properly displayed as open circles. Fixes #4248. -
When using the
'mpl'
output backend for theqiskit.circuit.QuantumCircuit.draw()
method andqiskit.visualization.circuit_drawer()
function setting thefold
kwarg to -1 will now properly display the circuit without folding. Fixes #4506. -
Parametric pulses from
qiskit.pulse.library.discrete
now have zero ends of parametric pulses by default. The endpoints are defined such that for a function then . Fixes #4317
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
Prelude
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.
New Features
-
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 theqiskit.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 theqiskit.providers.aer.StatevectorSimulator
andqiskit.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:
qiskit.providers.aer.extensions.SnapshotExpectationValue
qiskit.providers.aer.extensions.SnapshotProbabilities
qiskit.providers.aer.extensions.SnapshotDensityMatrix
-
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
andSetPhase
pulse instructions to theqiskit.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 theqiskit.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
andqiskit.providers.aer.StatevectorSimulator
by using SIMD intrinsics on systems that support the AVX2 instruction set. AVX2 support is automatically detected and enabled at runtime.
Upgrade Notes
-
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 toqiskit.providers.aer.noise.NoiseModel.from_device()
for specifying customgate_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 theqiskit.providers.aer.QasmSimualtor.run()
method for the backend object toTrue
. -
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
anddifference
methods based onstd::set::contains
andstd::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.
Bug Fixes
-
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
Prelude
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.
New Features
- The
qiskit.ignis.verification.randomized_benchmarking.randomized_benchmarking_seq()
function was refactored to use the updated Clifford classClifford
, to allow efficient Randomized Benchmarking (RB) on Clifford sequences with more than 2 qubits. In addition, the code of the CNOT-Dihedral classqiskit.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. Theqiskit.ignis.verification.randomized_benchmarking.randomized_benchmarking_seq()
function has a new kwargrand_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 kwargseed
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.
Upgrade Notes
- The
qiskit.ignis.verification.randomized_benchmarking.randomized_benchmarking_seq()
function is now using the updated Clifford classClifford
and the updated CNOT-Dihedral classqiskit.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 theqiskit.ignis.measurement.discriminator.iq_discriminators
module was imported. This is now correctly listed as a dependency so thatscikit-learn
will be installed with qiskit-ignis. - The
qiskit.ignis.verification.qv_circuits()
function is now using the circuit library classQuantumVolume
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.
Deprecation Notes
-
The kwarg
interleaved_gates
for theqiskit.ignis.verification.randomized_benchmarking.randomized_benchmarking_seq()
function has been deprecated and will be removed in a future release. It is superseded byinterleaved_elem
. The helper functionsqiskit.ignis.verification.randomized_benchmarking.BasicUtils
,qiskit.ignis.verification.randomized_benchmarking.CliffordUtils
andqiskit.ignis.verification.randomized_benchmarking.DihedralUtils
were deprecated. These classes are superseded byqiskit.ignis.verification.randomized_benchmarking.RBgroup
that handles the group operations needed for RB. The classqiskit.ignis.verification.randomized_benchmarking.Clifford
is superseded byClifford
. -
The kwargs
qr
andcr
for theqiskit.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 aqiskit.circuit.QuantumRegister
andqiskit.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 theqiskit.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 inqubit_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 ofinitial_layout
in the transpiler and whether a circuit has been embedded with a layout set. Moving forward instead you should just runtranspile()
orexecute()
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)
Bug Fixes
- 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
New Features
- 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. Addedconvert
/interpret
methods for converters instead ofencode
/decode
. Addedto_ising
andfrom_ising
toQuadraticProgram
class. Moved all parameters fromconvert
to constructor exceptname
. Created setter/getter for converter parameters. Addedauto_define_penalty
andinterpret
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 forCobylaOptimizer
. - 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 asX + X == 2*X
andX + Z == Z + X
evaluate toTrue
.
Deprecation Notes
- GSLS optimizer class deprecated
__init__
parametermax_iter
in favor ofmaxiter
. SPSA optimizer class deprecated__init__
parametermax_trials
in favor ofmaxiter
. optimize_svm function deprecatedmax_iters
parameter in favor ofmaxiter
. ADMMParameters class deprecated__init__
parametermax_iter
in favor ofmaxiter
. - The ising convert classes
qiskit.optimization.converters.QuadraticProgramToIsing
andqiskit.optimization.converters.IsingToQuadraticProgram
have been deprecated and will be removed in a future release. Instead theqiskit.optimization.QuadraticProgram
methodsto_ising()
andfrom_ising()
should be used instead. - The
pprint_as_string
method forqiskit.optimization.QuadraticProgram
has been deprecated and will be removed in a future release. Instead you should just run.pprint_as_string()
on the output fromto_docplex()
- The
prettyprint
method forqiskit.optimization.QuadraticProgram
has been deprecated and will be removed in a future release. Instead you should just run.prettyprint()
on the output fromto_docplex()
Bug Fixes
- 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-community/qiskit-aqua/issues/1109> for more details.
- Binding parameters in the
CircuitStateFn
did not copy the value ofis_measurement
and always setis_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-community/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-community/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-community/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 ofsqrt(2)
. This has been fixed. OptimizationResult
included some public setters and class variables wereOptional
. 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 asstr
. This fix changed the result intoList[float]
as the other algorithms do. Some public classes related to optimization algorithms were missing in the documentation ofqiskit.optimization.algorithms
. This fix added all such classes to the docstring. #1131 <https://github.com/qiskit-community/qiskit-aqua/issues/1131> for more details.OptimizationResult.__init__
did not check whether the sizes ofx
andvariables
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 toOptimizationResult.variable_names
andOptimizationResult.variables_dict
intest_converters
. #1167 <https://github.com/qiskit-community/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)
, whereop
is of typeOperatorBase
, sometimes silently returns a nonsensical value when the number of qubits inop
andother
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 ofVQE
previously returned the expectation value to be evaluated as typeOperatorBase
. This functionality has been moved intoconstruct_expectation
andconstruct_circuit
returns a list of the circuits that are evaluated to compute the expectation value.
IBM Q Provider 0.8.0
New Features
IBMQBackend
now has a newreservations()
method that returns reservation information for the backend, with optional filtering. In addition, you can now useprovider.backends.my_reservations()
to query for your own reservations.qiskit.providers.ibmq.job.IBMQJob.result()
raises anIBMQJobFailureError
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 toIBMQJob
andqiskit.result.Result
object retrieved viaqiskit.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 parameterreservation_lookahead
. If specified or defaulted to, a backend is considered unavailable if it has reservations in the nextn
minutes, wheren
is the value ofreservation_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 newcombine_results()
method that combines results from all managed jobs and returns a singleResult
object. ThisResult
object can be used, for example, inqiskit-ignis
fitter methods.
Upgrade Notes
-
Timestamps in the following fields are now in local time instead of UTC:
- Backend properties returned by
qiskit.providers.ibmq.IBMQBackend.properties()
. - Backend properties returned by
qiskit.providers.ibmq.job.IBMQJob.properties()
. estimated_start_time
andestimated_complete_time
inQueueInfo
, returned byqiskit.providers.ibmq.job.IBMQJob.queue_info()
.date
inResult
, returned byqiskit.providers.ibmq.job.IBMQJob.result()
.
In addition, the
datetime
parameter forqiskit.providers.ibmq.IBMQBackend.properties()
is also expected to be in local time unless it has UTC timezone information. - Backend properties returned by
-
websockets
8.0 or above is now required if Python 3.7 or above is used.websockets
7.0 will continue to be used for Python 3.6 or below. -
On Windows, the event loop policy is set to
WindowsSelectorEventLoopPolicy
instead of using the defaultWindowsProactorEventLoopPolicy
. This fixes the issue that theqiskit.providers.ibmq.job.IBMQJob.result()
method could hang on Windows. Fixes #691
Deprecation Notes
- Use of
Qconfig.py
to save IBM Quantum Experience credentials is deprecated and will be removed in the next release. You should useqiskitrc
(the default) instead.
Bug Fixes
- 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 ofIBMQJob
objects when thestatus
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 installqiskit-ibmq-provider
with a version ofqiskit-terra
which was too old. Fixes #677