Release Notes#
0.2.1#
Bug Fixes#
Even though
qiskit-algorithms
included apy.typed
marker, reporting itself as being typed, the types were not checked and contained errors. We are releasing a bugfix release in an untyped form to allow dependent packages, that are themselves typed, to continue type checking normally.
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.