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
AmplificationProblemandGroverclasses now support being passedGateobjects to support the use ofPhaseOracleGatein addition toPhaseOracle. For instance, the following is a valid way to instantiate theAmplificationProblemclass:from qiskit.circuit.library.phase_oracle import PhaseOracleGate from qiskit_algorithms import AmplificationProblem problem = AmplificationProblem(PhaseOracleGate("(a & b)"))
The
AdaptVQEclass now supports a new way to specify its ansatz, following up on the deprecation ofEvolvedOperatorAnsatz. For instance, the following code to create aAdaptVQEinstance 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,
AdaptVQEnow accepts (as keyword arguments only) every possible argument that can be passed toevolved_operator_ansatz(), with the addition of aninitial_stateto prepend to the ansatz.
Support for
SBPLXoptimizer 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_eigenvaluemethod set theoperatorsattribute 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 beEvolvedOperatorAnsatzat the end because of transpilation, this feature has been removed.
Deprecation Notes¶
Previously, it was possible to pass to
VQE,SamplingVQEandVQDaBlueprintCircuitas an ansatz without its number of qubits being set, the algorithm taking care of setting it. SinceBlueprintCircuits 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
ComputeUncomputeto 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
GSLSoptimizerminimize()so that if theboundsparameter is passed with tuples that have entries ofNonethen 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-algorithmscode 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.utilswhich 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_globalsare removed fromQiskit, however you are highly recommended to already change to import/seed thealgorithm_globalsthat is now supplied byqiskit-algorithmsthus: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_algorithmsinstance 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.utilsversion exists, theqiskit-algorithmsversion simply delegates its function to that instance. However the main codebase ofqiskit-algorithmshas 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-algorithmsversion if it detects a difference in the seed. A difference could exist if therandom_seedwas set direct to theqiskit.utilsinstance.At such a time when the
qiskit.utilsalgorithm_globalsversion 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.utilsalgorithms_globals.
A couple of algorithms here,
PVQD,AdaptVQEand optimizerSNOBFIT, directly raised aQiskitError. These have been changed to raise anAlgorithmErrorinstead. Algorithms have now been moved out ofQiskitand this better distinguishes the exception to the algorithms when raised. NowAlgorithmErrorwas already raised elsewhere by the algorithms here so this makes things more consistent too. Note, that asAlgorithmErrorinternally 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
thresholdinput argument ofAdaptVQEhas been removed, and replaced bygradient_threshold. This change was made to avoid confusion with the later introducedeigenvalue_thresholdargument. 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 fromSamplingMinimumEigensolverResultso that string conversion is based on the method of its parentAlgorithmResultwhich 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 bySamplingVQEandQAOA.
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.eigensolversandqiskit_algorithms.minimum_eigensolversare now directly importable fromqiskit_algorithms. For example, the primitive-based VQE can now be imported usingfrom qiskit_algorithms import VQEwithout 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.