diff --git a/tutorials/popular_usage_examples/hamiltonian_simulation/hamiltonian_simulation_with_block_encoding/hamiltonian_simulation_with_block_encoding.ipynb b/tutorials/popular_usage_examples/hamiltonian_simulation/hamiltonian_simulation_with_block_encoding/hamiltonian_simulation_with_block_encoding.ipynb
index 55d9ecb4..28abeaa4 100644
--- a/tutorials/popular_usage_examples/hamiltonian_simulation/hamiltonian_simulation_with_block_encoding/hamiltonian_simulation_with_block_encoding.ipynb
+++ b/tutorials/popular_usage_examples/hamiltonian_simulation/hamiltonian_simulation_with_block_encoding/hamiltonian_simulation_with_block_encoding.ipynb
@@ -13,15 +13,15 @@
"id": "b5eab786-f4d8-4a89-b3f7-2355b46d4246",
"metadata": {},
"source": [
- "In this tutorial we demonstrate how to implement Hamiltonian simulation for block-encoded Hamiltonians, with two different techniques: Quantum Singular Eigenvalues Transform (QSVT) and Qubitization. We specialize to a [Linear Combination of Unitaries (LCU)](https://github.com/Classiq/classiq-library/blob/main/tutorials/advanced_tutorials/linear_combination_of_unitaries/linear_combination_of_unitaries.ipynb) block-encoding for the Hamiltonian, however, the implementation of the Hamiltonian simulation can be easily modified to other block-encoding implementations.\n",
+ "This tutorial demonstrates how to implement Hamiltonian simulation for block-encoded Hamiltonians using two different techniques: Quantum Singular Eigenvalues Transform (QSVT) and qubitization. It specializes for a [Linear Combination of Unitaries (LCU)](https://github.com/Classiq/classiq-library/blob/main/tutorials/advanced_tutorials/linear_combination_of_unitaries/linear_combination_of_unitaries.ipynb) block-encoding for the Hamiltonian; however, you can easily modify the implementation of the Hamiltonian simulation to other block-encoding implementations.\n",
"\n",
"The tutorial is organized as follows: \n",
"\n",
- "1. Short introduction that includes some basic and relevant definitions.\n",
- "2. Definition of several classical and quantum functions that are useful for the Hamiltonian block-encoding.\n",
- "3. Definition of a specific Hamiltonian.\n",
- "4. Implementation of a Hamiltonian simulation using QSVT.\n",
- "5. Implementation of a Hamiltonian simulation using Qubitization.\n",
+ "1. Definitions of block-encoding and the Jacobi–Anger Expansion\n",
+ "2. Definitions of classical and quantum functions that are useful for the Hamiltonian block-encoding\n",
+ "3. Definition of a specific Hamiltonian\n",
+ "4. Implementation of a Hamiltonian simulation using QSVT\n",
+ "5. Implementation of a Hamiltonian simulation using qubitization\n",
"\n",
"The two last sections are independent."
]
@@ -51,7 +51,7 @@
"id": "6b1b5b95-66b5-4eaf-a190-6485ed89cf26",
"metadata": {},
"source": [
- "## Introduction"
+ "## Definitions"
]
},
{
@@ -68,9 +68,9 @@
"* & *\n",
"\\end{pmatrix},\n",
"$$\n",
- "with some functional error $\\left|\\left(U_{(s,m,\\epsilon)-H}\\right)_{0:2^n-1,0:2^n-1}-H/s \\right|\\leq \\epsilon$. For the most basic usage of block-encoding see first item in the technical notes at the end of this tutorial.\n",
+ "with some functional error $\\left|\\left(U_{(s,m,\\epsilon)-H}\\right)_{0:2^n-1,0:2^n-1}-H/s \\right|\\leq \\epsilon$. For the most basic use of block-encoding, see the first item in the technical notes at the end of this tutorial.\n",
"\n",
- "**Definition**: LCU refers to $(\\bar{\\alpha}, m, 0)$-block encoding of a matrix given as a sum of unitaries:\n",
+ "**Definition**: LCU refers to $(\\bar{\\alpha}, m, 0)$-block-encoding of a matrix given as a sum of unitaries:\n",
"$$\n",
"U_{(\\bar{\\alpha},m,0)-A} =\\begin{pmatrix}\n",
"A/\\bar{\\alpha} & * \\\\\n",
@@ -80,14 +80,14 @@
"with $\\bar{\\alpha}\\equiv\\sum^{L-1}_{i=0}\\alpha_i$ and $m= \\lceil\\log_2(L) \\rceil$. See the [LCU tutorial](https://github.com/Classiq/classiq-library/blob/main/tutorials/advanced_tutorials/linear_combination_of_unitaries/linear_combination_of_unitaries.ipynb) for more details.\n",
"\n",
"\n",
- "In this tutorial we start with an exact $(s, m, 0)$-encoding of some Hamiltonian, and implement an approximated encoding of its Hamiltonian evolution\n",
+ "This tutorial starts with an exact $(s, m, 0)$-encoding of some Hamiltonian and implements an approximated encoding of its Hamiltonian evolution\n",
"$$\n",
"U_{(\\tilde{s},\\tilde{m},\\epsilon)-\\exp{(iHt)}} = \\begin{pmatrix}\n",
"\\exp{(iHt)}/\\tilde{s} & * \\\\\n",
"* & *\n",
"\\end{pmatrix},\n",
"$$\n",
- "using QSVT and Qubitization approaches. Both implementations are based on polynomial approximation of the function $f(x)=e^{ix}$, in particular, we will perform the block-encoding of $\\cos(Ht)$ and $\\sin(Ht)$ and then construct an LCU for $e^{iHt}=\\cos(Ht)+i\\sin(Ht)$. Therefore, the LCU methodology is employed at least twice, once for the block-encoding of $H$, and the second for block-encoding the sum of sine and cosine.\n",
+ "using QSVT and qubitization approaches. Both implementations are based on a polynomial approximation of the function $f(x)=e^{ix}$. In particular, perform the block-encoding of $\\cos(Ht)$ and $\\sin(Ht)$ and then construct an LCU for $e^{iHt}=\\cos(Ht)+i\\sin(Ht)$. Therefore, the LCU methodology is employed at least twice: once for the block-encoding of $H$, and the second for block-encoding the sum of sine and cosine.\n",
"\n"
]
},
@@ -109,12 +109,12 @@
"\\cos(xt) &=& J_0(t) + 2\\sum^{d}_{k=1} (-1)^k J_{2k}(t) T_{2k}(x)\\\\\n",
"\\sin(xt) &=& 2\\sum^{d}_{k=0} (-1)^k J_{2k+1}(t) T_{2k+1}(x),\n",
"\\end{eqnarray}\n",
- "where $J_i(x)$ and $T_i(x)$ are the Bessel function and Chebychev Polynomial of order $i$, respectivaly, and the degree $d$ is related to the approximation error $\\epsilon$ as\n",
+ "where $J_i(x)$ and $T_i(x)$ are the Bessel function and Chebyshev polynomial of order $i$, respectively, and the degree $d$ is related to the approximation error $\\epsilon$ as\n",
"$$\n",
"d = O\\left(t - \\frac{\\log\\epsilon}{1+\\log\\left(e-\\frac{\\log(\\epsilon)}{t}\\right)}\\right).\n",
"$$\n",
"\n",
- "We start with defining a function that gets $\\epsilon$ and the evolution time $t$, and returns the Chebyshev coefficients of the sine and cosine functions, using the `scipy` package."
+ "Start with defining a function that gets $\\epsilon$ and the evolution time $t$, and returns the Chebyshev coefficients of the sine and cosine functions, using the `scipy` package."
]
},
{
@@ -148,7 +148,7 @@
"id": "f63ec811-3171-4cc4-a3f3-794776557e35",
"metadata": {},
"source": [
- "We can visualize the approximation for a specific example"
+ "Visualize the approximation for a specific example:"
]
},
{
@@ -214,11 +214,11 @@
"id": "e7927b1e-1d95-4434-b096-73c033d55f35",
"metadata": {},
"source": [
- "We focus on Hamiltonians that are given in the Pauli basis, i.e., as a sum of unitaries\n",
+ "Focus on Hamiltonians that are given in the Pauli basis, i.e., as a sum of unitaries\n",
"$$\n",
"H = \\sum^{L-1}_{i=0} \\alpha_i U_i,\n",
"$$\n",
- "where $U_i$ are Pauli strings. Below we define some quantum and classical functions relevant for LCU. "
+ "where $U_i$ are Pauli strings. Next, define quantum and classical functions relevant for LCU. "
]
},
{
@@ -228,7 +228,7 @@
"source": [
"### Classical Pre-process Functions\n",
"\n",
- "The LCU is implemented with the so-called \"prepare\" and \"select\" operations. The former prepare a quantum state that corresponds to the probabilities $\\alpha_i /\\sum\\alpha_i$. We define a function that gets the list of $L$ coefficients and returns the probabilities to be loaded as part of the LCU. "
+ "The LCU is implemented with the so-called \"prepare\" and \"select\" operations. The former prepares a quantum state that corresponds to the probabilities $\\alpha_i /\\sum\\alpha_i$. Define a function that gets the list of $L$ coefficients and returns the probabilities to be loaded as part of the LCU. "
]
},
{
@@ -259,14 +259,14 @@
"source": [
"### Quantum Functions\n",
"\n",
- " Below we define a quantum function `lcu_paulis` that implements LCU of Pauli strings, its arguments are:\n",
+ " Define a quantum function `lcu_paulis` that implements the LCU of Pauli strings with these arguments:\n",
" - `pauli_terms_list`: the list of Pauli strings\n",
- " - `probs`: the normalized coefficients $\\alpha_i/\\sum\\alpha_i$,\n",
- " - `data`: the quantum variable on which the Hamiltonian operates.\n",
- " - `block`: the quantum \"prepare\" variable for the block encoding.\n",
+ " - `probs`: the normalized coefficients $\\alpha_i/\\sum\\alpha_i$\n",
+ " - `data`: the quantum variable on which the Hamiltonian operates\n",
+ " - `block`: the quantum \"prepare\" variable for the block-encoding\n",
"\n",
- "We define and use a subroutine `apply_pauli_term` that applies a single pauli string.\n",
- "For convenience, we restrict the the case where all the coefficients in the LCU are positive ones (see the second technical comment at the end of this notebook). "
+ "Define and use a subroutine `apply_pauli_term` that applies a single Pauli string.\n",
+ "For convenience, restrict the case so that all the coefficients in the LCU are positive ones (see the second technical comment at the end of this notebook). "
]
},
{
@@ -323,7 +323,7 @@
"id": "03e0555a-8c43-46bc-895a-db53812d57b2",
"metadata": {},
"source": [
- "Working with block-encoding typically requires post-selection of the block variables being at state 0 (see first technical note at the end of this tutorial). The success of this process can be amplified via a [Quantum Amplitude Amplification](https://github.com/Classiq/classiq-library/blob/main/algorithms/qsvt/qsvt_fixed_point_amplitude_amplification) routine. This issue is beyond the scope of this tutorial, instead, we simply work with a statevector simulator. We define a function that gets execution results and returns a projected state vector. "
+ "Working with block-encoding typically requires post-selection of the block variables being at state 0 (see the first technical note at the end of this tutorial). The success of this process can be amplified via a [Quantum Amplitude Amplification](https://github.com/Classiq/classiq-library/blob/main/algorithms/qsvt/qsvt_fixed_point_amplitude_amplification) routine. This issue is beyond the scope of this tutorial, instead, simply work with a statevector simulator. Define a function that gets execution results and returns a projected state vector. "
]
},
{
@@ -392,7 +392,7 @@
"id": "e4ab81a3-ee78-444f-b644-2dae9c500418",
"metadata": {},
"source": [
- "For simplicity, we now take a specific Hamiltonian with which we continue to the next sections.\n",
+ "For simplicity in the next sections, take a specific Hamiltonian:\n",
"$$\n",
"H = 0.4 \\cdot I\\otimes I +0.1\\cdot I\\otimes Z + 0.3 \\cdot X \\otimes X + 0.2\\cdot Z\\otimes Z\n",
"$$"
@@ -418,7 +418,7 @@
"id": "72d815ce-df09-4b5a-bcaf-fa84bc3756ba",
"metadata": {},
"source": [
- "Next, we need to calculate the normalized coefficients for the LCU, and the corresponding normalization factor:"
+ "Next, calculate the normalized coefficients for the LCU and the corresponding normalization factor:"
]
},
{
@@ -449,7 +449,7 @@
"id": "bbcf5a22-e442-4e0a-a771-e220fd3a6442",
"metadata": {},
"source": [
- "### Verification of the Hamiltonian Block Encoding"
+ "### Verifying the Hamiltonian Block-encoding"
]
},
{
@@ -457,7 +457,7 @@
"id": "819e0dc3-fbeb-4a07-9bf3-f0d9ab67ec4a",
"metadata": {},
"source": [
- "Before moving to the more complex Hamiltonian simulation implementation, it is useful to verify our Hamiltonian block-encoding. For this, we define a model in which we apply $U_H$ on some random vector state of size $2^n\\cdot 2^m$, $(\\vec{b},\\vec{0})$, and verify that the resulting state, after post-selection, gives $(H/\\bar{\\alpha})\\vec{b}$. "
+ "Before moving to the more complex Hamiltonian simulation implementation, it is useful to verify the Hamiltonian block-encoding. For this, define a model in which to apply $U_H$ on some random vector state of size $2^n\\cdot 2^m$, $(\\vec{b},\\vec{0})$, and verify that the resulting state, after post-selection, gives $(H/\\bar{\\alpha})\\vec{b}$: "
]
},
{
@@ -512,7 +512,7 @@
"id": "8a769f9b-89c6-43de-b9b8-864bc9107ff4",
"metadata": {},
"source": [
- "We use our pre-defined function for the post-selection:"
+ "Use the predefined function for the post-selection:"
]
},
{
@@ -530,7 +530,7 @@
"id": "7c158200-f0d7-4187-ab3d-ec1db6851f87",
"metadata": {},
"source": [
- "For comparing to the expected result, we define classical functions that help us to get the matrix in the standard basis:"
+ "To compare to the expected result, define classical functions that get the matrix in the standard basis:"
]
},
{
@@ -578,7 +578,7 @@
"id": "4b374fb3-37c1-40b3-9691-645e1efe0c61",
"metadata": {},
"source": [
- "The quantum state that returns from execution is given up to some global phase. For comparing to the expected state we run the following lines:"
+ "The quantum state that returns from execution is given up to some global phase. To compare to the expected state, run these lines:"
]
},
{
@@ -627,18 +627,18 @@
"id": "92993cea-4db1-46c9-bd83-f0e81b9d6c93",
"metadata": {},
"source": [
- "Given our block-encoding $U_{(s,m,0)-H}$ we can define the following operator (usually called Szegedy quanutm walk-operator [[5](#Szegedy)]):\n",
+ "Given the block-encoding $U_{(s,m,0)-H}$, define the following operator (usually called the Szegedy quantum walk operator [[5](#Szegedy)]):\n",
"$$\n",
"W\\equiv -\\Pi_{|0\\rangle_m} U_{(s,m,0)-H},\n",
"$$ \n",
- "where $\\Pi_{|0\\rangle_m}$ is a reflection operator about the block state. This unitary function has the important property that its powers correspond to a $(1,m,0)$-encoding of the Chebychev polynomials:\n",
+ "where $\\Pi_{|0\\rangle_m}$ is a reflection operator about the block state. This unitary function has the important property that its powers correspond to a $(1,m,0)$-encoding of the Chebyshev polynomials:\n",
"$$\n",
"W^k = \\begin{pmatrix}\n",
"T_k(H) & * \\\\\n",
"* & *\n",
"\\end{pmatrix}=U_{(1,m,0)-T_k(H)},\n",
"$$\n",
- "with $T_k$ being the k-th Chebychev polynomial. For more details see Sec. 7 in Ref. [[2](#Qubitization)] (the property holds only for Hermitian block-encoding, for generalization see comment 3 below). We can thus simply combine the Jacobi–Anger expansion with the LCU technique to get the block-encoding for the Hamiltonain simulation. Namely, we have an $\\epsilon$-approximation of $\\exp(iHt)\\approx \\sum^d_{i=0} \\beta_{i} T_{i}(x)$, for which we can perform the following encoding\n",
+ "with $T_k$ being the k-th Chebyshev polynomial. For more details, see Sec. 7 in Ref. [[2](#Qubitization)]. (The property holds only for Hermitian block-encoding. For generalization, see comment 3 below.) You can thus simply combine the Jacobi–Anger expansion with the LCU technique to get the block-encoding for the Hamiltonian simulation. Namely, you have an $\\epsilon$-approximation of $\\exp(iHt)\\approx \\sum^d_{i=0} \\beta_{i} T_{i}(x)$, for which you can perform the following encoding:\n",
"$$\n",
"U_{(\\bar{\\beta},\\tilde{m},\\epsilon)-\\exp{(iHt)}} =\n",
"\\begin{pmatrix}\n",
@@ -658,7 +658,7 @@
"* & *\n",
"\\end{pmatrix},\n",
"$$\n",
- "where $\\tilde{m}=m+\\lceil \\log_2(d+1) \\rceil$ (recall that $W$ are block-encoding themeselves with block size $m$)."
+ "where $\\tilde{m}=m+\\lceil \\log_2(d+1) \\rceil$ (recalling that $W$ are block-encodings themselves, with block size $m$)."
]
},
{
@@ -666,7 +666,7 @@
"id": "ecfb5bbf-e01e-4245-807a-25cd98066499",
"metadata": {},
"source": [
- "First, let us define a walk-operator for our specific example. For the reflection we can use the `reflect_about_zero` quantum function from Classiq's open library."
+ "Define a walk operator for this specific example. For the reflection, use the `reflect_about_zero` quantum function from the Classiq open library."
]
},
{
@@ -688,7 +688,7 @@
"id": "86cf9336-13b3-4a0c-b905-b15285b5b992",
"metadata": {},
"source": [
- "Next, we use our pre-defined function to calculate the coefficients $\\beta_i$ for approximating the sine and cosine functions. Recall that we want to approximate $e^{iHt}$, whereas our Hamiltonian is encoded with a normalization factor $\\bar{\\alpha}$. Therefore, we must rescale the time by this factor."
+ "Next, use the predefined function to calculate the coefficients $\\beta_i$ for approximating the sine and cosine functions. Recall that you want to approximate $e^{iHt}$, whereas the Hamiltonian is encoded with a normalization factor $\\bar{\\alpha}$. Therefore, you must rescale the time by this factor."
]
},
{
@@ -716,7 +716,7 @@
"id": "5c8193c3-dd48-4a90-b3a8-b1453179406d",
"metadata": {},
"source": [
- "Given the coefficients, we should now calculate the probabilities for the LCU prepare variable. These must be positive numbers. Moreover, for the odd terms, which corresponds to the sine function, we should add a factor of $i$. Those factors should be added to the unitary operations $W^k$. To take this into account, for each term we define a \"generalized sign\" $\\sigma_k$ such that $\\beta_k = e^{\\frac{\\pi}{2}\\sigma_k i} |\\beta_k|$ with $\\sigma_k \\in \\{0,1,2,3\\}$ that corresponds to the factors $1,i,-1,-i$ respectively. "
+ "Given the coefficients, calculate the probabilities for the LCU \"prepare\" variable. These must be positive numbers. Moreover, for the odd terms, which correspond to the sine function, add a factor of $i$ to the unitary operations $W^k$. To take this into account, for each term, define a \"generalized sign\" $\\sigma_k$ such that $\\beta_k = e^{\\frac{\\pi}{2}\\sigma_k i} |\\beta_k|$ with $\\sigma_k \\in \\{0,1,2,3\\}$ that corresponds to the factors $1,i,-1,-i$, respectively. "
]
},
{
@@ -738,7 +738,7 @@
"id": "ef531900-596b-4d42-8400-04fb1e969168",
"metadata": {},
"source": [
- "Now that we have our positive coefficients, we can use the pre-defined pre-process function to get the probabilities for the LCU:"
+ "Now that you have the positive coefficients, use the predefined preprocess function to get the probabilities for the LCU:"
]
},
{
@@ -768,7 +768,7 @@
"id": "1ba422ed-0cb3-48db-8833-2207b660ba22",
"metadata": {},
"source": [
- "We define a quantum function for a generic LCU of Chebyshev polynomials, which gets the prepare probabilities, the generalized signs, and a walk operator as a quantum callable."
+ "Define a quantum function for a generic LCU of Chebyshev polynomials, which gets the prepare probabilities, the generalized signs, and a walk operator as a quantum callable."
]
},
{
@@ -808,7 +808,7 @@
"id": "8516f07a-83ed-43d0-a61c-4bbdb4aa65b4",
"metadata": {},
"source": [
- "The code in the rest of this section builds a model that applies the `lcu_cheb` function on the randomly prepared vector $(\\vec{b},\\vec{0})$; synthesizes it; executes the resulting quantum program; and verifies the results. "
+ "The code in the rest of this section builds a model that applies the `lcu_cheb` function on the randomly prepared vector $(\\vec{b},\\vec{0})$, synthesizes it, executes the resulting quantum program, and verifies the results. "
]
},
{
@@ -842,7 +842,7 @@
"id": "77981a06-1111-4294-bc98-bb813338374f",
"metadata": {},
"source": [
- "We synthesize the quantum model and execute it"
+ "Synthesize the quantum model and execute it:"
]
},
{
@@ -958,11 +958,11 @@
"id": "0d64cbd2-d740-44ea-8d0b-5a1d85eb87da",
"metadata": {},
"source": [
- "The QSVT is a general technique for applying block encoding of matrix polynomials, via quantum signal processing. We refer to Ref. [[3](#grand)] and the [QSVT notebook](https://github.com/Classiq/classiq-library/blob/main/algorithms/qsvt/qsvt_matrix_inversion/qsvt_matrix_inversion.ipynb) for more information about this generic and important subject. In the QSVT approach we repeatedly apply two operations: $U_H$ application and rotated reflections around the block space, applied on an extra qubit. The value of the rotation angles can be found using the `pyqsp` package. \n",
+ "The QSVT is a general technique for applying block-encoding of matrix polynomials via quantum signal processing. Refer to Ref. [[3](#grand)] and the [QSVT notebook](https://github.com/Classiq/classiq-library/blob/main/algorithms/qsvt/qsvt_matrix_inversion/qsvt_matrix_inversion.ipynb) for more information about this generic and important subject. For the QSVT approach, repeatedly apply two operations: $U_H$ application and rotated reflections around the block space, applied on an extra qubit. The value of the rotation angles is found using the `pyqsp` package. \n",
"\n",
- "The QSVT gives block-encoding of polynomials with a well defined-parity. Thus, we have to apply two QSVT blocks, one for approximating the $\\cos(xt)$ function and one for the $\\sin(xt)$ function, and then, for the finale, construct an LCU to get the block-encoding the sum: $e^{ixt} = \\cos(xt)+i\\sin(xt)$. For a realziation of such model on real hardware see Ref. [[4](#paper)].\n",
+ "The QSVT gives block-encoding of polynomials with a well defined parity. Thus, you apply two QSVT blocks—one for approximating the $\\cos(xt)$ function and one for the $\\sin(xt)$ function—and then, for the finale, construct an LCU to get the block-encoding of the sum $e^{ixt} = \\cos(xt)+i\\sin(xt)$. For a realization of such a model on real hardware, see Ref. [[4](#paper)].\n",
"\n",
- "We start with calulating the rotation angles for the sine and cosine polynomial approximations. As in the Qubitization method, we need to normalize the evolution time $t$. In addition, the `pysqp` adds a factor $1/2$ to the sine and cosine polynomials."
+ "Start by calculating the rotation angles for the sine and cosine polynomial approximations. As for the qubitization method, normalize the evolution time $t$. In addition, the `pysqp` adds a factor $1/2$ to the sine and cosine polynomials."
]
},
{
@@ -1046,7 +1046,7 @@
"id": "386c6ca2-beb0-4dad-a569-eaf6ef1b4e55",
"metadata": {},
"source": [
- "The list of angles to use within the `qsvt` function are given by:"
+ "The list of angles to use within the `qsvt` function are given by"
]
},
{
@@ -1065,12 +1065,12 @@
"id": "a10143ae-c686-4b11-bfbc-5089147014c1",
"metadata": {},
"source": [
- "Next, we use [Classiq's `qsvt` function](https://github.com/Classiq/classiq-library/blob/main/functions/qmod_library_reference/classiq_open_library/qsvt/qsvt.ipynb) to get the QSVT of the sine and cosine block encoding. This open library function has the following arguments:\n",
- "- `phases`: the series of rotations according the quantum signal processing.\n",
- "- `proj_cnot_1`, `proj_cnot_2`: the projection operations for the block space- in our case these are identical, defined below as the `identify_block`.\n",
- "- `u`: the block-encoding quantum function- our the `lcu_paulis` function.\n",
- "- `qvar`: the combined variables of the block encoding function.\n",
- "- `qsvt_aux`: the extra qubit for the QSVT rotations."
+ "Next, use the [Classiq `qsvt` function](https://github.com/Classiq/classiq-library/blob/main/functions/qmod_library_reference/classiq_open_library/qsvt/qsvt.ipynb) to get the QSVT of the sine and cosine block-encoding. This open library function has the following arguments:\n",
+ "- `phases`: the series of rotations according to quantum signal processing\n",
+ "- `proj_cnot_1`, `proj_cnot_2`: the projection operations for the block space. In this case, these are identical, defined below as the `identify_block`\n",
+ "- `u`: the block-encoding quantum function—the `lcu_paulis` function\n",
+ "- `qvar`: the combined variables of the block-encoding function\n",
+ "- `qsvt_aux`: the extra qubit for the QSVT rotations"
]
},
{
@@ -1078,7 +1078,7 @@
"id": "9dc2508f-59ff-4fe8-a97d-42345c1af919",
"metadata": {},
"source": [
- "We define a qsvt function for our specific Hamiltonian and approximation. Passing it the series of angles `phases_cos` or `phases_sin` generates the block-encodings:\n",
+ "Define a QSVT function for the specific Hamiltonian and approximation. Passing it the `phases_cos` or `phases_sin` series of angles generates the block-encodings:\n",
"$$\n",
"U_{(2,m+1,\\epsilon)-\\cos(Ht)} = \\begin{pmatrix}\n",
"\\cos(iHt)/2 & * \\\\\n",
@@ -1137,11 +1137,11 @@
"id": "e95f73ea-4a86-45f7-883f-244e6645de68",
"metadata": {},
"source": [
- "Finally, to get the desired Hamiltonian simulation we apply an LCU with the two unitaries: \n",
+ "Finally, to get the desired Hamiltonian simulation, apply an LCU with the two unitaries: \n",
"$$\n",
- "U_{(2,m+1,\\epsilon)-\\cos(Ht)} + iU_{(2,m+1,\\epsilon)-\\sin(Ht)},\n",
+ "U_{(2,m+1,\\epsilon)-\\cos(Ht)} + iU_{(2,m+1,\\epsilon)-\\sin(Ht)}.\n",
"$$\n",
- "The normalized LCU coefficients are thus $(1/2,1/2)$, giving an $(4, m+2,\\epsilon)$-encoding for the Hamiltonian simulation:\n",
+ "The normalized LCU coefficients are therefore $(1/2,1/2)$, giving an $(4, m+2,\\epsilon)$-encoding for the Hamiltonian simulation:\n",
"$$\n",
"U_{((4, m+2,\\epsilon))-\\exp{(iHt)}} = \\begin{pmatrix}\n",
"\\frac{1}{4}\\exp{(iHt)} & * \\\\\n",
@@ -1149,7 +1149,7 @@
"\\end{pmatrix}.\n",
"$$\n",
"\n",
- "The code in the rest of this section builds a model that applies this block-encoding on the randomly prepared $(\\vec{b},\\vec{0})$; synthesizes it; executes the resulting quantum program; and verifies the results."
+ "The code in the rest of this section builds a model that applies this block-encoding on the randomly prepared $(\\vec{b},\\vec{0})$, synthesizes it, executes the resulting quantum program, and verifies the results."
]
},
{
@@ -1294,7 +1294,7 @@
"source": [
"## Technical Notes\n",
"\n",
- "1. The basic usage of the block-encoding unitary: let say we have a $(s, m, 0)$-encoding of a matrix $A$\n",
+ "1. Basic use of the block-encoding unitary: Let's say you have a $(s, m, 0)$-encoding of a matrix $A$\n",
"$$\n",
"U_{(s, m, 0)-A} = \\begin{pmatrix}\n",
"\t A/s & * \\\\\n",
@@ -1302,7 +1302,7 @@
"\\end{pmatrix},\n",
"$$\n",
"where the dimension of $A$ is $2^n\\times 2^n$.\n",
- "If we apply this unitary on the state \n",
+ "If you apply this unitary on the state \n",
"$$\n",
"|\\psi\\rangle_n|0\\rangle_m =|\\psi\\rangle_n \\otimes \n",
"\\begin{pmatrix}\n",
@@ -1318,7 +1318,7 @@
" 0\n",
"\\end{pmatrix},\n",
"$$\n",
- "we get\n",
+ "you get\n",
"$$\n",
"U_{(s, m, 0)-A} \\left(|\\psi\\rangle_n|0\\rangle_m \\right) = \n",
"\\begin{pmatrix}\n",
@@ -1335,12 +1335,12 @@
" *\n",
"\\end{pmatrix} = \\frac{1}{s}A|\\psi\\rangle_n|0\\rangle_m +\\sum_{l\\neq 0} c_l |\\phi\\rangle_n|l\\rangle_m .\n",
"$$\n",
- "Thus, if we measure $|0\\rangle_m$ on the second variable we know the first variable is the state $\\frac{1}{s}A|\\psi\\rangle_n$. In terms of measurment, we shall post-select on $|0\\rangle_m$ to measure the desired state. The success of this operation, which is given by $|\\frac{1}{s}A|\\psi\\rangle_n|$, can be amplified with Quantum Amplitude Amplification.\n",
+ "Thus, if you measure $|0\\rangle_m$ on the second variable, you know the first variable is the state $\\frac{1}{s}A|\\psi\\rangle_n$. In terms of measurement, post-select on $|0\\rangle_m$ to measure the desired state. You can amplify the success of this operation, given by $|\\frac{1}{s}A|\\psi\\rangle_n|$, with Quantum Amplitude Amplification.\n",
"\n",
"\n",
- "2. Generalization to Pauli strings with non-positive coefficients: We assumed that all the coeffecients $\\alpha_i$ in the Hamiltonain decomposition to Pauli strings are positive. This assumption can be easiy relaxed. Non-positive or complex coeffecients should be enter into the definition of $U_i$. Thus, one can modify the `get_cheb_coef` to return the \"generalized signs\" and add phases to the Pauli strings accordingly, as was done in the Qubitization method above.\n",
+ "2. Generalization to Pauli strings with non-positive coefficients: The assumption that all the coefficients $\\alpha_i$ in the Hamiltonian decomposition to Pauli strings are positive can be easily relaxed by entering non-positive or complex coefficients into the definition of $U_i$. Thus, you can modify `get_cheb_coef` to return the \"generalized signs\" and add phases to the Pauli strings accordingly, as in the qubitization method above.\n",
"\n",
- "3. Generalization to non-Hermitian block-encoding: In this tutorial we took an Hamiltonian block-encoding which is Hermitian, that is, the unitary $U_{(s,m,0)-H}$ itself is Hermitian. In the case of non-Hermitian unitary block-encoding, the cited property of the walk operator $W$ does not hold. However, similar property holds for $\\tilde{W}\\equiv U_{(s,m,0)-H}^T\\Pi_{|0\\rangle_m} U_{(s,m,0)-H}\\Pi_{|0\\rangle_m}$, see Sec. (7.4) in Ref. [[2](#qubitization)]."
+ "3. Generalization to non-Hermitian block-encoding: This tutorial took a Hermitian Hamiltonian block-encoding; that is, the unitary $U_{(s,m,0)-H}$ itself is Hermitian. In the case of non-Hermitian unitary block-encoding, the cited property of the walk operator $W$ does not hold. However, a similar property holds for $\\tilde{W}\\equiv U_{(s,m,0)-H}^T\\Pi_{|0\\rangle_m} U_{(s,m,0)-H}\\Pi_{|0\\rangle_m}$. (See Sec. 7.4 in Ref. [[2](#qubitization)].)"
]
},
{
@@ -1350,12 +1350,12 @@
"source": [
"[1]: [Jacobi-Anger Expansion](https://en.wikipedia.org/wiki/Jacobi%E2%80%93Anger_expansion).\n",
"\n",
- "[2]: [Lin, L. \"Lecture Notes on Quantum Algorithms for Scientific Computation\n",
+ "[2]: [Lin, L. \"Lecture notes on quantum algorithms for scientific computation\n",
".\" arXiv:2201.08309 \\[quant-ph\\])](https://arxiv.org/abs/2201.08309).\n",
"\n",
- "[3]: [Martyn JM, Rossi ZM, Tan AK, Chuang IL. Grand unification of quantum algorithms. PRX Quantum. 2021 Dec 3;2(4):040203.](https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.040203)\n",
+ "[3]: [Martyn JM, Rossi ZM, Tan AK, Chuang IL. \"Grand unification of quantum algorithms.\" PRX Quantum. 2021 Dec 3;2(4):040203.](https://journals.aps.org/prxquantum/abstract/10.1103/PRXQuantum.2.040203)\n",
"\n",
- "[4]: [Kikuchi, Y., Mc Keever, C., Coopmans, L. et al. \"Realization of quantum signal processing on a noisy quantum computer\". npj Quantum Inf 9, 93 (2023)](https://www.nature.com/articles/s41534-023-00762-0).\n",
+ "[4]: [Kikuchi, Y, Mc Keever, C, Coopmans, L, et al. \"Realization of quantum signal processing on a noisy quantum computer\". npj Quantum Inf 9, 93 (2023)](https://www.nature.com/articles/s41534-023-00762-0).\n",
"\n",
"[5]: [M. Szegedy, \"Quantum speed-up of Markov chain based algorithms,\" In 45th Annual IEEE symposium on foundations of computer science, pages 32–41, 2004](https://ieeexplore.ieee.org/abstract/document/1366222).\n"
]