Skip to content

Commit e7ff994

Browse files
committed
Fix the typos in classical_shadows.ipynb
1 parent 56555b6 commit e7ff994

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

docs/source/tutorials/classical_shadows.ipynb

+9-9
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@
3030
{
3131
"cell_type": "markdown",
3232
"source": [
33-
"Let's first briefly review the classical shadows in Pauli basis. For an $n$-qubit quantum state $\\rho$, we randomly perform Pauli projection measurement on each qubit and obtain a snapshot like $\\{1,-1,-1,1,\\cdots,1,-1\\}$. This process is equivalent to apply a random unitary $U$ to $\\rho$ and measure in computational basis to obtain $|b\\rangle=|s_1\\cdots s_n\\rangle,\\ s_j\\in\\{0,1\\}$:\n",
33+
"Let's first briefly review the classical shadows in Pauli basis. For an $n$-qubit quantum state $\\rho$, we randomly perform Pauli projection measurement on each qubit and obtain a snapshot like $\\{1,-1,-1,1,\\cdots,1,-1\\}$. This process is equivalent to apply a random unitary $U_i$ to $\\rho$ and measure in computational basis to obtain $|b_i\\rangle=|s_{i1}\\cdots s_{in}\\rangle,\\ s_{ij}\\in\\{0,1\\}$:\n",
3434
"$$\n",
35-
"\\rho\\rightarrow U\\rho U^{\\dagger}\\xrightarrow{measure}|b\\rangle\\langle b|,\n",
35+
"\\rho\\rightarrow U_i\\rho U_i^{\\dagger}\\xrightarrow{measure}|b_i\\rangle\\langle b_i|,\n",
3636
"$$\n",
37-
"where $U=\\bigotimes_{j=1}^{n}u_j$, $u_i\\in\\{H, HS^{\\dagger}, \\mathbb{I}\\}$ correspond to the projection measurements of Pauli $X$, $Y$, $Z$ respectively. Then we reverse the operation to get the equivalent measurement result on $\\rho$:\n",
37+
"where $U_i=\\bigotimes_{j=1}^{n}u_{ij}$, $u_{ij}\\in\\{H, HS^{\\dagger}, \\mathbb{I}\\}$ correspond to the projection measurements of Pauli $X$, $Y$, $Z$ respectively. Then we reverse the operation to get the equivalent measurement result on $\\rho$:\n",
3838
"$$\n",
39-
"\\rho\\xrightarrow{measure}U^{\\dagger}|b\\rangle\\langle b| U.\n",
39+
"\\rho\\xrightarrow{measure}U_i^{\\dagger}|b_i\\rangle\\langle b_i| U_i.\n",
4040
"$$\n",
4141
"Moreover, we perform $N$ random measurements and view their average as a quantum channel:\n",
4242
"$$\n",
43-
"\\mathbb{E}\\left[U^{\\dagger}|b\\rangle\\langle b|U\\right]=\\mathcal{M}(\\rho),\n",
43+
"\\mathbb{E}\\left[U_i^{\\dagger}|b_i\\rangle\\langle b_i|U_i\\right]=\\mathcal{M}(\\rho),\n",
4444
"$$\n",
4545
"we can invert the channel to get the approximation of $\\rho$:\n",
4646
"$$\n",
47-
"\\rho=\\mathbb{E}\\left[\\mathcal{M}^{-1}(U^{\\dagger}|b\\rangle\\langle b|U)\\right].\n",
47+
"\\rho=\\mathbb{E}\\left[\\mathcal{M}^{-1}(U_i^{\\dagger}|b_i\\rangle\\langle b_i|U_i)\\right].\n",
4848
"$$\n",
4949
"We call each $\\rho_i=\\mathcal{M}^{-1}(U_i^{\\dagger}|b_i\\rangle\\langle b_i|U_i)$ a shadow snapshot state and their ensemble $S(\\rho;N)=\\{\\rho_i|i=1,\\cdots,N\\}$ classical shadows."
5050
],
@@ -58,13 +58,13 @@
5858
"In Pauli basis, we have a simple expression of $\\mathcal{M}^{-1}$:\n",
5959
"$$\n",
6060
"\\begin{split}\n",
61-
" \\rho_i&=\\mathcal{M}^{-1}(U_i^{\\dagger}|b_i\\rangle\\langle b_i|U_i)=\\bigotimes_{j=1}^{n}3u_{ij}^{\\dagger}|s_{ij}\\rangle\\langle s_{ij}|u_{ij}-\\mathbb{I},\\\\\n",
61+
" \\rho_i&=\\mathcal{M}^{-1}(U_i^{\\dagger}|b_i\\rangle\\langle b_i|U_i)=\\bigotimes_{j=1}^{n}\\left(3u_{ij}^{\\dagger}|s_{ij}\\rangle\\langle s_{ij}|u_{ij}-\\mathbb{I}\\right),\\\\\n",
6262
" \\rho&=\\frac{1}{N}\\sum_{i=1}^{N}\\rho_i\\ .\n",
6363
"\\end{split}\n",
6464
"$$\n",
6565
"For an observable Pauli string $O=\\bigotimes_{j=1}^{n}P_j,\\ P_j\\in\\{\\mathbb{I}, X, Y, Z\\}$, we can directly use $\\rho$ to calculate $\\langle O\\rangle=\\text{Tr}(O\\rho)$. In practice, we will divide the classical shadows into $K$ parts to calculate the expectation values independently and take the median to avoid the influence of outliers:\n",
6666
"$$\n",
67-
"\\langle O\\rangle=\\text{median}\\{\\langle O_{(1)}\\rangle\\cdots\\langle O_{(K)}\\rangle\\},\n",
67+
"\\langle O\\rangle=\\text{median}\\{\\langle O_{(1)}\\rangle,\\cdots,\\langle O_{(K)}\\rangle\\},\n",
6868
"$$\n",
6969
"where\n",
7070
"$$\n",
@@ -248,7 +248,7 @@
248248
{
249249
"cell_type": "markdown",
250250
"source": [
251-
"If ``measurement_only=True`` (default ``False``), the outputs of ``shadow_snapshots`` are snapshot bit strings $b=s_1\\cdots s_n,\\ s_j\\in\\{0,1\\}$, otherwise the outputs are snapshot states $\\{u_{j}^{\\dagger}|s_j\\rangle\\langle s_j| u_j\\ |j=1,\\cdots,n\\}$. If you only need to generate one batch of snapshots or generate multiple batches of snapshots with different ``nps`` or ``r``, jit cannot provide speedup. JIT will only accelerate when the same shape of snapshots are generated multiple times."
251+
"If ``measurement_only=True`` (default ``False``), the outputs of ``shadow_snapshots`` are snapshot bit strings $\\{b_i=s_{i1}\\cdots s_{in}\\ |i=1,\\cdots,N,\\ s_{ij}\\in\\{0,1\\}\\}$, otherwise the outputs are snapshot states $\\{u_{ij}^{\\dagger}|s_{ij}\\rangle\\langle s_{ij}| u_{ij}\\ |i=1,\\cdots,N,\\ j=1,\\cdots,n\\}$. If you only need to generate one batch of snapshots or generate multiple batches of snapshots with different ``nps`` or ``r``, jit cannot provide speedup. Jit will only accelerate when the same shape of snapshots are generated multiple times."
252252
],
253253
"metadata": {
254254
"collapsed": false

0 commit comments

Comments
 (0)