some work on the presentation

This commit is contained in:
Daniel Knüttel 2020-02-28 16:09:51 +01:00
parent 7b633f0b62
commit a682dd7f5c
2 changed files with 422 additions and 34 deletions

View File

@ -12,14 +12,10 @@
\usepackage{listings}
%\usepackage{struktex}
\usepackage{qcircuit}
\usepackage{adjustbox}
\newtheorem{definition}{Definition}
\newtheorem{postulate}{Postulate}
\newtheorem{corrolary}{Corrolary}
\newtheorem{lemma}{Lemma}
\newtheorem{theorem}{Theorem}
\usetheme[progressbar=frametitle]{metropolis}
\usetheme{metropolis}
\setbeamercolor{background canvas}{bg=white!20}
@ -66,7 +62,9 @@
\begin{itemize}
\item Some (physical) problems are classically hard to solve.
\pause
\item The quantum simulator: Mapping a hard problem to quantum hardware that can simulate this specific problem.
\pause
\item The (universal) quantum computer: able to simulate any unitary transformation on the system.
\end{itemize}
@ -77,7 +75,9 @@
\begin{frame}{Quantum Errors and Quantum Error Correction}
\begin{itemize}
\item Quantum systems at non-zero temperature often have dephasing effects and a finite population lifetime (relaxation).
\pause
\item Fault tolerant QC needs a way to correct for those errors.
\pause
\item Several strategies exist one important class of quantum error correction codes are \textbf{stabilizer codes}.
\end{itemize}
@ -87,22 +87,387 @@
\section{Binary Quantum Computing}
{
\begin{frame}{Qbits}
\begin{definition}
\textbf{Definition}
{\itshape
A qbit is a two-level quantum mechanical system $\ket{0}, \ket{1}$ with $\braket{0}{1} = 0$.
In the following $Z = \sigma_Z, X = \sigma_X, Y = \sigma_Y, I = \id$ will be used.
\end{definition}
In the following $Z = \sigma_Z, X = \sigma_X, Y = \sigma_Y$ will be used. $I$ is the identity matrix.
}
Where $Z\ket{0} = +1\ket{0}$ and $Z\ket{1} = -1\ket{1}$.
\begin{postulate}
A $n$-qbit system is the tensor product of the single-qbit systems.
\end{postulate}
\end{frame}
}
{
\begin{frame}{Qbits and Gates}
\begin{itemize}
\item{
\textbf{Postulate}
{\itshape
A $n$-qbit system is the tensor product of the single-qbit systems.
}
}
\pause
%\item{
% For $n$ qbits define the integer state $\ket{j}$ as
% \begin{equation}
% \ket{j} := \ket{\mbox{0b}i_0i_1...i_{n-1}} := \ket{i_0}_s \otimes \ket{i_1}_s \otimes ... \otimes \ket{i_{n-1}}_s
% \end{equation}
%}
\item{
A transformation $U \in SU(2^n)$ is called \textit{gate} acting on the system.
For $\bar{U} \in SU(2)$ the gate $U_i$ acting on qbit $i$ is given by
\begin{equation}
U_i := \left(\bigotimes\limits_{k < i} I\right) \otimes \bar{U} \otimes \left(\bigotimes\limits_{k > i} I\right)
\end{equation}
}
\pause
\item{
For $\bar{U} \in SU(2)$ and qbits $i \neq j$
\begin{equation}
CU_{i,j} := \ket{1}\bra{1}_j \otimes U_i + \ket{0}\bra{0}_j \otimes I
\end{equation}
is the controlled $\ket{U}$ gate acting on $i$ with control-qbit $j$.
}
\pause
\end{itemize}
\end{frame}
}
{
\begin{frame}{Gates}
Some notable gates are
\begin{itemize}
\item{
the Hadamard gate
\begin{equation}
H := \frac{1}{\sqrt{2}}\left(\begin{array}{cc} 1 & 1 \\ 1 & -1\end{array}\right)
\end{equation}
which transforms from the $Z$ to the $X$ basis}
\pause
\item{the rotation gate
\begin{equation}
R_{\phi} := \left(\begin{array}{cc} 1 & 0 \\ 0 & \exp(i\phi)\end{array}\right)
\end{equation}
that performs a rotation around the $Z$ axis.}
\pause
\end{itemize}
\end{frame}
}
{
\begin{frame}{Gates}
\begin{itemize}
\item{The $Z$ and $S$ gates are given by:
\begin{equation}
Z := \left(\begin{array}{cc} 1 & 0 \\ 0 & -1\end{array}\right) = R_{\pi}
\end{equation}
\begin{equation}
S := \left(\begin{array}{cc} 1 & 0 \\ 0 & i\end{array}\right) = R_{\frac{\pi}{2}}
\end{equation}
The $S$ gate transforms from $X$ to $Y$ basis.
}
\pause
\item{
\textbf{Theorem}
{\itshape
Any gate $U \in SU(2^n)$ can be approximated arbitrarely good using the $H$, $R_\phi$
and $CZ_{i,j}$ gate.
}
}
\end{itemize}
\end{frame}
}
{
\begin{frame}{Integer States}
\begin{itemize}
\item{
The eigenstates of the $Z_i$ are called integer states. They have the form
\begin{equation}
\ket{j} = \ket{\mbox{0b}l_1...l_n} = \ket{l_1}_s \otimes ... \otimes \ket{l_n}s
\end{equation}
}
\pause
\item{
For $n$ qbits there exist $2^n$ such states and they form a basis
\begin{equation}
\ket{\psi} = \sum\limits_{i=0}^{n-1} \ket{i}\braket{i}{\psi} = \sum\limits_{i=0}^{n-1} c_i\ket{i}
\end{equation}
with the condition $\sum\limits_{i=0}^{n-1} c_i^2 = 1$.
}
\end{itemize}
\end{frame}
}
{
\begin{frame}{Measurement}
\begin{itemize}
\item{Measurements are performed in $Z$ basis, i.e. for a qbit $i$
$Z_i$ is measured.
}
\item{
The results of the measurements are associated with a classical result $s \in \{0, 1\}$
using
\begin{equation}
Z_i\ket{\psi'} = (-1)^s \ket{\psi'}
\end{equation}
after the measurement.
}
\end{itemize}
\end{frame}
}
{
\begin{frame}{Quantum Circuits}
\begin{itemize}
\item{
Writing a unitary transformation as a product of the generator gates is unreadable.
To fix this problem quantum circuits have been introduced.
}
\pause
\item{
Qbits are represented by horizontal lines.
}
\pause
\item{
Gates acting on a qbit are boxes on the lines.
}
\pause
\item{
Control-qbits are connected to the gate via a vertical line.
}
\pause
\item{
Circuits are read left to right.
}
\pause
\item{
Example:
\Qcircuit @C=1em @R=.7em {
& \gate{H} & \ctrl{1} & \qw &\qw \\
& \gate{H} & \gate{Z} & \gate{H} &\qw \\
}
}
\end{itemize}
\end{frame}
}
{
\begin{frame}{Case Study: Spin Chain in a Magnetic Field}
\begin{itemize}
\item{
For a set of $n$ spins in a magnetic field one can rescale the Hamiltonian
of the system to
\begin{equation}
H = -\sum\limits_{i=1}^{n-1} Z_i Z_{i-1} + g\sum\limits_{i=0}^{n-1} X_i
\end{equation}
}
\pause
\item{
The time evolution of such a system is given by the transfer matrix
\begin{equation}
T := \exp(-itH) \in SU(2^n)
\end{equation}
}
\pause
\item{
By associating every qbit with one spin (both are two-level systems)
one should be able to simulate the behaviour of the spin chain using
a quantum computer.
}
\end{itemize}
\end{frame}
}
{
\begin{frame}{Case Study: Spin Chain in a Magnetic Field}
\begin{itemize}
\item{
Trotterizing the matrix exponential
\begin{equation}
\exp(t(A + B)) = \left(\exp(\frac{t}{N}A)\exp(\frac{t}{N}B)\right)^N + \mathcal{O}\left(\frac{t^2}{N^2}\right)
\end{equation}
}
\item{
For $n=3$ spins one gets a circuit
{\centering\adjustbox{max width=\textwidth}{
\Qcircuit @C=1em @R=.7em {
& \qw & \gate{X} & \gate{R_{-\frac{t}{2N}}} & \gate{X} & \gate{R_{\frac{t}{2N}}} & \gate{X} & \gate{X} & \qw & \qw & \qw & \qw & \qw & \qw & \qw & \gate{H} & \gate{R_{-2\frac{gt}{2N}}} & \gate{H} & \gate{R_{\frac{gt}{2N}}} & \gate{X} & \gate{R_{\frac{gt}{2N}}} & \gate{X} & \gate{X} & \gate{R_{-\frac{t}{2N}}} & \gate{X} & \gate{R_{\frac{t}{2N}}} & \gate{X} & \gate{X} & \qw & \qw & \qw & \qw & \qw & \qw & \qw &\qw \\
& \qw & \ctrl{-1} & \qw & \qw & \qw & \qw & \ctrl{-1} & \qw & \gate{X} & \gate{R_{-\frac{t}{2N}}} & \gate{X} & \gate{R_{\frac{t}{2N}}} & \gate{X} & \gate{X} & \gate{H} & \gate{R_{-2\frac{gt}{2N}}} & \gate{H} & \gate{R_{\frac{gt}{2N}}} & \gate{X} & \gate{R_{\frac{gt}{2N}}} & \gate{X} & \ctrl{-1} & \qw & \qw & \qw & \qw & \ctrl{-1} & \qw & \gate{X} & \gate{R_{-\frac{t}{2N}}} & \gate{X} & \gate{R_{\frac{t}{2N}}} & \gate{X} & \gate{X} &\qw \\
& \qw & \qw & \qw & \qw & \qw & \qw & \qw & \qw & \ctrl{-1} & \qw & \qw & \qw & \qw & \ctrl{-1} & \gate{H} & \gate{R_{-2\frac{gt}{2N}}} & \gate{H} & \gate{R_{\frac{gt}{2N}}} & \gate{X} & \gate{R_{\frac{gt}{2N}}} & \gate{X} & \qw & \qw & \qw & \qw & \qw & \qw & \qw & \ctrl{-1} & \qw & \qw & \qw & \qw & \ctrl{-1} &\qw \\
}
}}
}
\item{Applying this circuit $N$ times gives an approximation for the time evolution of a state.}
\end{itemize}
\end{frame}
}
{
\begin{frame}{Case Study: Spin Chain in a Magnetic Field}
\begin{figure}[h]
\begin{center}
\includegraphics[width=\linewidth]{spin_chain/time_evo_6spin_g3.png}
\end{center}
\end{figure}
\end{frame}
}
\section{Stabilizers}
{
\begin{frame}{The multilocal Pauli Group and the Clifford Group}
\begin{itemize}
\item{\textbf{Definition}
{\itshape
$P := \{\pm1, \pm i\} \cdot \{X, Y, Z, I\}$ is called the Pauli group.\\
$P_n := \left\{p_1 \otimes ... \otimes p_n \middle| p_i \in P \right\}$ is called the multilocal Pauli group.
}}
\pause
\item{
\textbf{Definition}
{\itshape
$C_n := \left\{U \in SU(2^n) \middle| \forall p \in P_n: U^\dagger p U \in P_n\right\}$
is called the Clifford group
}
}
\pause
\item{
One can show that $C_n$ is generated by $H, S, CZ_{i,j}$.
}
\end{itemize}
\end{frame}
}
{
\begin{frame}{Generators of a Group}
\begin{itemize}
\item{
\textbf{Definition}
{\itshape
For a finite group $G$ one says $G$ is generated by $g_1, ..., g_N$ iff any $g \in G$ can be expressed
as a product of $g_1, ..., g_N$. These generators are chosen to be the minimal set for which this
condition holds.
One also writes
\begin{equation}
G = \langle g_1,...,g_N \rangle \equiv \langle g_i\rangle_i
\end{equation}
}
}
\item{
The generators are not unique. For instance $C_1$ can be generated using $H, S$ or $\sqrt{-iX}, \sqrt{iZ}$.
}
\item{
The generators of a group have some kind of independence property.
}
\end{itemize}
\end{frame}
}
{
\begin{frame}{Stabilizers and Stabilizer Spaces}
\begin{itemize}
\item{
\textbf{Definition}
{\itshape
A finite abelian subgroup $S$ of $P_n$ is called a set of stabilizers iff $-I \notin S$ and
all elements of $S$ commute.
}
}
\item{
From $-I \notin S$ follows that all elements of $S$ are hermitian.
}
\item{
From the definition as tensor products of Pauli matrices follows that the
elements of $S$ have eigenvalues $\pm1$.
}
\item{
These properties together yield that all elements of $S$ can be diagonalized simultaneously.
Further there exists a vector space $V_S$ with $s \ket{\psi} = +1 \ket{\psi}$ for all $s \in S$
and all $\ket{\psi} \in V_S$. This space is called the stabilizer space of $S$
and all $\ket{\psi}$ are called stabilizer states.
}
\end{itemize}
\end{frame}
}
{
\begin{frame}{Stabilizer States}
\begin{itemize}
\item{
One can show that for $S = \langle S^{(i)} \rangle_{i=1,...,n}$ the stabilizer space $V_S$
has dimension $1$.
}
\item{
Therefore the state $\ket{\psi}$ that is the +1 eigenstate of all stabilizers is (up to a
global phase) unique.
}
\item{Notable stabilizer states are:
\begin{itemize}
\item{ $\ket{0b0..0} = \ket{0}\otimes ... \otimes \ket{0}$ and $\ket{0b1..1} = \ket{1}\otimes ... \otimes \ket{1}$
which are stabilized by $\langle Z_i \rangle_i$ and $\langle -Z_i \rangle_i$ respectively.
}
\item{
$\ket{+}$ stabilized by $\langle X_i \rangle_i$ (and $\ket{-}$ analogously).
}
\item{
$\ket{0b00} + \ket{0b11}$ the Bell/EPR state which is stabilized by $\langle X_1X_2, Z_1Z_2\rangle$.
}
\end{itemize}
}
\end{itemize}
\end{frame}
}
{
\begin{frame}{Dynamics of Stabilizer States}
\begin{itemize}
\item{
Under a transformation $U \in SU(2^n)$ the state changes to
\begin{equation}
\ket{\psi'} = U \ket{\psi}
\end{equation}
}
\item{
The stabilizers of $\ket{\psi}$ change to
\begin{equation}
\ket{\psi'} = U\ket{\psi} = US^{(i)}\ket{\psi} = US^{(i)}U^\dagger U\ket{\psi} = US^{(i)}U^\dagger\ket{\psi'}
\end{equation}
this gives that if $U \in C_n$ $\ket{\psi'}$ is a stabilizer state again with the stabilizers
$S' = \langle US^{(i)}U^\dagger\rangle_{i=1,...,n}$
}
\item{
Under the transformations $C_n$ one can describe the dynamics of the stabilizer states by their
stabilizers.
}
\item{Because the stabilizers are given by $n$ matrices which are the tensor product of $n$ Pauli matrices
this can be simulated in $n^2$ time instead of $2^n$.}
\end{itemize}
\end{frame}
}
{
\begin{frame}{Measurements on Stabilizer States}
\begin{itemize}
\item{
}
\end{itemize}
\end{frame}
}
\end{document}

View File

@ -1,64 +1,87 @@
import numpy as np
import matplotlib.pyplot as plt
from pyqcs import State, sample
from transfer_matrix import T_time_slice
from hamiltonian import H
import matplotlib
from scipy.linalg import expm
from pyqcs import State, sample
nqbits = 2
g = 0.20
N = 50
from transfer_matrix import T_time_slice
from hamiltonian import H
from bootstrap import bootstrap
np.random.seed(0xdeadbeef)
matplotlib.rcParams.update(
{'errorbar.capsize': 2
, 'figure.figsize': (16, 9)}
)
nqbits = 6
g = 3
N_trot = 80
t_stop = 9
delta_t = 0.05
delta_t = 0.09
qbits = list(range(nqbits))
n_sample = 400
n_sample = 2200
measure = 0b10
measure_coefficient_mask = [False if (i & measure) else True for i in range(2**nqbits)]
results_qc = []
results_np = []
errors_sampling = []
print()
for t in np.arange(0, t_stop, delta_t):
# QC simulation
state = State.new_zero_state(nqbits)
for _ in range(N):
state = T_time_slice(qbits, t, g, N) * state
T_dt = T_time_slice(qbits, t, g, N_trot)
for _ in range(N_trot):
state = T_dt * state
#result = sample(state, measure, n_sample)
result = sample(state, measure, n_sample)
results_qc.append(result[0] / n_sample)
#results_qc.append(result[0] / n_sample)
errors_sampling.append(bootstrap(result[0], n_sample, n_sample // 4, n_sample // 10, np.average))
amplitude = np.sqrt(np.sum(np.abs(state._qm_state[[False if (i & measure) else True for i in range(2**nqbits)]])**2))
results_qc.append(amplitude)
#amplitude = np.sqrt(np.sum(np.abs(state._qm_state[measure_coefficient_mask])**2))
#results_qc.append(amplitude)
# Simulation using matrices
np_zero_state = np.zeros(2**nqbits)
np_zero_state[0] = 1
itH = np.matrix(-1j * t * H(nqbits, g))
itH = np.matrix(-0.5j * t * H(nqbits, g))
T = expm(itH)
np_state = T.dot(np_zero_state)
amplitude = np.sqrt(np.sum(np.abs(np_state[[False if (i & measure) else True for i in range(2**nqbits)]])**2))
amplitude = (np.sum(np.abs(np_state[measure_coefficient_mask])**2))
results_np.append(amplitude)
print(f"simulating... {int(t/t_stop*100)} % ", end="\r")
print()
print("done.")
errors_trotter = np.arange(0, t_stop, delta_t)**2 / N**2
results_qc = np.array(results_qc)
errors_trotter = (np.arange(0, t_stop, delta_t) * g)**2 / N_trot**2
errors_sampling = np.array(errors_sampling)
h0 = plt.errorbar(np.arange(0, t_stop, delta_t), results_qc, yerr=errors_trotter, label=f"Quantum computing ({n_sample} samples, {N} trotterization steps)")
h0 = plt.errorbar(np.arange(0, t_stop, delta_t)
, results_qc
, yerr=(errors_trotter + errors_sampling)
, label=f"Quantum computing ({n_sample} samples, {N_trot} trotterization steps)"
, )
h1, = plt.plot(np.arange(0, t_stop, delta_t), results_np, label="Classical simulation using explicit transfer matrix")
plt.xlabel("t")
plt.ylabel(r"$|0\rangle$ probability amplitude for second spin")
plt.title(f"{nqbits} site spin chain with g={g} coupling to external field")
plt.legend(handles=[h0, h1])
plt.savefig("time_evo_6spin_g3.png", dpi=400)
plt.show()