Commit e3a4f80a authored by Guilhem Niot's avatar Guilhem Niot

Add quantum diagrams

parent 69d846eb
DIAGRAMS=$(wildcard diagrams/*.qpic)
TKIZ=$(DIAGRAMS:diagrams/%.qpic=diagrams/%.tkiz)
all: $(TKIZ)
%.tkiz: %.qpic
qpic $*.qpic > $@
clean:
$(RM) diagrams/*.tkiz
SCALE 2
a W \ket{0}_1 {\frac{1}{\sqrt 2} (\ket{0} + \ket{1})}
...b W
c W \ket{0}_q {\frac{1}{\sqrt 2} (\ket{0} + \ket{1})}
a H
c H
\begin{tikzpicture}[scale=2.000000,x=1pt,y=1pt]
\filldraw[color=white] (0.000000, -7.500000) rectangle (24.000000, 37.500000);
% Drawing wires
% Line 3: a W \ket{0}_1 {\frac{1}{\sqrt 2} (\ket{0} + \ket{1})}
\draw[color=black] (0.000000,30.000000) -- (24.000000,30.000000);
\draw[color=black] (0.000000,30.000000) node[left] {$\ket{0}_1$};
% Line 4: ...b W
\draw[color=black] (0.000000,15.000000) node[anchor=mid east] {$\vdots$};
% Line 5: c W \ket{0}_q {\frac{1}{\sqrt 2} (\ket{0} + \ket{1})}
\draw[color=black] (0.000000,0.000000) -- (24.000000,0.000000);
\draw[color=black] (0.000000,0.000000) node[left] {$\ket{0}_q$};
% Done with wires; drawing gates
% Line 7: a H
\begin{scope}
\draw[fill=white] (12.000000, 30.000000) +(-45.000000:8.485281pt and 8.485281pt) -- +(45.000000:8.485281pt and 8.485281pt) -- +(135.000000:8.485281pt and 8.485281pt) -- +(225.000000:8.485281pt and 8.485281pt) -- cycle;
\clip (12.000000, 30.000000) +(-45.000000:8.485281pt and 8.485281pt) -- +(45.000000:8.485281pt and 8.485281pt) -- +(135.000000:8.485281pt and 8.485281pt) -- +(225.000000:8.485281pt and 8.485281pt) -- cycle;
\draw (12.000000, 30.000000) node {$H$};
\end{scope}
% Line 8: c H
\begin{scope}
\draw[fill=white] (12.000000, -0.000000) +(-45.000000:8.485281pt and 8.485281pt) -- +(45.000000:8.485281pt and 8.485281pt) -- +(135.000000:8.485281pt and 8.485281pt) -- +(225.000000:8.485281pt and 8.485281pt) -- cycle;
\clip (12.000000, -0.000000) +(-45.000000:8.485281pt and 8.485281pt) -- +(45.000000:8.485281pt and 8.485281pt) -- +(135.000000:8.485281pt and 8.485281pt) -- +(225.000000:8.485281pt and 8.485281pt) -- cycle;
\draw (12.000000, -0.000000) node {$H$};
\end{scope}
% Done with gates; drawing ending labels
\draw[color=black] (24.000000,30.000000) node[right] {${\frac{1}{\sqrt 2} (\ket{0} + \ket{1})}$};
\draw[color=black] (24.000000,15.000000) node[anchor=mid west] {$\vdots$};
\draw[color=black] (24.000000,0.000000) node[right] {${\frac{1}{\sqrt 2} (\ket{0} + \ket{1})}$};
% Done with ending labels; drawing cut lines and comments
% Done with comments
\end{tikzpicture}
SCALE 2
a W \ket{0}_1
...b W
c W \ket{0}_q
a H
c H
d W \ket{0, ..., 0}
d G $U_f$ a c
\begin{tikzpicture}[scale=2.000000,x=1pt,y=1pt]
\filldraw[color=white] (0.000000, -7.500000) rectangle (48.000000, 52.500000);
% Drawing wires
% Line 3: a W \ket{0}_1
\draw[color=black] (0.000000,45.000000) -- (48.000000,45.000000);
\draw[color=black] (0.000000,45.000000) node[left] {$\ket{0}_1$};
% Line 4: ...b W
\draw[color=black] (0.000000,30.000000) node[anchor=mid east] {$\vdots$};
% Line 5: c W \ket{0}_q
\draw[color=black] (0.000000,15.000000) -- (48.000000,15.000000);
\draw[color=black] (0.000000,15.000000) node[left] {$\ket{0}_q$};
% Line 10: d W \ket{0, ..., 0}
\draw[color=black] (0.000000,0.000000) -- (48.000000,0.000000);
\draw[color=black] (0.000000,0.000000) node[left] {$\ket{0, ..., 0}$};
% Done with wires; drawing gates
% Line 7: a H
\begin{scope}
\draw[fill=white] (12.000000, 45.000000) +(-45.000000:8.485281pt and 8.485281pt) -- +(45.000000:8.485281pt and 8.485281pt) -- +(135.000000:8.485281pt and 8.485281pt) -- +(225.000000:8.485281pt and 8.485281pt) -- cycle;
\clip (12.000000, 45.000000) +(-45.000000:8.485281pt and 8.485281pt) -- +(45.000000:8.485281pt and 8.485281pt) -- +(135.000000:8.485281pt and 8.485281pt) -- +(225.000000:8.485281pt and 8.485281pt) -- cycle;
\draw (12.000000, 45.000000) node {$H$};
\end{scope}
% Line 8: c H
\begin{scope}
\draw[fill=white] (12.000000, 15.000000) +(-45.000000:8.485281pt and 8.485281pt) -- +(45.000000:8.485281pt and 8.485281pt) -- +(135.000000:8.485281pt and 8.485281pt) -- +(225.000000:8.485281pt and 8.485281pt) -- cycle;
\clip (12.000000, 15.000000) +(-45.000000:8.485281pt and 8.485281pt) -- +(45.000000:8.485281pt and 8.485281pt) -- +(135.000000:8.485281pt and 8.485281pt) -- +(225.000000:8.485281pt and 8.485281pt) -- cycle;
\draw (12.000000, 15.000000) node {$H$};
\end{scope}
% Line 12: d G $U_f$ a c
\draw (36.000000,45.000000) -- (36.000000,0.000000);
\begin{scope}
\draw[fill=white] (36.000000, -0.000000) +(-45.000000:8.485281pt and 8.485281pt) -- +(45.000000:8.485281pt and 8.485281pt) -- +(135.000000:8.485281pt and 8.485281pt) -- +(225.000000:8.485281pt and 8.485281pt) -- cycle;
\clip (36.000000, -0.000000) +(-45.000000:8.485281pt and 8.485281pt) -- +(45.000000:8.485281pt and 8.485281pt) -- +(135.000000:8.485281pt and 8.485281pt) -- +(225.000000:8.485281pt and 8.485281pt) -- cycle;
\draw (36.000000, -0.000000) node {$U_f$};
\end{scope}
\filldraw (36.000000, 45.000000) circle(1.500000pt);
\filldraw (36.000000, 15.000000) circle(1.500000pt);
% Done with gates; drawing ending labels
\draw[color=black] (48.000000,30.000000) node[anchor=mid west] {$\vdots$};
% Done with ending labels; drawing cut lines and comments
% Done with comments
\end{tikzpicture}
No preview for this file type
......@@ -7,10 +7,17 @@
\usepackage{amsfonts, amsmath, amssymb, amsthm}
\usepackage{hyperref}
% Pour le pseudo code
\usepackage{ifoddpage, relsize}
\usepackage[]{algorithm2e}
\SetKw{Continue}{continue}
% Pour les diagrammes quantiques
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,decorations.pathmorphing}
\providecommand{\ket}[1]{\left| #1 \right\rangle}
\newtheorem{lemma}{Lemme}
\renewcommand*{\proofname}{Preuve}
......@@ -200,4 +207,37 @@ de la forme $f(x) = a^x \bmod N$.
\subsection{Initialisation}
On fixe un entier $Q = 2^q \gg N$ correspondant à la taille du segment sur lequel on va évaluer la fonction $f(x) = a^x$. \\
\begin{enumerate}
\item
On utilise q qubits initialisés à $\ket{0}$ pour représenter la variable $x$. Puis, on applique la transformée de Hadamard à chacun de ses qubits ($H \cdot \ket{0} = \frac{1}{\sqrt 2}(\ket{0} + \ket{1})$) pour représenter l'ensemble des entiers de $[0, Q-1]$.
\paragraph{}
\begin{center}
\input{diagrams/1introduction.tkiz}
\end{center}
\item
On utilise q \emph{autres} qubits initialisés à $\ket{0}$ pour représenter les images de $f$ sur $[0, Q-1]$. \\
On définit l'opérateur $U_f$ sur ces $2 \cdot q$ qubits pour calculer f :
$$
\forall x \ \text{q q-bit},\ U_f \ket{x, O^q} = \ket{x, f(x)}
$$
On l'applique :
\begin{center}
\input{diagrams/2calculf.tkiz}
\end{center}
\end{enumerate}
Après cette initialisation, on se retrouve dans l'état :
$$
U_f \cdot \frac{1}{\sqrt{2}^q} \sum\limits_{x=0}^{Q-1} \ket{x, 0^q} =
\frac{1}{\sqrt{2}^q} \sum\limits_{x=0}^{Q-1} \ket{x, f(x)}
$$
\end{document}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment