99< meta http-equiv ="Content-Type " content ="text/html; charset=utf-8 " />
1010< meta name ="generator " content ="DocOnce: https://github.com/doconce/doconce/ " />
1111< meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
12- < meta name ="description " content ="Quantum Computing, Quantum Machine Learning and Quantum Information Theories ">
13- < title > Quantum Computing, Quantum Machine Learning and Quantum Information Theories </ title >
12+ < meta name ="description " content ="Quantum Computing and Quantum Machine Learning ">
13+ < title > Quantum Computing and Quantum Machine Learning </ title >
1414
1515<!-- reveal.js: https://lab.hakim.se/reveal-js/ -->
1616
168168< section >
169169<!-- ------------------- main content ---------------------- -->
170170< center >
171- < h1 style ="text-align: center; "> Quantum Computing, Quantum Machine Learning and Quantum Information Theories </ h1 >
171+ < h1 style ="text-align: center; "> Quantum Computing and Quantum Machine Learning </ h1 >
172172</ center > <!-- document title -->
173173
174174<!-- author(s): Morten Hjorth-Jensen -->
@@ -225,14 +225,14 @@ <h2 id="classical-discrete-fourier-transform">Classical Discrete Fourier Transfo
225225< p > Given a vector of \( N \) complex numbers \( \{x_0, x_1, \dots, x_{N-1}\} \), the DFT is defined as:</ p >
226226< p > < br >
227227$$
228- X_k = \sum_{n=0}^{N-1} x_n \exp{-2\pi i kn/N}, \quad k = 0, 1, \dots, N-1
228+ X_k = \sum_{n=0}^{N-1} x_n \exp{-( 2\pi i kn/N) }, \quad k = 0, 1, \dots, N-1
229229$$
230230< p > < br >
231231
232232< p > The inverse transform is:</ p >
233233< p > < br >
234234$$
235- x_n = \frac{1}{N} \sum_{k=0}^{N-1} X_k \exp{2\pi i kn/N}
235+ x_n = \frac{1}{N} \sum_{k=0}^{N-1} X_k \exp{( 2\pi i kn/N) }
236236$$
237237< p > < br >
238238</ section >
@@ -243,7 +243,7 @@ <h2 id="in-matrix-form">In matrix form </h2>
243243< p > This can be expressed in matrix form:</ p >
244244< p > < br >
245245$$
246- \vec {X} = F_N \vec {x}, \quad \text{where} \quad (F_N)_{jk} = \frac{1}{\sqrt{N}} \exp{2\pi i jk/N}
246+ \boldsymbol {X} = F_N \boldsymbol {x}, \quad \text{where} \quad (F_N)_{jk} = \frac{1}{\sqrt{N}} \exp{( 2\pi i jk/N) }
247247$$
248248< p > < br >
249249</ section >
@@ -254,14 +254,14 @@ <h2 id="quantum-fourier-transform">Quantum Fourier Transform </h2>
254254< p > Let \( N = 2^n \). The QFT acts on the state:</ p >
255255< p > < br >
256256$$
257- \vert x\rangle = \vert x_1 x_2 \dots x_n \rangle
257+ \vert x\rangle = \vert x_0 x_1 \dots x_{n-1} \rangle
258258$$
259259< p > < br >
260260
261261< p > and transforms it into:</ p >
262262< p > < br >
263263$$
264- \mathrm{QFT} \vert x\rangle = \frac{1}{\sqrt{N}} \sum_{k=0}^{N-1} \exp{2\pi i xk/N} \vert k\rangle
264+ \mathrm{QFT} \vert x\rangle = \frac{1}{\sqrt{N}} \sum_{k=0}^{N-1} \exp{( 2\pi i xk/N) } \vert k\rangle
265265$$
266266< p > < br >
267267
@@ -349,7 +349,7 @@ <h2 id="quantum-circuit-implementation">Quantum Circuit Implementation </h2>
349349
350350< p > < br >
351351$$
352- \frac{1}{\sqrt{2^n}} \sum_{k=0}^{2^n - 1} \exp{2\pi i xk / 2^n} \vert k\rangle
352+ \frac{1}{\sqrt{2^n}} \sum_{k=0}^{2^n - 1} \exp{( 2\pi i xk / 2^n) } \vert k\rangle
353353$$
354354< p > < br >
355355
@@ -509,7 +509,7 @@ <h2 id="introduction-to-quantum-phase-estimation-qpe">Introduction to Quantum Ph
509509
510510< p > < br >
511511$$
512- U | \psi \rangle = \exp{2\pi i \phi} | \psi \rangle
512+ U | \psi \rangle = \exp{( 2\pi i \phi) } | \psi \rangle
513513$$
514514< p > < br >
515515
@@ -560,7 +560,7 @@ <h2 id="mathematical-background">Mathematical Background </h2>
560560< p > The goal of QPE is to estimate the phase \( \phi \in [0,1) \) where:</ p >
561561< p > < br >
562562$$
563- U\vert \psi\rangle = \exp{2\pi i \phi} \vert\psi\rangle.
563+ U\vert \psi\rangle = \exp{( 2\pi i \phi) } \vert\psi\rangle.
564564$$
565565< p > < br >
566566
@@ -901,161 +901,6 @@ <h2 id="code-which-implements-the-qpe-using-pennylane">Code which implements the
901901</ div >
902902</ section >
903903
904- < section >
905- < h2 id ="pennylane-implementation-of-qpe "> PennyLane Implementation of QPE </ h2 >
906-
907- <!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
908- < div class ="cell border-box-sizing code_cell rendered ">
909- < div class ="input ">
910- < div class ="inner_cell ">
911- < div class ="input_area ">
912- < div class ="highlight " style ="background: #eeeedd ">
913- < pre style ="font-size: 80%; line-height: 125%; "> < span style ="color: #8B008B; font-weight: bold "> import</ span > < span style ="color: #008b45; text-decoration: underline "> pennylane</ span > < span style ="color: #8B008B; font-weight: bold "> as</ span > < span style ="color: #008b45; text-decoration: underline "> qml</ span >
914- < span style ="color: #8B008B; font-weight: bold "> from</ span > < span style ="color: #008b45; text-decoration: underline "> pennylane</ span > < span style ="color: #8B008B; font-weight: bold "> import</ span > numpy < span style ="color: #8B008B; font-weight: bold "> as</ span > np
915-
916- n_estimation = < span style ="color: #B452CD "> 3</ span >
917- dev = qml.device(< span style ="color: #CD5555 "> "default.qubit"</ span > , wires=n_estimation + < span style ="color: #B452CD "> 1</ span > )
918-
919- < span style ="color: #8B008B; font-weight: bold "> def</ span > < span style ="color: #008b45 "> apply_controlled_unitaries</ span > (U, wires):
920- < span style ="color: #8B008B; font-weight: bold "> for</ span > i, ctrl < span style ="color: #8B008B "> in</ span > < span style ="color: #658b00 "> enumerate</ span > (wires[:-< span style ="color: #B452CD "> 1</ span > ]):
921- power = < span style ="color: #B452CD "> 2</ span > **i
922- < span style ="color: #8B008B; font-weight: bold "> for</ span > _ < span style ="color: #8B008B "> in</ span > < span style ="color: #658b00 "> range</ span > (power):
923- qml.ctrl(U, control=ctrl)(wires[-< span style ="color: #B452CD "> 1</ span > ])
924-
925- < span style ="color: #8B008B; font-weight: bold "> def</ span > < span style ="color: #008b45 "> inverse_qft</ span > (wires):
926- swap_registers(wires)
927- < span style ="color: #8B008B; font-weight: bold "> for</ span > i < span style ="color: #8B008B "> in</ span > < span style ="color: #658b00 "> reversed</ span > (< span style ="color: #658b00 "> range</ span > (< span style ="color: #658b00 "> len</ span > (wires))):
928- < span style ="color: #8B008B; font-weight: bold "> for</ span > j < span style ="color: #8B008B "> in</ span > < span style ="color: #658b00 "> range</ span > (i):
929- qml.ctrl(qml.PhaseShift, control=wires[j])(-np.pi / < span style ="color: #B452CD "> 2</ span > **(i - j), wires=wires[i])
930- qml.Hadamard(wires=wires[i])
931-
932- < span style ="color: #707a7c "> @qml</ span > .qnode(dev)
933- < span style ="color: #8B008B; font-weight: bold "> def</ span > < span style ="color: #008b45 "> qpe</ span > ():
934- target_wire = n_estimation
935- < span style ="color: #8B008B; font-weight: bold "> for</ span > i < span style ="color: #8B008B "> in</ span > < span style ="color: #658b00 "> range</ span > (n_estimation):
936- qml.Hadamard(wires=i)
937-
938- qml.RZ(< span style ="color: #B452CD "> 2</ span > * np.pi * < span style ="color: #B452CD "> 0.375</ span > , wires=target_wire) < span style ="color: #228B22 "> # Assume phase = 0.375</ span >
939-
940- apply_controlled_unitaries(qml.RZ, < span style ="color: #658b00 "> list</ span > (< span style ="color: #658b00 "> range</ span > (n_estimation)) + [target_wire])
941- inverse_qft(< span style ="color: #658b00 "> list</ span > (< span style ="color: #658b00 "> range</ span > (n_estimation)))
942- < span style ="color: #8B008B; font-weight: bold "> return</ span > qml.probs(wires=< span style ="color: #658b00 "> range</ span > (n_estimation))
943-
944- probs = qpe()
945- < span style ="color: #658b00 "> print</ span > (< span style ="color: #CD5555 "> "Measured phase state:"</ span > , probs)
946- </ pre >
947- </ div >
948- </ div >
949- </ div >
950- </ div >
951- < div class ="output_wrapper ">
952- < div class ="output ">
953- < div class ="output_area ">
954- < div class ="output_subarea output_stream output_stdout output_text ">
955- </ div >
956- </ div >
957- </ div >
958- </ div >
959- </ div >
960- </ section >
961-
962- < section >
963- < h2 id ="accuracy-and-readout "> Accuracy and Readout </ h2 >
964-
965- < p > The accuracy of phase estimation improves with the number of qubits in
966- the control register. For \( n \) qubits, we obtain the \( n \) most
967- significant bits of \( \phi \).
968- </ p >
969- </ section >
970-
971- < section >
972- < h2 id ="hamiltonian-simulation "> Hamiltonian simulation </ h2 >
973-
974- < p > Let \( H \) be a Hamiltonian. The evolution \( U = \exp{-iHt} \) has
975- eigenvectors \( \vert u\rangle \) and eigenvalues \( \exp{-iEt} \). QPE yields
976- estimates of \( E \).
977- </ p >
978-
979- < p > Typical applications are</ p >
980- < ol >
981- < p > < li > Electronic structure problems</ li >
982- < p > < li > Dynamics of molecules</ li >
983- < p > < li > Energy spectrum estimation</ li >
984- </ ol >
985- </ section >
986-
987- < section >
988- < h2 id ="amplitude-estimation "> Amplitude estimation </ h2 >
989-
990- < p > Quantum Amplitude Estimation (QAE) uses QFT for estimating
991- probabilities (amplitudes) more efficiently than classical sampling.
992- </ p >
993-
994- < p > Prepare a state:</ p >
995- < p > < br >
996- $$
997- \vert \psi\rangle = \sqrt{a}\vert1\rangle + \sqrt{1 - a}\vert 0\rangle.
998- $$
999- < p > < br >
1000-
1001- < p > The QAE estimates \( a \) using Grover-like iterations and QFT.</ p >
1002- </ section >
1003-
1004- < section >
1005- < h2 id ="pennylane-example-energy-estimation "> PennyLane Example: Energy Estimation </ h2 >
1006-
1007- < p > We simulate a simple diagonal Hamiltonian using QPE.</ p >
1008-
1009- <!-- code=python (!bc pycod) typeset with pygments style "perldoc" -->
1010- < div class ="cell border-box-sizing code_cell rendered ">
1011- < div class ="input ">
1012- < div class ="inner_cell ">
1013- < div class ="input_area ">
1014- < div class ="highlight " style ="background: #eeeedd ">
1015- < pre style ="font-size: 80%; line-height: 125%; "> < span style ="color: #8B008B; font-weight: bold "> import</ span > < span style ="color: #008b45; text-decoration: underline "> pennylane</ span > < span style ="color: #8B008B; font-weight: bold "> as</ span > < span style ="color: #008b45; text-decoration: underline "> qml</ span >
1016- < span style ="color: #8B008B; font-weight: bold "> from</ span > < span style ="color: #008b45; text-decoration: underline "> pennylane</ span > < span style ="color: #8B008B; font-weight: bold "> import</ span > numpy < span style ="color: #8B008B; font-weight: bold "> as</ span > np
1017-
1018- n_qubits = < span style ="color: #B452CD "> 2</ span >
1019- dev = qml.device(< span style ="color: #a61717; background-color: #e3d2d2 "> ``</ span > default.qubit< span style ="color: #CD5555 "> ''</ span > , wires=n_qubits + < span style ="color: #B452CD "> 1</ span > )
1020-
1021- < span style ="color: #8B008B; font-weight: bold "> def</ span > < span style ="color: #008b45 "> controlled_unitary</ span > (t):
1022- < span style ="color: #8B008B; font-weight: bold "> def</ span > < span style ="color: #008b45 "> unitary</ span > ():
1023- qml.PhaseShift(< span style ="color: #B452CD "> 2</ span > * np.pi * < span style ="color: #B452CD "> 0.3</ span > * t, wires=n_qubits)
1024- < span style ="color: #8B008B; font-weight: bold "> return</ span > unitary
1025-
1026- < span style ="color: #707a7c "> @qml</ span > .qnode(dev)
1027- < span style ="color: #8B008B; font-weight: bold "> def</ span > < span style ="color: #008b45 "> energy_estimation</ span > ():
1028- < span style ="color: #228B22 "> # Apply Hadamards to estimation qubits</ span >
1029- < span style ="color: #8B008B; font-weight: bold "> for</ span > i < span style ="color: #8B008B "> in</ span > < span style ="color: #658b00 "> range</ span > (n_qubits):
1030- qml.Hadamard(wires=i)
1031- < span style ="color: #228B22 "> # Prepare eigenstate for target qubit</ span >
1032- qml.PauliX(wires=n_qubits)
1033- < span style ="color: #228B22 "> # Apply controlled-U^{2^j}</ span >
1034- < span style ="color: #8B008B; font-weight: bold "> for</ span > i < span style ="color: #8B008B "> in</ span > < span style ="color: #658b00 "> range</ span > (n_qubits):
1035- unitary = controlled_unitary(< span style ="color: #B452CD "> 2</ span > **i)
1036- qml.ctrl(unitary, control=i)()
1037- < span style ="color: #228B22 "> # Inverse QFT</ span >
1038- inverse_qft(< span style ="color: #658b00 "> range</ span > (n_qubits))
1039- < span style ="color: #8B008B; font-weight: bold "> return</ span > qml.probs(wires=< span style ="color: #658b00 "> range</ span > (n_qubits))
1040-
1041- probs = energy_estimation()
1042- < span style ="color: #658b00 "> print</ span > (< span style ="color: #a61717; background-color: #e3d2d2 "> ``</ span > Measured energy phase:< span style ="color: #CD5555 "> ''</ span > , probs)
1043- </ pre >
1044- </ div >
1045- </ div >
1046- </ div >
1047- </ div >
1048- < div class ="output_wrapper ">
1049- < div class ="output ">
1050- < div class ="output_area ">
1051- < div class ="output_subarea output_stream output_stdout output_text ">
1052- </ div >
1053- </ div >
1054- </ div >
1055- </ div >
1056- </ div >
1057- </ section >
1058-
1059904< section >
1060905< h2 id ="applications-of-qpe "> Applications of QPE </ h2 >
1061906
0 commit comments