Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: abbycross <[email protected]>
  • Loading branch information
kaelynj and abbycross authored Nov 5, 2024
1 parent 13e7a64 commit f956f77
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions docs/guides/_toc.json
Original file line number Diff line number Diff line change
Expand Up @@ -511,14 +511,14 @@
"url": "/guides/addons"
},
{
"title": "Sample-based Quantum Diagonalization (SQD)" ,
"title": "Sample-based quantum diagonalization (SQD)" ,
"children": [
{
"title": "SQD addon overview",
"url": "/guides/qiskit-addons-sqd"
},
{
"title": "SQD getting started",
"title": "Getting started with SQD",
"url": "/guides/qiskit-addons-sqd-get-started"
}
]
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/post-process-results.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ unphysical observables.
## Guides for post-processing results
* [Retrieve and save results](./save-jobs)
* [Visualize results](./visualize-results)
* [Sample-based quantum diagonalization (SQD)](./qiskit-addons-sqd)
* [Sample-based quantum diagonalization (SQD) overview](./qiskit-addons-sqd)
* [Getting started with SQD](./qiskit-addons-sqd-get-started)
24 changes: 12 additions & 12 deletions docs/guides/qiskit-addons-sqd.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ title: Sample-based quantum diagonalization
description: Overview of the Sample-based quantum diagonalization (SQD) workflow
---

# Sample-based quantum diagonalization (SQD)
# Sample-based quantum diagonalization (SQD) overview

Sample-based quantum diagonalization (SQD) is a technique for finding eigenvalues and eigenvectors of quantum operators, such as the Hamiltonian of a quantum system, using quantum and distributed classical computing together. This post-processing technique may be especially useful for users simulating chemical or other quantum systems.

Classical computing is used to process samples obtained from a quantum processor, and to project and diagonalize a target Hamiltonian in a subspace spanned by them. This allows SQD to be robust to samples corrupted by quantum noise and manage large Hamiltonians, such as chemical systems with millions of interacting terms, beyond the reach of exact diagonalization methods.

The SQD tool can target Hamiltonians expressed as linear combinations of Pauli operators, or second-quantized fermionic operators. The input samples are obtained by quantum circuits defined by the user, which are believed to be good representations of eigenstates (for example the ground state) of a target operator. The convergence rate of SQD as a function of the number of samples improves with the sparseness of the target eigenstate.
The SQD tool can target Hamiltonians expressed as linear combinations of Pauli operators, or second-quantized fermionic operators. The input samples are obtained by quantum circuits defined by the user, which are believed to be good representations of eigenstates (for example, the ground state) of a target operator. The convergence rate of SQD as a function of the number of samples improves with the sparseness of the target eigenstate.

## Install SQD package
## Install the SQD package

There are two ways to install the SQD package. Via PyPI and building from source. We also recommend installing these packages in a [virtual environment](https://docs.python.org/3.10/tutorial/venv.html) to ensure separation between package dependencies.
There are two ways to install the SQD package: PyPI and building from source. It is recommended to install these packages in a [virtual environment](https://docs.python.org/3.10/tutorial/venv.html) to ensure separation between package dependencies.

### Install from PyPI

Expand All @@ -25,13 +25,13 @@ pip install qiskit-addon-sqd

### Build from source

Users who wish to contribute to this package or who want to install it manually may do so by first cloning the repository
If you wish to contribute to this package or want to install it manually, first clone the repository:

```bash
git clone [email protected]:Qiskit/qiskit-addon-sqd.git
```

and install the package via `pip`. The repository also contains example notebooks which can be run and if you plan on developing in the repository, you may want to also install the `dev` dependencies.
and install the package via `pip`. The repository also contains example notebooks that you can run. If you plan on developing in the repository, you can install the `dev` dependencies.

Adjust the options to suit your needs.

Expand All @@ -41,26 +41,26 @@ pip install tox notebook -e '.[notebook-dependencies, dev]'

## Theoretical background

The SQD workflow using self-consistent configuration recovery is explained in detail in [[1]](#references). This section will briefly overview the technique depicted in the following diagram.
The SQD workflow using self-consistent configuration recovery is explained in detail in [[1]](#references). This section provides an overview to the technique depicted in the following diagram.

![SQD diagram depicting configuration recovery, collecting subsamples, and obtaining eigenstates from those subsamples](/images/guides/qiskit-addons/sqd_diagram.png)

Here $\bar{\mathcal{X}}$ is a set of noisy samples obtained from a QPU which contain, in the context of the Hamiltonian being simulated, physical and non-physical configurations (represented as bitstrings) obtained from execution on a QPU. The non-physical configurations are due to noise and can be processed by the `sqd.configuration_recovery.recover_configurations()` method to refine the samples into a new set $\mathcal{X}_R$.
Here $\bar{\mathcal{X}}$ is a set of noisy samples which contain, in the context of the Hamiltonian being simulated, physical and non-physical configurations (represented as bitstrings) obtained from execution on a QPU. The non-physical configurations are due to noise and can be processed by the `sqd.configuration_recovery.recover_configurations()` method to refine the samples into a new set $\mathcal{X}_R$.

From this set, batches of configurations $\mathcal{S}^{(1)}...\ \mathcal{S}^{(K)}$ are collected and represent samples obtained from different subspaces of the Hamiltonian. These subspace samples are built from a set of basis states, $\mathcal{S}^{(k)}=\{|\mathbf{x}^{(k)}\rangle\}$, and are projections of the system Hamiltonian, $\hat{H}$. This projection is defined as

$$ \hat{H}_{S^{(k)}} = \hat{P}_{\mathcal{S}^{(k)}}\hat{H}\hat{P}_{\mathcal{S}^{(k)}}\text{, with } \hat{P}_{\mathcal{S}^{(k)}} = \sum_{\mathbf{x} \in \mathcal{S}^{(k)}} |\mathbf{x}\rangle\langle\mathbf{x}|$$
$$ \hat{H}_{S^{(k)}} = \hat{P}_{\mathcal{S}^{(k)}}\hat{H}\hat{P}_{\mathcal{S}^{(k)}}\text{, with } \hat{P}_{\mathcal{S}^{(k)}} = \sum_{\mathbf{x} \in \mathcal{S}^{(k)}} |\mathbf{x}\rangle\langle\mathbf{x}|,$$

where $\hat{H}_{\mathcal{S}^{(k)}}$ is the Hamiltonian of a given subspace.

The bulk of the SQD workflow lies here where each of these subspace Hamiltonians are diagonalized. The ground states obtained from each of these subspaces, $|\psi^{(k)}\rangle$, are used to obtain an estimate of a reference vector of occupancies $\mathbf{n}^{(K)}$ averaged over each of the $K$ subspaces and sent back to the configuration recovery step. Then a new set of subspaces are obtained and diagonalized, and this procedure iterates in a self-consistent loop until the ground state energy estimate has converged.
The bulk of the SQD workflow lies here wherein each of these subspace Hamiltonians is diagonalized. The ground states obtained from each of these subspaces, $|\psi^{(k)}\rangle$, are used to obtain an estimate of a reference vector of occupancies $\mathbf{n}^{(K)}$ averaged over each of the $K$ subspaces and sent back to the configuration recovery step. A new set of subspaces are then obtained and diagonalized, and this procedure iterates in a self-consistent loop until the ground state energy estimate has converged.


## Next steps

<Admonition type="tip" title="Recommendations">
- Read about basis gates in the [Represent quantum computers](./represent-quantum-computers#basis-gates) topic.
- Apply your knowledge of basis gates to one of these [workflow example tutorials.](https://learning.quantum.ibm.com/catalog/tutorials?category=workflow-example)
- Read about basis gates in the [Represent quantum computers](/guides/represent-quantum-computers#basis-gates) topic.
- Apply your knowledge of basis gates to a tutorial in [IBM Quantum Learning](https://learning.quantum.ibm.com/catalog/tutorials).
</Admonition>

## References
Expand Down

0 comments on commit f956f77

Please sign in to comment.