Skip to content

Commit 990e840

Browse files
committed
fix links
1 parent 7790cdf commit 990e840

5 files changed

+91
-35
lines changed

Hamiltonian_simulation.ipynb

+15-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"[<img src=\"images/quantum_algorithms_tutorials.png\" alt=\"drawing\" width=\"100\" align=\"left\"/>](https://github.com/DavitKhach/quantum-algorithms-tutorials)\n",
7+
"[<img src=\"images/quantum_algorithms_tutorials.png\" alt=\"drawing\" width=\"100\" align=\"left\"/>][8]\n",
88
"\n",
99
"<h2 align=\"center\">\n",
1010
"Hamiltonian simulation\n",
1111
"</h2>\n",
1212
"\n",
13-
"[**Open with the *nbviewer*.**](https://nbviewer.jupyter.org/github/DavitKhach/quantum-algorithms-tutorials/blob/master/Hamiltonian_simulation.ipynb)\n",
13+
"**[[Homepage][8]]**\n",
14+
"**[[Open with the nbviewer][9]]**\n",
1415
"\n",
1516
"<h3 align=\"left\">\n",
1617
"Introduction\n",
@@ -34,7 +35,9 @@
3435
" [4]: https://quantumcomputing.stackexchange.com/questions/8725/can-arbitrary-matrices-be-decomposed-using-the-pauli-basis\n",
3536
" [5]: https://github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/quantum_phase_estimation.ipynb\n",
3637
" [6]: https://github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/iterative_quantum_phase_estimation.ipynb\n",
37-
" [7]: https://quantumcomputing.stackexchange.com/a/11391/9459"
38+
" [7]: https://quantumcomputing.stackexchange.com/a/11391/9459\n",
39+
" [8]: https://github.com/DavitKhach/quantum-algorithms-tutorials\n",
40+
" [9]: https://nbviewer.jupyter.org/github/DavitKhach/quantum-algorithms-tutorials/blob/master/Hamiltonian_simulation.ipynb"
3841
]
3942
},
4043
{
@@ -565,6 +568,12 @@
565568
"cell_type": "markdown",
566569
"metadata": {},
567570
"source": [
571+
"**[[Homepage][8]]**\n",
572+
"\n",
573+
"<h3 align=\"left\">\n",
574+
"References\n",
575+
"</h3>\n",
576+
"\n",
568577
"[[1]] [J.D. Whitfield, J. Biamonte and A. Aspuru-Guzik,\n",
569578
"Molecular Physics, \"Simulation of electronic structure Hamiltonians using\n",
570579
"quantum computers\" (2011)][1]\n",
@@ -583,7 +592,9 @@
583592
" [4]: https://quantumcomputing.stackexchange.com/questions/8725/can-arbitrary-matrices-be-decomposed-using-the-pauli-basis\n",
584593
" [5]: https://github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/quantum_phase_estimation.ipynb\n",
585594
" [6]: https://github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/iterative_quantum_phase_estimation.ipynb\n",
586-
" [7]: https://quantumcomputing.stackexchange.com/a/11391/9459"
595+
" [7]: https://quantumcomputing.stackexchange.com/a/11391/9459\n",
596+
" [8]: https://github.com/DavitKhach/quantum-algorithms-tutorials\n",
597+
" [9]: https://nbviewer.jupyter.org/github/DavitKhach/quantum-algorithms-tutorials/blob/master/Hamiltonian_simulation.ipynb"
587598
]
588599
}
589600
],

iterative_quantum_phase_estimation.ipynb

+15-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"[<img src=\"images/quantum_algorithms_tutorials.png\" alt=\"drawing\" width=\"100\" align=\"left\"/>](https://github.com/DavitKhach/quantum-algorithms-tutorials)\n",
7+
"[<img src=\"images/quantum_algorithms_tutorials.png\" alt=\"drawing\" width=\"100\" align=\"left\"/>][5]\n",
88
"\n",
99
"<h1 align=\"center\">\n",
1010
"Iterative quantum phase estimation\n",
1111
"</h1>\n",
1212
"\n",
13-
"[**Open with the *nbviewer*.**](https://nbviewer.jupyter.org/github/DavitKhach/quantum-algorithms-tutorials/blob/master/iterative_quantum_phase_estimation.ipynb)\n",
13+
"**[[Homepage][5]]**\n",
14+
"**[[Open with the nbviewer][6]]**\n",
1415
"\n",
1516
"The iterative quantum phase estimation (IQPE, also known as IPEA) algorithm is a quantum algorithm for estimating the phase (or eigenvalue) of an eigenvector of a unitary operator [[1], [2]]. One of the main applications of the algorithm is to estimate eigenvalues (energies) of some molecule's $H$ Hamiltonian. Because $H$ is a Hermitian operator, not unitary, (the algorithm works only with unitary operators) we can't estimate directly its eigenvalues. Instead, we create some unitary operator from $H$ and estimate not the eigenvalues of $H$, but something different (the phase). From the estimated phase one can obtain the corresponding eigenvalue of $H$. So, in the end, we are not only estimating the phase but, what is more important, the desired eigenvalue. Here are the main steps of the algorithm:\n",
1617
"\n",
@@ -45,7 +46,9 @@
4546
" [1]: https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm\n",
4647
" [2]: https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441\n",
4748
" [3]: https://science.sciencemag.org/content/273/5278/1073\n",
48-
" [4]: https://github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/Hamiltonian_simulation.ipynb"
49+
" [4]: https://github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/Hamiltonian_simulation.ipynb\n",
50+
" [5]: https://github.com/DavitKhach/quantum-algorithms-tutorials\n",
51+
" [6]: https://nbviewer.jupyter.org/github/DavitKhach/quantum-algorithms-tutorials/blob/master/iterative_quantum_phase_estimation.ipynb"
4952
]
5053
},
5154
{
@@ -391,6 +394,12 @@
391394
"cell_type": "markdown",
392395
"metadata": {},
393396
"source": [
397+
"**[[Homepage][5]]**\n",
398+
"\n",
399+
"<h3 align=\"left\">\n",
400+
"References\n",
401+
"</h3>\n",
402+
"\n",
394403
"[[1]] [Quantum phase estimation algorithm][1]\n",
395404
"\n",
396405
"[[2]] [J.D. Whitfield, J. Biamonte and A. Aspuru-Guzik,\n",
@@ -403,7 +412,9 @@
403412
" [1]: https://en.wikipedia.org/wiki/Quantum_phase_estimation_algorithm\n",
404413
" [2]: https://www.tandfonline.com/doi/abs/10.1080/00268976.2011.552441\n",
405414
" [3]: https://science.sciencemag.org/content/273/5278/1073\n",
406-
" [4]: https://github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/Hamiltonian_simulation.ipynb"
415+
" [4]: https://github.com/DavitKhach/quantum-algorithms-tutorials/blob/master/Hamiltonian_simulation.ipynb\n",
416+
" [5]: https://github.com/DavitKhach/quantum-algorithms-tutorials\n",
417+
" [6]: https://nbviewer.jupyter.org/github/DavitKhach/quantum-algorithms-tutorials/blob/master/iterative_quantum_phase_estimation.ipynb"
407418
]
408419
}
409420
],

quantum_parallelism_Deutsch_Jozsa.ipynb

+24-14
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,54 @@
88
}
99
},
1010
"source": [
11-
"[<img src=\"images/quantum_algorithms_tutorials.png\" alt=\"drawing\" width=\"100\" align=\"left\"/>][5]\n",
11+
"[<img src=\"images/quantum_algorithms_tutorials.png\" alt=\"drawing\" width=\"100\" align=\"left\" />][5]\n",
1212
"\n",
1313
"<h2 align=\"center\">\n",
1414
"Quantum parallelism and Deutsch–Jozsa algorithm\n",
1515
"</h2>\n",
1616
"\n",
17-
"**[[Homepage][5]]**\\\n",
18-
"**[[Open with the nbviewer.][6]]**\n",
17+
"**[[Homepage][5]]**\n",
18+
"**[[Open with the nbviewer][6]]**\n",
1919
"\n",
2020
"<h3 align=\"left\">\n",
2121
"1. Quantum parallelism\n",
2222
"</h3>\n",
2323
"\n",
24-
"In this tutorial, we are going to introduce 3 separate problems and we will mainly follow the [[1]] book's approach of describing them. After giving descriptions we will implement them with Qiskit. So, let's start with quantum parallelism, which is one of the powerful tools/properties that is used in the quantum computers. Quantum parallelism enables us to simultaneously compute the outputs of a function for given different inputs. Let's say we have two registers one for input the other one for output. The initial state is given by $\\left| x \\right\\rangle \\left| 0 \\right\\rangle$ wavefunction, where $\\left| x \\right\\rangle$ is the register that takes $x$ input and $\\left| 0 \\right\\rangle$ is the output register where the value of the $f(x)$ function will be stored. After applying the circuit that corresponds to the given function the wavefunction becomes $\\left| x \\right\\rangle \\left| f(x) \\right\\rangle$. Here is the circuit:\n",
24+
"In this tutorial, we are going to introduce 3 separate problems and we will mainly follow the [[1]] book's approach of describing them. After giving descriptions we will implement them with Qiskit. So, let's start with quantum parallelism, which is one of the powerful tools/properties that are used in the quantum computation. Quantum parallelism enables us to simultaneously compute (with some caveats) the outputs of a function for given different inputs. \n",
25+
"\n",
26+
"Suppose we have two registers one for the input the other one for the output. The initial state is given by $\\left| x \\right\\rangle \\left| 0 \\right\\rangle$ combined state of the two quantum registers, where $\\left| x \\right\\rangle$ is the register that takes $x$ input and $\\left| 0 \\right\\rangle$ is the output register where the value of the $f(x)$ function will be stored. After applying the circuit that corresponds to the given function the combined state is equal to $\\left| x \\right\\rangle \\left| f(x) \\right\\rangle$. Here is the circuit:\n",
2527
"\n",
2628
"<img src=\"images/qparallel.png\" alt=\"drawing\" width=\"300\"/>\n",
2729
"\n",
28-
"The $U_{f(x)}$ is the unitary operator that acts on both registers and corresponds to the given $f(x)$ function. Let's see what happens when instead of one $\\left| x \\right\\rangle$ bit string, we have a superposition state of all possible bit strings:\n",
30+
"The $U_{f(x)}$ is the unitary operator that acts on both registers and does the described transformation. Let's see what happens when instead of one $\\left| x \\right\\rangle$ bit string, we have a superposition state of all possible bit strings:\n",
2931
"\n",
3032
"$$\\frac{1}{2}\\sum_{x} \\left| x \\right\\rangle = \\frac{1}{2} \\left[ \\left| 00 \\right\\rangle + \\left| 01 \\right\\rangle + \\left| 10 \\right\\rangle + \\left| 11 \\right\\rangle \\right]$$\n",
3133
"\n",
32-
"The coefficient in front of the state is for normalization (sum of all bit string probabilities in the superposition state must be unity). This superposition state will let us witness the quantum parallelism in action. Now let's write down the combined state of two registers:\n",
34+
"The coefficient $\\frac{1}{2}$ is for the normalization of the state (sum of all bit string probabilities in the superposition state must be unity). This superposition state will let us witness the quantum parallelism in action. Now let's write down the initial state of the two registers:\n",
3335
"\n",
3436
"$$\\left| \\psi_{initial} \\right\\rangle = \\frac{1}{2} \\left| 0 \\right\\rangle \\sum_{x} = \\frac{1}{2} \\left[ \\left| 0 \\right\\rangle \\left| 00 \\right\\rangle + \\left| 0 \\right\\rangle \\left| 01 \\right\\rangle + \\left| 0 \\right\\rangle \\left| 10 \\right\\rangle + \\left| 0 \\right\\rangle \\left| 11 \\right\\rangle \\right]$$\n",
3537
"\n",
36-
"After $U_{f(x)}$ unitary operator the state will look like this:\n",
38+
"After $U_{f(x)}$ unitary operator:\n",
3739
"\n",
3840
"$$\\left| \\psi_{final} \\right\\rangle = \\frac{1}{2} \\left[ \\left| f(00) \\right\\rangle \\left| 00 \\right\\rangle + \\left| f(01) \\right\\rangle \\left| 01 \\right\\rangle + \\left| f(10) \\right\\rangle \\left| 10 \\right\\rangle + \\left| f(11) \\right\\rangle \\left| 11 \\right\\rangle \\right]$$\n",
3941
"\n",
40-
"We are already there. So, we have applied one $U_{f(x)}$ unitary operator, but, in fact, the $f(x)$ function was evaluated 4 times for each term from the superposition state. This effect is called quantum parallelism, and this quantum computing \"tool\" is widely used in lots of quantum algorithms. Let see how it works for some specific function. Suppose we have a function that for those $\\left| x \\right\\rangle$ bit strings that have even number of $1$s the function $f(x) = 0$ and when the number of $1$s is odd the function $f(x) = 1$. To make things more interesting we will use $3$ qubits for the input register. Here is the circuit:\n",
42+
"We are already there. So, we have applied one $U_{f(x)}$ unitary operator, but, in fact, the $f(x)$ function was evaluated 4 times for each term from the superposition state. This effect is called quantum parallelism, and this quantum computing \"tool\" is widely used in lots of quantum algorithms. Let see how it works for some specific function. Suppose we have a function that for those $\\left| x \\right\\rangle$ bit strings that have even number of $1$s the function $f(x) = 0$ and when the number of $1$s is odd the function $f(x) = 1$ (parity function). To make things more interesting we will use 3 qubits for the input register. Here is the circuit:\n",
4143
"\n",
4244
"<img src=\"images/qparallel_example.png\" alt=\"drawing\" width=\"400\"/>\n",
4345
"\n",
44-
"where $i$ indices denote the input qubits and $o$ denotes the output qubit. Here the first 3 Hadamard gates are for preparing a $3$ qubit superposition state. The CNOT gates represent our given function $f(x)$ that has an output $0$ if there are even number of $1$s in the input register and $1$ otherwise. Now let's go step by step and see how the quantum state changes. The initial $\\left| \\psi_{0} \\right\\rangle$ quantum state:\n",
46+
"where $i$ indices denote the input qubits and $o$ denotes the output qubit. Here the first 3 Hadamard gates are for preparing a 3 qubit superposition state with equal probabilities. The CNOT gates combined represent our given function $f(x)$ (unitary $U_{f(x)}$) that has an output $0$ if there are even number of $1$s in the input register and $1$ otherwise. Now let's go step by step and see how the quantum state changes and check if the given circuit implements the desired transformation. The initial $\\left| \\psi_{0} \\right\\rangle$ quantum state:\n",
4547
"\n",
4648
"$$\\left| \\psi_{0} \\right\\rangle = \\left| 0 \\right\\rangle_o \\left| 000 \\right\\rangle_i$$\n",
4749
"\n",
48-
"After 3 Hadamard gates the $\\left| \\psi_{1} \\right\\rangle$ quantum state looks like this (omitting the qubit indices):\n",
50+
"After 3 Hadamard gates we will have the $\\left| \\psi_{1} \\right\\rangle$ quantum state (omitting the qubit indices):\n",
4951
"\n",
50-
"$$\\left| \\psi_{1} \\right\\rangle = \\frac{1}{\\sqrt{2^3}}\\left| 0 \\right\\rangle \\left[ \\left| 000 \\right\\rangle + \\left| 001 \\right\\rangle + \\left| 010 \\right\\rangle + \\left| 011 \\right\\rangle + \\left| 100 \\right\\rangle + \\left| 101 \\right\\rangle + \\left| 110 \\right\\rangle + \\left| 111 \\right\\rangle \\right]$$\n",
52+
"\\begin{align*}\n",
53+
"\\left| \\psi_{1} \\right\\rangle = \\frac{1}{\\sqrt{2^3}}\\left| 0 \\right\\rangle &\\big[ \\left| 000 \\right\\rangle + \\left| 001 \\right\\rangle + \\left| 010 \\right\\rangle + \\left| 011 \\right\\rangle +\n",
54+
"\\\\\n",
55+
"&+ \\left| 100 \\right\\rangle + \\left| 101 \\right\\rangle + \\left| 110 \\right\\rangle + \\left| 111 \\right\\rangle \\big]\n",
56+
"\\end{align*}\n",
5157
"\n",
52-
"Or in more compact form:\n",
58+
"Or in a more compact form:\n",
5359
"\n",
5460
"$$\\left| \\psi_{1} \\right\\rangle = \\frac{1}{\\sqrt{2^3}}\\left| 0 \\right\\rangle \\sum_x \\left| x \\right\\rangle,$$\n",
5561
"\n",
@@ -95,9 +101,13 @@
95101
"\n",
96102
"Or in a more explicit form:\n",
97103
"\n",
98-
"$$\\left| \\psi_2 \\right\\rangle = \\frac{1}{\\sqrt{2^3}} \\left[ \\left| 0 \\right\\rangle \\left| 000 \\right\\rangle + \\left| 1 \\right\\rangle \\left| 001 \\right\\rangle + \\left| 1 \\right\\rangle \\left| 010 \\right\\rangle + \\left| 0 \\right\\rangle \\left| 011 \\right\\rangle + \\left| 1 \\right\\rangle \\left| 100 \\right\\rangle + \\left| 0 \\right\\rangle \\left| 101 \\right\\rangle + \\left| 0 \\right\\rangle \\left| 110 \\right\\rangle + \\left| 1 \\right\\rangle \\left| 111 \\right\\rangle \\right]$$\n",
104+
"\\begin{align*}\n",
105+
"\\left| \\psi_2 \\right\\rangle = \\frac{1}{\\sqrt{2^3}} \\big[ \\left| 0 \\right\\rangle \\left| 000 \\right\\rangle + \\left| 1 \\right\\rangle \\left| 001 \\right\\rangle + \\left| 1 \\right\\rangle \\left| 010 \\right\\rangle + \\left| 0 \\right\\rangle \\left| 011 \\right\\rangle +\n",
106+
"\\\\\n",
107+
"+ \\left| 1 \\right\\rangle \\left| 100 \\right\\rangle + \\left| 0 \\right\\rangle \\left| 101 \\right\\rangle + \\left| 0 \\right\\rangle \\left| 110 \\right\\rangle + \\left| 1 \\right\\rangle \\left| 111 \\right\\rangle \\big]\n",
108+
"\\end{align*}\n",
99109
"\n",
100-
"To check this calculation one should know the action of CNOT gate. For example, if CNOT is acting on an arbitrary two-qubit state $a \\left| 00 \\right\\rangle + b \\left| 01 \\right\\rangle + c \\left| 10 \\right\\rangle + d \\left| 11 \\right\\rangle$, where $a$, $b$, $c$ and $d$ are some arbitrary complex numbers that satisfy $\\left| a \\right|^2 + \\left| b \\right|^2 + \\left| c \\right|^2 + \\left| d \\right|^2 = 1$ (normalization). After acting CNOT gate, that is controlled from the first qubit, we will obtain the following state $\\left| 00 \\right\\rangle + b \\left| 01 \\right\\rangle + c \\left| 11 \\right\\rangle + d \\left| 10 \\right\\rangle$, where we changed the second qubit state when the first qubit was in $\\left|1\\right\\rangle$ state.\n",
110+
"So, it is easy to check that the circuit implements the described $f(x)$ parity function. To check this calculation one should know the action of CNOT gate. For example, if CNOT is acting on an arbitrary two-qubit state $a \\left| 00 \\right\\rangle + b \\left| 01 \\right\\rangle + c \\left| 10 \\right\\rangle + d \\left| 11 \\right\\rangle$, where $a$, $b$, $c$ and $d$ are some arbitrary complex numbers that satisfy $\\left| a \\right|^2 + \\left| b \\right|^2 + \\left| c \\right|^2 + \\left| d \\right|^2 = 1$ (normalization). After applying CNOT gate controlled from the first qubit, we will obtain the following state $\\left| 00 \\right\\rangle + b \\left| 01 \\right\\rangle + c \\left| 11 \\right\\rangle + d \\left| 10 \\right\\rangle$, where we changed the second qubit state when the first qubit was in $\\left|1\\right\\rangle$ state.\n",
101111
"\n",
102112
"Now let's write a code for this circuit:\n",
103113
"\n",

0 commit comments

Comments
 (0)