Skip to content

Commit 16f9110

Browse files
committed
Discrete Quantum Walks suggested English changes
1 parent c4f2e77 commit 16f9110

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

tutorials/advanced_tutorials/discrete_quantum_walk/discrete_quantum_walk.ipynb

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
"source": [
1616
"\"Quantum Walk\" is an approach for developing and designing quantum algorithms. Consider it as a quantum analogy to the classical random walk. This generic technique underlies many quantum algorithms. In particular, the Grover's search algorithm can be viewed as a quantum walk.\n",
1717
"\n",
18-
"Similarly to classical random walks, quantum walks are divided into the discrete case and the continuous one. This notebook focuses on discrete quantum walks, and is organized as follows: first, [one to one](##Classical-Random-Walks-vs.-Quantum-Walks) compares classical random walks with quantum walks via a specific example: a walk on a circle. Then, a [general quantum model](##How-to-Build-a-general-Quantum-Walk-with-Classiq) studies quantum walks and subsequently applies it to the [circle case](##Example:-Symmetric-Quantum-Walk-on-a-Circle) and to a [hypercube graph](##Example:-4D-Hypercube-with-a-Grover-Coin). "
18+
"Similarly to classical random walks, quantum walks are divided into the discrete and continuous cases. This notebook focuses on discrete quantum walks, and is organized as follows: \n",
19+
"\n",
20+
"1. [One to one](##Classical-Random-Walks-vs.-Quantum-Walks) compares classical random walks with quantum walks via a specific example: a walk on a circle.\n",
21+
"2. A [general quantum model](##How-to-Build-a-general-Quantum-Walk-with-Classiq) studies quantum walks and subsequently applies it to the [circle case](##Example:-Symmetric-Quantum-Walk-on-a-Circle) and to a [hypercube graph](##Example:-4D-Hypercube-with-a-Grover-Coin). "
1922
]
2023
},
2124
{
@@ -24,6 +27,7 @@
2427
"metadata": {},
2528
"source": [
2629
"This tutorial demonstrates the following concepts of Classiq:\n",
30+
"\n",
2731
"* The resemblance between classical and quantum programming with Classiq.\n",
2832
"* Classiq's built-in constructs:\n",
2933
" * `control`: general controlled-logic\n",
@@ -51,6 +55,7 @@
5155
"metadata": {},
5256
"source": [
5357
"Specify and implement a simple example: a discrete walk on a circle, or more precisely, on a regular polygon with $2^N$ nodes (see Figure 1). The idea behind the random/quantum walk:\n",
58+
"\n",
5459
"1. Start at some initial point, e.g., the zeroth node.\n",
5560
"2. Flip a coin. Heads moves one step clockwise; tails moves counterclockwise.\n",
5661
"3. Repeat steps 1-2 for a given total number of steps $T$."
@@ -101,6 +106,7 @@
101106
"metadata": {},
102107
"source": [
103108
"Define a function to flip a coin:\n",
109+
"\n",
104110
"* Classical: the coin is either 0 or 1. To flip the coin, draw a random number from the set $\\{0,1\\}$.\n",
105111
"* Quantum: the coin is represented by a qubit and a \"flip\" is defined by some unitary operation on it. Choose the Hadamard gate, which sends the $|0\\rangle$ state into an equal superposition of $|0\\rangle$ and $|1\\rangle$."
106112
]
@@ -133,7 +139,8 @@
133139
"id": "d10a317a-0267-4b51-b230-3d3cd393d3fd",
134140
"metadata": {},
135141
"source": [
136-
"Next, define a function for moving clockwise and counterclockwise. This operation is a modular addition by $\\pm 1$.\n",
142+
"Next, define a function for moving clockwise and counterclockwise. This operation is a modular addition by $\\pm 1$:\n",
143+
"\n",
137144
"* Classical: the position is an integer in $[-2^{N-1}, 2^{N-1}-1]$. Use basic arithmetic operations.\n",
138145
"* Quantum: the position is an $N$-qubits state. Build an in-place modular addition by 1 (see an explanation at [the end of this notebook](#Technical-Notes)). Note that since quantum operations are reversible, you can define a counterclockwise step as the inverse of the clockwise step."
139146
]
@@ -237,7 +244,7 @@
237244
"id": "ea9266b8-60a0-4f93-bc6b-942cd6d85cb7",
238245
"metadata": {},
239246
"source": [
240-
"Define and run a specific example, taking a circle of size $2^7$, a total time of 50 steps, and 10000 samples. "
247+
"Define and run a specific example, taking a circle of size $2^7$, a total time of 50 steps, and 10,000 samples. "
241248
]
242249
},
243250
{
@@ -323,7 +330,7 @@
323330
"source": [
324331
"<center>\n",
325332
"<img src=\"https://docs.classiq.io/resources/quantum_walk_circle_circuit.png\" style=\"width:100%\">\n",
326-
"<figcaption align = \"middle\"> Figure 2. The circuit for a quantum walk on a circle with $2^7$ nodes. The last three blocks are repeated `t` times. </figcaption>\n",
333+
"<figcaption align = \"middle\"> Figure 2. The circuit for a quantum walk on a circle with $2^7$ nodes. The last three blocks repeat `t` times. </figcaption>\n",
327334
"</center>"
328335
]
329336
},
@@ -399,15 +406,15 @@
399406
"id": "922b31e2-d1c4-4d7d-afd1-c633b5981441",
400407
"metadata": {},
401408
"source": [
402-
"There is a clear difference between the two distributions. The classical distribution is symmetric around the zero position, whereas the quantum example is asymmetric with a peak far from 0. This is a small example of the different behaviors of classical random walks and quantum walks. More details and examples are in Ref. [[1](#review)]."
409+
"There is a clear difference between the two distributions: the classical distribution is symmetric around the zero position, whereas the quantum example is asymmetric with a peak far from 0. This is a small example of the different behaviors of classical random walks and quantum walks. More details and examples are in Ref. [[1](#review)]."
403410
]
404411
},
405412
{
406413
"cell_type": "markdown",
407414
"id": "d0115edd-4b37-4482-8a30-c80bc0e50bac",
408415
"metadata": {},
409416
"source": [
410-
"## How to Build a General Quantum Walk with Classiq"
417+
"## Building a General Quantum Walk with Classiq"
411418
]
412419
},
413420
{
@@ -416,6 +423,7 @@
416423
"metadata": {},
417424
"source": [
418425
"Define a quantum function for a discrete quantum walk. The arguments of the function:\n",
426+
"\n",
419427
"* `time`: an integer for the number of walking steps.\n",
420428
"* `coin_flip_qfunc`: the quantum function for \"flipping\" the coin.\n",
421429
"* `walks_qfuncs`: a list of quantum functions for all possible transitions at a given point.\n",
@@ -633,7 +641,7 @@
633641
"id": "7dc4fde2-43ee-4249-84ee-909c3b694ce0",
634642
"metadata": {},
635643
"source": [
636-
"Define a model for quantum walk on a hypercube. Two nodes in the hypercube are connected to each other if their Hamming distance is 1. Thus, a step along a hypercube is given by moving \"1 Hamming distance away\". For a $d$-dimentional hypercube, at each node there are $d$ possible directions to move. Each of them is given by applying a bit flip on one of the bits. In the quantum case, this is obtained by applying an X gate on one of the $N$ qubits.\n",
644+
"Define a model for quantum walk on a hypercube. Two nodes in the hypercube are connected to each other if their Hamming distance is 1. Thus, a step along a hypercube is given by moving \"1 Hamming distance away\". For a $d$-dimensional hypercube, at each node there are $d$ possible directions to move. Each of them is given by applying a bit flip on one of the bits. In the quantum case, this is obtained by applying an X gate on one of the $N$ qubits.\n",
637645
"\n",
638646
"For the coin operator, take the \"Grover diffuser\" function. This choice refers to a symmetric quantum walk [[1](#review)]. The Grover diffuser operator is a reflection around a given state $|\\psi\\rangle$:\n",
639647
"$$\n",
@@ -767,7 +775,7 @@
767775
"source": [
768776
"<center>\n",
769777
"<img src=\"https://docs.classiq.io/resources/quantum_walk_hypercube_circuit.png\" style=\"width:100%\">\n",
770-
"<figcaption align = \"middle\"> Figure 4. The circuit for a quantum walk on a 4D cube with a Grover coin. The last two blocks are repeated `t` times. </figcaption>\n",
778+
"<figcaption align = \"middle\"> Figure 4. The circuit for a quantum walk on a 4D cube with a Grover coin. The last two blocks repeat `t` times. </figcaption>\n",
771779
"</center>"
772780
]
773781
},
@@ -821,7 +829,7 @@
821829
"id": "3cca3d17-4ec3-4cba-b770-13b38e58faa4",
822830
"metadata": {},
823831
"source": [
824-
"We found that at $T=4$ the probability to measure the walker at the opposite corner is larger than $1/2$. We can check an analogous question in the classical random walk, where the distribution is taken over an ensemble of independent experiments):"
832+
"At $T=4$, the probability to measure the walker at the opposite corner is larger than $1/2$. Check an analogous question in the classical random walk, where the distribution is taken over an ensemble of independent experiments:"
825833
]
826834
},
827835
{
@@ -876,11 +884,9 @@
876884
"id": "916c1dd1-3f08-417e-a7f7-adbaa33b60d4",
877885
"metadata": {},
878886
"source": [
879-
"## Technical Notes\n",
880-
"\n",
881-
"### QFT modular adder\n",
887+
"## Note Regarding QFT Modular Adder\n",
882888
"\n",
883-
"Below we explain the `quantum_step_clockwise` function defined for the quantum walk on a circle. The unitary matrix that represents walking on a circle operates as follows:\n",
889+
"This section explains the `quantum_step_clockwise` function defined for the quantum walk on a circle. The unitary matrix that represents walking on a circle operates as follows:\n",
884890
"$$\n",
885891
"U_{+}|i\\rangle =\n",
886892
"\\left\\{\n",
@@ -902,7 +908,7 @@
902908
"\t 1 & 0 & 0 & \\cdots & 0 & 0\n",
903909
"\\end{pmatrix}.\n",
904910
"$$\n",
905-
"In Fourier space this matrix is diagonal, namely, the Fourier matrix $\\mathcal{FT} $ diagonalizes it. Moreover, the diagonal entries forms a goemetric series:\n",
911+
"In Fourier space, this matrix is diagonal; namely, the Fourier matrix $\\mathcal{FT} $ diagonalizes it. Moreover, the diagonal entries forms a goemetric series:\n",
906912
"$$\n",
907913
"U_+ = \\mathcal{FT} \\cdot \\begin{pmatrix}\n",
908914
"\t\\alpha^0 & 0 & \\cdots& \\cdots & 0 \\\\\n",
@@ -912,15 +918,15 @@
912918
"\t 0 & \\cdots & 0 & \\cdots & \\alpha^{2^N-1}\n",
913919
"\\end{pmatrix} \\cdot \\mathcal{FT}^{\\dagger},\n",
914920
"$$\n",
915-
"with $\\alpha=e^{2\\pi i /2^N }$. We can implement both the $\\mathcal{FT}$ matrix and the diagonal matrix efficiently on a quantum computer, the former by a QFT and the latter by applying a series of $N$ RZ rotations."
921+
"with $\\alpha=e^{2\\pi i /2^N }$. You can implement both the $\\mathcal{FT}$ matrix and the diagonal matrix efficiently on a quantum computer; the former by a QFT and the latter by applying a series of $N$ RZ rotations."
916922
]
917923
},
918924
{
919925
"cell_type": "markdown",
920926
"id": "88b24611-5d16-4fa0-a014-d192459198d3",
921927
"metadata": {},
922928
"source": [
923-
"<a id='review'>[1]</a>: [Kempe, J. \"Quantum random walks: an introductory overview.\" Contemporary Physics 44, 307 (2003)](https://arxiv.org/abs/quant-ph/0303081).\n",
929+
"<a id='review'>[1]</a>: [Kempe, J. \"Quantum random walks: An introductory overview.\" Contemporary Physics 44, 307 (2003)](https://arxiv.org/abs/quant-ph/0303081).\n",
924930
"\n",
925931
"<a id='hypercube'>[2]</a>: [Kempe, J. \"Discrete quantum walks hit exponentially faster.\" Probability theory and related fields 133, 215 (2005)](https://arxiv.org/abs/quant-ph/0205083)."
926932
]

0 commit comments

Comments
 (0)