Skip to content

Commit 3b27356

Browse files
committed
merging yml
2 parents 426c76b + 7f23325 commit 3b27356

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+6058
-648
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
drafts/exercies.Rmd
12
drafts/
23
algpseudocode/*.aux
34
algpseudocode/*.fls
45
algpseudocode/*.log
56
algpseudocode/*.pdf
67
algpseudocode/*.fdb_latexmk
7-
algpseudocode/*.png
88
algpseudocode/TEMPLATE.png
99
.Rproj.user
1010
.Rhistory

README.md

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,66 @@
1-
# Welcome to the repository for quantumalgorithms.org
1+
2+
3+
[![quantumalgorithms.org](https://quantumalgorithms.org/images/mainlogo.png)](https://quantumalgorithms.org)
4+
5+
# README
26

37
[![Unitary Fund](https://img.shields.io/badge/Supported%20By-UNITARY%20FUND-brightgreen.svg?style=for-the-badge)](http://unitary.fund)
48

59

10+
611
This is the repository for [QuantumAlgorithms.org](https://quantumalgorithms.org).
712

813
This webiste is meant to be a set of lecture notes for students in quantum algorithms and quantum machine learning.
914
It will be updated regularly with new research material. The scope is to bridge the gap between introductory material in quantum computing and research-grade papers, standardize notation, and be an overfiew on the state of useful algorithms for quantum machine learning and information processing.
1015

1116

1217

13-
## How to contribute
18+
## How to contribute:
1419

1520
The book is written in bookdown, an R-based extension of markdown (even if you don't need to know R at all, it's simply markdown with some latex).
21+
Download RStudio and make sure you can compile a book with bookdown on your computer. Once you have it, you can work on the book and submit a PR.
1622

17-
The open issues are roughly organized as follows:
18-
19-
- minor issues (proofreading, checking steps, making sure things are clear enough)
20-
- technical enhancements on the website
21-
- major contributions (like new chapters)
22-
- create and solve new exercise
2323

24-
Please refer to the file tipsandtricks.md for small but useful tips on Rmarkdown.
24+
Feel free to submit a PR with improvements in
2525

26-
In any case, if you want to contribute, [drop me a line](mailto://[email protected])!
26+
- proofreading
27+
- checking and expanding steps in calculations,
28+
- pointing out sections are ambigious or hard to understand, or that can be explained better,
29+
- create and solve new exercise.
2730

31+
For major contributions (like new chapters or new content), [drop us a line](mailto://[email protected])!
2832

29-
## Algorithms file
33+
## How to write an algorithm
3034

31-
The book has some algorithms that are rendered as latex algorithms with a library
32-
for writing pseudocode. Successively these files are rendered as png via a python script.
35+
The book has some algorithms that are rendered as latex algorithms with a package for writing pseudocode.
36+
These algorithms are rendered as pdfs, and successively these files are rendered as png via a python script.
3337
The text of the pseudocode of the algorithm is in the folder /algpseudocode/
3438
When writing new algorithms, please use the template that you find there.
35-
39+
You can obtain a .png, which can be included in the .Rmd files with a small caption.
40+
There are countless examples of algorithms included in the book, so you can copy that.
41+
42+
43+
44+
## Style guide, tips&tricks.
45+
46+
- Use \ket{} and \bra{} instead of |x\rangle
47+
- \begin{equation} and \end{equation} in bookdown are not really working 100% of the time (check?), but they should be used throughout the whole book, as math book have all equation numbered.
48+
- Labels for equation equations are documented in the bookdown documentation https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html
49+
- Take the references from google scholar. Select that paper you want, go to cite, and use the biblatex paper. Be sure to include always the year of the document, becuase otherwise you will get an error when trying to compile the pdf version of the document.
50+
- Every time you compile, (and before doing the pull request) be sure to compile also the pdf version of the document. This becuase there are cases where the generation of the book in htlm succeed, but the pdf is failing for some reasons.
51+
- Use \~ before the citation.
52+
- We use runtime not run-time or run time.
53+
- no space between a dollar sign for equations $ and the first character of the formula (otherwise you get an error)
54+
- currently, it's not possible to put latex in the names of the theorems,lemma, definitions. (do we know how to do it?) For example in the definition of the parametereization of the function $\mu$, I had to use the greek letter μ...
55+
- itemize made with - should start and end with a newline
56+
- the way to number equation is the following: (\#eq:raylight)
57+
- This is the templtae to use to create an issue automatically using the github action
58+
- always use thm, lem, cor, in references: \@ref(thm:qla).
59+
- grep "\`{lemma" * to have the list of all lemmas (or theorems) so after we can check if they are used correctly with \@ref() and there are no wrong \ref{}.
60+
- the correct way of doing todo is:
61+
<!--
62+
# TODO
63+
# labels:
64+
-->
65+
- If you need a fast way for translating citation from latex \cite{ciao} to markdown [@ciao], you can use \\cite{(.*?)} -----> [@$1]
66+
-

_bookdown.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@ language:
44
ui:
55
chapter_name: "Chapter "
66
rmd_files: ["index.Rmd",
7-
#"intro.Rmd",
8-
#"classical.Rmd",
9-
#"toolbox.Rmd",
10-
#"sve-based-quantum-algorithms.Rmd",
7+
"intro.Rmd",
8+
"classical.Rmd",
9+
"toolbox.Rmd",
10+
"sve-based-quantum-algorithms.Rmd",
1111
#"between.Rmd",
12-
#"montecarlo.Rmd",
12+
"montecarlo.Rmd",
1313
#"perceptron.Rmd",
14-
#"dimensionality-reduction.Rmd",
15-
#"q-means.Rmd",
16-
#"qem.Rmd",
17-
#"on-real-data.Rmd",
18-
#"graphs.Rmd",
19-
#"lower-bounds.Rmd",
20-
#"selected-works.Rmd",
21-
#"virtual-quantum-labs.Rmd",
14+
"dimensionality-reduction.Rmd",
15+
"q-means.Rmd",
16+
"qem.Rmd",
17+
"on-real-data.Rmd",
18+
"graphs.Rmd",
19+
"lower-bounds.Rmd",
20+
"selected-works.Rmd",
2221
#"glossary.Rmd",
2322
"appendix.Rmd"
2423
]

abstract-of-project.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
The website https://quantumalgorithms.org is an open source book with two objective. First it aims to close the gap between the typical introductory course in quantum computing and research papers. Secondly, it aspire to be the go-to reference for lemmas and theorems needed for the quantum algorithm researcher to write new algorithms and applications of known quantum algorithms.
2+
3+
So far the book is mostly focused quantum machine learning algorithms, but is also touching topics like quantum algorithms for Monte Carlo, lower bounds in query complexity, and numerical experiments on real datasets. With a conspicuous appendix, covering from error propagation to the foundation of linear algebra needed to understand quantum machine learning from a computer science perspective.
4+
5+
The project hosted 5 students from the mentorship program of the Quantum Open Source Foundation, and we are backed by the unitary.fund. This set of lecture notes has already been used for teaching in two different occasions at Politecnico di Milano.
6+
7+
Being an open source project, so interest students are encouraged to engage with us if they want to contribute.

algpseudocode/cem.png

117 Bytes
Loading

algpseudocode/logdet-sve.png

117 Bytes
Loading

algpseudocode/min-finding.png

3.16 KB
Loading

algpseudocode/perceptronalgos-0.png

101 KB
Loading

algpseudocode/perceptronalgos-1.png

57.2 KB
Loading

algpseudocode/qem.png

-2.46 KB
Loading

algpseudocode/qem.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212

1313
\begin{algorithm}[ht]
14-
\caption{QEM for GMM } \label{qGMMEM}
14+
\caption{QEM for GMM }
1515
\begin{algorithmic}[1]
1616

1717
\Require Quantum access to a GMM model, precision parameters $\delta_\theta, \delta_\mu,$ and threshold $\epsilon_\tau$.
1818
\Ensure A GMM $\overline{\gamma}^t$ that maximizes locally the likelihood $\ell(\gamma;V)$, up to tolerance $\epsilon_\tau$.
1919
\vspace{10pt}
20-
\State Use a heuristic (like lemma \ref{$q$-means++} in Chapter \ref{chap:qmeans}) to determine the initial guess $\gamma^0=(\theta^0, \vec \mu^0, \vec \Sigma^0)$, and build quantum access as in definition \ref{def:quantumaccess-GMM} those parameters.
20+
\State Use a heuristic (like lemma $q$-means++) to determine the initial guess $\gamma^0=(\theta^0, \vec \mu^0, \vec \Sigma^0)$, and build quantum access those parameters.
2121
\State Use lemma \ref{lemma: absolute error logdet} to estimate the log determinant of the matrices $\{ \Sigma_j^0 \}_{j=1}^k$.
2222
\State t=0
2323
\Repeat

algpseudocode/qesa.png

67 KB
Loading

algpseudocode/qla-svd.png

56.7 KB
Loading

algpseudocode/qmeans.png

152 KB
Loading

algpseudocode/qmeans.tex

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
\usepackage{amsmath}
77
\usepackage{amssymb}
88

9-
9+
\makeatletter
10+
\renewcommand{\fnum@algorithm}{\fname@algorithm}
11+
\makeatother
1012

1113
\newcommand{\errdist}{\epsilon_1}
1214
\newcommand{\errmult}{\epsilon_2}
@@ -17,21 +19,21 @@
1719

1820

1921
\begin{document}
20-
\pagestyle{empty}
22+
\pagestyle{empty}
2123

22-
\begin{algorithm}
23-
\caption{$q$-means.}
24+
\begin{algorithm}
25+
\caption{$q$-means.}
2426
\begin{algorithmic}[1]
25-
27+
2628
\Require Data matrix $X \in \mathbb{R}^{n \times d}$ stored in QRAM data structure. Precision parameters $\delta$ for $k$-means, error parameters
27-
$\errdist$ for distance estimation, $\errmult$ and $\errnorms$ for matrix multiplication and $\errtom$ for tomography.
29+
$\errdist$ for distance estimation, $\errmult$ and $\errnorms$ for matrix multiplication and $\errtom$ for tomography.
2830
\Ensure Outputs vectors $c_{1}, c_{2}, \cdots, c_{k} \in \mathbb{R}^{d}$ that correspond to the centroids at the final step of the $\delta$-$k$-means algorithm.\\
29-
\vspace{10pt}
30-
\Statex Select $k$ initial centroids $c_{1}^{0}, \cdots, c_{k}^{0}$ and store them in QRAM data structure.
31+
\vspace{10pt}
32+
\Statex Select $k$ initial centroids $c_{1}^{0}, \cdots, c_{k}^{0}$ and store them in QRAM data structure.
3133
\State t=0
32-
\Repeat
34+
\Repeat
3335
\Statex {\bf Step 1: Centroid Distance Estimation}\\
34-
Perform the mapping
36+
Perform the mapping
3537
\begin{equation}
3638
\frac{1}{\sqrt{N}}\sum_{i=1}^{n} \ket{i} \otimes_{j \in [k]} \ket{j}\ket{0} \mapsto \frac{1}{\sqrt{N}}\sum_{i=1}^{n} \ket{i} \otimes_{j \in [k]} \ket{j}\ket{\overline{d^2(x_{i}, c_{j}^{t})}}
3739
\end{equation}
@@ -41,21 +43,21 @@
4143
\begin{equation}
4244
\frac{1}{\sqrt{n}}\sum_{i=1}^{n} \ket{i} \otimes_{j \in [k]} \ket{j}\ket{\overline{d^2(x_{i}, c_{j}^{t})}}
4345
\mapsto \frac{1}{\sqrt{n}}\sum_{i=1}^{n} \ket{i} \ket{ \ell^t(x_{i})}
44-
\end{equation}
45-
46+
\end{equation}
47+
4648
\Statex {\bf Step 3: Centroid states creation} \\
4749
{\bf 3.1} Measure the label register to obtain a state $\ket{\chi_{j}^t} = \frac{1}{ \sqrt{ |\mathcal{C}^t_{j}|} } \sum_{i\in \mathcal{C}^t_j}\ket{i}$, with prob. $\frac{|\mathcal{C}^{t}_j|}{N} $ \\ %= O(\frac{1}{k})$.\\
4850
{\bf 3.2} Perform matrix multiplication with matrix $V^T$ and vector $\ket{\chi_{j}^t}$ to obtain the state $\ket{c_{j}^{t+1}}$ with error $\errmult$, along with an estimation of $\norm{c_{j}^{t+1}}$ with relative error $\errnorms$ \\
49-
50-
51+
52+
5153
\Statex {\bf Step 4: Centroid Update} \\
52-
{\bf 4.1} Perform tomography for the states $\ket{c_{j}^{t+1}}$
54+
{\bf 4.1} Perform tomography for the states $\ket{c_{j}^{t+1}}$
5355
with precision $\errtom$ using the operation from Steps 1-3 and get a classical estimate $\overline{c}_j^{t+1}$ for the new centroids such that $|c_j^{t+1} - \overline{c}_j^{t+1}| \leq \sqrt{\eta}(\errnorms+\errtom) = \epsilon_{centroids}$\\ %$\norm{\ket{\overline{c_j^{t+1}}}-\ket{c_j^{t+1}}} \leqslant \errtom$ and $| \norm{c_j} - \overline{\norm{c_j}} | \leq \errnorms\norm{c_j}$
54-
{\bf 4.2} Update the QRAM data structure for the centroids with the new vectors $\overline{c}^{t+1}_0 \cdots \overline{c}^{t+1}_k$.
55-
56+
{\bf 4.2} Update the QRAM data structure for the centroids with the new vectors $\overline{c}^{t+1}_0 \cdots \overline{c}^{t+1}_k$.
57+
5658
\Statex t=t+1
57-
\Until convergence condition is satisfied.
58-
59+
\Until convergence condition is satisfied.
60+
5961
\end{algorithmic}
6062
\end{algorithm}
6163

43.2 KB
Loading
79.9 KB
Loading
Loading
58.3 KB
Loading

0 commit comments

Comments
 (0)