Skip to main content

Release Platform Python Qiskit

License Downloads Tests

Sample-based quantum diagonalization (SQD)

This package implements sample-based quantum diagonalization (SQD) -- a technique for finding eigenvalues and eigenvectors of quantum operators, such as a quantum system Hamiltonian [1-6]. It can target Hamiltonians expressed as linear combinations of Pauli operators or second-quantized Fermionic operators. SQD-based workflows can be run on current quantum computers and have been shown to scale to problem sizes beyond what was possible with variational methods — and even beyond the reach of exact classical diagonalization methods.

SQD-based workflows involve first preparing one or more quantum states on a quantum device and sampling from them. Then, classical distributed computing is used to process those noisy samples. This processing occurs iteratively in two steps: first, a configuration recovery step corrects noisy samples using information about the input problem; second, the Hamiltonian is projected and diagonalized in the subspace spanned by those samples. These steps are repeated self-consistently until convergence. The result is an approximated lowest eigenvalue (energy) and lowest energy eigenstate of a given Hamiltonian. SQD is robust to samples corrupted by quantum noise; in fact, as long as a useful signal can be retrieved out of the quantum computer, the outcome of SQD will be insensitive to noisy bitstrings.

qiskit-addon-sqd can be used to classically process samples drawn from a variety of quantum circuits in practice. For example:

  1. A variational circuit ansatz with parameters chosen such that sampling the circuit produces electronic configurations on which the target wavefunction (for example, the ground state) has significant support. This is appealing for chemistry applications where Hamiltonians can have millions of interaction terms [1]. For an example of this approach applied to chemistry using an LUCJ circuit see the tutorial for approximating the ground state energy of the N2 molecule.

  2. A set of Krylov basis states prepared over increasing time intervals. Assuming a good initial state and sparsity of the ground state, this approach is proven to converge efficiently. As one needs to prepare Trotterized time evolution circuits on a quantum device, this approach is best for applications to lattice models [2] instead of complex many-body Hamiltonians like those for quantum chemistry. For an example of this approach applied to Fermionic lattice Hamiltonians, see the tutorial for approximating the ground state energy of a simplified single-impurity Anderson model.

  3. A set of Kyrlov basis states implemented with qDRIFT randomized compilation of the time evolution operator. This approach yields shorter-depth circuits compared to Trotter-based decompositions of the time evolution and so can be used for quantum chemistry Hamiltonians. This technique has been applied to the ground state energy of polycyclic aromatic hydrocarbons [6].


Documentation

All documentation is available at https://quantum.cloud.ibm.com/docs/addons/qiskit-addon-sqd.


Installation

We encourage installing this package via pip, when possible:

pip install 'qiskit-addon-sqd'

For more installation information refer to these installation instructions.


Getting started

A simple guide to help you get started quickly with this package is available [here][docs/guides/quickstart.ipynb).


Use case examples

The sample-based quantum diagonalization technique can be used to implement a diverse set of workflows. Some examples of where it has been used include:


Technical discussion

Computational requirements

The computational cost of SQD is dominated by the eigenstate solver calls. At each step of the self-consistent configuration recovery iteration, n_batches of eigenstate solver calls are performed. The different calls are embarrassingly parallel. In this tutorial, those calls are inside a for loop. It is highly recommended to perform these calls in parallel.

The qiskit_addon_sqd.fermion.solve_fermion() function is multithreaded and capable of handling systems with ~25 spatial orbitals and ~10 electrons with subspace dimensions of ~$10^7$, using ~10-30 cores.

Choosing subspace dimensions

The choice of the subspace dimension affects the accuracy and runtime of the eigenstate solver. The larger the subspace the more accurate the calculation, at the cost of increasing the runtime and memory requirements. The optimal subspace size for a given system is not known, thus a convergence study with the subspace dimension may be performed as described in this example.

The subspace dimension is set indirectly

In this package, the user controls the number of bitstrings (see the samples_per_batch argument in qiskit_addon_sqd.subsampling.postselect_and_subsample()) contained in each subspace. The value of this argument sets an upper bound to the subspace dimension in the case of quantum chemistry applications. See this example for more details.

Solvers

This package contains the functionality for the classical processing of user-provided samples. It can target Hamiltonians expressed as linear combinations of Pauli operators or second-quantized Fermionic operators. The projection and diagonalization steps are performed by a classical solver. We provide here two generic solvers, one for Fermionic systems and another for qubit systems. Other solvers that might be more efficient for specific systems can be interfaced by the users.


Contributing

The source code is available on GitHub.

The developer guide is located at CONTRIBUTING.md in the root of this project's repository. By participating, you are expected to uphold Qiskit's code of conduct.


Citing this package

If you use this package in your research, use the CITATION.bib file in this project’s repository to cite the appropriate reference(s).


License

Apache License 2.0


Deprecation policy

We follow semantic versioning. We may occasionally make breaking changes in order to improve the user experience. When possible, we will keep old interfaces and mark them as deprecated, as long as they can co-exist with the new ones. Each substantial improvement, breaking change, or deprecation will be documented in the release notes.


References

[1] Javier Robledo-Moreno, et al., Chemistry Beyond Exact Solutions on a Quantum-Centric Supercomputer, arXiv:2405.05068 [quant-ph].

[2] Jeffery Yu, et al., Quantum-Centric Algorithm for Sample-Based Krylov Diagonalization, arXiv:2501.09702 [quant-ph].

[3] Keita Kanno, et al., Quantum-Selected Configuration Interaction: classical diagonalization of Hamiltonians in subspaces selected by quantum computers, arXiv:2302.11320 [quant-ph].

[4] Kenji Sugisaki, et al., Hamiltonian simulation-based quantum-selected configuration interaction for large-scale electronic structure calculations with a quantum computer, arXiv:2412.07218 [quant-ph].

[5] Mathias Mikkelsen, Yuya O. Nakagawa, Quantum-selected configuration interaction with time-evolved state, arXiv:2412.13839 [quant-ph].

[6] Samuele Piccinelli, et al., Quantum chemistry with provable convergence via randomized sample-based Krylov quantum diagonalization, arXiv:2508.02578 [quant-ph].

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qiskit_addon_sqd-0.13.1.tar.gz (468.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qiskit_addon_sqd-0.13.1-py3-none-any.whl (36.8 kB view details)

Uploaded Python 3

File details

Details for the file qiskit_addon_sqd-0.13.1.tar.gz.

File metadata

  • Download URL: qiskit_addon_sqd-0.13.1.tar.gz
  • Upload date:
  • Size: 468.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for qiskit_addon_sqd-0.13.1.tar.gz
Algorithm Hash digest
SHA256 6b275b0d1d3fd72c1b5496872c8217f2597898c34268d1f764e38be0a31eca77
MD5 f3b1a426f6c031a9a8f6a1f7fed7ebab
BLAKE2b-256 8bf1231d99b4ea3627ecc1e6f8a797847072df041b7dcabc8f91b1e677bd6285

See more details on using hashes here.

Provenance

The following attestation bundles were made for qiskit_addon_sqd-0.13.1.tar.gz:

Publisher: release.yml on Qiskit/qiskit-addon-sqd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qiskit_addon_sqd-0.13.1-py3-none-any.whl.

File metadata

File hashes

Hashes for qiskit_addon_sqd-0.13.1-py3-none-any.whl
Algorithm Hash digest
SHA256 67ba6d23f7688e223c5d3bfc31d3f9f6ccd6e997ec71055a6b5aeb2cc0c28276
MD5 fab2179ffed06827c9895b057aee15ba
BLAKE2b-256 de8945481ff89e8df362cd86956958b6f06d1ae11eabe34ec2d525148f17bb01

See more details on using hashes here.

Provenance

The following attestation bundles were made for qiskit_addon_sqd-0.13.1-py3-none-any.whl:

Publisher: release.yml on Qiskit/qiskit-addon-sqd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.13.1 This release

2 files

0.12.1

2 files

0.12.0

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.1

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page