Skip to content

Commit

Permalink
Cleanup shor.tex
Browse files Browse the repository at this point in the history
  • Loading branch information
vEnhance committed Nov 14, 2023
1 parent 5ea585e commit 1742a2b
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tex/quantum/shor.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ \chapter{Shor's algorithm}
OK, now for Shor's Algorithm:
how to factor $M = pq$ in $O\left( (\log M)^2 \right)$ time.

This is arguably the reason agencies such as the US's National
Security Agency have been diverting millions of dollars toward
This is arguably the reason agencies such as the US's National
Security Agency have been diverting millions of dollars toward
quantum computing.

\section{The classical (inverse) Fourier transform}
Expand Down Expand Up @@ -39,7 +39,7 @@ \section{The classical (inverse) Fourier transform}
us detect if the $x_i$ are periodic.
More generally, given a sequence of $1$'s appearing with period $r$,
the amplitudes will peak at inputs which are divisible by $\frac{N}{\gcd(N,r)}$.
Mathematically, we have that
Mathematically, we have that
\[
x_k = \sum_{j=0}^{N-1} y_j \omega_N^{-jk}.
\]
Expand Down Expand Up @@ -72,7 +72,7 @@ \section{The classical (inverse) Fourier transform}
\end{remark}
If we apply the definition as written, computing the transform takes $O(N^2)$ time.
It turns out that by a classical algorithm called the \vocab{fast Fourier transform}
(whose details we won't discuss, but it effectively ``reuses'' calculations),
(whose details we won't discuss, but it effectively ``reuses'' calculations),
one can reduce this to $O(N \log N)$ time.
However, for Shor's algorithm this is also insufficient;
we need something like $O\left( (\log N)^2 \right)$ instead.
Expand Down Expand Up @@ -165,15 +165,15 @@ \section{The quantum Fourier transform}

For general $n$, we can write this as inductively as
\[
\Qcircuit @C=1em @R=.7em {
\lstick{\ket{x_n}} & \multigate{5}{\text{QFT}_{n-1}} & \gate{R_n} & \qw & \qw & \cdots & & \qw & \qw & \cdots & & \qw & \qw & \rstick{\ket{y_1}} \qw \\
\lstick{\ket{x_{n-1}}} & \ghost{\text{QFT}_{n-1}} & \qw & \gate{R_{n-1}} & \qw & \cdots & & \qw & \qw & \cdots & & \qw & \qw & \rstick{\ket{y_2}} \qw \\
\lstick{\vdots\ \ } & \pureghost{\text{QFT}_{n-1}} & & & & & & & & & & & & \rstick{\ \ \vdots} \\
\lstick{\ket{x_i}} & \ghost{\text{QFT}_{n-1}} & \qw & \qw & \qw & \cdots & & \gate{R_i} & \qw & \cdots & & \qw & \qw & \rstick{\ket{y_{n-i+1}}} \qw \\
\lstick{\vdots\ \ } & \pureghost{\text{QFT}_{n-1}} & & & & & & & & & & & & \rstick{\ \ \vdots} \\
\lstick{\ket{x_2}} & \ghost{\text{QFT}_{n-1}} & \qw & \qw & \qw & \cdots & & \qw & \qw & \cdots & & \gate{R_2} & \qw & \rstick{\ket{y_{n-1}}} \qw \\
\lstick{\ket{x_1}} & \qw & \ctrl{-6} & \ctrl{-5} & \qw & \cdots & & \ctrl{-3} & \qw & \cdots & & \ctrl{-1} & \gate{H} & \rstick{\ket{y_n}} \qw
}
\Qcircuit @C=1em @R=.7em {
\lstick{\ket{x_n}} & \multigate{5}{\text{QFT}_{n-1}} & \gate{R_n} & \qw & \qw & \cdots & & \qw & \qw & \cdots & & \qw & \qw & \rstick{\ket{y_1}} \qw \\
\lstick{\ket{x_{n-1}}} & \ghost{\text{QFT}_{n-1}} & \qw & \gate{R_{n-1}} & \qw & \cdots & & \qw & \qw & \cdots & & \qw & \qw & \rstick{\ket{y_2}} \qw \\
\lstick{\vdots\ \ } & \pureghost{\text{QFT}_{n-1}} & & & & & & & & & & & & \rstick{\ \ \vdots} \\
\lstick{\ket{x_i}} & \ghost{\text{QFT}_{n-1}} & \qw & \qw & \qw & \cdots & & \gate{R_i} & \qw & \cdots & & \qw & \qw & \rstick{\ket{y_{n-i+1}}} \qw \\
\lstick{\vdots\ \ } & \pureghost{\text{QFT}_{n-1}} & & & & & & & & & & & & \rstick{\ \ \vdots} \\
\lstick{\ket{x_2}} & \ghost{\text{QFT}_{n-1}} & \qw & \qw & \qw & \cdots & & \qw & \qw & \cdots & & \gate{R_2} & \qw & \rstick{\ket{y_{n-1}}} \qw \\
\lstick{\ket{x_1}} & \qw & \ctrl{-6} & \ctrl{-5} & \qw & \cdots & & \ctrl{-3} & \qw & \cdots & & \ctrl{-1} & \gate{H} & \rstick{\ket{y_n}} \qw
}
\]
\begin{ques}
Convince yourself that when $n=3$ the two circuits displayed are equivalent.
Expand Down Expand Up @@ -297,13 +297,13 @@ \section{Shor's algorithm}
\frac{1152}{2033}, \;
\dots
\]
So $\frac{17}{30}$ is a very good approximation,
So $\frac{17}{30}$ is a good approximation,
hence we deduce $s = 17$ and $r = 30$ as candidates.
And indeed, one can check that $r = 30$ is the desired order.
\end{example}

This won't work all the time\footnote{%
Not to mention the general issue of noise, but that's for
Not to mention the general issue of noise, but that's for
engineers to worry about.
} (for example, we could get unlucky and
measure $j=0$, i.e.\ $s=0$, which would tell us no information at all).
Expand Down

0 comments on commit 1742a2b

Please sign in to comment.