Release Notes¶
0.4.0¶
Prelude¶
Following up on the deprecation of BlueprintsCircuit
in the 2.1 version of Qiskit, most tests have been updated to use the replacements functions instead. These circuits are still supported by qiskit-algorithms
, though their use is now deprecated, and their support will be removed when the oldest supported Qiskit version is 3.0.
The AmplificationProblem
and Grover
classes now support being passed Gate
objects to support the use of PhaseOracleGate
in addition to PhaseOracle
.
The AdaptVQE
class now supports a new way to specify its ansatz, following up on the deprecation of EvolvedOperatorAnsatz
.
New Features¶
Added Python 3.13 support.
The
AmplificationProblem
andGrover
classes now support being passedGate
objects to support the use ofPhaseOracleGate
in addition toPhaseOracle
. For instance, the following is a valid way to instantiate theAmplificationProblem
class:from qiskit.circuit.library.phase_oracle import PhaseOracleGate from qiskit_algorithms import AmplificationProblem problem = AmplificationProblem(PhaseOracleGate("(a & b)"))
The
AdaptVQE
class now supports a new way to specify its ansatz, following up on the deprecation ofEvolvedOperatorAnsatz
. For instance, the following code to create aAdaptVQE
instance in the 0.3 version:AdaptVQE( VQE( StatevectorEstimator(), EvolvedOperatorAnsatz(operators, initial_state=initial_state), SLSQP(), ) )
is now deprecated, and should instead be written as:
AdaptVQE( VQE( StatevectorEstimator(), QuantumCircuit(1), SLSQP(), ), operators=operators, initial_state=initial_state, )
Note that the ansatz passed to the class:.VQE: solver is ignored when using this method. More generally,
AdaptVQE
now accepts (as keyword arguments only) every possible argument that can be passed toevolved_operator_ansatz()
, with the addition of aninitial_state
to prepend to the ansatz.
Support for
SBPLX
optimizer from NLopt library has been added. SBPLX is a local gradient-free optimizer based on Nelder-Mead and is expected to show better convergence behavior. Further information about this optimizer and the others can be found in the API ref for theoptimizers
.
Upgrade Notes¶
Previously, the
compute_minimum_eigenvalue
method set theoperators
attribute of its solver’s ansatz, which was assumed to be of typeEvolvedOperatorAnsatz
. Since this behavior was undocumented, and since the ansatz’s type can’t be assumed to still beEvolvedOperatorAnsatz
at the end because of transpilation, this feature has been removed.
Deprecation Notes¶
Previously, it was possible to pass to
VQE
,SamplingVQE
andVQD
aBlueprintCircuit
as an ansatz without its number of qubits being set, the algorithm taking care of setting it. SinceBlueprintCircuit
s are now deprecated, and those being the only ones that can have their number of qubits set after their initialization, this behavior is now also deprecated, and won’t be supported once the oldest supported Qiskit version is 3.0. As such, users that made use of this feature would now need to ensure that the ansatz they pass to these algorithms have their number of qubits set and matching with that of the operator they wish to run the algorithm on.
Other Notes¶
Aspects of the gradients internal implementation, which manipulate circuits more directly, have been updated now that circuit data is being handled by Rust so it’s compatible with the former Python way as well as the new Qiskit Rust implementation.
0.3.0¶
Prelude¶
This release now supports Qiskit 1.0 while continuing to work with the Qiskit 0.46 release for those still navigating the changes brought about in the Qiskit 1.0 release.
New Features¶
Added input argument insert_barriers to TrotterQRTE to add barriers between Trotter layers.
Added support for using Qiskit Algorithms with Python 3.12.
Bug Fixes¶
Fixes state fidelity
ComputeUncompute
to correct an issue arising from the threading used for the job result. This issue could be seen sometimes if more than one job was created and their results fetched back-to-back, such that more than one internal thread was active processing these results.
Fixes internal cache used by state fidelities so that circuits are cached using the same generated key method as that used by the reference primitives. This avoids a potential incorrect result that could have occurred with the key as it was before when id() was used.
Fixes
GSLS
optimizerminimize()
so that if thebounds
parameter is passed with tuples that have entries ofNone
then the entry is treated as equivalent to infinity.
Fixed the AQGD optimizer grouping objective function calls by default so that a single point is now passed to the objective function. For algorithms that can handle more than one gradient evaluations in their objective function, such as a VQE in the algorithms here, the number of grouped evaluations can be controlled via the max_grouped_evals parameter. Grouped evaluations allows a list of points to be handed over so that they can potentially be assessed more efficiently in a single job.
0.2.0¶
Upgrade Notes¶
The
qiskit-algorithms
code uses a common random number generator, which can be seeded for reproducibility. The algorithms code here, having originated in Qiskit and having been moved here, used random function fromqiskit.utils
which was seeded as follows:from qiskit.utils import algorithm_globals algorithm_globals.random_seed = 101
Now this will continue to work in
qiskit-algorithms
, until such time as thealgorithm_globals
are removed fromQiskit
, however you are highly recommended to already change to import/seed thealgorithm_globals
that is now supplied byqiskit-algorithms
thus:from qiskit_algorithms.utils import algorithm_globals algorithm_globals.random_seed = 101
As can be seen it’s simply a change to the import statement, so as to import the
qiskit_algorithms
instance rather than the one fromqiskit
.This has been done to afford a transition and not break end-users code by supporting seeding the random generator as it was done before. How does it work - well, while the
qiskit.utils
version exists, theqiskit-algorithms
version simply delegates its function to that instance. However the main codebase ofqiskit-algorithms
has already been altered to use the new instance and the delegation function, that accesses the random generator, will warn with a message to switch to seeding theqiskit-algorithms
version if it detects a difference in the seed. A difference could exist if therandom_seed
was set direct to theqiskit.utils
instance.At such a time when the
qiskit.utils
algorithm_globals
version no longer exists, rather than delegating the functionality to that, it will use identical logic which it already has, so no further user change will be required if you already transitioned to seeding theqiskit_algorithms.utils
algorithms_globals
.
A couple of algorithms here,
PVQD
,AdaptVQE
and optimizerSNOBFIT
, directly raised aQiskitError
. These have been changed to raise anAlgorithmError
instead. Algorithms have now been moved out ofQiskit
and this better distinguishes the exception to the algorithms when raised. NowAlgorithmError
was already raised elsewhere by the algorithms here so this makes things more consistent too. Note, that asAlgorithmError
internally extendsQiskitError
, any code that might have caught that specifically will continue to work. However we do recommend you update your code accordingly forAlgorithmError
.
The deprecated
threshold
input argument ofAdaptVQE
has been removed, and replaced bygradient_threshold
. This change was made to avoid confusion with the later introducedeigenvalue_threshold
argument. The updated AdaptVQE use would look like this:from qiskit_algorithms import VQE, AdaptVQE adapt_vqe = AdaptVQE( VQE(Estimator(), ansatz, optimizer), gradient_threshold=1e-3, eigenvalue_threshold=1e-3 )
Other Notes¶
Removed the custom
__str__
method fromSamplingMinimumEigensolverResult
so that string conversion is based on the method of its parentAlgorithmResult
which prints all the result fields in a dictionary like format. The overridden method had only printed a select couple of fields, unlike when normally printing a result all fields are shown, and the lack of fields expected to be shown caused confusion when printing results derived from that, such as returned bySamplingVQE
andQAOA
.
0.1.0¶
Prelude¶
Qiskit’s qiskit.algorithms module has been superseded by this
new standalone library, qiskit_algorithms
.
As of Qiskit’s 0.25 release, active development of new algorithm features has moved to this new package.
If you’re relying on qiskit.algorithms
you should update your
requirements to also include qiskit-algorithms
and update the imports
from qiskit.algorithms
to qiskit_algorithms
.
Note
If you have not yet
migrated from QuantumInstance
-based to primitives-based algorithms,
you should first follow the migration guidelines in https://qisk.it/algo_migration,
to complete the migration of your code, as this package does not include
any deprecated algorithm function.
The decision to migrate the qiskit.algorithms
module to a
separate package was made to clarify the purpose of Qiskit and
make a distinction between the tools and libraries built on top of it.
New Features¶
The primitive-based algorithms in
qiskit_algorithms.eigensolvers
andqiskit_algorithms.minimum_eigensolvers
are now directly importable fromqiskit_algorithms
. For example, the primitive-based VQE can now be imported usingfrom qiskit_algorithms import VQE
without having to specifyfrom qiskit_algorithms.minimum_eigensolvers import VQE
. This short import path used to be reserved forQuantumInstance
-based algorithms (now deprecated and removed from the codebase). If you have not yet migrated fromQuantumInstance
-based to primitives-based algorithms, you should follow the migration guidelines in https://qisk.it/algo_migration.