Skip to content

Commit

Permalink
cleanup first section
Browse files Browse the repository at this point in the history
  • Loading branch information
natestemen committed Oct 11, 2024
1 parent 7a4dc58 commit a25683f
Showing 1 changed file with 17 additions and 24 deletions.
41 changes: 17 additions & 24 deletions docs/source/guide/lre-5-theory.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ kernelspec:
name: python3
---


```{warning}
The user guide for LRE in Mitiq is currently under construction.
```

# What is the theory behind LRE?

Similar to [ZNE](zne.md), LRE works in two steps:
Expand All @@ -25,27 +20,26 @@ Similar to [ZNE](zne.md), LRE works in two steps:
- **Step 2:** Extrapolate to the noiseless limit using multivariate richardson extrapolation.

The noise-scaled circuits in ZNE are scaled by the user choosing which layers of the input circuit to fold whereas in LRE
each noise scaled circuit scales the layers in the input circuit in a specific pattern. LRE leverages the flexible configuration space of layerwise unitary folding,
allowing for a more nuanced mitigation of errors by treating the noise level of each layer of
the quantum circuit as an independent variable.
each noise-scaled circuit scales the layers in the input circuit in a specific pattern.
LRE leverages the flexible configuration space of layerwise unitary folding, allowing for a more nuanced mitigation of errors by treating the noise level of each layer of the quantum circuit as an independent variable.

## Step 1: Create noise-scaled circuits

The goal is to create noise-scaled circuits of different depths where the layers in each circuit are scaled in
a specific pattern as a result of [unitary folding](zne-5-theory.md). This pattern is often described by the vector of scale factor vectors generated by the fold multiplier and the chosen degree for multivariate Richardson extrapolation polynomial.
The goal is to create noise-scaled circuits of different depths where the layers in each circuit are scaled in a specific pattern as a result of [unitary folding](zne-5-theory.md).
This pattern is described by the vector of scale factor vectors which are generated after the fold multiplier and degree for multivariate Richardson extrapolation are chosen.

Suppose we're interested in the value of some observable in an $n$-qubit circuit with $l$ layers.
Suppose we're interested in the value of some observable of a circuit $C$ that has $L$ layers.
For each layer $0 \leq l \leq L$ we can choose a scale factor for how much to scale that particular layer.
Thus a vector $\lambda \in \mathbb{R}^L_+$ corresponds to a folding configuration where $\lambda_0$ corresponds to the scale factor for the first layer, and $\lambda_{L - 1}$ is the scale factor to apply on the circuits final layer.

Each layer can have a different scale factor and we can create $M$ such variations of the scaled circuit. Let
$\Lambda = (λ_1, λ_2, λ_3, \ldots, λ_M)^T$ be the scale factors vectors used to create multiple variations of the
noise-scaled circuits $(C_{λ_1}, C_{λ_2}, C_{λ_3}, \ldots, C_{λ_M})^T$ such that each vector $λ_i$ defines the scale
factors for the different layers in the input circuit $({λ^1}_i, {λ^2}_i, {λ^3}_i, \ldots, {λ^l}_i)^T$.
Fix the number of noise-scaled circuits we wish to generate at $M\in\mathbb{N}$.
Define $\Lambda = (λ_1, λ_2, \ldots, λ_M)^T$ to be the collection of scale factors and let $(C_{λ_1}, C_{λ_2}, \ldots, C_{λ_M})^T$ denote the noise-scaled circuits corresponding to each scale factor.

If $d$ is the chosen degree of our multivariate polynomial, we define $M_j(λ_i, d)$ to be the terms in the polynomial
arranged in increasing order. In general, the number of monomial terms with $l$ variables up to degree $d$ can be determined
After $d$ is fixed as the degree of the multivariate polynomial, we define $M_j(λ_i, d)$ to be the terms in the polynomial arranged in increasing order.
In general, the number of monomial terms with $l$ variables up to degree $d$ can be determined
through the [stars and bars method](https://en.wikipedia.org/wiki/Stars_and_bars_%28combinatorics%29).

For example, if the input circuit has 2 layers in the input circuit and our choice of degree of the extrapolating polynomial is 2, the basis of monomial terms contains 6 terms in total due to $\binom{2 + 2}{2}$ using the formula below where $d=2, l=2$. We skip the detailed discussion about the stars and bars method but the monomial basis for our example is $\{1, λ_1, λ_2, {λ_1}^2, λ_1 . λ_2, {λ_2}^2 \}$.
For example, if $C$ has 2 layers, the degree of the extrapolating polynomial is 2, the basis of monomials contains 6 terms: $\{1, λ_1, λ_2, {λ_1}^2, λ_1 \cdot λ_2, {λ_2}^2 \}$.

$$
\text{total number of terms in the monomial basis with max degree } d = \binom{d + l}{d}
Expand All @@ -57,14 +51,14 @@ $$
\text{number of terms in the monomial basis with total degree } d = \binom{d + l - 1}{d}
$$

Terms with total degree 2 are 3 calculated by $\binom{2 + 2 -1}{2} = 3$: $\{{λ_1}^2, λ_1 . λ_2, {λ_2}^2 \}$
Terms with total degree 2 are 3 calculated by $\binom{2 + 2 -1}{2} = 3$ and correspond to $\{{λ_1}^2, λ_1 \cdot λ_2, {λ_2}^2 \}$.

Similarly, number of terms with total degree 1 and 0 can be calculated as $\binom{1 + 2 -1}{1} = 2:\{λ_1, λ_2\}$ and $\binom{0 + 2 -1}{0}= 1: \{1\}$ respectively.
Similarly, number of terms with total degree 1 and 0 can be calculated as $\binom{1 + 2 -1}{1} = 2:\{λ_1, λ_2\}$ and $\binom{0 + 2 -1}{0}= 1: \{1\}$ respectively.

These terms in the monomial basis define the rows of the square sample matrix as shown below:

$$
\mathbf{A}(\Lambda, d) =
\mathbf{A}(\Lambda, d) =
\begin{bmatrix}
M_1(λ_1, d) & M_2(λ_1, d) & \cdots & M_N(λ_1, d) \\
M_1(λ_2, d) & M_2(λ_2, d) & \cdots & M_N(λ_2, d) \\
Expand All @@ -73,7 +67,7 @@ $$
\end{bmatrix}
$$

For our example circuit of $l=2$ and $d=2$, each row defined by the generic monomial terms $\{M_1(λ_i, d), M_2(λ_i, d), \ldots, M_N(λ_i, d)\}$ in the sample matrix $\mathbf{A}$ will instead be replaced by $\{1, λ_1, λ_2, {λ_1}^2, λ_1 . λ_2, {λ_2}^2 \}$.
For our example circuit of $l=2$ and $d=2$, each row defined by the generic monomial terms $\{M_1(λ_i, d), M_2(λ_i, d), \ldots, M_N(λ_i, d)\}$ in the sample matrix $\mathbf{A}$ will instead be replaced by $\{1, λ_1, λ_2, {λ_1}^2, λ_1 \cdot λ_2, {λ_2}^2 \}$.

Here, each monomial term in the sample matrix $\mathbf{A}$ is then evaluated using the values in the scale factor vectors. In Step 2, this sample matrix will be utilized to obtain our mitigated expectation value.

Expand All @@ -96,7 +90,6 @@ $$
O_{\rm LRE} = \sum_{i=1}^M \langle O (\boldsymbol{\lambda}_i)\rangle \frac{\det \left(\mathbf{B}_i (\boldsymbol{0}) \right)}{\det \left(\mathbf{A}\right)}
$$

To summarize, based on a user's choice of degree of extrapolating polynomial for some circuit, expectation values from noise scaled circuits created in a specific pattern along with multivariate Lagrange interpolation of the sample matrix evaluated using the scale factor vectors are used to find error mitigated expectation value.
To summarize, based on a user's choice of degree of extrapolating polynomial for some circuit, expectation values from noise scaled circuits created in a specific pattern along with multivariate Lagrange interpolation of the sample matrix evaluated using the scale factor vectors are used to find error mitigated expectation value.

Additional details on the LRE functionality are available in the [API-doc](https://mitiq.readthedocs.io/en/stable/apidoc.html#module-mitiq.lre.multivariate_scaling.layerwise_folding).

0 comments on commit a25683f

Please sign in to comment.