リリースノート¶
更新履歴¶
下表はQiskitの メタパッケージとインストールされている各要素のバージョンの履歴です。
Qiskit Metapackage Version |
qiskit-terra |
qiskit-aer |
qiskit-ignis |
qiskit-ibmq-provider |
qiskit-aqua |
---|---|---|---|---|---|
0.26.1 |
0.17.4 |
0.8.2 |
0.6.0 |
0.13.1 |
0.9.1 |
0.26.0 |
0.17.3 |
0.8.2 |
0.6.0 |
0.13.1 |
0.9.1 |
0.25.4 |
0.17.2 |
0.8.2 |
0.6.0 |
0.12.3 |
0.9.1 |
0.25.3 |
0.17.1 |
0.8.2 |
0.6.0 |
0.12.3 |
0.9.1 |
0.25.2 |
0.17.1 |
0.8.1 |
0.6.0 |
0.12.3 |
0.9.1 |
0.25.1 |
0.17.1 |
0.8.1 |
0.6.0 |
0.12.2 |
0.9.1 |
0.25.0 |
0.17.0 |
0.8.0 |
0.6.0 |
0.12.2 |
0.9.0 |
0.24.1 |
0.16.4 |
0.7.6 |
0.5.2 |
0.12.2 |
0.8.2 |
0.24.0 |
0.16.4 |
0.7.6 |
0.5.2 |
0.12.1 |
0.8.2 |
注釈
0.7.0
、0.7.1
、および 0.7.2
メタパッケージリリースでは、バージョン管理 ポリシーはまだ正式化されていません。
注目すべき変更¶
Qiskit 0.24.1¶
Terra 0.16.4¶
No change
Aer 0.7.6¶
No change
Ignis 0.5.2¶
No change
Aqua 0.8.2¶
No change
IBM Q Provider 0.12.2¶
ノートをアップグレードします。¶
qiskit.providers.ibmq.IBMQBackend.defaults()
now returns the pulse defaults for the backend if the backend supports pulse. However, your provider may not support pulse even if the backend does. Theopen_pulse
flag in backend configuration indicates whether the provider supports it.
Qiskit 0.24.0¶
Terra 0.16.4¶
No change
Aer 0.7.6¶
新機能¶
This is the first release of qiskit-aer that publishes precompiled binaries to PyPI for Linux on aarch64 (arm64). From this release onwards Linux aarch64 packages will be published and supported.
バグ修正¶
Fixes a bug #1153 where noise on conditional gates was always being applied regardless of whether the conditional gate was actually applied based on the classical register value. Now noise on a conditional gate will only be applied in the case where the conditional gate is applied.
Fixed issue #1126: bug in reporting measurement of a single qubit. The bug occured when copying the measured value to the output data structure.
There was previously a mismatch between the default reported number of qubits the Aer backend objects would say were supported and the the maximum number of qubits the simulator would actually run. This was due to a mismatch between the Python code used for calculating the max number of qubits and the C++ code used for a runtime check for the max number of qubits based on the available memory. This has been correct so by default now Aer backends will allow running circuits that can fit in all the available system memory. Fixes #1114
No change
Ignis 0.5.2¶
No change
Aqua 0.8.2¶
No change
IBM Q Provider 0.12.0¶
プレリュード¶
qiskit.providers.ibmq.IBMQBackend.run()
method now takes one or moreQuantumCircuit
orSchedule
. Use ofQasmQobj
andPulseQobj
is now deprecated. Runtime configuration options, such as the number of shots, can be set via either therun()
method, or theqiskit.providers.ibmq.IBMQBackend.set_options()
method. The former is used as a one-time setting for the job, and the latter for all jobs sent to the backend. If an option is set in both places, the value set inrun()
takes precedence.IBM Quantum credentials are now loaded only from sections of the
qiskitrc
file that start with 『ibmq』.
新機能¶
Python 3.9 support has been added in this release. You can now run Qiskit IBMQ provider using Python 3.9.
qiskit.providers.ibmq.AccountProvider.backends()
now has a new parameter min_num_qubits that allows you to filter by the minimum number of qubits.qiskit.providers.ibmq.IBMQBackend.run()
method now takes one or moreQuantumCircuit
orSchedule
. Runtime configuration options, such as the number of shots, can be set via either therun()
method, or theqiskit.providers.ibmq.IBMQBackend.set_options()
method. The former is used as a one-time setting for the job, and the latter for all jobs sent to the backend. If an option is set in both places, the value set inrun()
takes precedence. For example:from qiskit import IBMQ, transpile from qiskit.test.reference_circuits import ReferenceCircuits provider = IBMQ.load_account() backend = provider.get_backend('ibmq_vigo') circuits = transpile(ReferenceCircuits.bell(), backend=backend) default_shots = backend.options.shots # Returns the backend default of 1024 shots. backend.set_options(shots=2048) # All jobs will now have use 2048 shots. backend.run(circuits) # This runs with 2048 shots. backend.run(circuits, shots=8192) # This runs with 8192 shots. backend.run(circuits) # This again runs with 2048 shots.
qiskit.providers.ibmq.experiment.Experiment
now has three additional attributes, hub, group, and project, that identify the provider used to create the experiment.You can now assign an
experiment_id
to a job when submitting it usingqiskit.providers.ibmq.IBMQBackend.run()
. You can use this new field to group together a collection of jobs that belong to the same experiment. Theqiskit.providers.ibmq.IBMQBackendService.jobs()
method was also updated to allow filtering byexperiment_id
.qiskit.providers.ibmq.experiment.Experiment
now has two additional attributes:share_level: The level at which the experiment is shared which determines who can see it when listing experiments. This can be updated.
owner: The ID of the user that uploaded the experiment. This is set by the server and cannot be updated.
The method
qiskit.providers.ibmq.experimentservice.ExperimentService.experiments()
now acceptshub
,group
, andproject
as filtering keywords.Methods
qiskit.providers.ibmq.experiment.ExperimentService.experiments()
andqiskit.providers.ibmq.experiment.ExperimentService.analysis_results()
now support alimit
parameter that allows you to limit the number of experiments and analysis results returned.The method
qiskit.providers.ibmq.experimentservice.ExperimentService.experiments()
now acceptsexclude_mine
andmine_only
as filtering keywords.The method
qiskit.providers.ibmq.experimentservice.ExperimentService.experiments()
now acceptsexclude_public
andpublic_only
as filtering keywords.qiskit.providers.ibmq.managed.IBMQJobManager.run()
now accepts a singleQuantumCircuit
orSchedule
in addition to a list of them.The
least_busy()
function now skips backends that are operational but paused, meaning they are accepting but not processing jobs.You can now pickle an
IBMQJob
instance, as long as it doesn’t contain custom data that is not picklable (e.g. in Qobj header).You can now use the two new methods,
qiskit.providers.ibmq.AccountProvider.services()
andqiskit.providers.ibmq.AccountProvider.service()
to find out what services are available to your account and get an instance of a particular service.The
qiskit.providers.ibmq.IBMQBackend.reservations()
method now always returns the reservation scheduling modes even for reservations that you don’t own.
ノートをアップグレードします。¶
A number of previously deprecated methods and features have been removed, including:
qiskit.providers.ibmq.job.IBMQJob.to_dict()
qiskit.providers.ibmq.job.IBMQJob.from_dict()
Qconfig.py support
Use of proxy URLs that do not include protocols
A new parameter,
limit
is now the first parameter for bothqiskit.providers.ibmq.experiment.ExperimentService.experiments()
andqiskit.providers.ibmq.experiment.ExperimentService.analysis_results()
methods. Thislimit
has a default value of 10, meaning by deafult only 10 experiments and analysis results will be returned.IBM Quantum credentials are now loaded only from sections of the
qiskitrc
file that start with 『ibmq』. This allows theqiskitrc
file to be used for other functionality.
非推奨通知¶
Use of
QasmQobj
andPulseQobj
in theqiskit.providers.ibmq.IBMQBackend.run()
method is now deprecated.QuantumCircuit
andSchedule
should now be used instead.The
backends
attribute ofqiskit.providers.ibmq.AccountProvider
has been renamed tobackend
(sigular). For backward compatibility, you can continue to usebackends
, but it is deprecated and will be removed in a future release. Theqiskit.providers.ibmq.AccountProvider.backends()
method remains unchanged. For example:backend = provider.backend.ibmq_vigo # This is the new syntax. backend = provider.backends.ibmq_vigo # This is deprecated. backends = provider.backends() # This continues to work as before.
Setting of the
IBMQJob
client_version
attribute has been deprecated. You can, however, continue to read the value of attribute.「The
validate_qobj
keyword inqiskit.providers.ibmq.IBMQBackend.run()
is deprecated and will be removed in a future release. If you’re relying on this schema validation you should pull the schemas from the Qiskit/ibmq-schemas and directly validate your payloads with that.
バグ修正¶
Fixes the issue wherein a job could be left in the
CREATING
state if job submit fails half-way through.Fixes the issue wherein using Jupyter backend widget would fail if the backend’s basis gates do not include the traditional u1, u2, and u3. Fixes #844
Fixes the infinite loop raised when passing an
IBMQRandomService
instance to a child process.Fixes the issue wherein a
TypeError
is raised if the server returns an error code but the response data is not in the expected format.
Qiskit 0.23.6¶
Terra 0.16.4¶
No change
Aer 0.7.5¶
プレリュード¶
This release is a bugfix release that fixes compatibility in the precompiled binary wheel packages with numpy versions < 1.20.0. The previous release 0.7.4 was building the binaries in a way that would require numpy 1.20.0 which has been resolved now, so the precompiled binary wheel packages will work with any numpy compatible version.
Ignis 0.5.2¶
No change
Aqua 0.8.2¶
No change
IBM Q Provider 0.11.1¶
No change
Qiskit 0.23.5¶
Terra 0.16.4¶
プレリュード¶
This release is a bugfix release that primarily fixes compatibility with numpy
1.20.0. This numpy release deprecated their local aliases for Python’s numeric
types (np.int
-> int
, np.float
-> float
, etc.) and the usage of
these aliases in Qiskit resulted in a large number of deprecation warnings being
emitted. This release fixes this so you can run Qiskit with numpy 1.20.0 without
those deprecation warnings.
Aer 0.7.4¶
バグ修正¶
Fixes compatibility with numpy 1.20.0. This numpy release deprecated their local
aliases for Python’s numeric types (np.int
-> int
,
np.float
-> float
, etc.) and the usage of these aliases in Qiskit Aer
resulted in a large number of deprecation warnings being emitted. This release
fixes this so you can run Qiskit Aer with numpy 1.20.0 without those deprecation
warnings.
Ignis 0.5.2¶
プレリュード¶
This release is a bugfix release that primarily fixes compatibility with numpy 1.20.0. It is also the first release to include support for Python 3.9. Earlier releases (including 0.5.0 and 0.5.1) worked with Python 3.9 but did not indicate this in the package metadata, and there was no upstream testing for those releases. This release fixes that and was tested on Python 3.9 (in addition to 3.6, 3.7, and 3.8).
バグ修正¶
networkx is explicitly listed as a dependency now. It previously was an implicit dependency as it was required for the
qiskit.ignis.verification.topological_codes
module but was not correctly listed as a depdendency as qiskit-terra also requires networkx and is also a depdency of ignis so it would always be installed in practice. However, it is necessary to list it as a requirement for future releases of qiskit-terra that will not require networkx. It’s also important to correctly list the dependencies of ignis in case there were a future incompatibility between version requirements.
Aqua 0.8.2¶
IBM Q Provider 0.11.1¶
No change
Qiskit 0.23.4¶
Terra 0.16.3¶
バグ修正¶
Fixed an issue introduced in 0.16.2 that would cause errors when running
transpile()
on a circuit with a series of 1 qubit gates and a non-gate instruction that only operates on a qubit (e.g.Reset
). Fixes #5736
Aer 0.7.3¶
No change
Ignis 0.5.1¶
No change
Aqua 0.8.1¶
No change
IBM Q Provider 0.11.1¶
No change
Qiskit 0.23.3¶
Terra 0.16.2¶
新機能¶
Python 3.9 support has been added in this release. You can now run Qiskit Terra using Python 3.9.
ノートをアップグレードします。¶
The class
MCXGrayCode
will now create aC3XGate
ifnum_ctrl_qubits
is 3 and aC4XGate
ifnum_ctrl_qubits
is 4. This is in addition to the previous functionality where for any of the modes of the :class:』qiskit.library.standard_gates.x.MCXGate`, ifnum_ctrl_bits
is 1, aCXGate
is created, and if 2, aCCXGate
is created.
バグ修正¶
Pulse
Delay
instructions are now explicitly assembled asPulseQobjInstruction
objects included in thePulseQobj
output fromassemble()
.Previously, we could ignore
Delay
instructions in aSchedule
as part ofassemble()
as the time was explicit in thePulseQobj
objects. But, now with pulse gates, there are situations where we can schedule ONLY a delay, and not including the delay itself would remove the delay.Circuits with custom gate calibrations can now be scheduled with the transpiler without explicitly providing the durations of each circuit calibration.
The
BasisTranslator
andUnroller
passes, in some cases, had not been preserving the global phase of the circuit under transpilation. This has been fixed.A bug in
qiskit.pulse.builder.frequency_offset()
where whencompensate_phase
was set a factor of \(2\pi\) was missing from the appended phase.Fix the global phase of the output of the
QuantumCircuit
methodrepeat()
. If a circuit with global phase is appended to another circuit, the global phase is currently not propagated. Simulators rely on this, since the phase otherwise gets applied multiple times. This sets the global phase ofrepeat()
to 0 before appending the repeated circuit instead of multiplying the existing phase times the number of repetitions.Fixes bug in
SparsePauliOp
where multiplying by a certain non Python builtin Numpy scalar types returned incorrect values. Fixes #5408The definition of the Hellinger fidelity from has been corrected from the previous defition of \(1-H(P,Q)\) to \([1-H(P,Q)^2]^2\) so that it is equal to the quantum state fidelity of P, Q as diagonal density matrices.
Reduce the number of CX gates in the decomposition of the 3-controlled X gate,
C3XGate
. Compiled and optimized in the U CX basis, now only 14 CX and 16 U gates are used instead of 20 and 22, respectively.Fixes the issue wherein using Jupyter backend widget or
qiskit.tools.backend_monitor()
would fail if the backend’s basis gates do not include the traditional u1, u2, and u3.When running
qiskit.compiler.transpile()
on a list of circuits with a single element, the function used to return a circuit instead of a list. Now, whenqiskit.compiler.transpile()
is called with a list, it will return a list even if that list has a single element. See #5260.from qiskit import * qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) qc.measure_all() transpiled = transpile([qc]) print(type(transpiled), len(transpiled))
<class 'list'> 1
Aer 0.7.3¶
新機能¶
Python 3.9 support has been added in this release. You can now run Qiskit Aer using Python 3.9 without building from source.
バグ修正¶
Fixes issue with setting
QasmSimulator
basis gates when using"method"
and"noise_model"
options together, and when using them with a simulator constructed usingfrom_backend()
. Now the listed basis gates will be the intersection of gates supported by the backend configuration, simulation method, and noise model basis gates. If the intersection of the noise model basis gates and simulator basis gates is empty a warning will be logged.Fixes a bug that resulted in c_if not working when the width of the conditional register was greater than 64. See #1077.
Fixes bug in
from_backend()
andfrom_backend()
wherebasis_gates
was set incorrectly for IBMQ devices with basis gate set['id', 'rz', 'sx', 'x', 'cx']
. Now the noise model will always have the same basis gates as the backend basis gates regardless of whether those instructions have errors in the noise model or not.Fixes a bug when applying truncation in the matrix product state method of the QasmSimulator.
Ignis 0.5.1¶
No change
Aqua 0.8.1¶
No change
IBM Q Provider 0.11.1¶
No change
Qiskit 0.23.2¶
Terra 0.16.1¶
No change
Aer 0.7.2¶
新機能¶
Add the CMake flag
DISABLE_CONAN
(default=``OFF``)s. When installing from source, setting this toON
allows bypassing the Conan package manager to find libraries that are already installed on your system. This is also available as an environment variableDISABLE_CONAN
, which takes precedence over the CMake flag. This is not the official procedure to build AER. Thus, the user is responsible of providing all needed libraries and corresponding files to make them findable to CMake.
バグ修正¶
Fixes a bug with nested OpenMP flag was being set to true when it shouldn’t be.
Ignis 0.5.1¶
No change
Aqua 0.8.1¶
No change
IBM Q Provider 0.11.1¶
No change
Qiskit 0.23.1¶
Terra 0.16.1¶
バグ修正¶
Fixed an issue where an error was thrown in execute for valid circuits built with delays.
The QASM definition of 『c4x』 in qelib1.inc has been corrected to match the standard library definition for C4XGate.
Fixes a bug in subtraction for quantum channels \(A - B\) where \(B\) was an
Operator
object. Negation was being applied to the matrix in the Operator representation which is not equivalent to negation in the quantum channel representation.Changes the way
_evolve_instruction()
access qubits to handle the case of an instruction with multiple registers.
Aer 0.7.1¶
ノートをアップグレードします。¶
The minimum cmake version to build qiskit-aer has increased from 3.6 to 3.8. This change was necessary to enable fixing GPU version builds that support running on x86_64 CPUs lacking AVX2 instructions.
バグ修正¶
qiskit-aer with GPU support will now work on systems with x86_64 CPUs lacking AVX2 instructions. Previously, the GPU package would only run if the AVX2 instructions were available. Fixes #1023
Fixes bug with
AerProvider
where options set on the returned backends usingset_options()
were stored in the provider and would persist for subsequent calls toget_backend()
for the same named backend. Now every call to andbackends()
returns a new instance of the simulator backend that can be configured.Fixes bug in the error message returned when a circuit contains unsupported simulator instructions. Previously some supported instructions were also being listed in the error message along with the unsupported instructions.
Fix bug where the 「sx」` gate
SXGate
was not listed as a supported gate in the C++ code, in StateOpSet of matrix_product_state.hp.Fix bug where
"csx"
,"cu2"
,"cu3"
were incorrectly listed as supported basis gates for the"density_matrix"
method of theQasmSimulator
.In MPS, apply_kraus was operating directly on the input bits in the parameter qubits, instead of on the internal qubits. In the MPS algorithm, the qubits are constantly moving around so all operations should be applied to the internal qubits.
When invoking MPS::sample_measure, we need to first sort the qubits to the default ordering because this is the assumption in qasm_controller.This is done by invoking the method move_all_qubits_to_sorted_ordering. It was correct in sample_measure_using_apply_measure, but missing in sample_measure_using_probabilities.
Ignis 0.5.1¶
バグ修正¶
Fix the
"auto"
method of theTomographyFitter
,StateTomographyFitter
, andProcessTomographyFitter
to only use"cvx"
if CVXPY is installed and a third-party SDP solver other than SCS is available. This is because the SCS solver has lower accuracy than other solver methods and often returns a density matrix or Choi-matrix that is not completely-positive and fails validation when used with theqiskit.quantum_info.state_fidelity()
orqiskit.quantum_info.process_fidelity()
functions.
Aqua 0.8.1¶
0.8.1¶
新機能¶
A new algorithm has been added: the Born Openheimer Potential Energy surface for the calculation of potential energy surface along different degrees of freedom of the molecule. The algorithm is called
BOPESSampler
. It further provides functionalities of fitting the potential energy surface to an analytic function of predefined potentials.some details.
Critical Issues¶
Be aware that
initial_state
parameter inQAOA
has now different implementation as a result of a bug fix. The previous implementation wrongly mixed the user providedinitial_state
with Hadamard gates. The issue is fixed now. No attention needed if your code does not make use of the user providedinitial_state
parameter.
バグ修正¶
optimize_svm method of qp_solver would sometimes fail resulting in an error like this ValueError: cannot reshape array of size 1 into shape (200,1) This addresses the issue by adding an L2 norm parameter, lambda2, which defaults to 0.001 but can be changed via the QSVM algorithm, as needed, to facilitate convergence.
A method
one_letter_symbol
has been removed from theVarType
in the latest build of DOCplex making Aqua incompatible with this version. So instead of using this method an explicit type check of variable types has been introduced in the Aqua optimization module.:meth`~qiskit.aqua.operators.state_fns.DictStateFn.sample()` could only handle real amplitudes, but it is fixed to handle complex amplitudes. #1311 <https://github.com/Qiskit/qiskit-aqua/issues/1311> for more details.
Trotter class did not use the reps argument in constructor. #1317 <https://github.com/Qiskit/qiskit-aqua/issues/1317> for more details.
Raise an AquaError if :class`qiskit.aqua.operators.converters.CircuitSampler` samples an empty operator. #1321 <https://github.com/Qiskit/qiskit-aqua/issues/1321> for more details.
to_opflow()
returns a correct operator when coefficients are complex numbers. #1381 <https://github.com/Qiskit/qiskit-aqua/issues/1381> for more details.Let backend simulators validate NoiseModel support instead of restricting to Aer only in QuantumInstance.
Correctly handle PassManager on QuantumInstance
transpile
method by calling itsrun
method if it exists.A bug that mixes custom
initial_state
inQAOA
with Hadamard gates has been fixed. This doesn’t change functionality of QAOA if no initial_state is provided by the user. Attention should be taken if your implementation uses QAOA with cusominitial_state
parameter as the optimization results might differ.Previously, setting seed_simulator=0 in the QuantumInstance did not set any seed. This was only affecting the value 0. This has been fixed.
IBM Q Provider 0.11.1¶
新機能¶
qiskit.providers.ibmq.experiment.Experiment
now has three additional attributes, hub, group, and project, that identify the provider used to create the experiment.Methods
qiskit.providers.ibmq.experiment.ExperimentService.experiments()
andqiskit.providers.ibmq.experiment.ExperimentService.analysis_results()
now support alimit
parameter that allows you to limit the number of experiments and analysis results returned.
ノートをアップグレードします。¶
A new parameter,
limit
is now the first parameter for bothqiskit.providers.ibmq.experiment.ExperimentService.experiments()
andqiskit.providers.ibmq.experiment.ExperimentService.analysis_results()
methods. Thislimit
has a default value of 10, meaning by deafult only 10 experiments and analysis results will be returned.
バグ修正¶
Fixes the issue wherein a job could be left in the
CREATING
state if job submit fails half-way through.Fixes the infinite loop raised when passing an
IBMQRandomService
instance to a child process.
Qiskit 0.23.0¶
Terra 0.16.0¶
プレリュード¶
The 0.16.0 release includes several new features and bug fixes. The major features in this release are the following:
Introduction of scheduled circuits, where delays can be used to control the timing and alignment of operations in the circuit.
Compilation of quantum circuits from classical functions, such as oracles.
Ability to compile and optimize single qubit rotations over different Euler basis as well as the phase + square-root(X) basis (i.e.
['p', 'sx']
), which will replace the older IBM Quantum basis of['u1', 'u2', 'u3']
.Tracking of
global_phase()
on theQuantumCircuit
class has been extended through thetranspiler
,quantum_info
, andassembler
modules, as well as the BasicAer and Aer simulators. Unitary and state vector simulations will now return global phase-correct unitary matrices and state vectors.
Also of particular importance for this release is that Python 3.5 is no longer supported. If you are using Qiskit Terra with Python 3.5, the 0.15.2 release is that last version which will work.
新機能¶
Global R gates have been added to
qiskit.circuit.library
. This includes the global R gate (GR
), global Rx (GRX
) and global Ry (GRY
) gates which are derived from theGR
gate, and global Rz (GRZ
) that is defined in a similar way to theGR
gates. The global R gates are defined on a number of qubits simultaneously, and act as a direct sum of R gates on each qubit.For example:
from qiskit import QuantumCircuit, QuantumRegister import numpy as np num_qubits = 3 qr = QuantumRegister(num_qubits) qc = QuantumCircuit(qr) qc.compose(GR(num_qubits, theta=np.pi/3, phi=2*np.pi/3), inplace=True)
will create a
QuantumCircuit
on aQuantumRegister
of 3 qubits and perform aRGate
of an angle \(\theta = \frac{\pi}{3}\) about an axis in the xy-plane of the Bloch spheres that makes an angle of \(\phi = \frac{2\pi}{3}\) with the x-axis on each qubit.A new color scheme,
iqx
, has been added to thempl
backend for the circuit drawerqiskit.visualization.circuit_drawer()
andqiskit.circuit.QuantumCircuit.draw()
. This uses the same color scheme as the Circuit Composer on the IBM Quantum Experience website. There are now 3 available color schemes -default
,iqx
, andbw
.There are two ways to select a color scheme. The first is to use a user config file, by default in the
~/.qiskit
directory, in the filesettings.conf
under the[Default]
heading, a user can entercircuit_mpl_style = iqx
to select theiqx
color scheme.The second way is to add
{'name': 'iqx'}
to thestyle
kwarg to theQuantumCircuit.draw
method or to thecircuit_drawer
function. The second way will override the setting in the settings.conf file. For example:from qiskit.circuit import QuantumCircuit circuit = QuantumCircuit(2) circuit.h(0) circuit.cx(0, 1) circuit.measure_all() circuit.draw('mpl', style={'name': 'iqx'})
In the
style
kwarg for the the circuit drawerqiskit.visualization.circuit_drawer()
andqiskit.circuit.QuantumCircuit.draw()
thedisplaycolor
field with thempl
backend now allows for entering both the gate color and the text color for each gate type in the form(gate_color, text_color)
. This allows the use of light and dark gate colors with contrasting text colors. Users can still set only the gate color, in which case thegatetextcolor
field will be used. Gate colors can be set in thestyle
dict for any number of gate types, from one to the entiredisplaycolor
dict. For example:from qiskit.circuit import QuantumCircuit circuit = QuantumCircuit(1) circuit.h(0) style_dict = {'displaycolor': {'h': ('#FA74A6', '#000000')}} circuit.draw('mpl', style=style_dict)
or
style_dict = {'displaycolor': {'h': '#FA74A6'}} circuit.draw('mpl', style=style_dict)
Two alignment contexts are added to the pulse builder (
qiskit.pulse.builder
) to facilitate writing a repeated pulse sequence with delays.qiskit.pulse.builder.align_equispaced()
inserts delays with equivalent length in between pulse schedules within the context.qiskit.pulse.builder.align_func()
offers more advanced control of pulse position. This context takes a callable that calculates a fractional coordinate of i-th pulse and aligns pulses within the context. This makes coding of dynamical decoupling easy.
A
rep_delay
parameter has been added to theQasmQobj
class under the run configuration,QasmQobjConfig
. This parameter is used to denote the time between program executions. It must be chosen from the backend range given by theBackendConfiguration
methodrep_delay_range()
. If a value is not provided a backend default,qiskit.providers.models.BackendConfiguration.default_rep_delay
, will be used.rep_delay
will only work on backends which allow for dynamic repetition time. This is can be checked with theBackendConfiguration
propertydynamic_reprate_enabled
.The
qobj_schema.json
JSON Schema file inqiskit.schemas
has been updated to include therep_delay
as an optional configuration property for QASM Qobjs.The
backend_configuration_schema.json
JSON Schema file inqiskit.schemas
has been updated to includedynamic_reprate_enabled
,rep_delay_range
anddefault_rep_delay
as optional properties for a QASM backend configuration payload.A new optimization pass,
qiskit.transpiler.passes.TemplateOptimization
has been added to the transpiler. This pass applies a template matching algorithm described in arXiv:1909.05270 that replaces all compatible maximal matches in the circuit.To implement this new transpiler pass a new module,
template_circuits
, was added to the circuit library (qiskit.circuit.library
). This new module contains all the Toffoli circuit templates used in theTemplateOptimization
.This new pass is not currently included in the preset pass managers (
qiskit.transpiler.preset_passmanagers
), to use it you will need to create a customPassManager
.A new version of the providers interface has been added. This new interface, which can be found in
qiskit.providers
, provides a new versioning mechanism that will enable changes to the interface to happen in a compatible manner over time. The new interface should be simple to migrate existing providers, as it is mostly identical except for the explicit versioning.Besides having explicitly versioned abstract classes the key changes for the new interface are that the
BackendV1
methodrun()
can now take aQuantumCircuit
orSchedule
object as inputs instead ofQobj
objects. To go along with that options are now part of a backend class so that users can configure run time options when running with a circuit. The final change is thatqiskit.providers.JobV1
can now be synchronous or asynchronous, the exact configuration and method for configuring this is up to the provider, but there are interface hook points to make it explicit which execution model a job is running under in theJobV1
abstract class.A new kwarg,
inplace
, has been added to the functionqiskit.result.marginal_counts()
. This kwarg is used to control whether the contents are marginalized in place or a new copy is returned, forResult
object input. This parameter does not have any effect for an inputdict
orCounts
object.An initial version of a classical function compiler,
qiskit.circuit.classicalfunction
, has been added. This enables compiling typed python functions (operating only on bits of typeInt1
at the moment) intoQuantumCircuit
objects. For example:from qiskit.circuit import classical_function, Int1 @classical_function def grover_oracle(a: Int1, b: Int1, c: Int1, d: Int1) -> Int1: x = not a and b y = d and not c z = not x or y return z quantum_circuit = grover_oracle.synth() quantum_circuit.draw()
q_0: ──o────■────■────o──────────── │ │ │ │ q_1: ──o────o────┼────┼────■────o── │ │ │ │ │ │ q_2: ──o────■────o────┼────■────┼── │ │ │ │ │ │ q_3: ──■────┼────■────┼────■────■── ┌─┴─┐┌─┴─┐┌─┴─┐┌─┴─┐┌─┴─┐┌─┴─┐ q_4: ┤ X ├┤ X ├┤ X ├┤ X ├┤ X ├┤ X ├ └───┘└───┘└───┘└───┘└───┘└───┘
The parameter
registerless=False
in theqiskit.circuit.classicalfunction.ClassicalFunction
methodsynth()
creates a circuit with registers refering to the parameter names. For example:quantum_circuit = grover_oracle.synth(registerless=False) quantum_circuit.draw()
d_0: ──o────■────■────o──────────── │ │ │ │ c_0: ──o────o────┼────┼────■────o── │ │ │ │ │ │ b_0: ──o────■────o────┼────■────┼── │ │ │ │ │ │ a_0: ──■────┼────■────┼────■────■── ┌─┴─┐┌─┴─┐┌─┴─┐┌─┴─┐┌─┴─┐┌─┴─┐ return_0: ┤ X ├┤ X ├┤ X ├┤ X ├┤ X ├┤ X ├ └───┘└───┘└───┘└───┘└───┘└───┘
A decorated classical function can be used the same way as any other quantum gate when appending it to a circuit.
circuit = QuantumCircuit(5) circuit.append(grover_oracle, range(5)) circuit.draw()
┌────────────────┐ q_0: ┤0 ├ │ │ q_1: ┤1 ├ │ │ q_2: ┤2 GROVER_ORACLE ├ │ │ q_3: ┤3 ├ │ │ q_4: ┤4 ├ └────────────────┘
The
GROVER_ORACLE
gate is synthesized when its decomposition is required.circuit.decompose().draw()
q_0: ──o────■────■────o──────────── │ │ │ │ q_1: ──o────o────┼────┼────■────o── │ │ │ │ │ │ q_2: ──o────■────o────┼────■────┼── │ │ │ │ │ │ q_3: ──■────┼────■────┼────■────■── ┌─┴─┐┌─┴─┐┌─┴─┐┌─┴─┐┌─┴─┐┌─┴─┐ q_4: ┤ X ├┤ X ├┤ X ├┤ X ├┤ X ├┤ X ├ └───┘└───┘└───┘└───┘└───┘└───┘
The feature requires
tweedledum
, a library for synthesizing quantum circuits, that can be installed via pip withpip install tweedledum
.A new class
qiskit.circuit.Delay
for representing a delay instruction in a circuit has been added. A new methoddelay()
is now available for easily appending delays to circuits. This makes it possible to describe timing-sensitive experiments (e.g. T1/T2 experiment) in the circuit level.from qiskit import QuantumCircuit qc = QuantumCircuit(1, 1) qc.delay(500, 0, unit='ns') qc.measure(0, 0) qc.draw()
┌────────────────┐┌─┐ q_0: ┤ DELAY(500[ns]) ├┤M├ └────────────────┘└╥┘ c: 1/═══════════════════╩═ 0
A new argument
scheduling_method
forqiskit.compiler.transpile()
has been added. It is required when transpiling circuits with delays. Ifscheduling_method
is specified, the transpiler returns a scheduled circuit such that all idle times in it are padded with delays (i.e. start time of each instruction is uniquely determined). This makes it possible to see how scheduled instructions (gates) look in the circuit level.from qiskit import QuantumCircuit, transpile from qiskit.test.mock.backends import FakeAthens qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) scheduled_circuit = transpile(qc, backend=FakeAthens(), scheduling_method="alap") print("Duration in dt:", scheduled_circuit.duration) scheduled_circuit.draw(idle_wires=False)
Duration in dt: 2016
┌─────────┐ q_0 -> 0 ────┤ U2(0,π) ├──────■── ┌──┴─────────┴───┐┌─┴─┐ q_1 -> 1 ─┤ DELAY(160[dt]) ├┤ X ├ ┌┴────────────────┤└───┘ ancilla_0 -> 2 ┤ DELAY(2016[dt]) ├───── ├─────────────────┤ ancilla_1 -> 3 ┤ DELAY(2016[dt]) ├───── ├─────────────────┤ ancilla_2 -> 4 ┤ DELAY(2016[dt]) ├───── └─────────────────┘
See also
timeline_drawer()
for the best visualization of scheduled circuits.A new fuction
qiskit.compiler.sequence()
has been also added so that we can convert a scheduled circuit into aSchedule
to make it executable on a pulse-enabled backend.from qiskit.compiler import sequence sched = sequence(scheduled_circuit, pulse_enabled_backend)
The
schedule()
has been updated so that it can schedule circuits with delays. Now there are two paths to schedule a circuit with delay:qc = QuantumCircuit(1, 1) qc.h(0) qc.delay(500, 0, unit='ns') qc.h(0) qc.measure(0, 0) sched_path1 = schedule(qc.decompose(), backend) sched_path2 = sequence(transpile(qc, backend, scheduling_method='alap'), backend) assert pad(sched_path1) == sched_path2
Refer to the release notes and documentation for
transpile()
andsequence()
for the details on the other path.Added the
GroverOperator
to the circuit library (qiskit.circuit.library
) to construct the Grover operator used in Grover’s search algorithm and Quantum Amplitude Amplification/Estimation. Provided with an oracle in form of a circuit,GroverOperator
creates the textbook Grover operator. To generalize this for amplitude amplification and use a generic operator instead of Hadamard gates as state preparation, thestate_in
argument can be used.The
InstructionScheduleMap
methodsget()
andpop()
methods now takeParameterExpression
instances in addition to numerical values for schedule generator parameters. If the generator is a function, expressions may be bound before or within the function call. If the generator is aParametrizedSchedule
, expressions must be bound before the schedule itself is bound/called.A new class
LinearAmplitudeFunction
was added to the circuit library (qiskit.circuit.library
) for mapping (piecewise) linear functions on qubit amplitudes,\[F|x\rangle |0\rangle = \sqrt{1 - f(x)}|x\rangle |0\rangle + \sqrt{f(x)}|x\rangle |1\rangle\]The mapping is based on a controlled Pauli Y-rotations and a Taylor approximation, as described in https://arxiv.org/abs/1806.06893. This circuit can be used to compute expectation values of linear functions using the quantum amplitude estimation algorithm.
The new jupyter magic
monospaced_output
has been added to theqiskit.tools.jupyter
module. This magic sets the Jupyter notebook output font to 「Courier New」, when possible. When used this fonts returns text circuit drawings that are better aligned.import qiskit.tools.jupyter %monospaced_output
A new transpiler pass,
Optimize1qGatesDecomposition
, has been added. This transpiler pass is an alternative to the existingOptimize1qGates
that uses theOneQubitEulerDecomposer
class to decompose and simplify a chain of single qubit gates. This method is compatible with any basis set, whileOptimize1qGates
only works for u1, u2, and u3. The default pass managers foroptimization_level
1, 2, and 3 have been updated to use this new pass if the basis set doesn’t include u1, u2, or u3.The
OneQubitEulerDecomposer
now supports two new basis,'PSX'
and'U'
. These can be specified with thebasis
kwarg on the constructor. This will decompose the matrix into a circuit usingPGate
andSXGate
for'PSX'
, andUGate
for'U'
.A new method
remove()
has been added to theqiskit.transpiler.PassManager
class. This method enables removing a pass from aPassManager
instance. It works on indexes, similar toreplace()
. For example, to remove theRemoveResetInZeroState
pass from the pass manager used at optimization level 1:from qiskit.transpiler.preset_passmanagers import level_1_pass_manager from qiskit.transpiler.passmanager_config import PassManagerConfig pm = level_1_pass_manager(PassManagerConfig()) pm.draw()
[0] FlowLinear: UnrollCustomDefinitions, BasisTranslator [1] FlowLinear: RemoveResetInZeroState [2] DoWhile: Depth, FixedPoint, Optimize1qGates, CXCancellation
The stage
[1]
withRemoveResetInZeroState
can be removed like this:pass_manager.remove(1) pass_manager.draw()
[0] FlowLinear: UnrollCustomDefinitions, BasisTranslator [1] DoWhile: Depth, FixedPoint, Optimize1qGates, CXCancellation
Several classes to load probability distributions into qubit amplitudes;
UniformDistribution
,NormalDistribution
, andLogNormalDistribution
were added to the circuit library (qiskit.circuit.library
). The normal and log-normal distribution support both univariate and multivariate distributions. These circuits are central to applications in finance where quantum amplitude estimation is used.Support for pulse gates has been added to the
QuantumCircuit
class. This enables aQuantumCircuit
to override (for basis gates) or specify (for standard and custom gates) a definition of aGate
operation in terms of time-ordered signals across hardware channels. In other words, it enables the option to provide pulse-level custom gate calibrations.The circuits are built exactly as before. For example:
from qiskit import pulse from qiskit.circuit import QuantumCircuit, Gate class RxGate(Gate): def __init__(self, theta): super().__init__('rxtheta', 1, [theta]) circ = QuantumCircuit(1) circ.h(0) circ.append(RxGate(3.14), [0])
Then, the calibration for the gate can be registered using the
QuantumCircuit
methodadd_calibration()
which takes aSchedule
definition as well as the qubits and parameters that it is defined for:# Define the gate implementation as a schedule with pulse.build() as custom_h_schedule: pulse.play(pulse.library.Drag(...), pulse.DriveChannel(0)) with pulse.build() as q1_x180: pulse.play(pulse.library.Gaussian(...), pulse.DriveChannel(1)) # Register the schedule to the gate circ.add_calibration('h', [0], custom_h_schedule) # or gate.name string to register circ.add_calibration(RxGate(3.14), [0], q1_x180) # Can accept gate
Previously, this functionality could only be used through complete Pulse Schedules. Additionally, circuits can now be submitted to backends with your custom definitions (dependent on backend support).
Circuits with pulse gates can still be lowered to a
Schedule
by using theschedule()
function.The calibrated gate can also be transpiled using the regular transpilation process:
transpiled_circuit = transpile(circ, backend)
The transpiled circuit will leave the calibrated gates on the same qubit as the original circuit and will not unroll them to the basis gates.
Support for disassembly of
PulseQobj
objects has been added to theqiskit.assembler.disassemble()
function. For example:from qiskit import pulse from qiskit.assembler.disassemble import disassemble from qiskit.compiler.assemble import assemble from qiskit.test.mock import FakeOpenPulse2Q backend = FakeOpenPulse2Q() d0 = pulse.DriveChannel(0) d1 = pulse.DriveChannel(1) with pulse.build(backend) as sched: with pulse.align_right(): pulse.play(pulse.library.Constant(10, 1.0), d0) pulse.shift_phase(3.11, d0) pulse.measure_all() qobj = assemble(sched, backend=backend, shots=512) scheds, run_config, header = disassemble(qobj)
A new kwarg,
coord_type
has been added toqiskit.visualization.plot_bloch_vector()
. This kwarg enables changing the coordinate system used for the input parameter that describes the positioning of the vector on the Bloch sphere in the generated visualization. There are 2 supported values for this new kwarg,'cartesian'
(the default value) and'spherical'
. If thecoord_type
kwarg is set to'spherical'
the list of parameters taken in are of the form[r, theta, phi]
wherer
is the radius,theta
is the inclination from +z direction, andphi
is the azimuth from +x direction. For example:from numpy import pi from qiskit.visualization import plot_bloch_vector x = 0 y = 0 z = 1 r = 1 theta = pi phi = 0 # Cartesian coordinates, where (x,y,z) are cartesian coordinates # for bloch vector plot_bloch_vector([x,y,z])
plot_bloch_vector([x,y,z], coord_type="cartesian") # Same as line above
# Spherical coordinates, where (r,theta,phi) are spherical coordinates # for bloch vector plot_bloch_vector([r, theta, phi], coord_type="spherical")
Pulse
Schedule
objects now support usingParameterExpression
objects for parameters.For example:
from qiskit.circuit import Parameter from qiskit import pulse alpha = Parameter('⍺') phi = Parameter('ϕ') qubit = Parameter('q') amp = Parameter('amp') schedule = pulse.Schedule() schedule += SetFrequency(alpha, DriveChannel(qubit)) schedule += ShiftPhase(phi, DriveChannel(qubit)) schedule += Play(Gaussian(duration=128, sigma=4, amp=amp), DriveChannel(qubit)) schedule += ShiftPhase(-phi, DriveChannel(qubit))
Parameter assignment is done via the
assign_parameters()
method:schedule.assign_parameters({alpha: 4.5e9, phi: 1.57, qubit: 0, amp: 0.2})
Expressions and partial assignment also work, such as:
beta = Parameter('b') schedule += SetFrequency(alpha + beta, DriveChannel(0)) schedule.assign_parameters({alpha: 4.5e9}) schedule.assign_parameters({beta: phi / 6.28})
A new visualization function
timeline_drawer()
was added to theqiskit.visualization
module.For example:
from qiskit.visualization import timeline_drawer from qiskit import QuantumCircuit, transpile from qiskit.test.mock import FakeAthens qc = QuantumCircuit(2) qc.h(0) qc.cx(0,1) timeline_drawer(transpile(qc, FakeAthens(), scheduling_method='alap'))
ノートをアップグレードします。¶
Type checking for the
params
kwarg of the constructor for theGate
class and its subclasses has been changed. Previously allGate
parameters had to be in a set of allowed types defined in theInstruction
class. Now a new method,validate_parameter()
is used to determine if a parameter type is valid or not. The definition of this method in a subclass will take priority over its parent. For example,UnitaryGate
accepts a parameter of the typenumpy.ndarray
and defines a customvalidate_parameter()
method that returns the parameter if it’s annumpy.ndarray
. This takes priority over the function defined in its parent classGate
. IfUnitaryGate
were to be used as parent for a new class, thisvalidate_parameter
method would be used unless the new child class defines its own method.The previously deprecated methods, arguments, and properties named
n_qubits
andnumberofqubits
have been removed. These were deprecated in the 0.13.0 release. The full set of changes are:Class
Old
New
n_qubits
numberofqubits
Function
Old Argument
New Argument
n_qubits
num_qubits
n_qubits
num_qubits
Inserting a parameterized
Gate
instance into aQuantumCircuit
now creates a copy of that gate which is used in the circuit. If changes are made to the instance inserted into the circuit it will no longer be reflected in the gate in the circuit. This change was made to fix an issue when inserting a single parameterizedGate
object into multiple circuits.The function
qiskit.result.marginal_counts()
now, by default, does not modify theqiskit.result.Result
instance parameter. Previously, theResult
object was always modified in place. A new kwarginplace
has been addedmarginal_counts()
which enables using the previous behavior wheninplace=True
is set.The
U3Gate
definition has been changed to be in terms of theUGate
class. TheUGate
class has no definition. It is therefore not possible to unroll every circuit in terms of U3 and CX anymore. Instead, U and CX can be used for every circuit.The deprecated support for running Qiskit Terra with Python 3.5 has been removed. To use Qiskit Terra from this release onward you will now need to use at least Python 3.6. If you are using Python 3.5 the last version which will work is Qiskit Terra 0.15.2.
In the
PulseBackendConfiguration
in thehamiltonian
attributes thevars
field is now returned in a unit of Hz instead of the previously used GHz. This change was made to be consistent with the units used with the other attributes in the class.The previously deprecated support for passing in a dictionary as the first positional argument to
DAGNode
constructor has been removed. Using a dictonary for the first positional argument was deprecated in the 0.13.0 release. To create aDAGNode
object now you should directly pass the attributes as kwargs on the constructor.The keyword arguments for the circuit gate methods (for example:
qiskit.circuit.QuantumCircuit.cx
)q
,ctl*
, andtgt*
, which were deprecated in the 0.12.0 release, have been removed. Instead, onlyqubit
,control_qubit*
andtarget_qubit*
can be used as named arguments for these methods.The previously deprecated module
qiskit.extensions.standard
has been removed. This module has been deprecated since the 0.14.0 release. Theqiskit.circuit.library
can be used instead. Additionally, all the gate classes previously inqiskit.extensions.standard
are still importable fromqiskit.extensions
.The previously deprecated gates in the module
qiskit.extensions.quantum_initializer
:DiagGate
, UCG`,UCPauliRotGate
,UCRot
,UCRXGate
,UCX
,UCRYGate
,UCY
,UCRZGate
,UCZ
have been removed. These were all deprecated in the 0.14.0 release and have alternatives available in the circuit library (qiskit.circuit.library
).The previously deprecated
qiskit.circuit.QuantumCircuit
gate methodiden()
has been removed. This was deprecated in the 0.13.0 release andi()
orid()
can be used instead.
非推奨通知¶
The use of a
numpy.ndarray
for a parameter in theparams
kwarg for the constructor of theGate
class and subclasses has been deprecated and will be removed in future releases. This was done as part of the refactoring of howparms
type checking is handled for theGate
class. If you have a custom gate class which is a subclass ofGate
directly (or via a different parent in the hierarchy) that accepts anndarray
parameter, you should define a customvalidate_parameter()
method for your class that will return the allowed parameter type. For example:def validate_parameter(self, parameter): """Custom gate parameter has to be an ndarray.""" if isinstance(parameter, numpy.ndarray): return parameter else: raise CircuitError("invalid param type {0} in gate " "{1}".format(type(parameter), self.name))
The
num_ancilla_qubits
property of thePiecewiseLinearPauliRotations
andPolynomialPauliRotations
classes has been deprecated and will be removed in a future release. Instead the propertynum_ancillas
should be used instead. This was done to make it consistent with theQuantumCircuit
methodnum_ancillas()
.The
qiskit.circuit.library.MSGate
class has been deprecated, but will remain in place to allow loading of old jobs. It has been replaced with theqiskit.circuit.library.GMS
class which should be used instead.The
MSBasisDecomposer
transpiler pass has been deprecated and will be removed in a future release. Theqiskit.transpiler.passes.BasisTranslator
pass can be used instead.The
QuantumCircuit
methodsu1
,u2
andu3
are now deprecated. Instead the following replacements can be used.u1(theta) = p(theta) = u(0, 0, theta) u2(phi, lam) = u(pi/2, phi, lam) = p(pi/2 + phi) sx p(pi/2 lam) u3(theta, phi, lam) = u(theta, phi, lam) = p(phi + pi) sx p(theta + pi) sx p(lam)
The gate classes themselves,
U1Gate
,U2Gate
andU3Gate
remain, to allow loading of old jobs.
バグ修正¶
The
Result
class’s methodsdata()
,get_memory()
,get_counts()
,get_unitary()
, andget_statevector ` will now emit a warning when the ``experiment`()
kwarg is specified for attempting to fetch results using either aQuantumCircuit
orSchedule
instance, when more than one entry matching the instance name is present in theResult
object. Note that only the first entry matching this name will be returned. Fixes #3207The
qiskit.circuit.QuantumCircuit
methodappend()
can now be used to insert one parameterized gate instance into multiple circuits. This fixes a previous issue where inserting a single parameterizedGate
object into multiple circuits would cause failures when one circuit had a parameter assigned. Fixes #4697Previously the
qiskit.execute.execute()
function would incorrectly disallow both thebackend
andpass_manager
kwargs to be specified at the same time. This has been fixed so that bothbackend
andpass_manager
can be used together on calls toexecute()
. Fixes #5037The
QuantumCircuit
methodunitary()
method has been fixed to accept a single integer for theqarg
argument (when adding a 1-qubit unitary). The allowed types for theqargs
argument are nowint
,Qubit
, or a list of integers. Fixes #4944Previously, calling
inverse()
on aBlueprintCircuit
object could fail if its internal data property was not yet populated. This has been fixed so that the callinginverse()
will populate the internal data before generating the inverse of the circuit. Fixes #5140Fixed 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 #5017Fixes a bug where setting
ctrl_state
of aUnitaryGate
would be applied twice; once in the creation of the matrix for the controlled unitary and again when calling thedefinition()
method of theqiskit.circuit.ControlledGate
class. This would give the appearence that settingctrl_state
had no effect.Previously the
ControlledGate
methodinverse()
would not preserve thectrl_state
parameter in some cases. This has been fixed so that callinginverse()
will preserve the valuectrl_state
in its output.Fixed a bug in the
mpl
output backend of the circuit drawerqiskit.circuit.QuantumCircuit.draw()
andqiskit.visualization.circuit_drawer()
that would cause the drawer to fail if thestyle
kwarg was set to a string. The correct behavior would be to treat that string as a path to a JSON file containing the style sheet for the visualization. This has been fixed, and warnings are raised if the JSON file for the style sheet can’t be loaded.Fixed an error where loading a QASM file via
from_qasm_file()
orfrom_qasm_str()
would fail if au
,phase(p)
,sx
, orsxdg
gate were present in the QASM file. Fixes #5156Fixed a bug that would potentially cause registers to be mismapped when unrolling/decomposing a gate defined with only one 2-qubit operation.
Aer 0.7.0¶
プレリュード¶
This 0.7.0 release includes numerous performance improvements and significant enhancements to the simulator interface, and drops support for Python 3.5. The main interface changes are configurable simulator backends, and constructing preconfigured simulators from IBMQ backends. Noise model an basis gate support has also been extended for most of the Qiskit circuit library standard gates, including new support for 1 and 2-qubit rotation gates. Performance improvements include adding SIMD support to the density matrix and unitary simulation methods, reducing the used memory and improving the performance of circuits using statevector and density matrix snapshots, and adding support for Kraus instructions to the gate fusion circuit optimization for greatly improving the performance of noisy statevector simulations.
新機能¶
Adds basis gate support for the
qiskit.circuit.Delay
instruction to theStatevectorSimulator
,UnitarySimulator
, andQasmSimulator
. Note that this gate is treated as an identity gate during simulation and the delay length parameter is ignored.Adds basis gate support for the single-qubit gate
qiskit.circuit.library.UGate
to theStatevectorSimulator
,UnitarySimulator
, and the"statevector"
,"density_matrix"
,"matrix_product_state"
, and"extended_stabilizer"
methods of theQasmSimulator
.Adds basis gate support for the phase gate
qiskit.circuit.library.PhaseGate
to theStatevectorSimulator
,StatevectorSimulator
,UnitarySimulator
, and the"statevector"
,"density_matrix"
,"matrix_product_state"
, and"extended_stabilizer"
methods of theQasmSimulator
.Adds basis gate support for the controlled-phase gate
qiskit.circuit.library.CPhaseGate
to theStatevectorSimulator
,StatevectorSimulator
,UnitarySimulator
, and the"statevector"
,"density_matrix"
, and"matrix_product_state"
methods of theQasmSimulator
.Adds support for the multi-controlled phase gate
qiskit.circuit.library.MCPhaseGate
to theStatevectorSimulator
,UnitarySimulator
, and the"statevector"
method of theQasmSimulator
.Adds support for the \(\sqrt(X)\) gate
qiskit.circuit.library.SXGate
to the class:~qiskit.providers.aer.StatevectorSimulator,UnitarySimulator
, andQasmSimulator
.Adds support for 1 and 2-qubit Qiskit circuit library rotation gates
RXGate
,RYGate
,RZGate
,RGate
,RXXGate
,RYYGate
,RZZGate
,RZXGate
to theStatevectorSimulator
,UnitarySimulator
, and the"statevector"
and"density_matrix"
methods of theQasmSimulator
.Adds support for multi-controlled rotation gates
"mcr"
,"mcrx"
,"mcry"
,"mcrz"
to theStatevectorSimulator
,UnitarySimulator
, and the"statevector"
method of theQasmSimulator
.Make simulator backends configurable. This allows setting persistant options such as simulation method and noise model for each simulator backend object.
The
QasmSimulator
andPulseSimulator
can also be configured from anIBMQBackend
backend object using the :meth:`~qiskit.providers.aer.QasmSimulator.from_backend method. For theQasmSimulator
this will configure the coupling map, basis gates, and basic device noise model based on the backend configuration and properties. For thePulseSimulator
the system model and defaults will be configured automatically from the backend configuration, properties and defaults.For example a noisy density matrix simulator backend can be constructed as
QasmSimulator(method='density_matrix', noise_model=noise_model)
, or an ideal matrix product state simulator asQasmSimulator(method='matrix_product_state')
.A benefit is that a
PulseSimulator
instance configured from a backend better serves as a drop-in replacement to the original backend, making it easier to swap in and out a simulator and real backend, e.g. when testing code on a simulator before using a real backend. For example, in the following code-block, thePulseSimulator
is instantiated from theFakeArmonk()
backend. All configuration and default data is copied into the simulator instance, and so when it is passed as an argument toassemble
, it behaves as if the original backend was supplied (e.g. defaults fromFakeArmonk
will be present and used byassemble
).armonk_sim = qiskit.providers.aer.PulseSimulator.from_backend(FakeArmonk()) pulse_qobj = assemble(schedules, backend=armonk_sim) armonk_sim.run(pulse_qobj)
While the above example is small, the demonstrated 『drop-in replacement』 behavior should greatly improve the usability in more complicated work-flows, e.g. when calibration experiments are constructed using backend attributes.
Adds support for qobj global phase to the
StatevectorSimulator
,UnitarySimulator
, and statevector methods of theQasmSimulator
.Improves general noisy statevector simulation performance by adding a Kraus method to the gate fusion circuit optimization that allows applying gate fusion to noisy statevector simulations with general Kraus noise.
Use move semantics for statevector and density matrix snapshots for the 「statevector」 and 「density_matrix」 methods of the
QasmSimulator
if they are the final instruction in a circuit. This reduces the memory usage of the simulator improves the performance by avoiding copying a large array in the results.Adds support for general Kraus
QauntumError
gate errors in theNoiseModel
to the"matrix_product_state"
method of theQasmSimulator
.Adds support for density matrix snapshot instruction
qiskit.providers.aer.extensions.SnapshotDensityMatrix
to the"matrix_product_state"
method of theQasmSimulator
.Extends the SIMD vectorization of the statevector simulation method to the unitary matrix, superoperator matrix, and density matrix simulation methods. This gives roughtly a 2x performance increase general simulation using the
UnitarySimulator
, the"density_matrix"
method of theQasmSimulator
, gate fusion, and noise simulation.Adds a custom vector class to C++ code that has better integration with Pybind11. This haves the memory requirement of the
StatevectorSimulator
by avoiding an memory copy during Python binding of the final simulator state.
ノートをアップグレードします。¶
AER now uses Lapack to perform some matrix related computations. It uses the Lapack library bundled with OpenBlas (already available in Linux and Macos typical OpenBlas dsitributions; Windows version distributed with AER) or with the accelerate framework in MacOS.
The deprecated support for running qiskit-aer with Python 3.5 has been removed. To use qiskit-aer >=0.7.0 you will now need at least Python 3.6. If you are using Python 3.5 the last version which will work is qiskit-aer 0.6.x.
Updates gate fusion default thresholds so that gate fusion will be applied to circuits with of more than 14 qubits for statevector simulations on the
StatevectorSimulator
andQasmSimulator
.For the
"density_matrix"
method of theQasmSimulator
and for theUnitarySimulator
gate fusion will be applied to circuits with more than 7 qubits.Custom qubit threshold values can be set using the
fusion_threshold
backend option iebackend.set_options(fusion_threshold=10)
Changes
fusion_threshold
backend option to apply fusion when the number of qubits is above the threshold, not equal or above the threshold, to match the behavior of the OpenMP qubit threshold parameter.
非推奨通知¶
qiskit.providers.aer.noise.NoiseModel.set_x90_single_qubit_gates()
has been deprecated as unrolling to custom basis gates has been added to the qiskit transpiler. The correct way to use an X90 based noise model is to define noise on the Sqrt(X)"sx"
or"rx"
gate and one of the single-qubit phase gates"u1"
,"rx"
, or"p"
in the noise model.The
variance
kwarg of Snapshot instructions has been deprecated. This function computed the sample variance in the snapshot due to noise model sampling, not the variance due to measurement statistics so was often being used incorrectly. If noise modeling variance is required single shot snapshots should be used so variance can be computed manually in post-processing.
バグ修正¶
Fixes bug in the
StatevectorSimulator
that caused it to always run as CPU with double-precision without SIMD/AVX2 support even on systems with AVX2, or when single-precision or the GPU method was specified in the backend options.Fixes some for-loops in C++ code that were iterating over copies rather than references of container elements.
Fixes a bug where snapshot data was always copied from C++ to Python rather than moved where possible. This will halve memory usage and improve simulation time when using large statevector or density matrix snapshots.
Fix State::snapshot_pauli_expval to return correct Y expectation value in stabilizer simulator. Refer to #895 <https://github.com/Qiskit/qiskit-aer/issues/895> for more details.
The controller_execute wrappers have been adjusted to be functors (objects) rather than free functions. Among other things, this allows them to be used in multiprocessing.pool.map calls.
Add missing available memory checks for the
StatevectorSimulator
andUnitarySimulator
. This throws an exception if the memory required to simulate the number of qubits in a circuit exceeds the available memory of the system.
Ignis 0.5.0¶
プレリュード¶
This release includes a new module for expectation value measurement error mitigation, improved plotting functionality for quantum volume experiments, several bug fixes, and drops support for Python 3.5.
新機能¶
The
qiskit.ignis.verification.randomized_benchmarking.randomized_benchmarking_seq()
function allows an optional input of gate objects as interleaved_elem. In addition, the CNOT-Dihedral classqiskit.ignis.verification.randomized_benchmarking.CNOTDihedral
has a new method to_instruction, and the existing from_circuit method has an optional input of an Instruction (in addition to QuantumCircuit).The
qiskit.ignis.verification.randomized_benchmarking.CNOTDihedral
now contains the following new features. Initialization from various types of objects: CNOTDihedral, ScalarOp, QuantumCircuit, Instruction and Pauli. Converting to a matrix using to_matrix and to an operator using to_operator. Tensor product methods tensor and expand. Calculation of the adjoint, conjugate and transpose using conjugate, adjoint and transpose methods. Verify that an element is CNOTDihedral using is_cnotdihedral method. Decomposition method to_circuit of a CNOTDihedral element into a circuit was extended to allow any number of qubits, based on the function decompose_cnotdihedral_general.Adds expectation value measurement error mitigation to the mitigation module. This supports using complete N-qubit assignment matrix, single-qubit tensored assignment matrix, or continuous time Markov process (CTMP) [1] measurement error mitigation when computing expectation values of diagonal operators from counts dictionaries. Expectation values are computed using the using the
qiskit.ignis.mitigation.expectation_value()
function.Calibration circuits for calibrating a measurement error mitigator are generated using the
qiskit.ignis.mitigation.expval_meas_mitigator_circuits()
function, and the result fitted using theqiskit.ignis.mitigation.ExpvalMeasMitigatorFitter
class. The fitter returns a mitigator object can the be supplied as an argument to theexpectation_value()
function to apply mitigation.- [1] S Bravyi, S Sheldon, A Kandala, DC Mckay, JM Gambetta,
Mitigating measurement errors in multi-qubit experiments, arXiv:2006.14044 [quant-ph].
Example:
The following example shows calibrating a 5-qubit expectation value measurement error mitigator using the
'tensored'
method.from qiskit import execute from qiskit.test.mock import FakeVigo import qiskit.ignis.mitigation as mit backend = FakeVigo() num_qubits = backend.configuration().num_qubits # Generate calibration circuits circuits, metadata = mit.expval_meas_mitigator_circuits( num_qubits, method='tensored') result = execute(circuits, backend, shots=8192).result() # Fit mitigator mitigator = mit.ExpvalMeasMitigatorFitter(result, metadata).fit() # Plot fitted N-qubit assignment matrix mitigator.plot_assignment_matrix()
<matplotlib.axes._subplots.AxesSubplot at 0x7f6740e0b310>
The following shows how to use the above mitigator to apply measurement error mitigation to expectation value computations
from qiskit import QuantumCircuit # Test Circuit with expectation value -1. qc = QuantumCircuit(num_qubits) qc.x(range(num_qubits)) qc.measure_all() # Execute shots = 8192 seed_simulator = 1999 result = execute(qc, backend, shots=8192, seed_simulator=1999).result() counts = result.get_counts(0) # Expectation value of Z^N without mitigation expval_nomit, error_nomit = mit.expectation_value(counts) print('Expval (no mitigation): {:.2f} \u00B1 {:.2f}'.format( expval_nomit, error_nomit)) # Expectation value of Z^N with mitigation expval_mit, error_mit = mit.expectation_value(counts, meas_mitigator=mitigator) print('Expval (with mitigation): {:.2f} \u00B1 {:.2f}'.format( expval_mit, error_mit))
Expval (no mitigation): -0.81 ± 0.01 Expval (with mitigation): -1.00 ± 0.01
Adds Numba as an optional dependency. Numba is used to significantly increase the performance of the
qiskit.ignis.mitigation.CTMPExpvalMeasMitigator
class used for expectation value measurement error mitigation with the CTMP method.Add two methods to
qiskit.ignis.verification.quantum_volume.QVFitter
.qiskit.ignis.verification.quantum_volume.QVFitter.calc_z_value()
to calculate z value in standard normal distribution using mean and standard deviation sigma. If sigma = 0, it raises a warning and assigns a small value (1e-10) for sigma so that the code still runs.qiskit.ignis.verification.quantum_volume.QVFitter.calc_confidence_level()
to calculate confidence level using z value.
Store confidence level even when hmean < 2/3 in
qiskit.ignis.verification.quantum_volume.QVFitter.qv_success()
.Add explanations for how to calculate statistics based on binomial distribution in
qiskit.ignis.verification.quantum_volume.QVFitter.calc_statistics()
.The
qiskit.ignis.verification.QVFitter
methodplot_qv_data()
has been updated to return amatplotlib.Figure
object. Previously, it would not return anything. By returning a figure this makes it easier to integrate the visualizations into a largermatplotlib
workflow.The error bars in the figure produced by the
qiskit.ignis.verification.QVFitter
methodqiskit.ignis.verification.QVFitter.plot_qv_data()
has been updated to represent two-sigma confidence intervals. Previously, the error bars represent one-sigma confidence intervals. The success criteria of Quantum Volume benchmarking requires heavy output probability > 2/3 with one-sided two-sigma confidence (~97.7%). Changing error bars to represent two-sigma confidence intervals allows easily identification of success in the figure.A new kwarg,
figsize
has been added to theqiskit.ignis.verification.QVFitter
methodqiskit.ignis.verification.QVFitter.plot_qv_data()
. This kwarg takes in a tuple of the form(x, y)
wherex
andy
are the dimension in inches to make the generated plot.The
qiskit.ignis.verification.quantum_volume.QVFitter.plot_hop_accumulative()
method has been added to plot heavy output probability (HOP) vs number of trials similar to Figure 2a of Quantum Volume 64 paper (arXiv:2008.08571). HOP of individual trials are plotted as scatters and cummulative HOP are plotted in red line. Two-sigma confidence intervals are plotted as shaded area and 2/3 success threshold is plotted as dashed line.The
qiskit.ignis.verification.quantum_volume.QVFitter.plot_qv_trial()
method has been added to plot individual trials, leveraging on theqiskit.visualization.plot_histogram()
method from Qiskit Terra. Bitstring counts are plotted as overlapping histograms for ideal (hollow) and experimental (filled) values. Experimental heavy output probability are shown on the legend. Median probability is plotted as red dashed line.
ノートをアップグレードします。¶
The deprecated support for running qiskit-ignis with Python 3.5 has been removed. To use qiskit-ignis >=0.5.0 you will now need at least Python 3.6. If you are using Python 3.5 the last version which will work is qiskit-ignis 0.4.x.
バグ修正¶
Fixing a bug in the class
qiskit.ignis.verification.randomized_benchmarking.CNOTDihedral
for elements with more than 5 quits.Fix the confidence level threshold for
qiskit.ignis.verification.quantum_volume.QVFitter.qv_success()
to 0.977 corresponding to z = 2 as defined by the QV paper Algorithm 1.Fix a bug at
qiskit.ignis.verification.randomized_benchmarking.randomized_benchmarking_seq()
which caused all the subsystems with the same size in the given rb_pattern to have the same gates when a 『rand_seed』 parameter was given to the function.
Aqua 0.8.0¶
プレリュード¶
This release introduces an interface for running the available methods for Bosonic problems. In particular we introduced a full interface for running vibronic structure calculations.
This release introduces an interface for excited states calculations. It is now easier for the user to create a general excited states calculation. This calculation is based on a Driver which provides the relevant information about the molecule, a Transformation which provides the information about the mapping of the problem into a qubit Hamiltonian, and finally a Solver. The Solver is the specific way which the excited states calculation is done (the algorithm). This structure follows the one of the ground state calculations. The results are modified to take lists of expectation values instead of a single one. The QEOM and NumpyEigensolver are adapted to the new structure. A factory is introduced to run a numpy eigensolver with a specific filter (to target states of specific symmetries).
VQE expectation computation with Aer qasm_simulator now defaults to a computation that has the expected shot noise behavior.
新機能¶
Introduced an option warm_start that should be used when tuning other options does not help. When this option is enabled, a relaxed problem (all variables are continuous) is solved first and the solution is used to initialize the state of the optimizer before it starts the iterative process in the solve method.
The amplitude estimation algorithms now use
QuantumCircuit
objects as inputs to specify the A- and Q operators. This change goes along with the introduction of theGroverOperator
in the circuit library, which allows an intuitive and fast construction of different Q operators. For example, a Bernoulli-experiment can now be constructed asimport numpy as np from qiskit import QuantumCircuit from qiskit.aqua.algorithms import AmplitudeEstimation probability = 0.5 angle = 2 * np.sqrt(np.arcsin(probability)) a_operator = QuantumCircuit(1) a_operator.ry(angle, 0) # construct directly q_operator = QuantumCircuit(1) q_operator.ry(2 * angle, 0) # construct via Grover operator from qiskit.circuit.library import GroverOperator oracle = QuantumCircuit(1) oracle.z(0) # good state = the qubit is in state |1> q_operator = GroverOperator(oracle, state_preparation=a_operator) # use default construction in QAE q_operator = None ae = AmplitudeEstimation(a_operator, q_operator)
Add the possibility to compute Conditional Value at Risk (CVaR) expectation values.
Given a diagonal observable H, often corresponding to the objective function of an optimization problem, we are often not as interested in minimizing the average energy of our observed measurements. In this context, we are satisfied if at least some of our measurements achieve low energy. (Note that this is emphatically not the case for chemistry problems).
To this end, one might consider using the best observed sample as a cost function during variational optimization. The issue here, is that this can result in a non-smooth optimization surface. To resolve this issue, we can smooth the optimization surface by using not just the best observed sample, but instead average over some fraction of best observed samples. This is exactly what the CVaR estimator accomplishes [1].
Let \(\alpha\) be a real number in \([0,1]\) which specifies the fraction of best observed samples which are used to compute the objective function. Observe that if \(\alpha = 1\), CVaR is equivalent to a standard expectation value. Similarly, if \(\alpha = 0\), then CVaR corresponds to using the best observed sample. Intermediate values of \(\alpha\) interpolate between these two objective functions.
The functionality to use CVaR is included into the operator flow through a new subclass of OperatorStateFn called CVaRMeasurement. This new StateFn object is instantied in the same way as an OperatorMeasurement with the exception that it also accepts an alpha parameter and that it automatically enforces the is_measurement attribute to be True. Observe that it is unclear what a CVaRStateFn would represent were it not a measurement.
例:
qc = QuantumCircuit(1) qc.h(0) op = CVaRMeasurement(Z, alpha=0.5) @ CircuitStateFn(primitive=qc, coeff=1.0) result = op.eval()
Similarly, an operator corresponding to a standard expectation value can be converted into a CVaR expectation using the CVaRExpectation converter.
例:
qc = QuantumCircuit(1) qc.h(0) op = ~StateFn(Z) @ CircuitStateFn(primitive=qc, coeff=1.0) cvar_expecation = CVaRExpectation(alpha=0.1).convert(op) result = cvar_expecation.eval()
See [1] for additional details regarding this technique and it’s empircal performance.
References:
- [1]: Barkoutsos, P. K., Nannicini, G., Robert, A., Tavernelli, I., and Woerner, S.,
「Improving Variational Quantum Optimization using CVaR」 arXiv:1907.04769
New interface
Eigensolver
for Eigensolver algorithms.An interface for excited states calculation has been added to the chemistry module. It is now easier for the user to create a general excited states calculation. This calculation is based on a
Driver
which provides the relevant information about the molecule, aTransformation
which provides the information about the mapping of the problem into a qubit Hamiltonian, and finally a Solver. The Solver is the specific way which the excited states calculation is done (the algorithm). This structure follows the one of the ground state calculations. The results are modified to take lists of expectation values instead of a single one. TheQEOM
andNumpyEigensolver
are adapted to the new structure. A factory is introduced to run a numpy eigensolver with a specific filter (to target states of specific symmetries).In addition to the workflows for solving Fermionic problems, interfaces for calculating Bosonic ground and excited states have been added. In particular we introduced a full interface for running vibronic structure calculations.
The
OrbitalOptimizationVQE
has been added as new ground state solver in the chemistry module. This solver allows for the simulatneous optimization of the variational parameters and the orbitals of the molecule. The algorithm is introduced in Sokolov et al., The Journal of Chemical Physics 152 (12).A new algorithm has been added: the Born Openheimer Potential Energy surface for the calculation of potential energy surface along different degrees of freedom of the molecule. The algorithm is called
BOPESSampler
. It further provides functionalities of fitting the potential energy surface to an analytic function of predefined potentials.A feasibility check of the obtained solution has been added to all optimizers in the optimization stack. This has been implemented by adding two new methods to
QuadraticProgram
: *get_feasibility_info(self, x: Union[List[float], np.ndarray])
accepts an array and returns whether this solution is feasible and a list of violated variables(violated bounds) and a list of violated constraints. *is_feasible(self, x: Union[List[float], np.ndarray])
accepts an array and returns whether this solution is feasible or not.Add circuit-based versions of
FixedIncomeExpectedValue
,EuropeanCallDelta
,GaussianConditionalIndependenceModel
andEuropeanCallExpectedValue
toqiskit.finance.applications
.Gradient Framework.
qiskit.operators.gradients
Given an operator that represents either a quantum state resp. an expectation value, the gradient framework enables the evaluation of gradients, natural gradients, Hessians, as well as the Quantum Fisher Information.Suppose a parameterized quantum state |ψ(θ)〉 = V(θ)|ψ〉 with input state |ψ〉 and parametrized Ansatz V(θ), and an Operator O(ω).
Gradients: We want to compute \(d⟨ψ(θ)|O(ω)|ψ(θ)〉/ dω\) resp. \(d⟨ψ(θ)|O(ω)|ψ(θ)〉/ dθ\) resp. \(d⟨ψ(θ)|i〉⟨i|ψ(θ)〉/ dθ\).
The last case corresponds to the gradient w.r.t. the sampling probabilities of |ψ(θ). These gradients can be computed with different methods, i.e. a parameter shift, a linear combination of unitaries and a finite difference method.
例:
x = Parameter('x') ham = x * X a = Parameter('a') q = QuantumRegister(1) qc = QuantumCircuit(q) qc.h(q) qc.p(params[0], q[0]) op = ~StateFn(ham) @ CircuitStateFn(primitive=qc, coeff=1.) value_dict = {x: 0.1, a: np.pi / 4} ham_grad = Gradient(grad_method='param_shift').convert(operator=op, params=[x]) ham_grad.assign_parameters(value_dict).eval() state_grad = Gradient(grad_method='lin_comb').convert(operator=op, params=[a]) state_grad.assign_parameters(value_dict).eval() prob_grad = Gradient(grad_method='fin_diff').convert(operator=CircuitStateFn(primitive=qc, coeff=1.), params=[a]) prob_grad.assign_parameters(value_dict).eval()
Hessians: We want to compute \(d^2⟨ψ(θ)|O(ω)|ψ(θ)〉/ dω^2\) resp. \(d^2⟨ψ(θ)|O(ω)|ψ(θ)〉/ dθ^2\) resp. \(d^2⟨ψ(θ)|O(ω)|ψ(θ)〉/ dθdω\) resp. \(d^2⟨ψ(θ)|i〉⟨i|ψ(θ)〉/ dθ^2\).
The last case corresponds to the Hessian w.r.t. the sampling probabilities of |ψ(θ). Just as the first order gradients, the Hessians can be evaluated with different methods, i.e. a parameter shift, a linear combination of unitaries and a finite difference method. Given a tuple of parameters
Hessian().convert(op, param_tuple)
returns the value for the second order derivative. If a list of parameters is givenHessian().convert(op, param_list)
returns the full Hessian for all the given parameters according to the given parameter order.QFI: The Quantum Fisher Information QFI is a metric tensor which is representative for the representation capacity of a parameterized quantum state |ψ(θ)〉 = V(θ)|ψ〉 generated by an input state |ψ〉 and a parametrized Ansatz V(θ). The entries of the QFI for a pure state read \([QFI]kl= Re[〈∂kψ|∂lψ〉−〈∂kψ|ψ〉〈ψ|∂lψ〉] * 4\).
Just as for the previous derivative types, the QFI can be computed using different methods: a full representation based on a linear combination of unitaries implementation, a block-diagonal and a diagonal representation based on an overlap method.
例:
q = QuantumRegister(1) qc = QuantumCircuit(q) qc.h(q) qc.p(params[0], q[0]) op = ~StateFn(ham) @ CircuitStateFn(primitive=qc, coeff=1.) value_dict = {x: 0.1, a: np.pi / 4} qfi = QFI('lin_comb_full').convert(operator=CircuitStateFn(primitive=qc, coeff=1.), params=[a]) qfi.assign_parameters(value_dict).eval()
The combination of the QFI and the gradient lead to a special form of a gradient, namely
NaturalGradients: The natural gradient is a special gradient method which rescales a gradient w.r.t. a state parameter with the inverse of the corresponding Quantum Fisher Information (QFI) \(QFI^-1 d⟨ψ(θ)|O(ω)|ψ(θ)〉/ dθ\). Hereby, we can choose a gradient as well as a QFI method and a regularization method which is used together with a least square solver instead of exact invertion of the QFI:
例:
op = ~StateFn(ham) @ CircuitStateFn(primitive=qc, coeff=1.) nat_grad = NaturalGradient(grad_method='lin_comb, qfi_method='lin_comb_full', \ regularization='ridge').convert(operator=op, params=params)
The gradient framework is also compatible with the optimizers from qiskit.aqua.components.optimizers. The derivative classes come with a gradient_wrapper() function which returns the corresponding callable.
Introduces
transformations
for the fermionic and bosonic transformation of a problem instance. Transforms the fermionic operator to qubit operator. Respective class for the transformation isfermionic_transformation
Introduces in algorithmsground_state_solvers
for the calculation of ground state properties. The calculation can be done either using anMinimumEigensolver
or usingAdaptVQE
Introduceschemistry/results
where the eigenstate_result and the electronic_structure_result are also used for the algorithms. Introduces Minimum Eigensolver factoriesminimum_eigensolver_factories
where chemistry specific minimum eigensolvers can be initialized Introduces orbital optimization vqeoovqe
as a ground state solver for chemistry applicationsNew Algorithm result classes:
Grover
method_run()
returns classGroverResult
.AmplitudeEstimation
method_run()
returns classAmplitudeEstimationResult
.IterativeAmplitudeEstimation
method_run()
returns classIterativeAmplitudeEstimationResult
.MaximumLikelihoodAmplitudeEstimation
method_run()
returns classMaximumLikelihoodAmplitudeEstimationResult
.All new result classes are backwards compatible with previous result dictionary.
New Linear Solver result classes:
HHL
method_run()
returns classHHLResult
.NumPyLSsolver
method_run()
returns classNumPyLSsolverResult
.All new result classes are backwards compatible with previous result dictionary.
MinimumEigenOptimizationResult
now exposes properties:samples
andeigensolver_result
. The latter is obtained from the underlying algorithm used by the optimizer and specific to the algorithm.RecursiveMinimumEigenOptimizer
now returns an instance of the result classRecursiveMinimumEigenOptimizationResult
which in turn may contains intermediate results obtained from the underlying algorithms. The dedicated result class exposes propertiesreplacements
andhistory
that are specific to this optimizer. The depth of the history is managed by thehistory
parameter of the optimizer.GroverOptimizer
now returns an instance ofGroverOptimizationResult
and this result class exposes propertiesoperation_counts
,n_input_qubits
, andn_output_qubits
directly. These properties are not available in theraw_results
dictionary anymore.SlsqpOptimizer
now returns an instance ofSlsqpOptimizationResult
and this result class exposes additional properties specific to the SLSQP implementation.Support passing
QuantumCircuit
objects as generator circuits into theQuantumGenerator
.Removes the restriction to real input vectors in CircuitStateFn.from_vector. The method calls extensions.Initialize. The latter explicitly supports (in API and documentation) complex input vectors. So this restriction seems unnecessary.
Simplified AbelianGrouper using a graph coloring algorithm of retworkx. It is faster than the numpy-based coloring algorithm.
Allow calling
eval
on state function objects with no argument, which returns theVectorStateFn
representation of the state function. This is consistent behavior withOperatorBase.eval
, which returns theMatrixOp
representation, if no argument is passed.Adds
max_iterations
to theVQEAdapt
class in order to allow limiting the maximum number of iterations performed by the algorithm.VQE expectation computation with Aer qasm_simulator now defaults to a computation that has the expected shot noise behavior. The special Aer snapshot based computation, that is much faster, with the ideal output similar to state vector simulator, may still be chosen but like before Aqua 0.7 it now no longer defaults to this but can be chosen.
ノートをアップグレードします。¶
Extension of the previous Analytic Quantum Gradient Descent (AQGD) classical optimizer with the AQGD with Epochs. Now AQGD performs the gradient descent optimization with a momentum term, analytic gradients, and an added customized step length schedule for parametrized quantum gates. Gradients are computed 「analytically」 using the quantum circuit when evaluating the objective function.
The deprecated support for running qiskit-aqua with Python 3.5 has been removed. To use qiskit-aqua >=0.8.0 you will now need at least Python 3.6. If you are using Python 3.5 the last version which will work is qiskit-aqua 0.7.x.
Added retworkx as a new dependency.
非推奨通知¶
The
i_objective
argument of the amplitude estimation algorithms has been renamed toobjective_qubits
.TransformationType
QubitMappingType
Deprecate the
CircuitFactory
and derived types. TheCircuitFactory
has been introduced as temporary class when theQuantumCircuit
missed some features necessary for applications in Aqua. Now that the circuit has all required functionality, the circuit factory can be removed. The replacements are shown in the following table.Circuit factory class | Replacement ------------------------------------+----------------------------------------------- CircuitFactory | use QuantumCircuit | UncertaintyModel | - UnivariateDistribution | - MultivariateDistribution | - NormalDistribution | qiskit.circuit.library.NormalDistribution MultivariateNormalDistribution | qiskit.circuit.library.NormalDistribution LogNormalDistribution | qiskit.circuit.library.LogNormalDistribution MultivariateLogNormalDistribution | qiskit.circuit.library.LogNormalDistribution UniformDistribution | qiskit.circuit.library.UniformDistribution MultivariateUniformDistribution | qiskit.circuit.library.UniformDistribution UnivariateVariationalDistribution | use parameterized QuantumCircuit MultivariateVariationalDistribution | use parameterized QuantumCircuit | UncertaintyProblem | - UnivariateProblem | - MultivariateProblem | - UnivariatePiecewiseLinearObjective | qiskit.circuit.library.LinearAmplitudeFunction
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.Deprecate the
WeightedSumOperator
which has been ported to the circuit library asWeightedAdder
inqiskit.circuit.library
.Core Hamiltonian
class is deprecated in favor of theFermionicTransformation
Chemistry Operator
class is deprecated in favor of thetranformations
minimum_eigen_solvers/vqe_adapt
is also deprecated and moved as an implementation of the ground_state_solver interfaceapplications/molecular_ground_state_energy
is deprecated in favor ofground_state_solver
Optimizer.SupportLevel
nested enum is replaced byOptimizerSupportLevel
andOptimizer.SupportLevel
was removed. Use, for example,OptimizerSupportLevel.required
instead ofOptimizer.SupportLevel.required
.Deprecate the
UnivariateVariationalDistribution
andMultivariateVariationalDistribution
as input to theQuantumGenerator
. Instead, plainQuantumCircuit
objects can be used.Ignored fast and use_nx options of AbelianGrouper.group_subops to be removed in the future release.
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 UCCSD excitation list, comprising single and double excitations, was not being generated correctly when an active space was explicitly provided to UCSSD via the active_(un)occupied parameters.
For the amplitude estimation algorithms, we define the number of oracle queries as number of times the Q operator/Grover operator is applied. This includes the number of shots. That factor has been included in MLAE and IQAE but was missing in the 『standard』 QAE.
Fix CircuitSampler.convert, so that the
is_measurement
property is propagated to converted StateFns.Fix double calculation of coefficients in :meth`~qiskit.aqua.operators.VectorStateFn.to_circuit_op`.
Calling PauliTrotterEvolution.convert on an operator including a term that is a scalar multiple of the identity gave an incorrect circuit, one that ignored the scalar coefficient. This fix includes the effect of the coefficient in the global_phase property of the circuit.
Make ListOp.num_qubits check that all ops in list have the same num_qubits Previously, the number of qubits in the first operator in the ListOp was returned. With this change, an additional check is made that all other operators also have the same number of qubits.
Make PauliOp.exp_i() generate the correct matrix with the following changes. 1) There was previously an error in the phase of a factor of 2. 2) The global phase was ignored when converting the circuit to a matrix. We now use qiskit.quantum_info.Operator, which is generally useful for converting a circuit to a unitary matrix, when possible.
Fixes the cyclicity detection as reported buggy in https://github.com/Qiskit/qiskit-aqua/issues/1184.
IBM Q Provider 0.11.0¶
ノートをアップグレードします。¶
The deprecated support for running qiskit-ibmq-provider with Python 3.5 has been removed. To use qiskit-ibmq-provider >=0.11.0 you will now need at least Python 3.6. If you are using Python 3.5 the last version which will work is qiskit-ibmq-provider 0.10.x.
Prior to this release,
websockets
7.0 was used for Python 3.6. With this release,websockets
8.0 or above is required for all Python versions. The package requirements have been updated to reflect this.
Qiskit 0.22.0¶
Terra 0.15.2¶
No change
Aer 0.6.1¶
No change
Ignis 0.4.0¶
No change
Aqua 0.7.5¶
No change
IBM Q Provider 0.10.0¶
新機能¶
CQC randomness extractors can now be invoked asynchronously, using methods
run_async_ext1()
andrun_async_ext2()
. Each of these methods returns aCQCExtractorJob
instance that allows you to check on the job status (usingstatus()
) and wait for its result (usingblock_until_ready()
). Theqiskit.provider.ibmq.random.CQCExtractor.run()
method remains synchronous.You can now use the new IBMQ experiment service to query, retrieve, and download experiment related data. Interface to this service is located in the new
qiskit.providers.ibmq.experiment
package. Note that this feature is still in beta, and not all accounts have access to it. It is also subject to heavy modification in both functionality and API without backward compatibility.Two Jupyter magic functions, the IQX dashboard and the backend widget, are updated to display backend reservations. If a backend has reservations scheduled in the next 24 hours, time to the next one and its duration are displayed (e.g.
Reservation: in 6 hrs 30 min (60m)
). If there is a reservation and the backend is active, the backend status is displayed asactive [R]
.
ノートをアップグレードします。¶
Starting from this release, the basis_gates returned by
qiskit.providers.ibmq.IBMQBackend.configuration()
may differ for each backend. You should update your program if it relies on the basis gates being['id','u1','u2','u3','cx']
. We recommend always using theconfiguration()
method to find backend configuration values instead of hard coding them.qiskit-ibmq-provider
release 0.10 requiresqiskit-terra
release 0.15 or above. The package metadata has been updated to reflect the new dependency.
Qiskit 0.21.0¶
Terra 0.15.2¶
No change
Aer 0.6.1¶
No change
Ignis 0.4.0¶
No change
Aqua 0.7.5¶
No change
IBM Q Provider 0.9.0¶
新機能¶
You can now access the IBMQ random number services, such as the CQC randomness extractor, using the new package
qiskit.providers.ibmq.random
. Note that this feature is still in beta, and not all accounts have access to it. It is also subject to heavy modification in both functionality and API without backward compatibility.
バグ修正¶
Fixes an issue that may raise a
ValueError
ifretrieve_job()
is used to retrieve a job submitted via the IBM Quantum Experience Composer.IBMQJobManager
has been updated so that if a time out happens while waiting for an old job to finish, the time out error doesn’t prevent a new job to be submitted. Fixes #737
Qiskit 0.20.1¶
Terra 0.15.2¶
バグ修正¶
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 #5017Extending 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
Qiskit 0.20.0¶
Terra 0.15.1¶
プレリュード¶
The 0.15.0 release includes several new features and bug fixes. Some highlights for this release are:
This release includes the introduction of arbitrary basis translation to the transpiler. This includes support for directly targeting a broader range of device basis sets, e.g. backends implementing RZ, RY, RZ, CZ or iSwap gates.
The QuantumCircuit
class now tracks global
phase. This means controlling a circuit which has global phase now
correctly adds a relative phase, and gate matrix definitions are now
exact rather than equal up to a global phase.
新機能¶
A new DAG class
qiskit.dagcircuit.DAGDependency
for representing the dependency form of circuit, In this DAG, the nodes are operations (gates, measure, barrier, etc…) and the edges corresponds to non-commutation between two operations.Four new functions are added to
qiskit.converters
for converting back and forth 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 \(\pi\) 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 \(\phi\) of an eigenvalue \(e^{2\pi i\phi}\) of a unitary operator \(U\), provided with the corresponding eigenstate \(|psi\rangle\). That is\[U|\psi\rangle = e^{2\pi i\phi} |\psi\rangle\]This estimation (and thereby this circuit) is a central routine to several well-known algorithms, such as Shor’s algorithm or Quantum Amplitude Estimation.
The
qiskit.visualization
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 operation\[|x\rangle |0\rangle \mapsto |x\rangle |Q(x) \mod 2^m\rangle\]for the quadratic form \(Q\) and \(m\) output qubits. The result is in the \(m\) output qubits is encoded in two’s complement. If \(m\) is not specified, the circuit will choose the minimal number of qubits required to represent the result without applying a modulo operation. The quadratic form is specified using a matrix for the quadratic terms, a vector for the linear terms and a constant offset. If all terms are integers, the circuit implements the quadratic form exactly, otherwise it is only an approximation.
For example:
import numpy as np from qiskit.circuit.library import QuadraticForm A = np.array([[1, 2], [-1, 0]]) b = np.array([3, -3]) c = -2 m = 4 quad_form_circuit = QuadraticForm(m, A, b, c)
Add
qiskit.quantum_info.Statevector.expectation_value()
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 \(\sqrt{X}\), its adjoint \(\sqrt{X}^\dagger\), and controlled \(\sqrt{X}\) 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')
ノートをアップグレードします。¶
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)
Acquire(duration)(AcquireChannel(0))
Acquire(duration, AcquireChannel(0))
Delay(duration)(channel)
Delay(duration, channel)
FrameChange(angle)(DriveChannel(0))
# FrameChange was also renamed ShiftPhase(angle, DriveChannel(0))
Gaussian(...)(DriveChannel(0))
# Pulses need to be `Play`d Play(Gaussian(...), DriveChannel(0))
All classes and function in the
qiskit.tool.qi
module were deprecated in the 0.12.0 release and have now been removed. Instead use 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.
非推奨通知¶
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()
.
バグ修正¶
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 #4500ControlledGate
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 #4573When 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 #4576Open 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 #4437The
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-terra/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 #4461Previously 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 \(f(x)\) then \(f(-1) = f(duration + 1) = 0\). 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¶
プレリュード¶
This 0.6.0 release includes numerous performance improvements for all simulators in the Aer provider and significant changes to the build system when building from source. The main changes are support for SIMD vectorization, approximation in the matrix product state method via bond-dimension truncation, more efficient Pauli expectation value computation, and greatly improved efficiency in Python conversion of C++ result objects. The build system was upgraded to use the Conan to manage common C++ dependencies when building from source.
新機能¶
Add density matrix snapshot support to 「statevector」 and 「statevector_gpu」 methods of the QasmSimulator.
Allow density matrix snapshots on specific qubits, not just all qubits. This computes the partial trace of the state over the remaining qubits.
Adds Pauli expectation value snapshot support to the 「density_matrix」 simulation method of the
qiskit.providers.aer.QasmSimulator
. Add snapshots to circuits using 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:
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 functionIntroduce 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.
ノートをアップグレードします。¶
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.
バグ修正¶
Remove 「extended_stabilizer」 from the automatically selected simulation methods. This is needed as the extended stabilizer method is not exact and may give incorrect results for certain circuits unless the user knows how to optimize its configuration parameters.
The automatic method now only selects from 「stabilizer」, 「density_matrix」, and 「statevector」 methods. If a non-Clifford circuit that is too large for the statevector method is executed an exception will be raised suggesting you could try explicitly using the 「extended_stabilizer」 or 「matrix_product_state」 methods instead.
Disables gate fusion for the matrix product state simulation method as this was causing issues with incorrect results being returned in some cases.
Fixes a bug causing incorrect channel evaluation in the
qiskit.providers.aer.PulseSimulator
.Fixes several minor bugs for Hamiltonian parsing edge cases in the
qiskit.providers.aer.pulse.system_models.hamiltonian_model.HamiltonianModel
class.
Ignis 0.4.0¶
プレリュード¶
The main change made in this release is a refactor of the Randomized
Benchmarking code to integrate the updated Clifford class
qiskit.quantum_info.Clifford
from Terra and to improve the
CNOT-Dihedral class.
新機能¶
The
qiskit.ignis.verification.randomized_benchmarking.randomized_benchmarking_seq()
function was refactored to use the updated Clifford 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.
ノートをアップグレードします。¶
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.
非推奨通知¶
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)
バグ修正¶
Fix a bug of the position of measurement pulses inserted by py:func:qiskit.ignis.characterization.calibrations.pulse_schedules.drag_schedules. Fixes #465
Aqua 0.7.5¶
新機能¶
Removed soft dependency on CPLEX in ADMMOptimizer. Now default optimizers used by ADMMOptimizer are MinimumEigenOptimizer for QUBO problems and SlsqpOptimizer as a continuous optimizer. You can still use CplexOptimizer as an optimizer for ADMMOptimizer, but it should be set explicitly.
New Yahoo! finance provider created.
Introduced
QuadraticProgramConverter
which is an abstract class for converters. 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
.
非推奨通知¶
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()
バグ修正¶
Changed in python version 3.8: On macOS, the spawn start method is now the default. The fork start method should be considered unsafe as it can lead to crashes in subprocesses. However P_BFGS doesn’t support spawn, so we revert to single process. Refer to #1109 <https://github.com/Qiskit/qiskit-aqua/issues/1109> for more details.
Binding parameters in the
CircuitStateFn
did not copy the value 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/qiskit-aqua/issues/1153> for more details.
Exchange and Wikipedia finance providers were fixed to correctly handle Quandl data. Refer to #775 <https://github.com/Qiskit/qiskit-aqua/issues/775> for more details. Fixes a divide by 0 error on finance providers mean vector and covariance matrix calculations. Refer to #781 <https://github.com/Qiskit/qiskit-aqua/issues/781> for more details.
The
ListOp.combo_fn
property has been lost in several transformations, such as converting to another operator type, traversing, reducing or multiplication. Now this attribute is propagated to the resulting operator.The evaluation of some operator expressions, such as of
SummedOp``s and evaluations with the ``CircuitSampler
did not treat coefficients correctly or ignored them completely. E.g. evaluating~StateFn(0 * (I + Z)) @ Plus
did not yield 0 or the normalization of~StateFn(I) @ ((Plus + Minus) / sqrt(2))
missed a factor 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/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/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¶
新機能¶
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.
ノートをアップグレードします。¶
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.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
非推奨通知¶
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.
バグ修正¶
Fixes an issue wherein a call to
qiskit.providers.ibmq.IBMQBackend.jobs()
can hang if the number of jobs being returned is large. Fixes #674Fixes an issue which would raise a
ValueError
when building error maps in Jupyter for backends that are offline. Fixes #706qiskit.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
Qiskit 0.19.6¶
Terra 0.14.2¶
変更なし
Aer 0.5.2¶
変更なし
Ignis 0.3.3¶
ノートをアップグレードします。¶
A new requirement scikit-learn has been added to the requirements list. This dependency was added in the 0.3.0 release but wasn’t properly exposed as a dependency in that release. This would lead to an
ImportError
if 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.
バグ修正¶
qiskit-ignis 0.3.2 において、
cvxpy
がインストールされていない状態でqiskit.ignis.verification.tomography.fitters.process_fitter
がインポートされたときに``ImportError``が発生する問題を修正しました。
Aqua 0.7.3¶
変更なし
IBM Q Provider 0.7.2¶
変更なし
Qiskit 0.19.5¶
Terra 0.14.2¶
変更なし
Aer 0.5.2¶
変更なし
Ignis 0.3.2¶
バグ修正¶
The
qiskit.ignis.verification.TomographyFitter.fit()
method has improved detection logic for the default fitter. Previously, thecvx
fitter method was used whenever cvxpy was installed. However, it was possible to install cvxpy without an SDP solver that would work for thecvx
fitter method. This logic has been reworked so that thecvx
fitter method is only used ifcvxpy
is installed and an SDP solver is present that can be used. Otherwise, thelstsq
fitter is used.Fixes an edge case in
qiskit.ignis.mitigation.measurement.fitters.MeasurementFitter.apply()
for input that has invalid or incorrect state labels that don’t match the calibration circuit. Previously, this would not error and just return an empty result. Instead now this case is correctly caught and aQiskitError
exception is raised when using incorrect labels.
Aqua 0.7.3¶
ノートをアップグレードします。¶
The cvxpy dependency which is required for the svm classifier has been removed from the requirements list and made an optional dependency. This is because installing cvxpy is not seamless in every environment and often requires a compiler be installed to run. To use the svm classifier now you’ll need to install cvxpy by either running
pip install cvxpy<1.1.0
or to install it with aqua runningpip install qiskit-aqua[cvx]
.
バグ修正¶
The
compose
method of theCircuitOp
usedQuantumCircuit.combine
which has been changed to useQuantumCircuit.compose
. Using combine leads to the problem that composing an operator with aCircuitOp
based on a named register does not chain the operators but stacks them. E.g. composingZ ^ 2
with a circuit based on a 2-qubit named register yielded a 4-qubit operator instead of a 2-qubit operator.The
MatrixOp.to_instruction
method previously returned an operator and not an instruction. This method has been updated to return an Instruction. Note that this only works if the operator primitive is unitary, otherwise an error is raised upon the construction of the instruction.The
__hash__
method of thePauliOp
class used theid()
method which prevents set comparisons to work as expected since they rely on hash tables and identical objects used to not have identical hashes. Now, the implementation uses a hash of the string representation inline with the implementation in thePauli
class.
IBM Q Provider 0.7.2¶
変更なし
Qiskit 0.19.4¶
Terra 0.14.2¶
ノートをアップグレードします。¶
The
circuit_to_gate
andcircuit_to_instruction
converters 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 is not to register the converted instance.
バグ修正¶
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` with ``MCXGate
, which caused these gates to be incorrectly transpiled and simulated.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.Fixed the SI unit conversion for
qiskit.pulse.SetFrequency
. TheSetFrequency
instruction should be in Hz on the frontend and has to be converted to GHz whenSetFrequency
is converted toPulseQobjInstruction
.Open controls were implemented by modifying a gate's definition. However, when the gate already exists in the basis, this definition is not used, which yields incorrect circuits sent to a backend. This modifies the unroller to output the definition if it encounters a controlled gate with open controls.
Aer 0.5.2¶
変更なし
Ignis 0.3.0¶
変更なし
Aqua 0.7.2¶
プレリュード¶
VQE expectation computation with Aer qasm_simulator now defaults to a computation that has the expected shot noise behavior.
ノートをアップグレードします。¶
cvxpy is now in the requirements list as a dependency for qiskit-aqua. It is used for the quadratic program solver which is used as part of the
qiskit.aqua.algorithms.QSVM
. Previouslycvxopt
was an optional dependency that needed to be installed to use this functionality. This is no longer required as cvxpy will be installed with qiskit-aqua.For state tomography run as part of
qiskit.aqua.algorithms.HHL
with a QASM backend the tomography fitter functionqiskit.ignis.verification.StateTomographyFitter.fit()
now gets called explicitly with the method set tolstsq
to always use the least-squares fitting. Previously it would opportunistically try to use thecvx
fitter ifcvxpy
were installed. But, thecvx
fitter depends on a specifically configuredcvxpy
installation with an SDP solver installed as part ofcvxpy
which is not always present in an environment withcvxpy
installed.The VQE expectation computation using qiskit-aer’s
qiskit.providers.aer.extensions.SnapshotExpectationValue
instruction is not enabled by default anymore. This was changed to be the default in 0.7.0 because it is significantly faster, but it led to unexpected ideal results without shot noise (see #1013 for more details). The default has now changed back to match user expectations. Using the faster expectation computation is now opt-in by setting the newinclude_custom
kwarg toTrue
on theqiskit.aqua.algorithms.VQE
constructor.
新機能¶
A new kwarg
include_custom
has been added to the constructor forqiskit.aqua.algorithms.VQE
and it’s subclasses (mainlyqiskit.aqua.algorithms.QAOA
). When set to true and theexpectation
kwarg is set toNone
(the default) this will enable the use of VQE expectation computation with Aer’sqasm_simulator
qiskit.providers.aer.extensions.SnapshotExpectationValue
instruction. The special Aer snapshot based computation is much faster but with the ideal output similar to state vector simulator.
IBM Q Provider 0.7.2¶
変更なし
Qiskit 0.19.3¶
Terra 0.14.1¶
変更なし
Aer 0.5.2¶
バグ修正¶
Fixed bug with statevector and unitary simulators running a number of (parallel) shots equal to the number of CPU threads instead of only running a single shot.
Fixes the 「diagonal」 qobj gate instructions being applied incorrectly in the density matrix Qasm Simulator method.
Fixes bug where conditional gates were not being applied correctly on the density matrix simulation method.
Fix bug in CZ gate and Z gate for 「density_matrix_gpu」 and 「density_matrix_thrust」 QasmSimulator methods.
Fixes issue where memory requirements of simulation were not being checked on the QasmSimulator when using a non-automatic simulation method.
Fixed a memory leak that effected the GPU simulator methods
Ignis 0.3.0¶
変更なし
Aqua 0.7.1¶
変更なし
IBM Q Provider 0.7.2¶
バグ修正¶
qiskit.provider.ibmq.IBMQBackend.jobs()
will now return the correct list ofIBMQJob
objects when thestatus
kwarg is set to'RUNNING'
. Fixes #523The 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
Qiskit 0.19.0¶
Terra 0.14.0¶
プレリュード¶
The 0.14.0 release includes several new features and bug fixes. The biggest
change for this release is the introduction of a quantum circuit library
in qiskit.circuit.library
, containing some circuit families of
interest.
The circuit library gives users access to a rich set of well-studied circuit families, instances of which can be used as benchmarks, as building blocks in building more complex circuits, or as a tool to explore quantum computational advantage over classical. The contents of this library will continue to grow and mature.
The initial release of the circuit library contains:
standard_gates
: these are fixed-width gates commonly used as primitive building blocks, consisting of 1, 2, and 3 qubit gates. For example theXGate
,RZZGate
andCSWAPGate
. The old location of these gates underqiskit.extensions.standard
is deprecated.generalized_gates
: these are families that can generalize to arbitrarily many qubits, for example aPermutation
orGMS
(Global Molmer-Sorensen gate).boolean_logic
: circuits that transform basis states according to simple Boolean logic functions, such asADD
orXOR
.arithmetic
: a set of circuits for doing classical arithmetic such asWeightedAdder
andIntegerComparator
.basis_changes
: circuits such as the quantum Fourier transform,QFT
, that mathematically apply basis changes.n_local
: patterns to easily create large circuits with rotation and entanglement layers, such asTwoLocal
which uses single-qubit rotations and two-qubit entanglements.data_preparation
: circuits that take classical input data and encode it in a quantum state that is difficult to simulate, e.g.PauliFeatureMap
orZZFeatureMap
.Other circuits that have proven interesting in the literature, such as
QuantumVolume
,GraphState
, orIQP
.
To allow easier use of these circuits as building blocks, we have introduced
a compose()
method of
qiskit.circuit.QuantumCircuit
for composition of circuits either
with other circuits (by welding them at the ends and optionally permuting
wires) or with other simpler gates:
>>> lhs.compose(rhs, qubits=[3, 2], inplace=True)
┌───┐ ┌─────┐ ┌───┐
lqr_1_0: ───┤ H ├─── rqr_0: ──■──┤ Tdg ├ lqr_1_0: ───┤ H ├───────────────
├───┤ ┌─┴─┐└─────┘ ├───┤
lqr_1_1: ───┤ X ├─── rqr_1: ┤ X ├─────── lqr_1_1: ───┤ X ├───────────────
┌──┴───┴──┐ └───┘ ┌──┴───┴──┐┌───┐
lqr_1_2: ┤ U1(0.1) ├ + = lqr_1_2: ┤ U1(0.1) ├┤ X ├───────
└─────────┘ └─────────┘└─┬─┘┌─────┐
lqr_2_0: ─────■───── lqr_2_0: ─────■───────■──┤ Tdg ├
┌─┴─┐ ┌─┴─┐ └─────┘
lqr_2_1: ───┤ X ├─── lqr_2_1: ───┤ X ├───────────────
└───┘ └───┘
lcr_0: 0 ═══════════ lcr_0: 0 ═══════════════════════
lcr_1: 0 ═══════════ lcr_1: 0 ═══════════════════════
With this, Qiskit’s circuits no longer assume an implicit initial state of \(|0\rangle\), and will not be drawn with this initial state. The all-zero initial state is still assumed on a backend when a circuit is executed.
新機能¶
A new method,
has_entry()
, has been added to theqiskit.circuit.EquivalenceLibrary
class to quickly check if a given gate has any known decompositions in the library.A new class
IQP
, to construct an instantaneous quantum polynomial circuit, has been added to the circuit library moduleqiskit.circuit.library
.A new
compose()
method has been added toqiskit.circuit.QuantumCircuit
. It allows composition of two quantum circuits without having to turn one into a gate or instruction. It also allows permutations of qubits/clbits at the point of composition, as well as optional inplace modification. It can also be used in place ofappend()
, as it allows composing instructions and operators onto the circuit as well.qiskit.circuit.library.Diagonal
circuits have been added to the circuit library. These circuits implement diagonal quantum operators (consisting of non-zero elements only on the diagonal). They are more efficiently simulated by the Aer simulator than dense matrices.Add
from_label()
method to theqiskit.quantum_info.Clifford
class for initializing as the tensor product of single-qubit I, X, Y, Z, H, or S gates.Schedule transformer
qiskit.pulse.reschedule.compress_pulses()
performs an optimization pass to reduce the usage of waveform memory in hardware by replacing multiple identical instances of a pulse in a pulse schedule with a single pulse. For example:from qiskit.pulse import reschedule schedules = [] for _ in range(2): schedule = Schedule() drive_channel = DriveChannel(0) schedule += Play(SamplePulse([0.0, 0.1]), drive_channel) schedule += Play(SamplePulse([0.0, 0.1]), drive_channel) schedules.append(schedule) compressed_schedules = reschedule.compress_pulses(schedules)
The
qiskit.transpiler.Layout
has a new methodreorder_bits()
that is used to reorder a list of virtual qubits based on the layout object.Two new methods have been added to the
qiskit.providers.models.PulseBackendConfiguration
for interacting with channels.get_channel_qubits()
to get a list of all qubits operated by the given channel andget_qubit_channel()
to get a list of channels operating on the given qubit.
New
qiskit.extensions.HamiltonianGate
andqiskit.circuit.QuantumCircuit.hamiltonian()
methods are introduced, representing Hamiltonian evolution of the circuit wavefunction by a user-specified Hermitian Operator and evolution time. The evolution time can be aParameter
, allowing the creation of parameterized UCCSD or QAOA-style circuits which compile toUnitaryGate
objects iftime
parameters are provided. The Unitary of aHamiltonianGate
with Hamiltonian OperatorH
and time parametert
is \(e^{-iHt}\).The circuit library module
qiskit.circuit.library
now provides a new boolean logic AND circuit,qiskit.circuit.library.AND
, and OR circuit,qiskit.circuit.library.OR
, which implement the respective operations on a variable number of provided qubits.New fake backends are added under
qiskit.test.mock
. These include mocked versions ofibmq_armonk
,ibmq_essex
,ibmq_london
,ibmq_valencia
,ibmq_cambridge
,ibmq_paris
,ibmq_rome
, andibmq_athens
. As with other fake backends, these include snapshots of calibration data (i.e.backend.defaults()
) and error data (i.e.backend.properties()
) taken from the real system, and can be used for local testing, compilation and simulation.The
last_update_date
parameter forBackendProperties
can now also be passed in as adatetime
object. Previously only a string in ISO8601 format was accepted.Adds
qiskit.quantum_info.Statevector.from_int()
andqiskit.quantum_info.DensityMatrix.from_int()
methods that allow constructing a computational basis state for specified system dimensions.The methods on the
qiskit.circuit.QuantumCircuit
class for adding gates (for exampleh()
) which were previously added dynamically at run time to the class definition have been refactored to be statically defined methods of the class. This means that static analyzer (such as IDEs) can now read these methods.
ノートをアップグレードします。¶
A new package, python-dateutil, is now required and has been added to the requirements list. It is being used to parse datetime strings received from external providers in
BackendProperties
objects.The marshmallow schema classes in
qiskit.providers.models
have been removed since they are no longer used by the BackendObjects.The output of the
to_dict()
method for the classes inqiskit.providers.models
is no longer in a format for direct JSON serialization. Depending on the content contained in instances of these class there may be numpy arrays and/or complex numbers in the fields of the dict. If you’re JSON serializing the output of the to_dict methods you should ensure your JSON encoder can handle numpy arrays and complex numbers. This includes:qiskit.providers.models.Nduv.to_dict()
qiskit.providers.models.Gate.to_dict()
非推奨通知¶
The
qiskit.dagcircuit.DAGCircuit.compose()
method now takes a list of qubits/clbits that specify the positional order of bits to compose onto. The dictionary-based method of mapping using theedge_map
argument is deprecated and will be removed in a future release.The
combine_into_edge_map()
method for theqiskit.transpiler.Layout
class has been deprecated and will be removed in a future release. Instead, the new methodreorder_bits()
should be used to reorder a list of virtual qubits according to the layout object.Passing a
qiskit.pulse.ControlChannel
object in via the parameterchannel
for theqiskit.providers.models.PulseBackendConfiguration
methodcontrol()
has been deprecated and will be removed in a future release. TheControlChannel
objects are now generated from the backend configurationchannels
attribute which has the information of all channels and the qubits they operate on. Now, the methodcontrol()
is expected to take the parameterqubits
of the form(control_qubit, target_qubit)
and typelist
ortuple
, and returns a list of control channels.The
AND
andOR
methods ofqiskit.circuit.QuantumCircuit
are deprecated and will be removed in a future release. Instead you should use the circuit library boolean logic classesqiskit.circuit.library.AND
amdqiskit.circuit.library.OR
and then append those objects to your class. For example:from qiskit import QuantumCircuit from qiskit.circuit.library import AND qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) qc_and = AND(2) qc.compose(qc_and, inplace=True)
The
qiskit.extensions.standard
module is deprecated and will be removed in a future release. The gate classes in that module have been moved toqiskit.circuit.library.standard_gates
.
バグ修正¶
The
qiskit.circuit.QuantumCircuit
methodsinverse()
,mirror()
methods, as well as theQuantumCircuit.data
setter would generate an invalid circuit when used on a parameterized circuit instance. This has been resolved and these methods should now work with a parameterized circuit. Fixes #4235Previously when creating a controlled version of a standard qiskit gate if a
ctrl_state
was specified a genericControlledGate
object would be returned whereas without it a standard qiskit controlled gate would be returned if it was defined. This PR allows standard qiskit controlled gates to understandctrl_state
.Additionally, this PR fixes what might be considered a bug where setting the
ctrl_state
of an already controlled gate would assume the specified state applied to the full control width instead of the control qubits being added. For instance,:circ = QuantumCircuit(2) circ.h(0) circ.x(1) gate = circ.to_gate() cgate = gate.control(1) c3gate = cgate.control(2, ctrl_state=0)
would apply
ctrl_state
to all three control qubits instead of just the two control qubits being added.Fixed a bug in
random_clifford()
that stopped it from sampling the full Clifford group. Fixes #4271The
qiskit.circuit.Instruction
methodqiskit.circuit.Instruction.is_parameterized()
method had previously returnedTrue
for anyInstruction
instance which had aqiskit.circuit.Parameter
in any element of itsparams
array, even if thatParameter
had been fully bound. This has been corrected so that.is_parameterized
will returnFalse
when the instruction is fully bound.qiskit.circuit.ParameterExpression.subs()
had not correctly detected some cases where substituting parameters would result in a two distinctParameters
objects in an expression with the same name. This has been corrected so aCircuitError
will be raised in these cases.Improve performance of
qiskit.quantum_info.Statevector
andqiskit.quantum_info.DensityMatrix
for low-qubit circuit simulations by optimizing the class__init__
methods. Fixes #4281The function
qiskit.compiler.transpile()
now correctly handles when the parameterbasis_gates
is set toNone
. This will allow any gate in the output tranpiled circuit, including gates added by the transpilation process. Note that using this parameter may have some unintended consequences during optimization. Some transpiler passes depend on having abasis_gates
set. For example,qiskit.transpiler.passes.Optimize1qGates
only optimizes the chains of u1, u2, and u3 gates and withoutbasis_gates
it is unable to unroll gates that otherwise could be optimized:from qiskit import * q = QuantumRegister(1, name='q') circuit = QuantumCircuit(q) circuit.h(q[0]) circuit.u1(0.1, q[0]) circuit.u2(0.1, 0.2, q[0]) circuit.h(q[0]) circuit.u3(0.1, 0.2, 0.3, q[0]) result = transpile(circuit, basis_gates=None, optimization_level=3) result.draw()
┌───┐┌─────────────┐┌───┐┌─────────────────┐ q_0: ┤ H ├┤ U2(0.1,0.3) ├┤ H ├┤ U3(0.1,0.2,0.3) ├ └───┘└─────────────┘└───┘└─────────────────┘
Fixes #3017
Other Notes¶
The objects in
qiskit.providers.models
which were previously constructed using the marshmallow library have been refactored to not depend on marshmallow. This includes:Nduv
Gate
These should be drop-in replacements without any noticeable change but specifics inherited from marshmallow may not work. Please file issues for any incompatibilities found.
Aer 0.5.1¶
変更なし
Ignis 0.3.0¶
変更なし
Aqua 0.7.0¶
プレリュード¶
The Qiskit Aqua 0.7.0 release introduces a lot of new functionality along
with an improved integration with qiskit.circuit.QuantumCircuit
objects. The central contributions are the Qiskit’s optimization module,
a complete refactor on Operators, using circuits as native input for the
algorithms and removal of the declarative JSON API.
Optimization module¶
The qiskit.optimization`
module now offers functionality for modeling
and solving quadratic programs. It provides various near-term quantum and
conventional algorithms, such as the MinimumEigenOptimizer
(covering e.g. VQE
or QAOA
) or CplexOptimizer
, as well as
a set of converters to translate between different
problem representations, such as QuadraticProgramToQubo
.
See the
changelog
for a list of the added features.
Operator flow¶
The operator logic provided in qiskit.aqua.operators`
was completely
refactored and is now a full set of tools for constructing
physically-intuitive quantum computations. It contains state functions,
operators and measurements and internally relies on Terra’s Operator
objects. Computing expectation values and evolutions was heavily simplified
and objects like the ExpectationFactory
produce the suitable, most
efficient expectation algorithm based on the Operator input type.
See the changelog
for a overview of the added functionality.
Native circuits¶
Algorithms commonly use parameterized circuits as input, for example the
VQE, VQC or QSVM. Previously, these inputs had to be of type
VariationalForm
or FeatureMap
which were wrapping the circuit
object. Now circuits are natively supported in these algorithms, which
means any individually constructed QuantumCircuit
can be passed to
these algorithms. In combination with the release of the circuit library
which offers a wide collection of circuit families, it is now easy to
construct elaborate circuits as algorithm input.
Declarative JSON API¶
The ability of running algorithms using dictionaries as parameters as well as using the Aqua interfaces GUI has been removed.
IBM Q Provider 0.7.0¶
新機能¶
A new exception,
qiskit.providers.ibmq.IBMQBackendJobLimitError
, is now raised if a job could not be submitted because the limit on active jobs has been reached.qiskit.providers.ibmq.job.IBMQJob
andqiskit.providers.ibmq.managed.ManagedJobSet
each has two new methodsupdate_name
andupdate_tags
. They are used to change the name and tags of a job or a job set, respectively.qiskit.providers.ibmq.IBMQFactory.save_account()
andqiskit.providers.ibmq.IBMQFactory.enable_account()
now accept optional parametershub
,group
, andproject
, which allow specifying a default provider to save to disk or use, respectively.
ノートをアップグレードします。¶
The
qiskit.providers.ibmq.job.IBMQJob
methodscreation_date
andtime_per_step
now return date time information as adatetime
object in local time instead of UTC. Similarly, the parametersstart_datetime
andend_datetime
, ofqiskit.providers.ibmq.IBMQBackendService.jobs()
andqiskit.providers.ibmq.IBMQBackend.jobs()
can now be specified in local time.The
qiskit.providers.ibmq.job.QueueInfo.format()
method now uses a customdatetime
to string formatter, and the package arrow is no longer required and has been removed from the requirements list.
非推奨通知¶
The
from_dict()
andto_dict()
methods ofqiskit.providers.ibmq.job.IBMQJob
are deprecated and will be removed in the next release.
バグ修正¶
Fixed an issue where
nest_asyncio.apply()
may raise an exception if there is no asyncio loop due to threading.
Qiskit 0.18.3¶
Terra 0.13.0¶
変更なし
Aer 0.5.1¶
ノートをアップグレードします。¶
Changes how transpilation passes are handled in the C++ Controller classes so that each pass must be explicitly called. This allows for greater customization on when each pass should be called, and with what parameters. In particular this enables setting different parameters for the gate fusion optimization pass depending on the QasmController simulation method.
Add
gate_length_units
kwarg 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
.
バグ修正¶
Remove 「extended_stabilizer」 from the automatically selected simulation methods. This is needed as the extended stabilizer method is not exact and may give incorrect results for certain circuits unless the user knows how to optimize its configuration parameters.
The automatic method now only selects from 「stabilizer」, 「density_matrix」, and 「statevector」 methods. If a non-Clifford circuit that is too large for the statevector method is executed an exception will be raised suggesting you could try explicitly using the 「extended_stabilizer」 or 「matrix_product_state」 methods instead.
Fixes Controller classes so that the ReduceBarrier transpilation pass is applied first. This prevents barrier instructions from preventing truncation of unused qubits if the only instruction defined on them was a barrier.
Disables gate fusion for the matrix product state simulation method as this was causing issues with incorrect results being returned in some cases.
Fix error in gate time unit conversion for device noise model with thermal relaxation errors and gate errors. The error probability the depolarizing error was being calculated with gate time in microseconds, while for thermal relaxation it was being calculated in nanoseconds. This resulted in no depolarizing error being applied as the incorrect units would make the device seem to be coherence limited.
Fix bug in incorrect composition of QuantumErrors when the qubits of composed instructions differ.
Fix issue where the 「diagonal」 gate is checked to be unitary with too high a tolerance. This was causing diagonals generated from Numpy functions to often fail the test.
Fix remove-barrier circuit optimization pass to be applied before qubit trucation. This fixes an issue where barriers inserted by the Terra transpiler across otherwise inactive qubits would prevent them from being truncated.
Ignis 0.3.0¶
変更なし
Aqua 0.6.6¶
変更なし
IBM Q Provider 0.6.1¶
変更なし
Qiskit 0.18.0¶
Terra 0.13.0¶
プレリュード¶
0.13.0リリースは数多くの大きな変更があります。このリリースの主なハイライトは以下の通りです:
トランスパイラーでは、全操作の背後にある基本的データ構造である qiskit.dagcircuit.DAGCircuit
クラスを構築するため使われていたグラフ・ライブラリを、パフォーマンスを大幅に向上させるために retworkx に基づいて切り替えました。0.13.0リリースにおける回路のトランスパイレーションの速度は、以前のリリースよりも大幅に高速になるはずです。
Pulse命令を構築するスタイルが劇的に簡略化されました。数々の``Command`` が廃止され、Instruction
の統合セットがサポートされました。
The qiskit.quantum_info
module includes several new functions
for generating random operators (such as Cliffords and quantum channels)
and for computing the diamond norm of quantum channels; upgrades to the
Statevector
and
DensityMatrix
classes to support
computing measurement probabilities and sampling measurements; and several
new classes are based on the symplectic representation
of Pauli matrices. These new classes include Clifford operators
(Clifford
), N-qubit matrices that are
sparse in the Pauli basis (SparsePauliOp
),
lists of Pauli’s (PauliTable
),
and lists of stabilizers (StabilizerTable
).
This release also has vastly improved documentation across Qiskit,
including improved documentation for the qiskit.circuit
,
qiskit.pulse
and qiskit.quantum_info
modules.
Additionally, the naming of gate objects and
QuantumCircuit
methods have been updated to be
more consistent. This has resulted in several classes and methods being
deprecated as things move to a more consistent naming scheme.
For full details on all the changes made in this release see the detailed release notes below.
新機能¶
Added a new circuit library module
qiskit.circuit.library
. This will be a place for constructors of commonly used circuits that can be used as building blocks for larger circuits or applications.The
qiskit.providers.BaseJob
class has four new methods:These methods are used to check wheter a job is in a given job status.
Add ability to specify control conditioned on a qubit being in the ground state. The state of the control qubits is represented by an integer. For example:
from qiskit import QuantumCircuit from qiskit.extensions.standard import XGate qc = QuantumCircuit(4) cgate = XGate().control(3, ctrl_state=6) qc.append(cgate, [0, 1, 2, 3])
Creates a four qubit gate where the fourth qubit gets flipped if the first qubit is in the ground state and the second and third qubits are in the excited state. If
ctrl_state
isNone
, the default, control is conditioned on all control qubits being excited.A new jupyter widget,
%circuit_library_info
has been added toqiskit.tools.jupyter
. This widget is used for visualizing details about circuits built from the circuit library. For examplefrom qiskit.circuit.library import XOR import qiskit.tools.jupyter circuit = XOR(5, seed=42) %circuit_library_info circuit
A new kwarg option,
formatted
, has been added toqiskit.circuit.QuantumCircuit.qasm()
. When set toTrue
the method will print a syntax highlighted version (using pygments) to stdout and returnNone
(which differs from the normal behavior of returning the QASM code as a string).A new kwarg option,
filename
, has been added toqiskit.circuit.QuantumCircuit.qasm()
. When set to a path the method will write the QASM code to that file. It will then continue to output as normal.A new instruction
SetFrequency
which allows users to change the frequency of thePulseChannel
. This is done in the following way:from qiskit.pulse import Schedule from qiskit.pulse import SetFrequency sched = pulse.Schedule() sched += SetFrequency(5.5e9, DriveChannel(0))
In this example, the frequency of all pulses before the
SetFrequency
command will be the default frequency and all pulses applied to drive channel zero after theSetFrequency
command will be at 5.5 GHz. Users ofSetFrequency
should keep in mind any hardware limitations.A new method,
assign_parameters()
has been added to theqiskit.circuit.QuantumCircuit
class. This method accepts a parameter dictionary with both floats and Parameters objects in a single dictionary. In other words this new method allows you to bind floats, Parameters or both in a single dictionary.Also, by using the
inplace
kwarg it can be specified you can optionally modify the original circuit in place. By default this is set toFalse
and a copy of the original circuit will be returned from the method.A new method
num_nonlocal_gates()
has been added to theqiskit.circuit.QuantumCircuit
class. This method will return the number of gates in a circuit that involve 2 or or more qubits. These gates are more costly in terms of time and error to implement.The
qiskit.circuit.QuantumCircuit
methodiso()
for adding anIsometry
gate to the circuit has a new alias. You can now callqiskit.circuit.QuantumCircuit.isometry()
in addition to callingiso
.A
description
attribute has been added to theCouplingMap
class for storing a short description for different coupling maps (e.g. full, grid, line, etc.).A new method
compose()
has been added to theDAGCircuit
class for composing two circuits via their DAGs.dag_left.compose(dag_right, edge_map={right_qubit0: self.left_qubit1, right_qubit1: self.left_qubit4, right_clbit0: self.left_clbit1, right_clbit1: self.left_clbit0})
┌───┐ ┌─────┐┌─┐ lqr_1_0: ───┤ H ├─── rqr_0: ──■──┤ Tdg ├┤M├ ├───┤ ┌─┴─┐└─┬─┬─┘└╥┘ lqr_1_1: ───┤ X ├─── rqr_1: ┤ X ├──┤M├───╫─ ┌──┴───┴──┐ └───┘ └╥┘ ║ lqr_1_2: ┤ U1(0.1) ├ + rcr_0: ════════╬════╩═ = └─────────┘ ║ lqr_2_0: ─────■───── rcr_1: ════════╩══════ ┌─┴─┐ lqr_2_1: ───┤ X ├─── └───┘ lcr_0: ═══════════ lcr_1: ═══════════ ┌───┐ lqr_1_0: ───┤ H ├────────────────── ├───┤ ┌─────┐┌─┐ lqr_1_1: ───┤ X ├─────■──┤ Tdg ├┤M├ ┌──┴───┴──┐ │ └─────┘└╥┘ lqr_1_2: ┤ U1(0.1) ├──┼──────────╫─ └─────────┘ │ ║ lqr_2_0: ─────■───────┼──────────╫─ ┌─┴─┐ ┌─┴─┐ ┌─┐ ║ lqr_2_1: ───┤ X ├───┤ X ├──┤M├───╫─ └───┘ └───┘ └╥┘ ║ lcr_0: ═══════════════════╩════╬═ ║ lcr_1: ════════════════════════╩═
The mock backends in
qiskit.test.mock
now have a functionalrun()
method that will return results similar to the real devices. Ifqiskit-aer
is installed a simulation will be run with a noise model built from the device snapshot in the fake backend. Otherwise,qiskit.providers.basicaer.QasmSimulatorPy
will be used to run an ideal simulation. Additionally, if a pulse experiment is passed torun
and qiskit-aer is installed thePulseSimulator
will be used to simulate the pulse schedules.The
qiskit.result.Result()
methodget_counts()
will now return a list of all the counts available when there are multiple circuits in a job. This works whenget_counts()
is called with no arguments.The main consideration for this feature was for drawing all the results from multiple circuits in the same histogram. For example it is now possible to do something like:
from qiskit import execute from qiskit import QuantumCircuit from qiskit.providers.basicaer import BasicAer from qiskit.visualization import plot_histogram sim = BasicAer.get_backend('qasm_simulator') qc = QuantumCircuit(2) qc.h(0) qc.cx(0, 1) qc.measure_all() result = execute([qc, qc, qc], sim).result() plot_histogram(result.get_counts())
A new kwarg,
initial_state
has been added to theqiskit.visualization.circuit_drawer()
function and theQuantumCircuit
methoddraw()
. When set toTrue
the initial state will be included in circuit visualizations for all backends. For example:from qiskit import QuantumCircuit circuit = QuantumCircuit(2) circuit.measure_all() circuit.draw(output='mpl', initial_state=True)
It is now possible to insert a callable into a
qiskit.pulse.InstructionScheduleMap
which returns a newqiskit.pulse.Schedule
when it is called with parameters. For example:def test_func(x): sched = Schedule() sched += pulse_lib.constant(int(x), amp_test)(DriveChannel(0)) return sched inst_map = InstructionScheduleMap() inst_map.add('f', (0,), test_func) output_sched = inst_map.get('f', (0,), 10) assert output_sched.duration == 10
Two new gate classes,
qiskit.extensions.iSwapGate
andqiskit.extensions.DCXGate
, along with theirQuantumCircuit
methodsiswap()
anddcx()
have been added to the standard extensions. These gates, which are locally equivalent to each other, can be used to enact particular XY interactions. A brief motivation for these gates can be found in: arxiv.org/abs/quant-ph/0209035The
qiskit.providers.BaseJob
class now has a new methodwait_for_final_state()
that polls for the job status until the job reaches a final state (such asDONE
orERROR
). This method also takes an optionalcallback
kwarg which takes a Python callable that will be called during each iteration of the poll loop.The
search_width
andsearch_depth
attributes of theqiskit.transpiler.passes.LookaheadSwap
pass are now settable when initializing the pass. A larger search space can often lead to more optimized circuits, at the cost of longer run time.The number of qubits in
BackendConfiguration
can now be accessed via the propertynum_qubits
. It was previously only accessible via then_qubits
attribute.Two new methods,
angles()
andangles_and_phase()
, have been added to theqiskit.quantum_info.OneQubitEulerDecomposer
class. These methods will return the relevant parameters without validation, and calling theOneQubitEulerDecomposer
object will perform the full synthesis with validation.An
RR
decomposition basis has been added to theqiskit.quantum_info.OneQubitEulerDecomposer
for decomposing an arbitrary 2x2 unitary into a twoRGate
circuit.Adds the ability to set
qargs
to objects which are subclasses of the abstractBaseOperator
class. This is done by calling the objectop(qargs)
(whereop
is an operator class) and will return a shallow copy of the original object with a qargs property set. When such an object is used with thecompose()
ordot()
methods the internal value for qargs will be used when theqargs
method kwarg is not used. This allows for subsystem composition using binary operators, for example:from qiskit.quantum_info import Operator init = Operator.from_label('III') x = Operator.from_label('X') h = Operator.from_label('H') init @ x([0]) @ h([1])
Adds
qiskit.quantum_info.Clifford
operator class to the quantum_info module. This operator is an efficient symplectic representation an N-qubit unitary operator from the Clifford group. This class includes ato_circuit()
method for compilation into aQuantumCircuit
of Clifford gates with a minimal number of CX gates for up to 3-qubits. It also providers general compilation for N > 3 qubits but this method is not optimal in the number of two-qubit gates.Adds
qiskit.quantum_info.SparsePauliOp
operator class. This is an efficient representaiton of an N-qubit matrix that is sparse in the Pauli basis and uses aqiskit.quantum_info.PauliTable
and vector of complex coefficients for its data structure.This class supports much of the same functionality of the
qiskit.quantum_info.Operator
class soSparsePauliOp
objects can be tensored, composed, scalar multiplied, added and subtracted.Numpy arrays or
Operator
objects can be converted to aSparsePauliOp
using the :class:`~qiskit.quantum_info.SparsePauliOp.from_operator method.SparsePauliOp
can be convered to a sparse csr_matrix or dense Numpy array using theto_matrix
method, or to anOperator
object using theto_operator
method.A
SparsePauliOp
can be iterated over in terms of itsPauliTable
components and coefficients, its coefficients and Pauli string labels using thelabel_iter()
method, and the (dense or sparse) matrix components using thematrix_iter()
method.Add
qiskit.quantum_info.diamond_norm()
function for computing the diamond norm (completely-bounded trace-norm) of a quantum channel. This can be used to compute the distance between two quantum channels usingdiamond_norm(chan1 - chan2)
.A new class
qiskit.quantum_info.PauliTable
has been added. This is an efficient symplectic representation of a list of N-qubit Pauli operators. Some features of this class are:PauliTable
objects may be composed, and tensored which will return aPauliTable
object with the combination of the operation (compose()
,dot()
,expand()
,tensor()
) between each element of the first table, with each element of the second table.Addition of two tables acts as list concatination of the terms in each table (
+
).Pauli tables can be sorted by lexicographic (tensor product) order or by Pauli weights (
sort()
).Duplicate elements can be counted and deleted (
unique()
).The PauliTable may be iterated over in either its native symplectic boolean array representation, as Pauli string labels (
label_iter()
), or as dense Numpy array or sparse CSR matrices (matrix_iter()
).Checking commutation between elements of the Pauli table and another Pauli (
commutes()
) or Pauli table (commutes_with_all()
)
See the
qiskit.quantum_info.PauliTable
class API documentation for additional details.Adds
qiskit.quantum_info.StabilizerTable
class. This is a subclass of theqiskit.quantum_info.PauliTable
class which includes a boolean phase vector along with the Pauli table array. This represents a list of Stabilizer operators which are real-Pauli operators with +1 or -1 coefficient. Because the stabilizer matrices are real the"Y"
label matrix is defined as[[0, 1], [-1, 0]]
. See the API documentation for additional information.Adds
qiskit.quantum_info.pauli_basis()
function which returns an N-qubit Pauli basis as aqiskit.quantum_info.PauliTable
object. The ordering of this basis can either be by standard lexicographic (tensor product) order, or by the number of non-identity Pauli terms (weight).Adds
qiskit.quantum_info.ScalarOp
operator class that represents a scalar multiple of an identity operator. This can be used to initialize an identity on arbitrary dimension subsystems and it will be implicitly converted to otherBaseOperator
subclasses (such as anqiskit.quantum_info.Operator
orqiskit.quantum_info.SuperOp
) when it is composed with, or added to, them.Example: Identity operator
from qiskit.quantum_info import ScalarOp, Operator X = Operator.from_label('X') Z = Operator.from_label('Z') init = ScalarOp(2 ** 3) # 3-qubit identity op = init @ X([0]) @ Z([1]) @ X([2]) # Op XZX
A new method,
reshape()
, has been added to theqiskit.quantum_innfo.Operator
class that returns a shallow copy of an operator subclass with reshaped subsystem input or output dimensions. The combined dimensions of all subsystems must be the same as the original operator or an exception will be raised.Adds
qiskit.quantum_info.random_clifford()
for generating a randomqiskit.quantum_info.Clifford
operator.Add
qiskit.quantum_info.random_quantum_channel()
function for generating a random quantum channel with fixedChoi
-rank in theStinespring
representation.Add
qiskit.quantum_info.random_hermitian()
for generating a random HermitianOperator
.Add
qiskit.quantum_info.random_statevector()
for generating a randomStatevector
.Adds
qiskit.quantum_info.random_pauli_table()
for generating a randomqiskit.quantum_info.PauliTable
.Adds
qiskit.quantum_info.random_stabilizer_table()
for generating a randomqiskit.quantum_info.StabilizerTable
.Add a
num_qubits
attribute toqiskit.quantum_info.StateVector
andqiskit.quantum_info.DensityMatrix
classes. This returns the number of qubits for N-qubit states and returnsNone
for non-qubit states.Adds
to_dict()
andto_dict()
methods to convertqiskit.quantum_info.Statevector
andqiskit.quantum_info.DensityMatrix
objects into Bra-Ket notation dictionary.Example
from qiskit.quantum_info import Statevector state = Statevector.from_label('+0') print(state.to_dict())
{'00': (0.7071067811865475+0j), '10': (0.7071067811865475+0j)}
from qiskit.quantum_info import DensityMatrix state = DensityMatrix.from_label('+0') print(state.to_dict())
{'00|00': (0.4999999999999999+0j), '10|00': (0.4999999999999999+0j), '00|10': (0.4999999999999999+0j), '10|10': (0.4999999999999999+0j)}
Adds
probabilities()
andprobabilities()
toqiskit.quantum_info.Statevector
andqiskit.quantum_info.DensityMatrix
classes which return an array of measurement outcome probabilities in the computational basis for the specified subsystems.Example
from qiskit.quantum_info import Statevector state = Statevector.from_label('+0') print(state.probabilities())
[0.5 0. 0.5 0. ]
from qiskit.quantum_info import DensityMatrix state = DensityMatrix.from_label('+0') print(state.probabilities())
[0.5 0. 0.5 0. ]
Adds
probabilities_dict()
andprobabilities_dict()
toqiskit.quantum_info.Statevector
andqiskit.quantum_info.DensityMatrix
classes which return a count-style dictionary array of measurement outcome probabilities in the computational basis for the specified subsystems.from qiskit.quantum_info import Statevector state = Statevector.from_label('+0') print(state.probabilities_dict())
{'00': 0.4999999999999999, '10': 0.4999999999999999}
from qiskit.quantum_info import DensityMatrix state = DensityMatrix.from_label('+0') print(state.probabilities_dict())
{'00': 0.4999999999999999, '10': 0.4999999999999999}
Add
sample_counts()
andsample_memory()
methods to theStatevector
andDensityMatrix
classes for sampling measurement outcomes on subsystems.Example:
Generate a counts dictionary by sampling from a statevector
from qiskit.quantum_info import Statevector psi = Statevector.from_label('+0') shots = 1024 # Sample counts dictionary counts = psi.sample_counts(shots) print('Measure both:', counts) # Qubit-0 counts0 = psi.sample_counts(shots, [0]) print('Measure Qubit-0:', counts0) # Qubit-1 counts1 = psi.sample_counts(shots, [1]) print('Measure Qubit-1:', counts1)
Measure both: {'00': 501, '10': 523} Measure Qubit-0: {'0': 1024} Measure Qubit-1: {'0': 469, '1': 555}
Return the array of measurement outcomes for each sample
from qiskit.quantum_info import Statevector psi = Statevector.from_label('-1') shots = 10 # Sample memory mem = psi.sample_memory(shots) print('Measure both:', mem) # Qubit-0 mem0 = psi.sample_memory(shots, [0]) print('Measure Qubit-0:', mem0) # Qubit-1 mem1 = psi.sample_memory(shots, [1]) print('Measure Qubit-1:', mem1)
Measure both: ['01' '01' '11' '01' '11' '01' '11' '01' '11' '11'] Measure Qubit-0: ['1' '1' '1' '1' '1' '1' '1' '1' '1' '1'] Measure Qubit-1: ['0' '0' '0' '1' '0' '1' '1' '1' '0' '1']
Adds a
measure()
method to theqiskit.quantum_info.Statevector
andqiskit.quantum_info.DensityMatrix
quantum state classes. This allows sampling a single measurement outcome from the specified subsystems and collapsing the statevector to the post-measurement computational basis state. For examplefrom qiskit.quantum_info import Statevector psi = Statevector.from_label('+1') # Measure both qubits outcome, psi_meas = psi.measure() print("measure([0, 1]) outcome:", outcome, "Post-measurement state:") print(psi_meas) # Measure qubit-1 only outcome, psi_meas = psi.measure([1]) print("measure([1]) outcome:", outcome, "Post-measurement state:") print(psi_meas)
measure([0, 1]) outcome: 11 Post-measurement state: Statevector([0.+0.j, 0.+0.j, 0.+0.j, 1.+0.j], dims=(2, 2)) measure([1]) outcome: 1 Post-measurement state: Statevector([0.+0.j, 0.+0.j, 0.+0.j, 1.+0.j], dims=(2, 2))
Adds a
reset()
method to theqiskit.quantum_info.Statevector
andqiskit.quantum_info.DensityMatrix
quantum state classes. This allows reseting some or all subsystems to the \(|0\rangle\) state. For examplefrom qiskit.quantum_info import Statevector psi = Statevector.from_label('+1') # Reset both qubits psi_reset = psi.reset() print("Post reset state: ") print(psi_reset) # Reset qubit-1 only psi_reset = psi.reset([1]) print("Post reset([1]) state: ") print(psi_reset)
Post reset state: Statevector([1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j], dims=(2, 2)) Post reset([1]) state: Statevector([0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j], dims=(2, 2))
A new visualization function
qiskit.visualization.visualize_transition()
for visualizing single qubit gate transitions has been added. It takes in a single qubit circuit and returns an animation of qubit state transitions on a Bloch sphere. To use this function you must have installed the dependencies for and configured globally a matplotlib animtion writer. You can refer to the matplotlib documentation for more details on this. However, in the default case simply ensuring that FFmpeg is installed is sufficient to use this function.It supports circuits with the following gates:
HGate
XGate
YGate
ZGate
RXGate
RYGate
RZGate
SGate
SdgGate
TGate
TdgGate
U1Gate
For example:
from qiskit.visualization import visualize_transition from qiskit import * qc = QuantumCircuit(1) qc.h(0) qc.ry(70,0) qc.rx(90,0) qc.rz(120,0) visualize_transition(qc, fpg=20, spg=1, trace=True)