Skip to content

Commit d01e413

Browse files
author
Scinawa
committed
Refactor structure of book, remove typo from definitions
1 parent e57518f commit d01e413

File tree

2 files changed

+36
-12
lines changed

2 files changed

+36
-12
lines changed

index.Rmd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,12 @@ https://stackoverflow.com/questions/41084020/add-a-html-block-above-each-chapter
126126
- February 2021: New subroutines for estimating $\ell_1$ norms.
127127
- March 2021: quantumalgorithms.org is proudly supported by the [Unitary Fund](https://unitary.fund/), and quantumalgorithms.org is a project of the [QOSF](https://qosf.org) mentorship program: 5 students started creating new content!
128128
- April 2021: Mobile version working, search functionality added, q-means, finding the minimum, new algo for dimensionality reduction, and factor score ratio estimation estimation.
129+
- June 2021: Quantum Monte Carlo algorithms, lower bounds techniques for query complexity of quantum algorithms, quantum algorithms for graph problems. The output of the mentorship program of the QOSF foundation!
130+
129131

130132
Coming soon:
131133

132134
- quantum perceptrons
133-
- quantum lower bounds
134135
- quantum algorithms for dynamic programming
135-
- quantum algorithms for graph problems
136-
- quantum Monte Carlo
137136
- quantum convolutional neural networks
138137
- quantum random feature sampling

intro.Rmd

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,17 @@ Let $U_1$ be the evolution of a quantum state $\ket{x}$ and $U_2$ the evolution
186186
## Measuring complexity of quantum algorithms
187187

188188

189-
This section is an attempt to organize in a coherent way some fundamental concept in quantum computer science. The formalization of some of these concepts comes from [@dorn2008quantum] and [@DeWolf].
189+
This section is an attempt to organize in a coherent way some fundamental concepts in quantum computer science. The formalization of some of these concepts comes from [@dorn2008quantum] and [@DeWolf].
190190

191-
There are various way to measure the complexity of a quantum algorithm. We denote with $T(U)$ the time complexity needed to implement $U$, measured in terms of depth of the circuit, which is roughly the number of time steps (or ``clock time'') we need, in order to executed the gates of the quantum circuit $U$. If we just care about the **relativized** complexity, we might limit ourselvs to compare two algorithms that solves the same problem in terms of the number of queries to a given oracle, we might observe that one is faster than the other. This is a **relativized** speedup. The oppositive is an **absolute** speedup, i.e. when we also take into account the complexity of the operations that are **not** queries to an oracle. In the case of quantum algorithms, these might simply be the gate depth of the circuit.
191+
There are various ways to measure the complexity of a quantum algorithm. We denote with $T(U)$ the time complexity needed to implement $U$, measured in terms of **depth** of the circuit, which is (very roughly) the number of time we execute a "block of depth 1" of quantum gates. This is a concept that bears some similarity with the cpu clock rate of classical CPUs, but as we are focusing on algorithms, we will leave this concept to the intuition of the reader. The reason for this choice will be clear in a few lines.
192192

193193
We use a standard notation of $\widetilde{O}$ for hiding polylogarithmic factors in the big-O notation of the algorithms: $O(\log(n))=\widetilde{O}(1)$.
194194

195195

196196

197197

198198
```{definition, quantum-computation, name="Quantum computation"}
199-
Let $O_x$ be a unitary operator that encodes the input of our computation, and acts in a non trivial way on its associated Hilbert space.
199+
Let $O_x$ be a unitary operator that encodes the input of our computation, and acts in a non-trivial way on its associated Hilbert space.
200200
A quantum computation with $T$ queries to an oracle $O_x : \ket{i,b,z} \mapsto \ket{i,b \otimes x_i, z}$ is a sequence of unitary transformations:
201201
202202
$$U_0O_xU_1O_x \dots U_{T-1}O_xUT$$
@@ -208,21 +208,23 @@ Note that the second register holds the XOR of the $i$-th component of the input
208208

209209

210210
```{definition, query-complexity, name="Query complexity"}
211-
The quantum query complexity of a quantum algorithm $\mathcal{A}$ is the number of query to a black-box made by $\mathcal{A}$ in order to compute $f$.
211+
The quantum query complexity of a quantum algorithm $\mathcal{A}$ is the number of queries to a black-box made by $\mathcal{A}$ in order to compute $f$.
212212
```
213213

214+
If we just care about the **relativized** complexity, we might limit ourselves to compare two algorithms that solve the same problem in terms of the number of queries to a given oracle, we might observe that one is faster than the other. This is a **relativized** speedup. The oppositive is an **absolute** speedup, i.e. when we also take into account the complexity of the operations that are **not** queries to an oracle. In the case of quantum algorithms, these might simply be the gate depth of the circuit.
215+
214216

215217
```{definition, circuit-complexity, name="Circuit complexity or time complexity"}
216218
The quantum circuit complexity (or time complexity) of a quantum algorithm $\mathcal{A}$ is the depth of the quantum circuit implementing $\mathcal{A}$.
217219
```
218220

219221
Quantum computing is not the only place where we measure the complexity in terms of query to an oracle. In fact, it's sufficient to do a few [ "queries"](https://www.cs.rutgers.edu/~sa1497/courses/cs514-s20/lec3.pdf) (pun intended) on your search engine to realize that in many computational models we have adopted this measure of computational complexity.
220222

221-
**Note that the query complexity of an algorithm is a lower bound on the gate complexity of the quantum circuit.** It is often simpler to study first the query complexity of a quantum algorithm and then study the time complexity. For most quantum algorithms (but not all!) the time complexity coincides with the query complexity, up to a logarithmic factor. Note that, if we find a way to have an oracle whose depth (i.e. circuit complexity) is only (poly)logarithmic in the input size, then the query complexity and the gate compexity coincide up to a negligible polylogarithmic factor.
222-
There are some exception. Most notably, there is a quantum algorithm for the important *hidden subgroup problem* with only polynomial query complexity, while the classical couterpart has a query complexity that is exponential in the input size. Nevertheless, the overall time complexity of the quantum algorithm is (to date) still exponential, and polynomial time quantum algorithms are known only for a few specialization of the problem.
223+
**Note that the query complexity of an algorithm is a lower bound on the gate complexity of the quantum circuit.** It is often simpler to study first the query complexity of a quantum algorithm and then study the time complexity. For most quantum algorithms (but not all!) the time complexity coincides with the query complexity, up to a logarithmic factor. Note that, if we find a way to have an oracle whose depth (i.e. circuit complexity) is only (poly)logarithmic in the input size, then the query complexity and the gate complexity coincide up to a negligible polylogarithmic factor.
224+
There are some exceptions. Most notably, there is a quantum algorithm for the important *hidden subgroup problem* with only polynomial query complexity, while the classical counterpart has a query complexity that is exponential in the input size. Nevertheless, the overall time complexity of the quantum algorithm is (to date) still exponential, and polynomial-time quantum algorithms are known only for a few specializations of the problem.
223225

224226

225-
We will clarify better some definition that are used to describe the probabilistic behavior of an algorithm:
227+
We will clarify better some definitions that are used to describe the probabilistic behavior of an algorithm:
226228

227229

228230
```{definition, error-behavior, name="Kind of randomized algorithms"}
@@ -234,7 +236,7 @@ Let $f : \{0,1\}^N \mapsto \{0,1\}$ be a Boolean function. An algorithm computes
234236
235237
```
236238

237-
A bounded error (quantum or classical) algorithm that fails with probability $1/3$ (or any other constant smaller than $1/2$) is meant to fail *in the worst case*. We do not expect the algorithm to fail in the average case, i.e. for most of the inputs (see Appendix of [@DeWolf]).
239+
A bounded error (quantum or classical) algorithm that fails with probability $1/3$ (or any other constant smaller than $1/2$) is meant to fail *in the worst-case*. We do not expect the algorithm to fail in the average case, i.e. for most of the inputs (see Appendix of [@DeWolf]).
238240

239241

240242
If a (quantum or classical) algorithm is said to output the right answer in **expected** (oftain said "in expectation") running time $T$, we can quickly create another algorithm that has **worst-case** guarantees on the runtime. This is obtained using the Markov's inequality, i.e. theorem \@ref(thm:markov) as follows. Run the algorithm for $kT$ steps, i.e.. stop the execution after $kT$ steps if it hasn't terminated already. If $X$ is the random variable of the runtime of the computation (so $\mathbb{E}[X]=T$), then:
@@ -246,6 +248,29 @@ So with probability $\geq 1-\frac{1}{k}$ we will have the output of the algorith
246248
<!-- TODO: ONE SIDE BOUNDED ERROR IS MISSING -->
247249

248250

251+
252+
253+
254+
## Review of famous quantum algorithms
255+
In this chapter we will explore some introductory quantum algorithms. Some of them are not particularly related to data analysis or machine learning, but given their potential to help us better understand the model of quantum computation that we adopt, we decided it was important to report them here. Others will prove to be really useful subroutines for the quantum machine learning practitioner.
256+
257+
```{definition, name="Constant function"}
258+
A function $f :\{0,1\}^n \mapsto \{0,1\}$ is constant if $f(x)=0 \forall x \in \{0,1\}^n$ or $f(x)=1 \forall x \in \{0,1\}^n$.
259+
```
260+
261+
```{definition, name="Balanced function"}
262+
A function $f :\{0,1\}^n \mapsto \{0,1\}$ is balanced if $f(x)=0$ for half of the inputs and $f(x)=1$ for the other half.
263+
```
264+
265+
```{theorem, name="Deutsch-Josza"}
266+
Assume to have quantum access to a unitary $U_f$ that computes the function $f :\{0,1\}^n \mapsto \{0,1\}$, which is either constant or balanced. There is a quantum algorithm that decides which is the case with probabiliy $1$, using $U_f$ only once and using $O(\log(n))$ other gates.
267+
```
268+
269+
```{theorem, name="Bernstein-Vazirani"}
270+
Assume to have quantum access to a unitary $U_f$ that computes the function $f :\{0,1\}^n \mapsto \{0,1\}$, which computes $f(x \cdot a) = (x,a) = ( \sum_i^n x_i a_i )\mod 2$ for a secret string $a \in \{0,1\}^n$. There is a quantum algorithm that learns $a$ with probability $1$, using $U_f$ only once and $O(\log(n))$ other gates.
271+
```
272+
273+
249274
## Representing data in quantum computers
250275

251276
What does it mean to represent or store data as a quantum state? This question is of paramount importance, because knowing what is the best way of encoding data in a quantum computer might pave the way for intuitions in solving our problems. On the contrary, using the wrong encoding might prevent you from reasoning about the right algorithm design, and obtaining the desired advantages in the implementation of your algorithm. Indeed, in [@schuld2015introduction], Schuld and others wrote: _In order to use the strengths of quantum mechanics without being confined by classical ideas of data encoding, finding “genuinely quantum” ways of representing and extracting information could become vital for the future of quantum machine learning_.
@@ -397,7 +422,7 @@ A matrix can be accessed also in another way.
397422
Let $V \in \mathbb{R}^{n \times d}$, there is an oracle that allows to perform the mappings:
398423
399424
- $\ket{i}\mapsto\ket{i}\ket{d(i)}$ where $d(i)$ is the number of entries in row $i$, for $i \in [n]$, and
400-
- $\ket{i,l}\mapsto\ket{i,\nu(j,l)}$, where $\nu(i,l)$ is the $l$-th nonzero entry of the $i$-th row of $V$.
425+
- $\ket{i,l}\mapsto\ket{i,l,\nu(i,l)}$, where $\nu(i,l)$ is the $l$-th nonzero entry of the $i$-th row of $V$, for $l < d(i)$.
401426
402427
```
403428

0 commit comments

Comments
 (0)