|
30 | 30 | {
|
31 | 31 | "cell_type": "markdown",
|
32 | 32 | "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", |
34 | 34 | "$$\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", |
36 | 36 | "$$\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", |
38 | 38 | "$$\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", |
40 | 40 | "$$\n",
|
41 | 41 | "Moreover, we perform $N$ random measurements and view their average as a quantum channel:\n",
|
42 | 42 | "$$\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", |
44 | 44 | "$$\n",
|
45 | 45 | "we can invert the channel to get the approximation of $\\rho$:\n",
|
46 | 46 | "$$\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", |
48 | 48 | "$$\n",
|
49 | 49 | "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."
|
50 | 50 | ],
|
|
58 | 58 | "In Pauli basis, we have a simple expression of $\\mathcal{M}^{-1}$:\n",
|
59 | 59 | "$$\n",
|
60 | 60 | "\\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", |
62 | 62 | " \\rho&=\\frac{1}{N}\\sum_{i=1}^{N}\\rho_i\\ .\n",
|
63 | 63 | "\\end{split}\n",
|
64 | 64 | "$$\n",
|
65 | 65 | "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",
|
66 | 66 | "$$\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", |
68 | 68 | "$$\n",
|
69 | 69 | "where\n",
|
70 | 70 | "$$\n",
|
|
248 | 248 | {
|
249 | 249 | "cell_type": "markdown",
|
250 | 250 | "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." |
252 | 252 | ],
|
253 | 253 | "metadata": {
|
254 | 254 | "collapsed": false
|
|
0 commit comments