Skip to content

Commit

Permalink
Adjustments to notebook guides (#16) (#19)
Browse files Browse the repository at this point in the history
(cherry picked from commit 68f0e4b)

Co-authored-by: Caleb Johnson <caleb.johnson@ibm.com>
  • Loading branch information
mergify[bot] and caleb-johnson authored Oct 21, 2024
1 parent 12d88c5 commit c20b6d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions docs/how_tos/choose_trotter_steps.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
"\n",
"In principle, any $k_j$ values can be chosen but some choices of Trotter steps will lead to a larger noise amplification on real devices than others.\n",
"Thus, it is important that one tries to find _\"good\"_ values of $k_j$.\n",
"In the following we will discuss some heuristics to help you guide in doing so.\n",
"In the following we will discuss some heuristics to help guide you in doing so.\n",
"\n",
"1. In practice, our **largest** $k_j$ ($k_{\\text{max}}$) value is simply bound by what we can afford to execute.\n",
"1. In practice, our **largest** $k_j$ ($k_{\\text{max}}$) value is simply bound by the depth of quantum circuit we can reliably execute.\n",
"\n",
"2. Since the Trotter error is only well behaved for $\\text{d}t = t/k \\lt 1$ (see also our explanations page on [Understanding the stability of MPFs](https://qiskit.github.io/qiskit-addon-mpf/explanations/mpf_stability.html), our **smallest** $k_j$ ($k_{\\text{min}}$) should satisfy: $t/k_{\\text{min}} \\lt 1$ (Note: empirically $\\text{d}t \\leq 1$ seems to work fine, too).\n",
"2. Since the Trotter error is only well behaved for $\\text{d}t = t/k \\lt 1$ (see [Understanding the stability of MPFs](https://qiskit.github.io/qiskit-addon-mpf/explanations/mpf_stability.html)), our **smallest** $k_j$ ($k_{\\text{min}}$) should satisfy: $t/k_{\\text{min}} \\lt 1$ (Note: empirically $\\text{d}t \\leq 1$ seems to work fine, too).\n",
"\n",
"3. None of our $x_j$ values should be close to $0$, as this would imply that we might as well exclude the corresponding $k_j$ from the expansion.\n",
"\n",
Expand Down Expand Up @@ -289,7 +289,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.12.4"
}
},
"nbformat": 4,
Expand Down
20 changes: 10 additions & 10 deletions docs/tutorials/01_getting_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@
"\n",
"where $x_j$ are our weighting coefficients, $\\rho^{k_j}_j$ is the density matrix corresponding to the pure state obtained by evolving the initial state with the product formula, $S^{k_j}$, involving $k_j$ Trotter steps, and $j$ indexes the number of PFs that make up the MPF.\n",
"\n",
"The key here is, that the remaining Trotter error is smaller than the Trotter error that one would obtain by simply using the largest $k_j$ value!\n",
"The key here is that the remaining Trotter error is smaller than the Trotter error that one would obtain by simply using the largest $k_j$ value!\n",
"\n",
"You can view the usefulness of this from two perspectives:\n",
"You can view the usefulness of MPF from two perspectives:\n",
"\n",
"1. For a fixed budget of Trotter steps that you are able to execute, you can obtain results with a Trotter error that is smaller in total.\n",
"2. Given some target number of Trotter steps that is too large to execute, you can use the MPF to find a shorter-depth circuit to run which results in a similar Trotter error."
"2. For a number of Trotter steps which results in deep circuits, you can use MPF to find several shorter-depth circuits to run which result in a similar Trotter error."
]
},
{
Expand All @@ -269,7 +269,7 @@
"\n",
"Determining the static MPF coefficients for a given set of $k_j$ values amounts to solving a linear system of equations:\n",
"$Ax=b$, where $x$ are our coefficients of interest, $A$ is a matrix depending on $k_j$ and the type of PF we use ($S$), and $b$ is a vector of constraints.\n",
"For brevity, we are not going to go into more detail here and instead refer you to the documentation of [LSE](https://qiskit.github.io/qiskit-addon-mpf/stubs/qiskit_addon_mpf.static.LSE.html)\n",
"For brevity, we are not going to go into more detail here and instead refer you to the documentation of [LSE](https://qiskit.github.io/qiskit-addon-mpf/stubs/qiskit_addon_mpf.static.LSE.html).\n",
"\n",
"We can find a solution for $x$ analytically as $x = A^{-1}b$, see e.g. [Carrera Vazquez et al., 2023] or [Zhuk et al., 2023].\n",
"However, this exact solution can be _\"ill-conditioned\"_ resulting in very large L1-norms of our coefficients, $x$, which can lead to bad performance of the MPF.\n",
Expand Down Expand Up @@ -336,7 +336,7 @@
"#### Setting up the LSE\n",
"\n",
"Now that we have chosen our $k_j$s, we must first construct the LSE, $Ax=b$ as explained above.\n",
"The matrix $A$ depends not only on $k_j$ but also our choice of PF, in particular its _order_.\n",
"The matrix $A$ depends not only on $k_j$ but also our choice of product formula (PF) -- in particular its _order_.\n",
"Additionally, one may take into account whether the PF is symmetric or not (see [Carrera Vazquez et al., 2023]), by setting `symmetric=True`.\n",
"However, this is not required as shown by [Zhuk et al., 2023].\n",
"\n",
Expand Down Expand Up @@ -435,7 +435,7 @@
"\n",
"Alternatively to computing $x=A^{-1}b$, you can also use [setup_exact_model](https://qiskit.github.io/qiskit-addon-mpf/stubs/qiskit_addon_mpf.static.setup_exact_model.html) to construct a [cvxpy.Problem](https://www.cvxpy.org/api_reference/cvxpy.problems.html#cvxpy.Problem) instance which uses the LSE as constraints and whose optimal solution will yield $x$.\n",
"\n",
"It will become clear in the next section, why this interface exists, too."
"In the next section, it will be clear why this interface exists."
]
},
{
Expand Down Expand Up @@ -588,8 +588,8 @@
"source": [
"### 1c: Setting up the Trotter circuits\n",
"\n",
"At this point, we have found our expansion coefficients, $x$, and all that is left to do, is to generate the Trotterized quantum circuits.\n",
"Once again, the [qiskit_addon_utils.problem_generators](https://qiskit.github.io/qiskit-addon-utils/stubs/qiskit_addon_utils.problem_generators.html) module comes to the resuce with a handy function do just that:"
"At this point, we have found our expansion coefficients, $x$, and all that is left to do is to generate the Trotterized quantum circuits.\n",
"Once again, the [qiskit_addon_utils.problem_generators](https://qiskit.github.io/qiskit-addon-utils/stubs/qiskit_addon_utils.problem_generators.html) module comes to the rescue with a handy function do just that:"
]
},
{
Expand Down Expand Up @@ -717,7 +717,7 @@
"## Step 2: Optimize the problem\n",
"\n",
"Normally, this is the step in the pattern during which you optimize your circuits for execution on hardware.\n",
"Here, since we only use a noiseless simulator, we simple transpile our circuit for a [GenericBackendV2](https://docs.quantum.ibm.com/api/qiskit/qiskit.providers.fake_provider.GenericBackendV2)."
"Here, since we only use a noiseless simulator, we simply transpile our circuit for a [GenericBackendV2](https://docs.quantum.ibm.com/api/qiskit/qiskit.providers.fake_provider.GenericBackendV2)."
]
},
{
Expand Down Expand Up @@ -946,7 +946,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
"version": "3.12.4"
}
},
"nbformat": 4,
Expand Down

0 comments on commit c20b6d1

Please sign in to comment.