Qiskit-algorithms

Latest version: v0.3.1

Safety actively analyzes 681812 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

0.3.1

Changelog

Prelude

This is a minor patch release of the 0.3 series.

Bug Fixes

* Revert Python 3.12.0 specific usage in https://github.com/qiskit-community/qiskit-algorithms/pull/161
* Fix bad indentation and missing hyphen on `vqd.py` in https://github.com/qiskit-community/qiskit-algorithms/pull/169
* Fix power() in subclass test for QuantumCircuit change in https://github.com/qiskit-community/qiskit-algorithms/pull/174
* Scipy 1.14 compatibility fix in https://github.com/qiskit-community/qiskit-algorithms/pull/185
* Update gradient logic for Qiskit Rust circuit data implementation in https://github.com/qiskit-community/qiskit-algorithms/pull/198
* ADAM bug when calculating the gradient in batches in https://github.com/qiskit-community/qiskit-algorithms/pull/200

0.3.0

Changelog

Prelude

This release now supports [Qiskit 1.0](https://docs.quantum.ibm.com/api/qiskit/release-notes/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](https://qiskit-community.github.io/qiskit-algorithms/stubs/qiskit_algorithms.state_fidelities.ComputeUncompute.html#qiskit_algorithms.state_fidelities.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.
* 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.
* 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](https://qiskit-community.github.io/qiskit-algorithms/stubs/qiskit_algorithms.optimizers.GSLS.html#qiskit_algorithms.optimizers.GSLS) optimizer [minimize()](https://qiskit-community.github.io/qiskit-algorithms/stubs/qiskit_algorithms.optimizers.GSLS.html#qiskit_algorithms.optimizers.GSLS.minimize) so that if the bounds parameter is passed with tuples that have entries of None then the entry is treated as equivalent to infinity.

0.2.2

Changelog

- Various maintainability fixes, changes dependency path from `qiskit-terra` to `qiskit`.

0.2.1

Changelog

Fixes

- Even though ``qiskit-algorithms`` included a ``py.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

Changelog

Upgrades

- 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 from qiskit.utils which was seeded as follows:

python
from qiskit.utils import algorithm_globals
algorithm_globals.random_seed = 101


Now this will continue to work in `qiskit-algorithms`, until such time as the `algorithm_globals` are removed from Qiskit, however you are highly recommended to already change to import/seed the `algorithm_globals` that is now supplied by `qiskit-algorithms` thus:

python
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 from qiskit.

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, the `qiskit-algorithms` version simply delegates its function to that instance. However the main codebase of `qiskit-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 the `qiskit-algorithms` version if it detects a difference in the seed. A difference could exist if the random_seed was set direct to the `qiskit.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 the `qiskit_algorithms.utils` `algorithms_globals`.

- A couple of algorithms here, [PVQD](https://qiskit.org/ecosystem/algorithms/stubs/qiskit_algorithms.PVQD.html#qiskit_algorithms.PVQD), [AdaptVQE](https://qiskit.org/ecosystem/algorithms/stubs/qiskit_algorithms.AdaptVQE.html#qiskit_algorithms.AdaptVQE) and optimizer [SNOBFIT](https://qiskit.org/ecosystem/algorithms/stubs/qiskit_algorithms.optimizers.SNOBFIT.html#qiskit_algorithms.optimizers.SNOBFIT), directly raised a [QiskitError](https://qiskit.org/documentation/apidoc/exceptions.html#qiskit.exceptions.QiskitError). These have been changed to raise an [AlgorithmError](https://qiskit.org/ecosystem/algorithms/apidocs/qiskit_algorithms.AlgorithmError.html#qiskit_algorithms.AlgorithmError) instead. Algorithms have now been moved out of Qiskit and this better distinguishes the exception to the algorithms when raised. Now `AlgorithmError` was already raised elsewhere by the algorithms here so this makes things more consistent too. Note, that as `AlgorithmError` internally extends `QiskitError`, any code that might have caught that specifically will continue to work. However we do recommend you update your code accordingly for `AlgorithmError`.

The deprecated threshold input argument of [AdaptVQE](https://qiskit.org/ecosystem/algorithms/stubs/qiskit_algorithms.AdaptVQE.html#qiskit_algorithms.AdaptVQE) has been removed, and replaced by gradient_threshold`. This change was made to avoid confusion with the later introduced `eigenvalue_threshold` argument. The updated `AdaptVQE` use would look like this:

python
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 from [SamplingMinimumEigensolverResult](https://qiskit.org/ecosystem/algorithms/stubs/qiskit_algorithms.SamplingMinimumEigensolverResult.html#qiskit_algorithms.SamplingMinimumEigensolverResult) so that string conversion is based on the method of its parent `AlgorithmResult` 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 by [SamplingVQE](https://qiskit.org/ecosystem/algorithms/stubs/qiskit_algorithms.SamplingVQE.html#qiskit_algorithms.SamplingVQE) and [QAOA](https://qiskit.org/ecosystem/algorithms/stubs/qiskit_algorithms.QAOA.html#qiskit_algorithms.QAOA).

0.1.0

Changelog

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](https://qiskit.org/documentation/apidoc/algorithms.html#module-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](https://qiskit.org/documentation/apidoc/algorithms.html#module-qiskit.algorithms) module to a separate package was made to clarify the purpose of [Qiskit](https://qiskit.org) and make a distinction between the tools and libraries built on top of it.

New Features

The primitive-based algorithms in [qiskit_algorithms.eigensolvers](https://qiskit.org/ecosystem/algorithms/stubs/qiskit_algorithms.eigensolvers.html#module-qiskit_algorithms.eigensolvers) and [qiskit_algorithms.minimum_eigensolvers](https://qiskit.org/ecosystem/algorithms/stubs/qiskit_algorithms.minimum_eigensolvers.html#module-qiskit_algorithms.minimum_eigensolvers) are now directly importable from `qiskit_algorithms`. For example, the primitive-based VQE can now be imported using `from qiskit_algorithms import VQE` without having to specify `from qiskit_algorithms.minimum_eigensolvers import VQE`. This short import path used to be reserved for `QuantumInstance`-based algorithms (now deprecated and removed from the codebase). If you have not yet migrated from `QuantumInstance`-based to primitives-based algorithms, you should follow the migration guidelines in https://qisk.it/algo_migration.

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.