You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: intro.Rmd
+20-20Lines changed: 20 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -320,8 +320,8 @@ This section is an attempt to organize in a coherent way some
320
320
fundamental concepts in quantum computer science. Some refereces for this section
321
321
are [@dorn2008quantum], [@DeWolf], and [@kuperberg2011another].
322
322
323
-
Le't s suppose that we have a quantum circuit of $n$ qubits, and for each qubit we have one Hadamard gate.
324
-
What is the time complexity for running this circuit? Is it $O(n)$ or $O(1)$?. To answer this question we have to introduce discuss different ways for measuring the complexity of a quantum algorithm: the number of gates, the depth, and the number of queries to an oracle.
323
+
Let's suppose that we have a quantum circuit of $n$ qubits, and for each qubit we have one Hadamard gate.
324
+
What is the time complexity for running this circuit? Is it $O(n)$ or $O(1)$? To answer this question we have to introduce discuss different ways for measuring the complexity of a quantum algorithm: the number of gates, the depth, and the number of queries to an oracle.
325
325
The first two are a direct generalization of the measure of complexity of boolean circuits, where we measure the number of gates (serial time) or the depth of the circuit (parallel time). The third measure of complexity is the query complexity, which is the number of times we use (or query) an oracle: a circuit or a data structure that we can use as a black box. In this section we will define more formally the query complexity of a quantum algorithm, and in the next chapter we will explain possible implementations of different kind of oracles. The *time* complexity, which is ultimately the most interesting measure of complexity of an algorithm for most practical purposes, is more tricky to define properly. If we assume that our hardware is capable of executing all the gates at the same depth in parallel, than the measure of time complexity becomes the depth of the quantum algorithm. We denote with $T(U)$ the time complexity needed to implement a quantum circuit implementing a unitary $U$, and this is measured in terms of **number of gates**, i.e. the size of the circuit (this is quite standard see for example the section the introduction in [@ambainis2022matching]). This is a concept that bears some similarity with the clock rate of classical CPUs. If our hardware is not capable of executing all the gates at the same depth in one clock, we might have to consider the time complexity as the number of gates (eventually divided by the number of gates that can be executed at the same time). As an important exception to this rule we have the query complexity, where we consider the cost of a single query of an oracle as $O(1)$, i.e. as any other gate. This is somehow justified because for certain oracles we have efficient (i.e. with depth polylogarithmic in the size of the oracle) implementations. For this, the (often non said) assumption is that the part of the quantum computer dedicated to run the main part of the circuit has to be evaluated with serial time (i.e. the number of gates), while the part of the circuit dedicated to executing the oracle has to be evaluated for its parallel time complexity. An example of this, which we will treat in more details in the next chapter is the QRAM and the QRAG gate. This assumption allows to justifiably conflate the query complexity of an algorithm as its time complexity.
326
326
327
327
Last but not least, everything is made even more complicated by error correction. In fact, in some architecture and some error correction codes, the time complexity of the algorithm is well approximated by the number of $T$ gates of the circuit.
@@ -332,7 +332,7 @@ factors in the big-O notation of the algorithms:
332
332
$O(\log(n))=\widetilde{O}(1)$.
333
333
334
334
::: {.definition #quantum-oracle-access name="Quantum query or oracle access to a function"}
335
-
Let $\mathcal{H}$ be a finite-dimensional Hilbert space with basis $\{0,1\}^{n}$. Given $f:\{0,1\}^n\to\{0,1\}^m$, we say that we have quantum query access to $f$ if we have access to a unitary operator $U_f$ on $\mathcal{H}\otimes\mathbb{C}^{2^n}$ such that $U\ket{x}\ket{b} = \ket{x}\ket{b \oplus f(x)}$ for any bit string $b\in\{0,1\}^m$. One application of $U_f$ costs $T_f$ operations.
335
+
Let $\mathcal{H}$ be a finite-dimensional Hilbert space with basis $\{0,1\}^{n}$. Given $f:\{0,1\}^n\to\{0,1\}^m$, we say that we have quantum query access to $f$ if we have access to a unitary operator $U_f$ on $\mathcal{H}\otimes\mathbb{C}^{2^m}$ such that $U\ket{x}\ket{b} = \ket{x}\ket{b \oplus f(x)}$ for any bit string $b\in\{0,1\}^m$. One application of $U_f$ costs $T_f$ operations.
336
336
:::
337
337
338
338
::: {.definition #quantum-computation name="Quantum computation in the query model"}
@@ -521,7 +521,7 @@ The algorithm follows exactly the same steps as the Deutsch-Josza algorithm. The
Now we resort again to Lemma \ref(lem:hadamard-on-bitstring), and we use the fact that the Hadamard it is also a self-adjoint operator (i.e. it is the inverse of itself: $H^2 = I$). Thus applying $n$ Hadamard gates to the first register leads to the state $\ket{a}$ deterministically.
524
+
Now we resort again to Lemma \@ref(lem:hadamard-on-bitstring), and we use the fact that the Hadamard it is also a self-adjoint operator (i.e. it is the inverse of itself: $H^2 = I$). Thus applying $n$ Hadamard gates to the first register leads to the state $\ket{a}$ deterministically.
525
525
526
526
:::
527
527
@@ -548,7 +548,7 @@ Let $U$ be a unitary acting on $n$ qubits, and $\ket{\psi}$ a quantum
548
548
state on $n$ qubit (generated by another unitary $V$). We also require
549
549
to be able to apply the controlled version of the unitary $U$. Then, the
550
550
Hadamard test is a quantum circuit that we can use to estimate the value
551
-
of $\braket{\psi| U \psi}$. The circuit is very simple, it consists in a
551
+
of $\braket{\psi| U | \psi}$. The circuit is very simple, it consists in a
552
552
Hadamard gate applied on an ancilla qubit, the controlled application of
Note that when taking the conjugate of our state, we changed the sign of
621
621
$i$. We now have only to convince ourselves that
622
-
$-i\braket{\psi|U|\psi} + i \braket{\psi|U^\dagger|\psi} = i\braket{\psi(U^\dagger -U)\psi}$
622
+
$-i\braket{\psi|U|\psi} + i \braket{\psi|U^\dagger|\psi} = i\braket{\psi|U^\dagger -U|\psi}$
623
623
is indeed the real number corresponding to
624
624
$2\text{Im}(\braket{\psi| U|\psi})$, and thus the whole equation can be a
625
625
probability.
@@ -637,11 +637,11 @@ of interested with a certain level of accuracy and with a certain
637
637
probability.
638
638
639
639
::: {.theorem #modified-hadamard-test-no-amplification name="Modified Hadamard test (no amplitude amplification)"}
640
-
Assume to have access to a unitary $U_1$ that produces a state $U_1 \ket{0} = \ket{\psi_1}$ and a unitary $U_2$ that produces a state $\ket{\psi_2}$, where $\ket{\psi_1},\ket{\psi_2} \in \mathbb{R}^N$ for $N=2^n, n\in\mathbb{N}$. There is a quantum algorithm that allows to estimate the quantity $\braket{\psi_1|\psi_2}$ with additive precision $\epsilon$ using controlled applications of $U_1$ and $U_2$ $O(\frac{\log(1/\delta)}{\epsilon^2})$ times, with probability $1-\delta$
640
+
Assume to have access to a unitary $U_1$ that produces a state $U_1 \ket{0} = \ket{\psi_1}$ and a unitary $U_2$ that produces a state $\ket{\psi_2}$, where $\ket{\psi_1},\ket{\psi_2} \in \mathbb{C}^N$ for $N=2^n, n\in\mathbb{N}$. There is a quantum algorithm that allows to estimate the quantity $\braket{\psi_1|\psi_2}$ with additive precision $\epsilon$ using controlled applications of $U_1$ and $U_2$ $O(\frac{\log(1/\delta)}{\epsilon^2})$ times, with probability $1-\delta$
641
641
:::
642
642
643
643
::: {.proof}
644
-
Create a state $\ket{0}\ket{0}$ where the first register is just an ancilla qubit, and the second register has $n$ qubits. Then, apply an Hadamard gate to the first qubit, so to obtain $\ket{+}\ket{0}\ket{0}$. Then, controlled on the first register being $0$, we apply the unitary $U_1$, and controlled on the register being $1$, we apply the unitary $U_2$. Then, we apply again the Hadamard gate on the ancilla qubit. The state that we obtain is the following:
644
+
Create a state $\ket{0}\ket{0}$ where the first register is just an ancilla qubit, and the second register has $n$ qubits. Then, apply an Hadamard gate to the first qubit, so to obtain $\ket{+}\ket{0}$. Then, controlled on the first register being $0$, we apply the unitary $U_1$, and controlled on the register being $1$, we apply the unitary $U_2$. Then, we apply again the Hadamard gate on the ancilla qubit. The state that we obtain is the following:
645
645
646
646
\begin{align}
647
647
(H\otimes I ) \frac{1}{\sqrt{2}}\left( \ket{0}\ket{\psi_1} + \ket{1}\ket{\psi_2} \right) \\
@@ -662,11 +662,11 @@ We conclude the proof by recalling the Chernoff bound in theorem \@ref(thm:chern
662
662
<!-- TODO add circuit for complex part of inner product.-->
663
663
664
664
Can you think of the reasons that might lead one to prefer the swap test
665
-
over the Hadamard test, or vice versa? At the end of the day, they are
665
+
over the Hadamard test, or vice versa? At the end of the day, aren't they
666
666
both computing the same thing? For instance, note that for the Hadamard
667
667
test, we are requiring the ability to call the *controlled* version of
668
668
the unitaries $U_1$, and $U_2$, while for the swap test, we can just
669
-
trat them as black-box: these can be quantum states that we obtain from
669
+
treat them as black-boxes: these can be quantum states that we obtain from
670
670
a quantum process, or that we obtain from a quantum communication
671
671
channel.
672
672
@@ -677,32 +677,32 @@ context of quantum fingerprinting, but it has been quickly extended to
677
677
many other context. For us, the swap test is a way to obtain an estimate
678
678
of an inner product between two quantum states. The difference between
679
679
the swap test and the Hadamard test is that in this case we don't assume
680
-
to have access to the unitary creating the states, hance we cannot
681
-
perform controlled operations on this unitary. You can think that we
680
+
to have access to the unitary creating the states, hence we cannot
681
+
perform controlled operations with this unitary. You can think that we
682
682
receive the states from a third-party, i.e. via a communication
683
683
protocol.
684
684
685
685
::: {.theorem #swap-test-no-amplification name="Swap test (no amplitude amplification)"}
686
-
Assume to have access to a unitary $U_1$ that produces a state $U_1 \ket{0} = \ket{\psi_1}$ and a unitary $U_2$ that produces a state $\ket{\psi_2}$, where $\ket{\psi_1},\ket{\psi_2} \in \mathbb{R}^N$ for $N=2^n, n\in\mathbb{N}$. There is a quantum algorithm that allows to estimate the quantity $|\braket{\psi_1|\psi_2}|^2$ with additive precision $\epsilon$ using $U_1$ and $U_2$ $O(\frac{\log(1/\delta)}{\epsilon^2})$ times with probability $1-\delta$
686
+
Assume to have access to a unitary $U_1$ that produces a state $U_1 \ket{0} = \ket{\psi_1}$ and a unitary $U_2$ that produces a state $\ket{\psi_2}$, where $\ket{\psi_1},\ket{\psi_2} \in \mathbb{C}^N$ for $N=2^n, n\in\mathbb{N}$. There is a quantum algorithm that allows to estimate the quantity $|\braket{\psi_1|\psi_2}|^2$ with additive precision $\epsilon$ using $U_1$ and $U_2$ $O(\frac{\log(1/\delta)}{\epsilon^2})$ times with probability $1-\delta$
687
687
:::
688
688
689
689
::: {.proof}
690
-
Create a state $\ket{0}\ket{0}\ket{0}$ where the first register is just an ancilla qubit, and the second and third register have $n$ qubits. Then, apply an Hadamard gate to the first qubit, so to obtain $\ket{+}\ket{0}\ket{0}$. Then, apply $U_1$ and $U_2$ to the second and third register, and then apply a controlled swap gate controlled on the ancilla qubit, targeting the two registers. More precisely, we apply $n$ controlled swap gates, each controlling a single qubit of the second and third register. Thus, we obtain the state:
690
+
Create a state $\ket{0}\ket{0}\ket{0}$ where the first register is just an ancilla qubit, and the second and third register have $n$ qubits each. Then, apply an Hadamard gate to the first qubit, so to obtain $\ket{+}\ket{0}\ket{0}$. Then, apply $U_1$ and $U_2$ to the second and third register, and then apply a controlled swap gate controlled on the ancilla qubit, targeting the two registers. More precisely, we apply $n$ controlled swap gates, each controlling a single qubit of the second and third register. Thus, we obtain the state:
Now we consider the probability of measuring $0$ and $1$ in the ancilla qubit. More in detail, we want to estimate $p(0)=\bra{\phi}M_0\ket{\phi}$. For this, we recall our Postulate \@ref(prp:postulate3), and more precisely equation \@ref(eq:simple-measurement-probability), with $M_0=\ket{0}\bra{0}\otimes I$, where $I$ is the identiy operator over $n$ qubits. It is simple to see that $p(0)=\frac{2-2|\braket{\psi_1|\psi_2}|^2}{4}$.
704
704
705
-
By repeating this measurement $O(\log(1/\delta)/\epsilon^2)$ times, duly following the statement of the Chernoff bound in theorem \@ref(thm:chernoff-bound2), we have that the number of samples needed to obtain an error $\epsilon$ with probability $1-\delta$ is $t=\frac{\log(1/\delta)}{2\epsilon^2}$. Once we have obtained an estimate of $p(0)$, we can estiamte the sought-after quantity of interest as $|\braket{\psi_1|\psi_2}|^2 = 1-2p(0)$.
705
+
By repeating this measurement $O(\log(1/\delta)/\epsilon^2)$ times, duly following the statement of the Chernoff bound in theorem \@ref(thm:chernoff-bound2), we have that the number of samples needed to obtain an error $\epsilon$ with probability $1-\delta$ is $t=\frac{\log(1/\delta)}{2\epsilon^2}$. Once we have obtained an estimate of $p(0)$, we can estimate the sought-after quantity of interest as $|\braket{\psi_1|\psi_2}|^2 = 1-2p(0)$.
706
706
:::
707
707
708
708
::: {.exercise name="Obtain the absolute value of the inner product"}
0 commit comments