Qiskit 0.20 release notes
0.20.1
Terra 0.15.2
Bug Fixes
- When accessing the
definitionattribute of a parameterizedGateinstance, the generatedQuantumCircuithad been generated with an invalidParameterTable, such that reading fromQuantumCircuit.parametersor callingQuantumCircuit.bind_parameterswould incorrectly report the unbound parameters. This has been resolved. SXGate().inverse()had previously returned an ‘sx_dg’ gate with a correctdefinitionbut 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 aGateinstance with an incorrectto_matrixmethod. The instances of incorrectto_matrixmethods have been removed.- For
C3XGatewith a non-zeroangle, inverting the gate viaC3XGate.inverse()had previously generated an incorrect inverse gate. This has been corrected. - The
MCXGatemodes 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 anMCXVChaingate would raise an error. - Previously, when creating a multiply controlled phase gate via
PhaseGate.control, anMCU1Gategate had been returned. This has been had corrected so that anMCPhaseGateis returned. - Previously, attempting to decompose a circuit containing an
MCPhaseGatewould raise an error due to an inconsistency in the definition of theMCPhaseGate. This has been corrected. QuantumCircuit.composeandDAGCircuit.composehad, 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.Countsobject from an empty data dictionary. Now this will create an emptyCountsobject. 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
qregsandcregsproperties accordingly, but not thequbitsandclbitslists. 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 theextendmethod 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_stateparameter. - 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.DAGDependencyfor 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.convertersfor converting back and forth toDAGDependency. These functions are:circuit_to_dagdependency()to convert from aQuantumCircuitobject to aDAGDependencyobject.dagdependency_to_circuit()to convert from aDAGDependencyobject to aQuantumCircuitobject.dag_to_dagdependency()to convert from aDAGCircuitobject to aDAGDependencyobject.dagdependency_to_dag()to convert from aDAGDependencyobject to aDAGCircuitobject.
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.passesThe first,UnrollCustomDefinitions, unrolls all instructions in the circuit according to theirdefinitionproperty, stopping when reaching either the specifiedbasis_gatesor a set of gates in the providedEquivalenceLibrary. The second,BasisTranslator, uses the set of translations in the providedEquivalenceLibraryto re-write circuit instructions in a specified basis. -
A new
translation_methodkeyword 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 theUnrollerpass'translator': to use theBasisTranslatorpass.'synthesis': to use theUnitarySynthesispass.
The default value is
'translator'. -
A new class for handling counts result data,
qiskit.result.Counts, has been added. This class is a subclass ofdictand 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. ACountsobject 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.DAGCircuitobjects has been added,from_networkx(). This method takes in a networkxMultiDiGraphobject (in the format returned byto_networkx()) and will return a newDAGCircuitobject. 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_qubitshas been added toassemble()andexecute(). For backends that support this featureinit_qubitscan 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 toTruemeaning that all qubits can assumed to be in the ground state at the start of each shot. However, wheninit_qubitsis set toFalsequbits 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_delayhas 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_delaysfrom a backend’sPulseBackendConfigurationobject which can be accessed asbackend.configuration().rep_delays).The
rep_delaykwarg will only work on backends which allow for dynamic repetition time. This will also be indicated in thePulseBackendConfigurationobject for a backend as thedynamic_reprate_enabledattribute. Ifdynamic_reprate_enabledisFalsethen therep_timevalue specified forqiskit.compiler.assemble(),qiskit.execute.execute(), or the constructor forPulseQobjtConfigwill be used rather thanrep_delay.rep_timeonly allows users to specify the duration of a program, rather than the delay between programs. -
The
qobj_schema.jsonJSON Schema file inqiskit.schemashas been updated to include therep_delayas an optional configuration property for pulse qobjs. -
The
backend_configuration_schema.jsonJSON Schema file in mod:qiskit.schemas has been updated to includerep_delay_rangeanddefault_rep_delayas 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.QuantumCircuitclass. 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_phasein 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
QuantumCircuitobject to take global phase into account. For example. with theglobal_phaseattribute 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
DAGCircuitclass so that global phase can be tracked when converting betweenQuantumCircuitandDAGCircuit. -
Two new classes,
AncillaRegisterandAncillaQubithave been added to theqiskit.circuitmodule. These are subclasses ofQuantumRegisterandQubitrespectively 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 theQuantumCircuitobject, with both open and closed controls. This functionality had previously only been accessible via theGateclass. -
A new method
repeat()has been added to theQuantumCircuitclass. 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 theQuantumCircuitclass. 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.Layoutclass. This method enables converting converting twoLayoutobjects into a qubit map for composing two circuits. -
A new class,
ConfigurableFakeBackend, has been added to theqiskit.test.mock.utilsmodule. 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.EquivalenceLibraryclass. 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 theSetPhaseinstruction will be set to radians. -
A new pulse instruction
ShiftFrequencyhas 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 theShiftFrequencycommand will have the envelope a frequency decremented by 340MHz. -
A new method
conjugate()has been added to theParameterExpressionclass. This enables callingnumpy.conj()without raising an error. Since aParameterExpressionobject is real, it will return itself. This behaviour is analogous to Python floats/ints. -
A new class
PhaseEstimationhas 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.visualizationfunctionplot_state_qsphere()has a new kwargshow_state_labelswhich is used to control whether each blob in the qsphere visualization is labeled. By default this kwarg is set toTrueand shows the basis states next to each blob by default. This feature can be disabled, reverting to the previous behavior, by setting theshow_state_labelskwarg toFalse. -
The
qiskit.visualizationfunctionplot_state_qsphere()has a new kwargshow_state_phaseswhich is set toFalseby default. When set toTrueit displays the phase of each basis state. -
The
qiskit.visualizationfunctionplot_state_qsphere()has a new kwarguse_degreeswhich is set toFalseby default. When set toTrueit displays the phase of each basis state in degrees, along with the phase circle at the bottom right. -
A new class,
QuadraticFormto theqiskit.circuit.librarymodule 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
seedkwarg in the constructor forqiskit.circuit.library.QuantumVolumenumpy random Generator objects can now be used. Previously, only integers were a valid input. This is useful when integratingQuantumVolumeas part of a larger function with its own random number generation, e.g. generating a sequence ofQuantumVolumecircuits. -
The
QuantumCircuitmethodcompose()has a new kwargfrontwhich 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,
SabreLayoutandSabreSwapfor 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_methodkwarg to'sabre'and/or therouting_methodto'sabre'to useSabreLayoutandSabreSwaprespectively. -
Added the method
replace()to theqiskit.pulse.Scheduleclass which allows a pulse instruction to be replaced with another. For example:.. code-block:: pythonfrom 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.libraryfor the , its adjoint , and controlled gates asSXGate,SXdgGate, andCSXGate. They can also be added to aQuantumCircuitobject using thesx(),sxdg(), andcsx()respectively. -
Add support for
Resetinstructions 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 acceptParameterExpressionas 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 kwarglabelwhich can be used to set a label for for the outputGateobject. 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, andCPhaseGatewith the correspondingQuantumCircuitmethodsu(),cu(),p(), andcp(). TheUGategate is the generic single qubit rotation gate with 3 Euler angles and theCUGategate its controlled version.CUGatehas 4 parameters to account for a possible global phase of the U gate. ThePhaseGateandCPhaseGategates are the general Phase gate at an arbitrary angle and it’s controlled version. -
A new kwarg,
cregbundlehas been added to theqiskit.visualization.circuit_drawer()function and theQuantumCircuitmethoddraw(). When set toTruethe cregs will be bundled into a single line in circuit visualizations for thetextandmpldrawers. 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_statehas been added to theqiskit.visualization.circuit_drawer()function and theQuantumCircuitmethoddraw(). When set toTruethe 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 theirnameproperties changed to more accurately describe their implementation:mcx_gray,mcx_recursive, andmcx_vchainrespectively. Previously, these gates shared the namemcxwithMCXGate, which caused these gates to be incorrectly transpiled and simulated. -
By default the preset passmanagers in
qiskit.transpiler.preset_passmanagersare usingUnrollCustomDefinitionsandBasisTranslatorto 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_methodkwarg 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_librarykeyword 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
cregbundlekwarg 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
cregbundlekwarg 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) -
Scheduleplotting withqiskit.pulse.Schedule.draw()andqiskit.visualization.pulse_drawer()will no longer display the event table by default. This can be reenabled by setting thetablekwarg toTrue. -
The pass
RemoveResetInZeroStatewas previously included in the preset pass managerlevel_0_pass_manager()which was used with theoptimization_level=0fortranspile()andexecute()functions. However,RemoveResetInZeroStateis an optimization pass and should not have been included in optimization level 0 and was removed. If you need to runtranspile()withRemoveResetInZeroStateeither use a custom pass manager oroptimization_level1, 2, or 3. -
The deprecated kwarg
line_lengthfor 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 thefoldkwarg 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_tokensmethods for theqiskit.qasm.Qasmandqiskit.qasm.QasmParserhas 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_plotforqiskit.pulse.Schedule.draw(),qiskit.pulse.Instruction.draw(),qiskit.visualization.pulse.matplotlib.ScheduleDrawer.drawandpulse_drawer()has been removed. The kwarg has been deprecated since the 0.11.0 release and was replaced by thechannelskwarg, which functions identically and should be used instead. -
The deprecated
circuit_instruction_mapattribute of theqiskit.providers.models.PulseDefaultsclass has been removed. This attribute has been deprecated since the 0.12.0 release and was replaced by theinstruction_schedule_mapattribute which can be used instead. -
The
unionmethod ofScheduleandInstructionhave 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
scalingargument to thedrawmethod ofScheduleandInstructionhas been replaced withscalesince the 0.12.0 release and now has been removed. Use thescalekwarg instead. -
The deprecated
periodargument toqiskit.pulse.libraryfunctions have been replaced byfreqsince the 0.13.0 release and now removed. Use thefreqkwarg instead ofperiod. -
The
qiskit.pulse.commandsmodule containingCommandsclasses 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.qimodule were deprecated in the 0.12.0 release and have now been removed. Instead use theqiskit.quantum_infomodule and the new methods and classes that it has for working with quantum states and operators. -
The
qiskit.quantum_info.basis_stateandqiskit.quantum_info.projectorfunctions are deprecated as of Qiskit Terra 0.12.0 as are now removed. Use theqiskit.quantum_info.QuantumStateand its derivativesqiskit.quantum_info.Statevectorandqiskit.quantum_info.DensityMatrixto 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_paulivecnow 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.validationhave been removed from terra. Since they are no longer used to build any objects in terra. -
The marshmallow schema classes in
qiskit.resulthave been removed since they are no longer used by theqiskit.result.Resultclass. -
The output of the
to_dict()method for theqiskit.result.Resultclass 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_slotsandreg_slotshave been removed fromqiskit.pulse.instructions.Acquire, andchannel,mem_slotandreg_slotwill raise an error if a list is provided as input. -
Support for the use of the
USE_RETWORKXenvironment variable which was introduced in the 0.13.0 release to provide an optional fallback to the legacy networkx basedqiskit.dagcircuit.DAGCircuitimplementation 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.pulseresponsible for schedule->schedule transformations has been renamed fromreschedule.pytotransforms.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
PassManagerdid not allowTransformationPassclasses to modify thePropertySet. This restriction has been lifted so aTransformationPassclass now has read and write access to both thePropertySetandDAGCircuitduringrun(). This change was made to more efficiently facilitateTransformationPassclasses that have an internal state which may be necessary for later passes in thePassManager. Without this change a second redundantAnalysisPasswould 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.visualizationfunctionsplot_state_hinton(),plot_bloch_multivector(),plot_state_city(),plot_state_paulivec(), andplot_state_qsphere()has been renamed fromrhotostate. Passing in the value by name torhois 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_libmodule has been deprecated and will be removed in a future release. It has been renamed toqiskit.pulse.librarywhich should be used instead. -
The
qiskit.circuit.QuantumCircuitmethodmirror()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.DAGCircuithave been deprecated and will be removed in a future release. They have been replaced with properties of the same name,qiskit.dagcircuit.DAGCircuit.qubitsandqiskit.dagcircuit.DAGCircuit.clbits, and are cached so accessing them is much faster. -
The
get_sample_pulsemethod forqiskit.pulse.library.ParametricPulsederived classes (for exampleGaussianSquare) has been deprecated and will be removed in a future release. It has been replaced by theget_waveformmethod (for exampleget_waveform()) which should behave identically. -
The use of the optional
conditionargument 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 thecontrolset inqiskit.circuit.Instructioninstances being added to aDAGCircuitshould be used. -
The
set_atolandset_rtolclass methods of theqiskit.quantum_info.BaseOperatorandqiskit.quantum_info.QuantumStateclasses (and their subclasses such asOperatorandqiskit.quantum_info.DensityMatrix) are deprecated and will be removed in a future release. Instead the value for the attributes.atoland.rtolshould 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_paulivechave 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_slotsof theqiskit.pulse.instructions.Acquirepulse instruction have been deprecated and will be removed in a future release. They are just duplicates ofchannel,mem_slot, andreg_slotrespectively now that previously deprecated support for using multiple qubits in a singleAcquireinstruction has been removed. -
The
SamplePulseclass fromqiskit.pulsehas been renamed toWaveform.SamplePulseis deprecated and will be removed in a future release. -
The style dictionary key
cregbundlehas been deprecated and will be removed in a future release. This has been replaced by the kwargcregbundleadded to theqiskit.visualization.circuit_drawer()function and theQuantumCircuitmethoddraw().
Bug Fixes
-
The
qiskit.circuit.QuantumCircuitmethodnum_nonlocal_gatespreviously included multi-qubitqiskit.circuit.Instructionobjects (for example,Barrier) in its count of non-local gates. This has been corrected so that only non-localGateobjects are counted. Fixes #4500 -
ControlledGateinstances with a setctrl_statewere 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.QuantumRegisterorqiskit.circuit.ClassicalRegisterby index when using numpy integer types <https://numpy.org/doc/stable/user/basics.types.html>`__ would previously raise aCircuitErrorexception. This has been resolved so numpy types can be used in addition to Python’s built-ininttype. Fixes #3929. -
A bug was fixed where only the first
qiskit.pulse.configuration.Kernelorqiskit.pulse.configuration.Discriminatorfor anqiskit.pulse.Acquirewas used when there were multiple Acquires at the same time in aqiskit.pulse.Schedule. -
The SI unit use for constructing
qiskit.pulse.SetFrequencyobjects is in Hz, but when aPulseQobjInstructionobject is created from aSetFrequencyinstance 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
AttributeErrorto be raised if the caller attempted to access an attribute which onlyControlledGateobject have. This has been fixed by adding a getter and setter fornum_ctrl_qubitsto validate that a valid value is being used. Fixes #4576 -
Open controls were implemented by modifying a
Gateobjectsdefinition. 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 theUnrollerpass to use the definition if it encounters a controlled gate with open controls. Fixes #4437 -
The
insert_barrierskeyword argument in theZZFeatureMapclass 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.QuantumCircuitmethoddraw()and theqiskit.visualization.circuit_drawer()function was not properly scaling when the kwargscalewas 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.Statevectorandqiskit.quantum_info.DensityMatrixclasses by circuits by circuit containingBarrierinstructions would raise an exception. Fixes #4461 -
Previously when a
QuantumCircuitcontained aGatewith a classical condition the transpiler would sometimes fail when usingoptimization_level=3ontranspile()orexecute()raising anUnboundLocalError. This has been fixed by updating theConsolidateBlockspass 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=Truewith 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()functionCSwapGategates and a controlledRZZGategates 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.Gatemethod 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 anAttributeErrorthat occurred when usingIsometryorInitializehas 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 thefoldkwarg to -1 will now properly display the circuit without folding. Fixes #4506. -
Parametric pulses from
qiskit.pulse.library.discretenow 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.Resultclass 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.SnapshotExpectationValueextension. -
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.QasmSimulatorin both theqiskit.providers.aer.StatevectorSimulatorandqiskit.providers.aer.UnitarySimulatorbackends. -
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.SnapshotExpectationValueqiskit.providers.aer.extensions.SnapshotProbabilitiesqiskit.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
QasmSimulatorto 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”
QasmSimulatorsimulation method. -
Add support for
Delay,PhaseandSetPhasepulse instructions to theqiskit.providers.aer.PulseSimulator. -
Improve the performance of the
qiskit.providers.aer.PulseSimulatorby caching calls to RHS function -
Introduce alternate DE solving methods, specifiable through
backend_optionsin 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.QasmSimulatorandqiskit.providers.aer.StatevectorSimulatorby 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_unitskwarg toqiskit.providers.aer.noise.NoiseModel.from_device()for specifying customgate_lengthsin 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
validatekwarg 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
containsanddifferencemethods based onstd::set::containsandstd::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.HamiltonianModelclass.
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.CNOTDihedralwas 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_seedwhich 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 kwargseedwhich 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 classCliffordand the updated CNOT-Dihedral classqiskit.ignis.verification.randomized_benchmarking.CNOTDihedralto 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
ImportErrorif theqiskit.ignis.measurement.discriminator.iq_discriminatorsmodule was imported. This is now correctly listed as a dependency so thatscikit-learnwill be installed with qiskit-ignis. - The
qiskit.ignis.verification.qv_circuits()function is now using the circuit library classQuantumVolumeto 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_gatesfor 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.CliffordUtilsandqiskit.ignis.verification.randomized_benchmarking.DihedralUtilswere deprecated. These classes are superseded byqiskit.ignis.verification.randomized_benchmarking.RBgroupthat handles the group operations needed for RB. The classqiskit.ignis.verification.randomized_benchmarking.Cliffordis superseded byClifford. -
The kwargs
qrandcrfor 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.QuantumRegisterandqiskit.circuit.ClassicalRegisterto 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_listsparameter 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_layoutin 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
QuadraticProgramConverterwhich is an abstract class for converters. Addedconvert/interpretmethods for converters instead ofencode/decode. Addedto_isingandfrom_isingtoQuadraticProgramclass. Moved all parameters fromconvertto constructor exceptname. Created setter/getter for converter parameters. Addedauto_define_penaltyandinterpretfor``LinearEqualityToPenalty``. Now error messages of converters are more informative. - Added an SLSQP optimizer
qiskit.optimization.algorithms.SlsqpOptimizeras 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
SummedOpdoes a mathematically more correct check for equality, where expressions such asX + X == 2*XandX + Z == Z + Xevaluate toTrue.
Deprecation Notes
- GSLS optimizer class deprecated
__init__parametermax_iterin favor ofmaxiter. SPSA optimizer class deprecated__init__parametermax_trialsin favor ofmaxiter. optimize_svm function deprecatedmax_itersparameter in favor ofmaxiter. ADMMParameters class deprecated__init__parametermax_iterin favor ofmaxiter. - The ising convert classes
qiskit.optimization.converters.QuadraticProgramToIsingandqiskit.optimization.converters.IsingToQuadraticProgramhave been deprecated and will be removed in a future release. Instead theqiskit.optimization.QuadraticProgrammethodsto_ising()andfrom_ising()should be used instead. - The
pprint_as_stringmethod forqiskit.optimization.QuadraticProgramhas been deprecated and will be removed in a future release. Instead you should just run.pprint_as_string()on the output fromto_docplex() - The
prettyprintmethod forqiskit.optimization.QuadraticProgramhas 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
CircuitStateFndid not copy the value ofis_measurementand 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_fnproperty 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 ``CircuitSamplerdid not treat coefficients correctly or ignored them completely. E.g. evaluating~StateFn(0 * (I + Z)) @ Plusdid not yield 0 or the normalization of~StateFn(I) @ ((Plus + Minus) / sqrt(2))missed a factor ofsqrt(2). This has been fixed. OptimizationResultincluded 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.solvegenerated 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 ofxandvariablesmatch 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_namesandOptimizationResult.variables_dictintest_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), whereopis of typeOperatorBase, sometimes silently returns a nonsensical value when the number of qubits inopandotherare 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_circuitmethod ofVQEpreviously returned the expectation value to be evaluated as typeOperatorBase. This functionality has been moved intoconstruct_expectationandconstruct_circuitreturns a list of the circuits that are evaluated to compute the expectation value.
IBM Q Provider 0.8.0
New Features
IBMQBackendnow 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 anIBMQJobFailureErrorexception 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_versionwas added toIBMQJobandqiskit.result.Resultobject retrieved viaqiskit.providers.ibmq.job.IBMQJob.result().client_versionis 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 nextnminutes, wherenis 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. ManagedResultsnow has a newcombine_results()method that combines results from all managed jobs and returns a singleResultobject. ThisResultobject can be used, for example, inqiskit-ignisfitter 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_timeandestimated_complete_timeinQueueInfo, returned byqiskit.providers.ibmq.job.IBMQJob.queue_info().dateinResult, returned byqiskit.providers.ibmq.job.IBMQJob.result().
In addition, the
datetimeparameter forqiskit.providers.ibmq.IBMQBackend.properties()is also expected to be in local time unless it has UTC timezone information. - Backend properties returned by
-
websockets8.0 or above is now required if Python 3.7 or above is used.websockets7.0 will continue to be used for Python 3.6 or below. -
On Windows, the event loop policy is set to
WindowsSelectorEventLoopPolicyinstead 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.pyto 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
ValueErrorwhen building error maps in Jupyter for backends that are offline. Fixes #706 qiskit.providers.ibmq.IBMQBackend.jobs()will now return the correct list ofIBMQJobobjects when thestatuskwarg 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-providerwith a version ofqiskit-terrawhich was too old. Fixes #677