\documentclass[xcolor={usenames, dvipsnames},]{beamer}
%\documentclass[xcolor={usenames, dvipsnames}, handout]{beamer}
\usepackage[T1]{fontenc}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{xcolor}
\usepackage{pgfpages}

% \setbeameroption{show only notes}

\DeclareMathAlphabet{\mathscr}{OT1}{pzc}{m}{it} % make \matscr command with Zapf Chancery font

\author[JLC]{Jeremy Lloyd Conlin}
\title[ERAM]{Explicitly Restarted Arnoldi's Method for Monte Carlo Nuclear Criticality Calculations}
\date[PhD Thesis Defense]{August 17, 2009}

% New commands
\newcommand{\A}{\ensuremath{\mathcal{A}}}
\newcommand{\DA}{\ensuremath{\mathbf{\Delta}\A}}
\newcommand{\QR}{\ensuremath{QR} }
\newcommand{\p}{\ensuremath{\bm{p}}}
\newcommand{\poly}[2]{\ensuremath{\bm{p}_#1(#2)}}
\newcommand{\vp}{\ensuremath{v^{(+)}(x)}}
\newcommand{\vm}{\ensuremath{v^{(-)}(x)}}
\newcommand{\dd}{\mathop{}\!\mathsf{d}}
\newcommand{\E}[1]{\ensuremath{\,\mathsf{E#1}}}
\newcommand{\e}[1]{\ensuremath{\times 10^{#1}}}
\newcommand{\xmax}{\ensuremath{x_{\mathsf{max}}}}
\newcommand{\xmin}{\ensuremath{x_{\mathsf{min}}}}
\newcommand{\xmid}{\ensuremath{x_{b,\mathsf{mid}}}}
\newcommand{\Lin}{\ensuremath{\mathcal{L}}}
\newcommand{\vP}{\ensuremath{v_{\Pi}}}
\newcommand{\vL}{\ensuremath{v_{\Lin}}}
\newcommand{\Lx}{\ensuremath{\Lin_b(x, \alpha_b, \beta_b)}}
\newcommand{\Px}{\ensuremath{\Pi_b(x)}}
\DeclareMathOperator{\mathspan}{span}
\setlength\delimitershortfall{-2pt} % make delimiters grow

% Customize look
\usetheme{Defense}

\begin{document}

\begin{frame}
    \titlepage
    \note{I will be speaking today---if it wasn't already obvious---on the work I performed for my PhD.}
\end{frame}

\begin{frame}{Acknowledgements}
    \begin{itemize}
        \item James Hollowy
        \item Bill Martin, Ed Larsen, Martin Strauss
        \item Scott and Geri Conlin
        \item Annie, Brigham, Lily, Emma
        \item Trisha Conlin
    \end{itemize}
    \note{Before we get started, I wanted to thank some of those who have played an important role in my education. \ldots}
\end{frame}

\section{Introduction}
\begin{frame}{Particle Transport}
\begin{block}{Boltzmann Transport Equation:}
\begin{equation*}
    \Omega\cdot\mathbf{\nabla}\psi(\mathbf{r},\Omega)+\Sigma_t\psi(\mathbf{r},\Omega) = \frac{\Sigma_s}{4\pi}\int \psi(\mathbf{r},\Omega)\;d\Omega + \frac{1}{k}\frac{\nu\Sigma_f}{4\pi}\int \psi(\mathbf{r},\Omega)\;d\Omega,
\end{equation*}
\end{block}

\begin{columns}[t]
    \pause
    \begin{column}{0.45\textwidth}
        Operator Form:
            \begin{align*}
            (\mathbf{L} + \mathbf{C} - \mathbf{S})\psi &= \frac{1}{k}\mathbf{F}\psi \\
            \mathbf{T}\psi &= \frac{1}{k}\mathbf{F}\psi
        \end{align*}
    \end{column}

    \pause
    \begin{column}{0.45\textwidth}
        Define:
        \begin{align*}
            v &\equiv \mathbf{F}\psi \\
            \A &\equiv \mathbf{F}\,\mathbf{T}^{-1}
        \end{align*}
    \end{column}
\end{columns}

\pause
\vspace{2em}{\Large
    \begin{equation*}
        \A v = kv
    \end{equation*}
    }
    \note{I begin with the Boltzmann Transport Equation.  This is the equation we are solving.  This equation can be written in Operator Form where we have the leakage term representing how particles (or neutrons) move around, a collision term, and a scattering term.  These can be combined into an operator which I call the Transport operator, $\mathbf{T}$.  $\mathbf{F}$ is the fission operator.  We define $v$, the fission source, as the fission operator applied to the flux.  Finally we define \A{} to be the transport-fission operator.  Using these definitions we can rearrange the transport equation so that it looks like this (changes slide).  $\A v = kv$ is a standard eigenvalue problem with $k$ and $v$ as the eigenvalue and eigenvector of the transport-fission operator.}

\end{frame}

\begin{frame}{Krylov Subspace Methods}
    \begin{itemize}
        \item Estimate eigenpairs from Krylov subspace:
        \begin{equation*}
            \mathcal{K}_m(\A, v) \equiv \mathspan\left\{v, \A v, \A^2v, \ldots, \A^{m-1}v\right\}
        \end{equation*}

        \item Subspace constructed iteratively
        \begin{equation*}
            v_i = \A v_{i-1}, \qquad \mathrm{for}\; i=1,2,\ldots, m-1
        \end{equation*}

        \item Krylov subspace
        \begin{equation*}
            \mathcal{K}_m(\A, v) \equiv \mathspan\left\{v_0, v_1, v_2, \ldots, v_{m-1}\right\}
        \end{equation*}

        \item Explicit form of \A{} not required
    \end{itemize}

    \note{Krylov subspace methods are methods which estimate eigenpairs of a linear operator, \A, from  a subspace spanned by the vectors formed by repeated applications of a linear operator on a vector $v$.  The subspace can be constructed iteratively by applying the linear operator to the previously calculated basis vector.  With these definitions of the basis vectors we can write the Krylov subspace as\ldots  Note that an explicit form of \A{} is not required; we only need to know how to apply the linear operator to a vector.

    These properties make Krylov subspace methods attractive to Monte Carlo particle transport calculations.  We don't have an explicit form, but we do know how to apply the operator to a vector (or fission source).
    }
\end{frame}

\begin{frame}{Monte Carlo Application of Transport-Fission Operator \A}
    \begin{columns}[m]
        \begin{column}{0.45\textwidth}
        To apply \A{} to $v_{i-1}$:
        \begin{enumerate}
            \item Sample neutron from $v_{i-1}$
            \item Transport neutron
            \item Record positions of fission neutrons
            \item Repeat\ldots
        \end{enumerate}
        \end{column}

        \begin{column}{0.4\textwidth}
        \begin{block}{Fission Source:}
            \begin{align*}
                v &\equiv \mathbf{F}\psi \\[0.5em]
                v_i &= \A v_{i-1}
            \end{align*}
        \end{block}

        \begin{block}{Transport-fission Operator:}
            \begin{align*}
                \A &\equiv \mathbf{F}\,\mathbf{T}^{-1} \\[0.5em]
                \A &=\mathbf{F}\left(\mathbf{L}+\mathbf{C}-\mathbf{S}\right)^{-1}
            \end{align*}
        \end{block}
        \end{column}
    \end{columns}
\note{To apply the transport-fission operator to a fission source we can sample a neutron from the previous fission source; a fission source is collection of neutrons born through fission.  After sampling a neutron, we follow the neutron as it moves around in the material, colliding and scattering.  When the neutron causes fission, we record the positions of the fission neutrons in a new fission source.  This process is repeated many times.}
\end{frame}

\subsection{Power Method}
\begin{frame}{Krylov Subspace Method: Power Method}
    \begin{itemize}
        \item Straightforward Krylov subspace method
        \begin{align*}
            v_{i} &= \frac{1}{k_{i-1}}\A v_{i-1} \\
            k_{i} &= k_{i-1}\frac{\int \A v_{i-1}}{\int v_{i-1}}
        \end{align*}

        \item $k_i$ and $v_{i}$ converge to fundamental eigenpair as $i$ becomes large
        \item Eigenvalue convergence proportional to dominance ratio
        \begin{equation*}
            \mathsf{DR} = \lambda_1/\lambda_0
        \end{equation*}
    \end{itemize}
    \note{The power method is a straightforward application of a Krylov subspace method, i.e. we simply apply the linear operator many times.  The power method constructs the Krylov subspace iteratively in this fashion:
    \begin{enumerate}
        \item Apply transport-fission operator to fission source to get new fission source
        \item Estimate new eigenvalue as shown here
    \end{enumerate}
    The new fission source is normalized by the estimate of the eigenvalue.

    Note that at every power method iteration one estimate of the eigenvalue and eigenvector are calculated.  As the method proceeds, $k_i$ and $v_i$ will eventually converge to the fundamental eigenvalue and eigenvector.  The rate at which the eigenvalue converges is proportional to the dominance ratio, the ratio of the first harmonic eigenvalue to the fundamental.  The notation here isn't very clear, but $\lambda_0 = k$ in the original notation.
    }
\end{frame}

\begin{frame}{Monte Carlo Statistics}
    \begin{itemize}
        \item Iterations before power method converges are discarded
        \begin{itemize}
            \item \emph{Inactive} iterations
        \end{itemize}
        \item Iterations after convergence are \emph{Active} iterations
        \item Calculate mean and variance of eigenvalue estimates
        \begin{align*}
            \overline{\lambda} &\equiv \frac{1}{N} \sum_{n=1}^N \lambda_n \\[0.5em]
            \sigma_{\overline{\lambda}}^2 &\equiv \frac{1}{N-1} \left(\frac{1}{N}\sum_{n=1}^N \left(\lambda_n - \overline{\lambda}\right)^2\right)
        \end{align*}
    \item $\sigma_{\overline{\lambda}}$ is a measure of statistical uncertainty of $\overline{\lambda}$
    \end{itemize}

    \note{While the eigenvalue converges to the fundamental, the results of the iterations are discarded.  These iterations are referred to as inactive iterations.  Once convergence has been achieved, the eigenvalue estimates are stored so that their mean and variance can be calculated.  The standard deviation is a measure of the statistical uncertainty of the calculation.}
\end{frame}

\begin{frame}{Arnoldi's Method---Alternative to Power Method}
    \begin{columns}[t,onlytextwidth]
    \begin{column}{0.5\textwidth}
        Power method has been used for more than 50 years
        \begin{itemize}
            \item Straightforward implementation
            \item Fundamental eigenvalue and eigenvector
            \item Only one Krylov basis vector is stored and used
            \item Slow convergence
        \end{itemize}
    \end{column}

    \note{The power method has been used in Monte Carlo criticality calculations for more than 50 years.  I have shown how it is used.}
    \pause
    \begin{column}{0.5\textwidth}
        Arnoldi's method:
        \begin{itemize}
            \item Application of \A{} same as in Power method
            \item Multiple eigenpairs
            \item All Krylov basis vectors are stored and used.
            \item Faster convergence
        \end{itemize}
    \end{column}
    \end{columns}

    \note{Arnoldi's method is an alternative to the power method.  It was first proposed in 1951 and was nearly forgotten until 1981 when Yousef Saad found a way to improve it.  While Arnoldi's method is not as simple as the power method, it still only requires knowledge of how to apply the fission-transport operator to the fission source which is done in exactly the same way as in the power method.  Some benefits we get from Arnoldi's method is that it is capable of estimating multiple eigenpairs.  It uses all of the previously calculated Krylov subspace basis vectors to get a better picture of the Krylov subspace.  We will see later in this presentation that Arnoldi's method has a much faster convergence rate than the power method.}
\end{frame}

\section{Arnoldi's Method}
\begin{frame}{Arnoldi's Method}
    \begin{block}{Krylov Subspace}
        \begin{align*}
            \mathcal{K}_m(\A, v) &\equiv \mathspan\left\{v, \A v, \A^2v, \ldots, \A^{m-1}v\right\} \\[0.5em]
            \mathcal{K}_m(\A, v) &\equiv \mathspan\left\{v_0, v_1, v_2, \ldots, v_{m-1}\right\}
        \end{align*}
    \end{block}
        \begin{itemize}
            \item Krylov subspace built iteratively
            \item Vectors are orthogonalized and normalized
            \item Normalized basis vectors ($v_i$) are called Arnoldi vectors
            \item All Arnoldi vectors are stored and used
        \end{itemize}
        \note{In Arnoldi's method, we build an orthogonal subspace iteratively.  The orthogonal basis vectors are called Arnoldi vectors and all the Arnoldi vectors are used to estimate eigenpairs of the linear operator.  This is different than the power method which only uses one Krylov subspace vector.}
\end{frame}

\begin{frame}{Arnoldi Method Iteration}

    \begin{columns}[t,onlytextwidth]
    \begin{column}{0.45\textwidth}
    \begin{block}{Arnoldi Iteration}
        \begin{align*}
            v_1 &= \frac{v}{\left\|v\right\|_2} \\[0.5em]
            \tilde{v}_2 &= \A v_1 \phantom{ - h_{1,1} v_1} \\[0.5em]
            \tilde{v}_2 &= \A v_1 - h_{1,1} v_1 \\[0.5em]
            v_2 &= \frac{\tilde{v}_2}{h_{2,1}}
        \end{align*}
    \end{block}
    \end{column}
    \note{To show how Arnoldi's method proceeds I will describe an Arnoldi iteration.  We begin with an initial vector which is normalized.  ($\left\|v\right\|_2$ is the euclidean norm of the vector.)  The operator is applied to the vector as before.  The new vector is then orthgonalized against the previous vector and then normalized.  $v_1$ and $v_2$ are Arnoldi vectors.}

    \pause
    \begin{column}{0.45\textwidth}
    \begin{block}{At $m$-th iteration}
        \begin{align*}
        \tilde{v}_{m+1} &= \A v_m - \sum_{j=1}^m h_{jm} v_j \\[0.5em]
        v_{m+1} &= \frac{\tilde{v}_{m+1}}{h_{m,m+1}} \\[2.5em]
        h_{jm} &= \langle \A v_m, v_j\rangle
    \end{align*}
    \end{block}
    \end{column}
    \end{columns}
    \note{In subsequent iterations we perform much of the same calculation.  The operator is applied to a vector.  The new vector is orthgonalized against \emph{all} previously calculated  Arnoldi vectors.  Finally the vector is normalized.

    The $h_{jm}$ terms here are the inner product between the new vector and the previously calculated Arnoldi vectors.
    }
\end{frame}

\begin{frame}{Arnoldi Factorization}
\begin{equation*}
    \A V_m = V_mH_m + v_{m+1}h_{m+1,m}e_m^T
\end{equation*}
    \begin{itemize}
        \item Columns of $V_m$ are Arnoldi vectors
        \item Elements of $H_m$ are $h_{jm}$
        \item $H_m$ is the projection of \A{} onto Krylov subspace

        \vspace{1em}
        \item $H_m \in \mathbb{R}^{m \times m}$, upper-Hessenberg matrix
        \item $m$ is small, easy to calculate eigenpair of $H_m$, $\left(\mu_i, x_i\right)$
    \end{itemize}

    \note{As Arnoldi's method proceeds we create what is called the Arnoldi Factorization.  The columns of the matrix $V_m$ are the Arnoldi vectors and the elements $h_{jm}$ form an upper Hessenberg matrix $H_m$.  $H_m$ is the projection of \A{} onto the Krylov subspace.  Since $m$ is small we can calculate the eigenvalues and eigenvectors of $H_m$ cheaply using whatever routine we desire.}
\end{frame}

\begin{frame}{Finding Ritz Pairs from Arnoldi Factorization}

    \note{$y_i$ is an eigenvector of \A{} except for this residual error.}
    \begin{itemize}
        \item $\left(\mu_i, x_i\right)$ is an eigenpair of $H_m$
        \begin{alignat*}{2}
            \A V_m &= V_mH_m &+ v_{m+1}h_{m+1,m}e_m^T\phantom{x_i} \\[0.5em]
            \A V_mx_i &= V_m\left( H_mx_i \right) &+ v_{m+1}h_{m+1,m}e_m^Tx_i \\[0.5em]
            \A V_mx_i &= V_m\left( \mu_ix_i \right) &+ v_{m+1}h_{m+1,m}e_m^Tx_i \\[0.5em]
            \A y_i &= \mu_iy_i &+ v_{m+1}h_{m+1,m}e_m^Tx_i
        \end{alignat*}
        \item $y_i = V_mx_i$
        \item $\left(\mu_i, y_i\right)$ is a \emph{Ritz pair} or approximated eigenpair of \A
        \item Residual:
        \begin{equation*}
            \left|r_i\right| = \left\|\A y_i - \mu y_i\right\| = \left|h_{m+1,m}\right|\left|e_mx_i\right|.
        \end{equation*}
    \end{itemize}
    \note{Once we have calculated the eigenvalues and eigenvectors of $H_m$ we can estimate the eigenvalues and eigenvectors of \A{} by applying the Arnoldi Factorization to an eigenvector of $H_m$, $x_i$.  Because $x_i$ is an eigenvector of $H_m$ we can use it to estimate the eigenvectors and eigenvalues of \A.  We can see here that $y_i$ is an eigenvector of \A{} except for this residual error.  $y_i$ is the product of $V_m$ and an eigenvector of $H_m$ and $\left(\mu_i,y_i\right)$ is a Ritz pair or approximated eigenpair of \A.  Note that we can estimate \emph{multiple} eigenpairs of \A.  We will discuss the residual error later in this presentation.}
\end{frame}

\begin{frame}{Explicitly Restarted Arnoldi's Method}
    \begin{itemize}
        \item Begin with estimate of desired eigenvector
        \item Calculate eigenpairs of $H_m$ after a fixed number of iterations
        \item Restart Arnoldi with desired eigenvectors as new starting vector
        \item Several iterations make up one Arnoldi \emph{restart}
    \end{itemize}

    \note{After a set number of iterations we calculate the eigenvalues and eigenvectors of $H_m$ which is easy and fast since $m$ is small.  Because we need to calculate the statistical uncertainty of the calculation we restart Arnoldi's method.  To restart, we sum the desired eigenvectors and use this as the starting vector for a new Arnoldi calculation.  This is known as \emph{restarting} Arnoldi's method.  We restart Arnoldi's method multiple times so we can calculate many eigenvalue estimates so we can calculate the statistical uncertainty of the calculation.}
\end{frame}

\subsection{Monte Carlo Arnoldi's Method}
\begin{frame}{Monte Carlo Arnoldi's Method}
    \begin{itemize}
        \item \A{} is applied exactly as it is applied in power method
        \item Eigenvalues and eigenvectors estimated at end of every restart
        \item Mean and variance of estimates can be calculated
        \item Can do inactive restarts (but don't need to!)

        \vspace{1em}
        \item Orthogonalization will create negative Arnoldi vectors
        \begin{itemize}
            \item Negative fission source
        \end{itemize}
        \item Need to define inner product between two fission sources
    \end{itemize}
    \note{To reiterate: in Arnoldi's method the transport-fission operator is applied in exactly the same way as in the power method.  After a fixed number of iterations we estimate the eigenvalues and eigenvectors of \A{} and restart Arnlodi's method.  We can calculate the mean and variance of these estimates.  We can discard inactive Arnoldi restarts similarly to what we did with the power method, although we will see later that this isn't really necessary.

    The process of orthgonalizing Arnoldi vectors will inevitably create Arnoldi vectors which will have some negative elements.  This implies that we have a negative fission source or negative number of neutrons in a given region.  Furthermore, I have not yet shown how we can take the inner product of two fission sources.  I will describe how negative fission sources are dealt with next and then describe the inner product after.
    }
\end{frame}

\subsubsection{Negative Sources}
\begin{frame}{Negative Sources}
    \begin{itemize}
        \item To sample from negative fission source, normalize
        \begin{align*}
            \int \left|v(x)\right| \dd x &= q \\
            p(x) = \frac{\left|v(x)\right|}{q}
        \end{align*}
        \item $p(x) \dd x$ is probability of picking a point in $\dd x$ about $x$
        \item Neutron is given weight
        \begin{equation*}
            \omega = \begin{cases}
                \phantom{-}1, & v(x_s) > 0 \\
                -1, & v(x_s) < 1.
            \end{cases}
        \end{equation*}
    \end{itemize}
    \note{To sample from a potentially negative fission source we normalize the fission source in this way.  $p(x)$ is the PDF from which we will sample; it is everywhere positive and integrates to 1.  $p(x)\dd x$ is the probability of picking a point in $\dd x$ about $x$.

    A neutron sampled from a positive region should contribute positively whenever it tallies.  Similarly a neutron sampled from a negative region should contribute negatively to the tally each time it scores.  To accomplish this I have given each neutron a weight; positive if it is sampled from a positive region of the fission source and negative if it is sampled from a negative region.  Any variance reduction techniques can still be used.
    }
\end{frame}

\subsubsection{Spatial Discretization}
\begin{frame}{Spatial Discretization}
    \begin{itemize}
        \item Orthonormalization requires inner product between fission sources:
        \begin{equation*}
            h_{jk} = \langle v_j,v_k\rangle = \int v_j(x)v_k(x) \dd x
        \end{equation*}
    \item Discretize fission source
        \begin{equation*}
            \vP(x) = \sum_{b=1}^B a_b \Pi_b(x)
        \end{equation*}
        \begin{equation*}
            \Pi_b(x) = \begin{cases}
                \left(\frac{1}{\Delta x_b}\right)^{1/2}, & x_b \leq x < x_{b+1} \\
                0, & \mathsf{otherwise}
            \end{cases}
        \end{equation*}
    \end{itemize}
    \note{The inner product between to vectors is defined as the integral of the product of the two vectors.  To be able to calculate the inner product I have discretized the fission source into spatial bins.  The value of the fission source is constant in each bin.
    }
\end{frame}

\begin{frame}{Inner Product of Fission Sources}
    \begin{itemize}
        \item Discretization:
        \begin{equation*}
            \vP(x) = \sum_{b=1}^B a_b \Pi_b(x)
        \end{equation*}

        \item Arnoldi vector representation:
        \begin{equation*}
            \vP = \left[a_1, a_2, \ldots, a_B\right]^T
        \end{equation*}

        \item Inner product of discretized fission sources:
        \begin{equation*}
            h_{jk} = \langle \vP^{(j)},\vP^{(k)}\rangle = \sum_{b=1}^B a_b^{(j)}a_b^{(k)}
        \end{equation*}
    \end{itemize}
    \note{With the fission source represented as a linear approximation of piecewise functions the elements of the Arnoldi vector are the expansion coefficients.  The inner product between two fission sources is the sum of the product of the elements of the vector.}
\end{frame}

\begin{frame}{Sampling from Discretized Source}
    \begin{itemize}
        \item $\vP(x)$ is a first order accurate approximation of fission source
        \item To sample from $\vP(x)$, normalize
            \begin{align*}
                q &= \sum_{b=1}^B \left|a_b\right| \\[0.5em]
                p_b &= \left|a_b\right|/q
            \end{align*}
        \item $p_b$ is probability of sampling from bin $b$
        \item Bin $b$ is sampled \emph{uniformly} to determine neutron position
    \end{itemize}
    \note{Sampling from the discretized fission source isn't very different than what I already described.  The source is normalized as before and the quantity $p_b$ here is the probability of sampling from bin $b$.  Once a bin has been chosen, the position of the particle is sample uniformly within in the bin.
    }
\end{frame}

\subsection{Numerical Results}
\begin{frame}{Numerical Results}
    \begin{itemize}
        \item Homogeneous slab
        \item $\nu\Sigma_f = 1.0$, $\Sigma_a = 0.2$, $\Sigma_s = 0.8$, $\Sigma_t = 1.0$
        \item 0.2, 2.0, 20 mfp thick
        \item Geometry and cross sections match published results
        \note{One slab is ridiculuously thin, one thin, and one is modestly thick.  These cross sections and slab widths were chosen to match published results.}

        \vspace{1em}
        \item Parameters:
            \begin{itemize}
                \item 1 \e{5} particles per iteration
                \item 25 inactive, 100 active Arnoldi restarts, 10 iterations per restart
                \item 250 inactive, 1000 active power iterations
                \note{It is important to note here that the total number of iterations is the same between Arnoldi's method and the power method as well as the total number of particles tracked.  However, the power method calculates an estimate of the fundamental eigenvalue at each iteration while Arnoldi's method only estimates an eigenvalue at the end of every restart; thus the power method has 10 times more eigenvalue estimates than Arnoldi's method.}
                \item 50 spatial bins (0.2 mfp), 75 spatial bins (2.0, 20 mfp)
            \end{itemize}
    \end{itemize}
\end{frame}

\begin{frame}{Numerical Results}

\begin{table}[h]\centering
    \begin{tabular}{ccccc}
        \toprule
        Width & \multirow{2}{*}{Method} & \multirow{2}{*}{Eigenvalue} & Standard & \multirow{2}{*}{Reference} \\ %& \multirow{2}{*}{Error} \\
        (DR) & & & Deviation & \\
        \midrule
        0.2 & Power    & 0.329979 & 6.3\e{-5} & \multirow{2}{*}{0.330000}            \\ %& 2.1\e{-5} \\
        (0.2400)   & Arnoldi      &  0.33008 & 1.8\e{-4} &   \\ %& 8.3\e{-5} \\
        \midrule
        2.0 & Power    &  2.09593 & 2.7\e{-4} &  \multirow{2}{*}{2.09599}            \\ %& 6.0\e{-5} \\
        (0.4015) & Arnoldi      &  2.09652 & 6.9\e{-4} &      \\ %& 5.3\e{-4} \\
        \midrule
        20 & Power     &  4.82734 & 6.3\e{-4} &  \multirow{2}{*}{4.82780}            \\ %& 4.6\e{-4} \\
        (0.9079) & Arnoldi &   4.8290 & 1.5\e{-3} &            \\ %& 1.2\e{-3} \\
         \bottomrule
     \end{tabular}
     \label{tab:BasicResults}
\end{table}
\end{frame}

\begin{frame}{Eigenvalue Convergence}
    \begin{figure} \centering
        \includegraphics[width=0.9\textwidth,keepaspectratio]{Figures/BasicValues}
    \end{figure}
\end{frame}

\begin{frame}{Fundamental Eigenvector}
    \begin{figure} \centering
        \includegraphics[width=0.9\textwidth,keepaspectratio]{Figures/BasicFundamental}
    \end{figure}
\end{frame}

\begin{frame}{Multiple Eigenvectors}
    \begin{figure} \centering
        \includegraphics[width=0.9\textwidth,keepaspectratio]{Figures/BasicVectors}
    \end{figure}
\end{frame}

\begin{frame}{Figure of Merit}
\begin{table}[h] \centering
    \begin{tabular}{ccccc}
        \toprule
        Width & \multirow{2}{*}{Method} & Standard & \multirow{2}{*}{FOM} & Time \\
        (mfp) & & Deviation & & (sec)\\
        \midrule
        \multirow{2}{*}{0.2}    & Power   & 6.3\e{-5} & 1.7\e{6} &  149.0 \\
                                & Arnoldi & 1.8\e{-4} & 3.3\e{5} &   95.3 \\
        \cmidrule{2-5}
        \multirow{2}{*}{2.0}    & Power   & 2.7\e{-4} & 5.5\e{4} &  258.1 \\
                                & Arnoldi & 6.9\e{-4} & 9.8\e{3} &  212.5 \\
        \cmidrule{2-5}
        \multirow{2}{*}{20}     & Power   & 6.3\e{-4} & 5.4\e{3} &  463.0 \\
                                & Arnoldi & 1.5\e{-3} & 1.1\e{3} &  378.5 \\
        \bottomrule
    \end{tabular}
\end{table}
\end{frame}

\begin{frame}{Figure of Merit}
    \begin{columns}
    \begin{column}{0.45\textwidth}
    \begin{block}{Figure of Merit}
        \begin{equation*}
            \mathsf{FOM} \equiv \frac{1}{\sigma^2 T}
        \end{equation*}
    \end{block}
    \end{column}
    \end{columns}

    \pause
    \begin{columns}[m]
        \begin{column}{0.45\textwidth}
        \begin{block}{Variance}
            \begin{equation*}
                \sigma^2 \equiv \frac{1}{N-1}\left(\frac{1}{N}\sum_{n=1}^N \left(x_n - \overline{x}\right)^2\right)
            \end{equation*}
        \end{block}
        \end{column}

        \begin{column}{0.45\textwidth}
        \begin{block}{Spread}
            \begin{equation*}
                \mathscr{s} \equiv \frac{1}{N}\sum_{n=1}^N \left(x_n - \overline{x}\right)^2
            \end{equation*}
        \end{block}
        \end{column}
    \end{columns}

    \note{There are types all over in the dissertation which I discovered after it was printed.}

    \pause
    \begin{table}[h]
        \centering
        \begin{tabular}{cccc}
            \toprule
            & 0.2 mfp & 2.0 mfp & 20 mfp \\
            \midrule
            Power    & 0.0020 & 0.0084 & 0.0201 \\
            Arnoldi  & 0.0018 & 0.0069 & 0.0153 \\
            \bottomrule
        \end{tabular}
    \end{table}
    \begin{center} Spread of eigenvalue estimates \end{center}
        \note{We can see that the spread in the eigenvalue estimates is smaller for Arnoldi's method.  Arnoldi's method has less uncertainty in the eigenvalue estimate than the power method.}
\end{frame}

\section{Spatial Discretization}
\begin{frame}{Discretization Error}
    \begin{figure}\centering
        \includegraphics[width=.90\textwidth,keepaspectratio]{Figures/EigenvalueError}
    \end{figure}
\end{frame}
\begin{frame}{Spatial Approximations}
    \begin{figure}
        \includegraphics<1>[width=\textwidth,keepaspectratio]{Figures/HistogramCartoon}
        \includegraphics<2>[width=\textwidth,keepaspectratio]{Figures/LinearCartoon}
    \end{figure}
\end{frame}

\begin{frame}{Spatial Approximations}
\begin{columns}[t,onlytextwidth]
    \begin{column}{0.45\textwidth}
        \begin{block}{First Order Accurate}
            \begin{gather*}
                \vP(x) = \sum_{b=1}^B a_b \Pi_b(x) \\[0.5em]
                \Pi_b(x) = \left(\frac{1}{\Delta x_b}\right)^{1/2} \\[0.5em]
                \vP = \left[a_1, a_2, \ldots, a_B\right]^T
            \end{gather*}
        \end{block}
    \end{column}

    \begin{column}{0.45\textwidth}
        \begin{block}{Second Order Accurate}
            \begin{gather*}
                \vL(x) = \sum_{b=1}^B \Lx \\[1.5em]
                \Lx = \alpha_b + \beta_b x \\[1.5em]
                \vL = \left[\alpha_1, \beta_1, \alpha_2, \beta_2, \ldots, \alpha_n, \beta_B\right]^T
            \end{gather*}
        \end{block}
    \end{column}
\end{columns}
\note{$\alpha$ and $\beta$ are determined by the 1st and 2nd order moments.}
\end{frame}

\begin{frame}{Numerical Results}
    \only<1>{%
    \begin{itemize}
        \item 20 mfp homogeneous thick
        \item $\nu\Sigma_f = 1.0$, $\Sigma_a = 0.2$, $\Sigma_s = 0.8$, $\Sigma_t = 1.0$
        \item 1 \e{6} particles per iteration
        \item 50 inactive, 100 active Arnoldi restarts, 10 iterations per restart
        \item First and second order accurate spatial approximations
        \item 10--150 spatial bins
    \end{itemize}}
    \begin{center}
        \includegraphics<2>[width=0.9\textwidth, keepaspectratio]{Figures/BiasError}
    \end{center}
\end{frame}

\begin{frame}{Spatial Discretization---FOM}
    \begin{figure}\centering
        \includegraphics[width=.90\textwidth,keepaspectratio]{Figures/ErrorFOM}
    \end{figure}
\end{frame}

\begin{frame}{Spatial Discretization---Eigenvectors}
    \begin{figure}
        \includegraphics<1>[width=0.9\textwidth,keepaspectratio]{Figures/LinearVectors}
        \includegraphics<2>[width=0.9\textwidth,keepaspectratio]{Figures/HistoLinearVectors}
    \end{figure}
\end{frame}

\begin{frame}{Spatial Discretization---Conclusions}
    \begin{itemize}
        \item Spatially discretizing can cause an error in the eigenvalue estimate
        \item Second order accurate approximation:
            \begin{itemize}
                \item Reduces error
                \item Reduces standard deviation
                \item Increases figure of merit
                \item Improves eigenvector estimate
            \end{itemize}
    \end{itemize}
\end{frame}
\subsection{Numerical Results}

\section{Relaxed Arnoldi}
\begin{frame}{Relaxed Arnoldi}
    \begin{block}{Residual}
        \begin{equation*}
            \left|r_m\right| = \left\|\A y - \mu y\right\| = \left|h_{m+1,m}\right|\left|e_mx_i\right|.
        \end{equation*}
    \end{block}
    \pause
    \vspace{1em}
    Bouras and Frayss\'e:
    \begin{itemize}
        \item Can \emph{relax} application of \A{}
        \item Maintain convergence of Arnoldi's method
        \item Save computational expense
    \end{itemize}
\end{frame}

\begin{frame}{Relaxing Monte Carlo Arnoldi}
    Relax Monte Carlo = Run fewer particles
    \begin{columns}[t]
    \begin{column}{0.45\textwidth}
    \begin{itemize}
        \item As residual decreases:
        \begin{itemize}
            \item Relaxation \emph{increases}
            \item Number of particles tracked \emph{decreases}
        \end{itemize}
        \item Relaxation controlled by parameter $\eta$
    \end{itemize}
    \end{column}
    \note{One could choose a different technique for reducing the number of particles in an iteration.  I chose this one.}

    \begin{column}{0.55\textwidth}
        \begin{block}{Number of particles tracked}
            \begin{align*}
                N_k &= f\,N_0 \\[0.5em]
                f &=
                \begin{cases}
                    \left(\left\|r_{k-1}\right\|/\eta\right)^2, & \left\|r_{k-1}\right\| < \eta \\
                    1, & \left\|r_{k-1}\right\| \geq \eta
                \end{cases}
            \end{align*}
        \end{block}
    \end{column}
    \end{columns}

\end{frame}

\subsection{Numerical Results}
\begin{frame}{Numerical Results}
    \only<1>{%
    \begin{itemize}
        \item $\nu\Sigma_f = 1.0$, $\Sigma_a = 0.2$, $\Sigma_s = 0.8$, $\Sigma_t = 1.0$
        \item 50 mfp thick slab (DR = 0.9924)
        \item 100 inactive restarts

        \vspace{1em}
        \item $\eta$ ranges from 1E8--1.0
        \item Total number of particles is the same for all values of $\eta$
    \end{itemize}
    }
    \note{I use the same cross sections as before, but this time have a 50 mfp thick slab.}
    \begin{figure}
        \includegraphics<2>[width=0.9\textwidth,keepaspectratio]{Figures/Relaxed}
        \includegraphics<3>[width=0.9\textwidth,keepaspectratio]{Figures/ValueFOM}
    \end{figure}
\end{frame}

\begin{frame}{Numerical Results}
    \begin{figure}
        \includegraphics<1>[width=0.9\textwidth,keepaspectratio]{Figures/RelaxedComboValues}
        \includegraphics<2>[width=0.9\textwidth,keepaspectratio]{Figures/RelaxedComboFOM}
    \end{figure}
\end{frame}

\section{Convergence and Entropy}
\begin{frame}{Convergence in Monte Carlo Criticality Calculations}
    \begin{itemize}
        \item Eigenvalue estimate converges proportional to dominance ratio $\lambda_1/\lambda_0$
        \item Fission source converges more slowly
        \item Shannon entropy
        \begin{align*}
            H\left(S(x)\right) &\equiv -\sum_{b=1}^B S_b\log\left(S_b\right) \\[0.5em]
            S_b &= \int_{x_b}^{x_{b+1}} \left|v(x)\right| \dd x
        \end{align*}
    \end{itemize}
\end{frame}

\subsection{Shannon Entropy and Convergence}
\subsection{Numerical Results}
\subsubsection{Homogeneous Geometry}
\begin{frame}{Homogeneous Geometry}
    \begin{itemize}
        \item 50 mfp thick
        \item $\nu\Sigma_f = 1.0$, $\Sigma_a = 0.2$, $\Sigma_s = 0.8$, $\Sigma_t = 1.0$
        \item 5\e{5} particles per iteration
        \item 75 spatial bins (first order accurate)
        \item Source solely in left most bin
    \end{itemize}
\end{frame}

\begin{frame}{Homogeneous Geometry}
\begin{columns}[t,onlytextwidth]
    \begin{column}{0.5\textwidth}
        \includegraphics[width=1.1\textwidth,keepaspectratio]{Figures/50mfpPower}
        \begin{center} \hspace{6ex}Power Method \end{center}
    \end{column}
    \begin{column}{0.5\textwidth}
        \includegraphics[width=1.1\textwidth,keepaspectratio]{Figures/50mfpArnoldi}
        \begin{center} \hspace{2ex}Arnoldi's Method \end{center}
    \end{column}
\end{columns}
\end{frame}

\subsubsection{Heterogeneous Geometry}
\begin{frame}{Heterogeneous Geometry}
\begin{columns}
    \begin{column}{0.3\textwidth}
    Parameters:
    \begin{itemize}
        \item 1\e{5} particles per iteration
        \item 10 iterations per Arnoldi restart
        \item 300 spatial bins (first order accurate)
        \item Source solely in left most bin
        \item Symmetric
        \item Asymmetric
    \end{itemize}
    \end{column}

    \begin{column}{0.7\textwidth}
        \includegraphics[width=\textwidth, keepaspectratio]{Figures/MultimediaCartoon}
    \end{column}
\end{columns}
\end{frame}

% Asymmetric Geometry
\begin{frame}{Asymmetric Heterogeneous Geometry}
\begin{columns}[t,onlytextwidth]
    \begin{column}{0.5\textwidth}
        \includegraphics[width=1.1\textwidth,keepaspectratio]{Figures/AsymmetricPower}
        \begin{center} \hspace{6ex}Power Method \end{center}
    \end{column}
    \begin{column}{0.5\textwidth}
        \includegraphics[width=1.1\textwidth,keepaspectratio]{Figures/AsymmetricArnoldi}
        \begin{center} \hspace{2ex}Arnoldi's Method \end{center}
    \end{column}
\end{columns}
\end{frame}

% Symmetric Geometry
\begin{frame}{Symmetric Heterogeneous Geometry}
\begin{columns}[t,onlytextwidth]
    \begin{column}{0.5\textwidth}
        \includegraphics[width=1.1\textwidth,keepaspectratio]{Figures/SymmetricPower}
        \begin{center} \hspace{6ex}Power Method \end{center}
    \end{column}
    \begin{column}{0.5\textwidth}
        \includegraphics[width=1.1\textwidth,keepaspectratio]{Figures/SymmetricArnoldi}
        \begin{center} \hspace{2ex}Arnoldi's Method \end{center}
    \end{column}
\end{columns}
\end{frame}

\section{Conclusions}
\begin{frame}{Conclusions}
    \begin{itemize}[<+->]
        \item Arnoldi's method can be used in Monte Carlo Criticality Calculations
        \item Arnoldi's method can estimate multiple eigenvalues
        \item Fission source is discretized
        \begin{itemize}[<.->]
            \item Discretization causes error in eigenvalue estimate
            \item Second order accurate approximation reduces error and standard deviation
        \end{itemize}
        \item Relaxing Arnoldi's method can increase the figure of merit
        \begin{itemize}
            \item But you must be careful
        \end{itemize}
        \item Arnoldi's method converges in just a few iterations
        \begin{itemize}[<.->]
            \item Eigenvalue estimate
            \item Fission source
        \end{itemize}
    \end{itemize}
\end{frame}
\subsection{Future Work}
\begin{frame}{Future Work}
    \begin{itemize}
        \item Multi-dimensional and real-world problems
        \item Implicit restarts
        \item Calculating eigenvalue estimates at every iteration
        \item Condensing Arnoldi's method
    \end{itemize}
\end{frame}

\begin{frame}{Implicitly Restarted Arnoldi's Method}
    Danny Sorensen:
    \begin{itemize}
        \item Arnoldi's method can be \emph{implicitly} restarted
        \item Implicit restarts trade iterations of the \QR{} algorithm for Arnoldi iterations---much faster
        \item More robust restarts
        \item Mathematically equivalent to explicit restarts
    \end{itemize}
\end{frame}

\begin{frame}{Calculating Eigenvalue Estimates at Every Iteration}
\begin{table}[h] \centering
    \begin{itemize}
        \item $\sigma^2 \propto 1/N$
        \item Can increase $N$ in Arnoldi's method by estimating eigenvalue after every iteration
    \end{itemize}

    \pause
    \vspace{1em}
    \begin{tabular}{rccc}
        \toprule
        & $\lambda_0$ & $\sigma$ & FOM \\
        \midrule
        Arnoldi* & 4.82806 & 6.3\e{-4} & 6.6\e{3} \\
        Power    & 4.82734 & 6.3\e{-4} & 5.4\e{3} \\
        Arnoldi  &  4.8290 & 1.5\e{-3} & 1.1\e{3} \\
        \bottomrule
    \end{tabular}
\end{table}
\end{frame}

\begin{frame}{Condensing Arnoldi's Method}
    \only<1>{
    \begin{itemize}
        \item Arnoldi's method does not need many iterations to converge
        \item Why not condense all particles tracked to just a few iterations?
    \end{itemize}}
    \begin{figure} \centering
        \includegraphics<2>[width=0.9\textwidth,keepaspectratio]{Figures/CondensedVectors}
    \end{figure}
\end{frame}

\begin{frame}{Questions?}
    \begin{center}
        \includegraphics[width=\textwidth,keepaspectratio]{Figures/SplitM}
    \end{center}
\end{frame}

\section{Extra Slides}
\begin{frame}{Extra Slides}

\end{frame}
\begin{frame}{Spatial Approximations}
\begin{columns}[t,onlytextwidth]
    \begin{column}{0.45\textwidth}
        \begin{block}{First Order Accurate}
            \begin{equation*}
                \vP(x) = \sum_{b=1}^B a_b \Pi_b(x)
            \end{equation*}
            \begin{equation*}
                \Pi_b(x) = \left(\frac{1}{\Delta x_b}\right)^{1/2}
            \end{equation*}
        \end{block}
    \end{column}

    \begin{column}{0.45\textwidth}
        \begin{block}{Second Order Accurate}
            \begin{equation*}
                \vL(x) = \sum_{b=1}^B \Lx
            \end{equation*}
            \begin{equation*}
                \Lx = \alpha_b + \beta_b x
            \end{equation*}
        \end{block}
    \end{column}
\end{columns}
\end{frame}

\begin{frame}{Spatial Approximations}
\begin{columns}[t,onlytextwidth]
    \begin{column}{0.45\textwidth}
        \begin{block}{First Order Accurate}
            \begin{equation*}
                \vP = \left[a_1, a_2, \ldots, a_B\right]^T
            \end{equation*}
            \begin{multline*}
                h_{jk} = \langle \vP^{(j)},\vP^{(k)}\rangle = \\
                \sum_{b=1}^B a_b^{(j)}a_b^{(k)}
            \end{multline*}
        \end{block}
    \end{column}

    \begin{column}{0.45\textwidth}
        \begin{block}{Second Order Accurate}
        \begin{equation*}
            \vL = \left[\alpha_1, \beta_1, \alpha_2, \beta_2, \ldots, \alpha_n, \beta_B\right]^T
        \end{equation*}
        \begin{multline*}
            h_{jk} = \langle \vP^{(j)},\vP^{(k)}\rangle = \\
            \sum_{b=1}^B \left(\alpha_b^{(j)}\alpha_b^{(k)} + \beta_b^{(j)}\beta_b^{(k)} \right)
        \end{multline*}
        \end{block}
    \end{column}
\end{columns}
\end{frame}

\subsubsection{Sampling}
\begin{frame}{Sampling from $\vL(x)$}
    \begin{itemize}
        \item To sample from $\vL(x)$, normalize
            \begin{align*}
                q_b &= \int \left|\Lx\right| \dd x \\[0.5em]
                Q &= \sum_{b=1}^B q_b \\[0.5em]
                p_b &= q_b/Q \\[0.5em]
                p &= \frac{1}{Q}\left[p_1, \ldots, p_B\right]
            \end{align*}
        \item $p_b$ is probability of sampling from bin $b$
        \item Bin $b$ is sampled to determine neutron position from PDF
            \begin{equation*}
                p_b(x) = \frac{1}{q_b}\left|\Lx\right|
            \end{equation*}
    \end{itemize}
\end{frame}

\end{document}


\section{Modelling}
\label{sec:modelling}

\section{Initial tests}
\label{sec:initialTests}
To get a feelling of the baseline performance of the models available in
the \emph{scikit} package severall were tried with the default parameters
(except were not possible), see \vref{tab:initialModelScores}.

\begin{table}[!h]
    \caption{}
    \label{tab:initialModelScores}
    \centering
    \begin{tabular}{cc}
        Model & AUC ROC Score \\
        \hline
        GradientBoostingClassifier & 0.9212 \\
        AdaBoostClassifier & 0.9008 \\
        BaggingClassifier & 0.8428 \\
        VotingClassifier & 0.8233 \\
        RandomForestClassifier & 0.8160 \\
        ExtraTreesClassifier & 0.8154 \\
        QuadraticDiscriminantAnalysis & 0.8053 \\
        KNeighborsClassifier & 0.7267 \\
        GaussianProcessClassifier & 0.7022 \\
        DecisionTreeClassifier & 0.6729 \\
        SVC & 0.6698 \\
        SGDClassifier & 0.6377 \\
        GaussianNB & 0.6718 \\
    \end{tabular}
\end{table}

With the default parameters there is, as expected, a clear dominance of
ensemble models.
The top 5 were selected for further parameter tuning.

\section{Model tuning \& selection}
\label{sec:modelTuning}

Each of the models was optimized by randomly searching a small part of the
parameter space.
The portion to explore was determined empirically by careful study of
each of the parameter.
The results are detailed in \vref{tab:hyperModelScores}.

\begin{table}[!h]
    \caption{}
    \label{tab:hyperModelScores}
    \centering
    \begin{tabular}{cc}
        Model & AUC ROC Score \\
        \hline
        GradientBoostingClassifier & 0.9369 \\
        AdaBoostClassifier & 0.9329 \\
        RandomForestClassifier & 0.9308 \\
        VotingClassifier & 0.9299 \\
        BaggingClassifier & 0.9143 \\
    \end{tabular}
\end{table}

After tuning all models were able to achieve AUR ROC scores in the .9 range,
but \emph{GradientBoostingClassifier} outperformed the others.
As there are no other constraints model selection is based solely on the score.

\section{Feature Elimination}
\label{sec:featureElimination}

Running recursive feature elimination on the model identified in the previous
section the optimal number of features was determined to be 31 and are the
following:
\begin{itemize}
    \item birth date
    \item interest earned
    \item monthly work
    \item job type--federal-gov
    \item job type--self-emp-not-inc
    \item school level--10th
    \item school level--advanced post graduate
    \item school level--college graduate
    \item school level--primary school
    \item school level--secondary
    \item school level--some post graduate
    \item domestic status--married 1
    \item domestic status--married 2
    \item domestic status--spouse passed
    \item profession--C-level
    \item profession--defense contractor
    \item profession--mechanic
    \item profession--other
    \item profession--secretarial
    \item profession--specialist technician
    \item profession--trucking
    \item profession--vocational
    \item domestic relationship type--has husband
    \item domestic relationship type--not living with family
    \item ethnicity--afro american
    \item country of origin--GR
    \item country of origin--HU
    \item country of origin--IE
    \item country of origin--JP
    \item country of origin--PH
    \item country of origin--US
\end{itemize}

\begin{figure}[!h]
    \caption{Score change.}
    \label{fig:score-features}
    \centering
    \scalebox{0.5}{\input{././img/score-features.pgf}}
\end{figure}

\Vref{fig:score-features} displays how the AUC ROC score changes with  the number of features.
Since there are no computational limitations and the prediction does not
deteriorate with the number of features this exercise is a mere curiosity.

Is is interesting however to compare the selected features with their
correlation (see \vref{tab:feature-correlation}) with the target,
remember that a positive correlation means it more likely to end up
unemployed in 12 months.
The selected features that correlate positively with being unemployed
soon are presented in the following list.
Note that this list says nothing of the decision surface of our model,
having any combination of these features does not mean that you are
more likely to become unemployed.
\begin{itemize}
    \item birth date
    \item school level--10th
    \item school level--secondary
    \item domestic status--spouse passed
    \item profession--mechanic
    \item profession--other
    \item profession--secretarial
    \item profession--trucking
    \item profession--vocational
    \item domestic relationship type--not living with family
    \item ethnicity--afro american
    \item country of origin--US
\end{itemize}

\begin{table}[!h]
\caption{Selected features and respective correlation.}
\label{tab:feature-correlation}
\centering
\begin{tabular}{cc}
    birth date & 0.114102 \\
    interest earned & -0.148656 \\
    monthly work & -0.110180 \\
    job type--federal-gov & -0.042745 \\
    job type--self-emp-not-inc & -0.065876 \\
    school level--10th & 0.047029 \\
    school level--advanced post graduate & -0.139795 \\
    school level--college graduate & -0.129046 \\
    school level--primary school & -0.077406 \\
    school level--secondary & 0.083645 \\
    school level--some post graduate & -0.145206 \\
    domestic status--married 1 & -0.047914 \\
    domestic status--married 2 & -0.469246 \\
    domestic status--spouse passed & 0.050169 \\
    profession--C-level & -0.131167 \\
    profession--defense contractor & -0.010123 \\
    profession--mechanic & 0.046294 \\
    profession--other & 0.105133 \\
    profession--secretarial & 0.036197 \\
    profession--specialist technician & -0.171728 \\
    profession--trucking & 0.005404 \\
    profession--vocational & 0.011720 \\
    domestic relationship type--has husband & -0.481157 \\
    domestic relationship type--not living with family & 0.094195 \\
    ethnicity--afro american & 0.068792 \\
    country of origin--GR & -0.016763 \\
    country of origin--HU & -0.016763 \\
    country of origin--IE & -0.009930 \\
    country of origin--JP & -0.027360 \\
    country of origin--PH & -0.024337 \\
    country of origin--US & 0.004980 \\
\end{tabular}
\end{table}


% !TeX program = lualatex
% !TeX spellcheck = en_US
% !TeX encoding = UTF-8

%https://www.forrestthewoods.com/blog/memory-bandwidth-napkin-math/

% COMPILE WITH:
% latexmk -pdflatex=lualatex -pdf -outdir=build %
% You need lualatex and biber (in all TeXLive distributions)
\documentclass{beamer}
\usepackage{fontawesome} %using symbols
\usepackage{ifthen} %conditional commands
\usepackage{xstring} %for string comparisons
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{tikz}
\usepackage{ulem}
\input{./packages}
\input{./glossaries}
\bibliography{references.bib}

%https://tex.stackexchange.com/questions/285578/how-to-draw-parallelepiped-and-cube-with-latex/288101#288101
%for loops https://tex.stackexchange.com/questions/29877/need-help-creating-a-3d-cube-from-a-2d-set-of-nodes-in-tikz
\newcommand{\tikzcuboid}[4]{% width, height, depth, scale
\begin{tikzpicture}[scale=#4]
\foreach \x in {0,...,#1}
{   \draw (\x ,0  ,#3 ) -- (\x ,#2 ,#3 );
    \draw (\x ,#2 ,#3 ) -- (\x ,#2 ,0  );
}
\foreach \x in {0,...,#2}
{   \draw (#1 ,\x ,#3 ) -- (#1 ,\x ,0  );
    \draw (0  ,\x ,#3 ) -- (#1 ,\x ,#3 );
}
\foreach \x in {0,...,#3}
{   \draw (#1 ,0  ,\x ) -- (#1 ,#2 ,\x );
    \draw (0  ,#2 ,\x ) -- (#1 ,#2 ,\x );
}
\end{tikzpicture}
}
\newcommand{\tikzcube}[2]{% length, scale
\tikzcuboid{#1}{#1}{#1}{#2}
}
\newcommand{\floor}[1]{\lfloor #1 \rfloor}
\captionsetup[figure]{font=small}
\captionsetup[subfigure]{singlelinecheck=off,justification=raggedright,font=scriptsize}
%\captionsetup{singlelinecheck=off,justification=raggedleft,labelformat=empty,labelsep=none}

\title{Robust, in-place, parallelized Seeded Region Growing for 3D image segmentation}
\subtitle{
  Studienarbeit \textsl{Medizin}
}
  %\\[1ex]
  %\insertdate\\[1ex]
  %\insertauthor\\[1ex]
\author{Jan Philipp Hafer\\[1ex]
Supervisor Dr. Felix Gremse}
\date{Winter Semester 2020}

\begin{document}
\begin{frame}[plain]
  \titlepage
\end{frame}
\begin{frame}{Table of Contents}
  \tableofcontents
\end{frame}
\section{Algorithm input - shapes of 3D scan data}
\begin{frame}{\insertsection}
\begin{minipage}{0.5\textwidth}%
  Voxel (size 1 Byte):
\tikzcuboid{1}{1}{1}{0.5}\\
  Cube ($4\times 4\times 4=64$B):
\tikzcuboid{4}{4}{4}{0.5}\\
  Cuboid:\\
\tikzcuboid{8}{4}{4}{0.5}
\end{minipage}%
\begin{minipage}{0.5\textwidth}%
  Path: \tikzcuboid{4}{1}{1}{0.5}\\
  Dilation: \tikzcuboid{2}{2}{2}{0.5}\\
  Dilated path: \tikzcuboid{5}{2}{2}{0.5}
\end{minipage}%
\end{frame}
\section{Seeded Region Growing}
\begin{frame}
  \tableofcontents[currentsection]
\end{frame}
\subsection{Why Seeded Region Growing?}
\begin{frame}{Why~\ac{srg}?}
  Purpose of~\ac{srg}:\\
  Determine and visualize connected voxel of a 3D scan for patient treatment from a user-defined starting point.\\
  %voxel do not need to be cubic!
  \vspace{1cm}
  \begin{enumerate}
      \item simple
      \item fast
      \item robust
  \end{enumerate}
\end{frame}

\begin{frame}{\Ac{srg} in 2D}
\centering
\begin{tcolorbox}[boxsep=1pt,left=0pt,right=0pt,top=0pt,bottom=0pt,title=round 0]
\begin{figure}[h]
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg1.pdf}
  %\\queue:\cancel{(1,1)}}
\end{subfigure}%a)
\end{figure}
\end{tcolorbox}
\begin{tcolorbox}[boxsep=1pt,left=0pt,right=0pt,top=0pt,bottom=0pt,title=round 1]
\begin{figure}[h]
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg2.pdf}
  %\\queue:}
\end{subfigure}%b)
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg3.pdf}
  %\\queue:}
\end{subfigure}%c)
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg4.pdf}
  %\\queue:(2,3)}
\end{subfigure}%d)
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg5.pdf}
  %\\queue:(2,3),(3,2)}
\end{subfigure}%e)
\end{figure}
\end{tcolorbox}
\begin{tcolorbox}[boxsep=1pt,left=0pt,right=0pt,top=0pt,bottom=0pt,title=round 2]
\begin{figure}[h]
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg6.pdf}
  %\\queue:\cancel{(2,3)},(3,2)}
\end{subfigure}%f)
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg7.pdf}
  %\\queue:(3,2)}
\end{subfigure}%g)
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg8.pdf}
  %\\queue:(3,2)}
\end{subfigure}%h)
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg9.pdf}
  %\\queue:(3,2),(3,3)}
\end{subfigure}%i)
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg10.pdf}
  %\\queue:\cancel{(3,2)},(3,3)}
\end{subfigure}%j)
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg11.pdf}
  %\\queue:(3,3)}
\end{subfigure}%k)
\end{figure}
\end{tcolorbox}
\begin{tcolorbox}[boxsep=1pt,left=0pt,right=0pt,top=0pt,bottom=0pt,title=round 3]
\begin{figure}
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg12.pdf}
  %\\queue:\cancel{(3,3)}}
\end{subfigure}%l)
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg13.pdf}
  %\\queue:}
\end{subfigure}%m)
\begin{subfigure}[b]{0.15\linewidth}%
\centering
  \includegraphics[width=0.8\linewidth]{figures/srg14.pdf}
  %\\queue:}
\end{subfigure}%n)
\end{figure}
\end{tcolorbox}
\end{frame}

\subsection{\Ac{srg} in 3D}
\begin{frame}{\insertsubsection : round 1}
  %\centering \vspace{-0.55cm}
  \includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgsteps/srgstep0.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\insertsubsection : round 2}
  %\centering \vspace{-0.55cm}
  \includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgsteps/srgstep1.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\insertsubsection : round 3}
  %\centering \vspace{-0.55cm}
  \includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgsteps/srgstep2.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\insertsubsection : round 4}
  %\centering \vspace{-0.55cm}
  \includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgsteps/srgstep3.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\insertsubsection : round 5}
  %\centering \vspace{-0.55cm}
  \includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgsteps/srgstep4.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\insertsubsection : round 6}
  \includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgsteps/srgstep5.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\insertsubsection : round 7}
  \includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgsteps/srgstep6.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\insertsubsection : round 11}
  \includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgsteps/srgstep10.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\insertsubsection : round 46}
  \includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgsteps/srgstep45.png}\\
  octahedron - dual object to cube\\
  \rightline{\color{gray} theory}
\end{frame}
%\SetAlCapNameFnt{\scriptsize}
%\SetAlCapFnt{\scriptsize}
%\begin{algorithm}[H]
%  \DontPrintSemicolon
%  %\algsetup{linenosize=\scriptsize}
% \scriptsize
%  \caption{\Ac{srg} by Adams and Bischoff} \label{alg:srg}
%  \KwData{Vector \texttt{data} as voxels with values 0(invalid) or 1(valid)}
%  \KwResult{Vector \texttt{data} as voxels with values 0(invalid), 1(unmarked) and 255(marked)}
%  queue.push(seeding\_point); \tcp*{$(x,y,z)$}
%  \While{queue.empty() == false}{
%    first\_element =  queue.front(); \tcp*{$(x,y,z)$}
%    queue.pop();\\
%    \ForAll{neighbors of first\_element}{
%      \tcc*{neighbor $\in \{(x\pm 1,y,z),(x,y\pm 1,z),(x,y,z\pm 1)\}$}
%      \If {neighbor $\in \text{Cuboid}(x_\text{max},y_\text{max},z_\text{max})$} {
%        %\tcc*{neighbor $(x,y,z)$ is in Cuboid-shaped input data}
%        offset $= x_\text{max}*y_\text{max}*z+x_\text{max}*y+x$;\\
%        neighborValue = \texttt{data}[offset];\\
%        \If{neighborValue == 1}{
%          neighborValue = 255;\\
%          queue.push(neighbor);
%        }
%      }
%    }
% }
%\end{algorithm}
\subsection{Memory access delay}
\begin{frame}{\insertsubsection}
  \centering
  \ac{mad}: Time delay of accessing data for modification in CPU core
  \begin{table}
    \small
    \caption{Memory types with~\ac{mad} on Intel x86\_64 as of 2020\footnote{\url{https://stackoverflow.com/questions/4087280/approximate-cost-to-access-various-caches-and-main-memory/33065382\#33065382}}}
    \begin{tabularx}{\textwidth}{l|l|l}
      \textbf{Memory type}      & \textbf{size}         & \textbf{time delay} \\
      \hline
      CPU core register(16 register) & 1024B                 & 0ns (no port contention)\\
      L1 data cache(L1d)        & 32\enspace\enspace KB & ca. 0.5ns (cache hit) \\
      L2 cache(per core)        & 512\enspace KB        & ca. 3-4ns (cache hit) \\
      \textbf{L3 cache(shared)} & 32\enspace\enspace MB & ca. 19ns (cache hit) \\
      RAM (ie DDR4)             & 64\enspace\enspace GB & ca. 100ns
    \end{tabularx}
  \end{table}
  \textit{Example}: Multiplication takes typically 1ns.\\
  \textbf{Additionally} CPU core: port contention.

  %CPU cores: On ports computation is done.
  %4 ports with ALU support, 2 ports for read, 1 port for write instructions.\\
\end{frame}
\subsection{Cache lines}
\begin{frame}{\insertsubsection (simplified = 4 Byte) : round 1}
  \centering\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgcache4/srgcache_step0.png}\\
  \rightline{\color{gray} practice}
\end{frame}
\begin{frame}{\insertsubsection (simplified = 4 Byte) : round 2}
  \centering\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgcache4/srgcache_step1.png}\\
  \rightline{\color{gray} practice}
\end{frame}
\begin{frame}{\insertsubsection (simplified = 4 Byte) : round 3}
  \centering\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgcache4/srgcache_step2.png}\\
  \rightline{\color{gray} practice}
\end{frame}
\begin{frame}{\insertsubsection (simplified = 4 Byte) : round 5}
  \centering\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgcache4/srgcache_step4.png}\\
  \rightline{\color{gray} practice}
\end{frame}
\begin{frame}{\insertsubsection (simplified = 4 Byte) : round 9}
  \centering\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgcache4/srgcache_step8.png}\\
  \rightline{\color{gray} practice}
\end{frame}
\begin{frame}{\insertsubsection (simplified = 4 Byte) : round 13}
  \centering\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgcache4/srgcache_step12.png}\\
  \textbf{notable overhead}, visualization out of memory\\
  \rightline{\color{gray} practice}
\end{frame}
\begin{frame}{\insertsubsection (real = 64 Byte) : round 1}
  \centering\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgcache64/srgcache_step0.png}\\
  \rightline{\color{gray} practice}
\end{frame}
\begin{frame}{\insertsubsection (real = 64 Byte) : round 2}
  \centering\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgcache64/srgcache_step1.png}\\
  \rightline{\color{gray} practice}
\end{frame}
\begin{frame}{\insertsubsection (real = 64 Byte) : round 3}
  \centering\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgcache64/srgcache_step2.png}\\
  \textbf{high overhead}, visualization out of memory\\
  \rightline{\color{gray} practice}
\end{frame}
\begin{frame}{\insertsubsection (approximation)}
  1.1 (shown in our paper) Worst case surface: $O_\text{max} = a^2+2$, $a$ edge length of Cube\\
  1.2 (shown in our paper) surface doubles in every round\\
  1.3 $a=[200,400,800] \Rightarrow O_\text{max} = [40\_000,160\_000,640\_000]$ voxel\\
  \vspace{0.3cm}
  2.1 position of surface voxel in queue: 12 Byte\\
  2.2 due to 1.2: 64 byte(2x)\\
  2.3 $\frac{\text{L3 cache size}}{\text{memory per Voxel}}=\frac{32\text{MB}}{2*64+12\text{B}} = \frac{32\text{MB}}{140\text{B}} = 239\_674 \approx 489^2$\\
  \vspace{0.3cm}
  %3.1 ignore that L3 cache is physically addressed (pages as continous chunks of 4KB or 4MB size mapping to RAM region)\\
  3.1 ignore overhead for cache management (highly architecture dependent\footnote{Patterson and Hennessey Computer Organisation and Design, example \url{https://stackoverflow.com/a/12505900}})\\
  3.2 ignore unknown influence of other processes, Kernel, ...\\
  3.3 ignore small sizes and tips of octahedron (near min/max of y and z of the algorithm surface)
\end{frame}

%\begin{frame}{\Ac{srg} with~\ac{mad} annotated}
%\centering
%\SetAlCapNameFnt{\scriptsize}
%\SetAlCapFnt{\scriptsize}
%\begin{algorithm}[H]
%  \DontPrintSemicolon
%  %\algsetup{linenosize=\scriptsize}
% \scriptsize
%  \caption{\Ac{srg} by Adams and Bischoff} \label{alg:srg}
%  \KwData{Vector \texttt{data} as voxels with values 0(invalid) or 1(valid)}
%  \KwResult{Vector \texttt{data} as voxels with values 0(invalid), 1(unmarked) and 255(marked)}
%  queue.push(seeding\_point); \tcp*{$(x,y,z)$}
%  \While{queue.empty() == false}{
%    first\_element =  queue.front(); \tcp*{$(x,y,z)$, \color{red}\ac{mad}}
%    queue.pop(); \\
%    \ForAll{neighbors of first\_element}{
%      \tcc*{neighbor $\in \{(x\pm 1,y,z),(x,y\pm 1,z),(x,y,z\pm 1)\}$}
%      \If {neighbor $\in \text{Cuboid}(x_\text{max},y_\text{max},z_\text{max})$} {
%        \tcc*{neighbor $(x,y,z)$ is in Cuboid-shaped input data}
%        offset $= x_\text{max}*y_\text{max}*z+x_\text{max}*y+x$;\\
%        neighborValue = \texttt{data}[offset]; \tcp*{\color{red}MAD}
%        \If{neighborValue == 1} {
%          neighborValue = 255;\\
%          queue.push(neighbor);
%        }
%      }
%    }
%  }
%\end{algorithm}
%  It depends, where elements of \textbf{queue} and \textbf{data} are!
%\end{frame}

\subsection{Scan data examples}
\begin{frame}{\insertsubsection: Helixes}
\begin{figure}[h]
\centering
  \begin{subfigure}[t]{0.5\textwidth}
    \centering
  \vskip 0pt
    \includegraphics[width=0.9\textwidth]{images/helixd1_800.png}
    \caption{Dilation by Cube with edge length 1.}\label{fig:helixd1_800}
  \end{subfigure}%
  \begin{subfigure}[t]{0.5\textwidth}
    \centering
  \vskip 0pt
    \includegraphics[width=0.9\textwidth]{images/helixd4_800.png}
    \caption{Dilation by Cube with edge length 4.}\label{fig:helixd4_800}
  \end{subfigure}%
  %\caption{Example \texttt{Helix}, size $800\times 800\times 800$}\label{fig:helixes}%
\end{figure}
  edge length: 200, 400 and 800 voxel\\
  reason: measure data-contention (on parallelization)
\end{frame}

\begin{frame}{\insertsubsection: Maus\_mit\_Draht}
\begin{figure}
\centering
\begin{subfigure}{.5\textwidth}
  \centering
  \includegraphics[width=.9\linewidth]{images/maus_mit_draht_unprocessed.png}
  \caption{Unprocessed \texttt{maus\_mit\_draht}.}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
  \centering
  \includegraphics[width=.9\linewidth]{images/maus_mit_draht_processed.png}
  \caption{Processed \texttt{maus\_mit\_draht}.}
\end{subfigure}
\end{figure}
  reason: measure data-contention (on parallelization)
\end{frame}

\begin{frame}{\insertsubsection: BoneMaskHigh}
\begin{figure}
\centering
  \begin{subfigure}[b]{.5\textwidth}
  \centering
  \includegraphics[width=0.9\textwidth]{images/bonemaskhigh_slice_unprocessed.png}
  \caption{Slice of \texttt{BoneMaskHigh}.}
  \end{subfigure}%
  \begin{subfigure}[b]{.5\textwidth}
  \centering
  \includegraphics[width=0.9\textwidth]{images/bonemaskhigh_unprocessed.png}
  \caption{3D visualization of \texttt{BoneMaskHigh}.}
  \end{subfigure}
\end{figure}
  reason: relation of forked structures and data-contention (on parallelization)
\end{frame}

\subsection{Results}
\begin{frame}{\Ac{srg} performance}
\centering
\small
\begin{tabularx}{\textwidth}{c|c|c|c|c}
\centering
\textbf{Example} & \textbf{size}[MB] & \textbf{written}[MB] & \textbf{speed}$[\frac{\texttt{voxel}}{\mu s}]$ & \textbf{time}[s]\\
\hline
  Helix\_D1-D5 & 7.63       & 0.007 - 0.177 & 28.1-56.6 & <3.2e-3\\
  Helix\_D1-D5 & 61.04      & 0.014 - 0.356 & 26.8-57.9 & <6.5e-3\\
  Helix\_D1-D5 & 488.28     & 0.03 - 0.72   & 24.5-47.2 & <15e-3 \\
  Maus\_mit\_Draht & 472.88 & 4.9           & 51.5      & 0.10 \\
  BoneMaskHigh & 2028.8     & 134.11        & 19.2      & 7.33
\end{tabularx}
\\
  \vspace{1cm}
  small surface in each~\ac{srg} round $\Rightarrow$ high voxel writing speed ($> 50\frac{\texttt{voxel}}{\mu s}$)\\
  big surface in many~\ac{srg} rounds $\Rightarrow$ small voxel writing speed ($\approx 17\frac{\texttt{voxel}}{\mu s}$)

\end{frame}
\section{Parallelized Seeded Region Growing}
\begin{frame}
  \tableofcontents[currentsection]
\end{frame}
\subsection{Why parallelized Seeded Region Growing?}
\begin{frame}{\insertsubsection}
\centering
  Purpose: Determine and visualize connected voxel of a 3D scan for patient treatment from a user-defined starting point.\\
  \vspace{1cm}
  \begin{enumerate}
      \item simple
      \item fast\textbf{er}: parallelized, \textbf{bigger data sets}
      \item robust
      \item \textbf{in-place} % limit overall memory, so no further volume allocation
  \end{enumerate}
\end{frame}
\subsection{Data-contention between CPU cores}
\begin{frame}{\insertsubsection}
  Cache coherency by current widespread hardware (ARM, Intel, AMD): Every CPU cache must have a valid representation of current data.\\
  Cache line in multiple L1 or L2 cache of other cores: Changes get automatically synchronized.\\
  \vspace{1cm}
\begin{minipage}{0.5\linewidth}
Ideal case of 2 threads\\
  \vspace{0.3cm}
  \includegraphics[width=.95\linewidth]{figures/datacont2.pdf}
\end{minipage}%
\begin{minipage}{0.5\linewidth}
Data contention of 2 threads\\
  \vspace{0.3cm}
  \includegraphics[width=.95\linewidth]{figures/datacont1.pdf}
\end{minipage}%
\end{frame}
\begin{frame}{\insertsubsection : step 1}
\centering
\begin{minipage}{0.5\linewidth}
\begin{figure}[h]%
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontAbad1.pdf}
  \end{subfigure}\\
  \vspace{1cm}
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontAbad2.pdf}
  \end{subfigure}%
  \caption{Thread A}
\end{figure}%
\end{minipage}%
\begin{minipage}{0.5\linewidth}
\begin{figure}[h]%
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontBbad1.pdf}
  \end{subfigure}\\
  \vspace{1cm}
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontBbad2.pdf}
  \end{subfigure}%
  \caption{Thread B}
\end{figure}%
\end{minipage}
\end{frame}
\begin{frame}{\insertsubsection : step 2}
\centering
\begin{minipage}{0.5\linewidth}
\begin{figure}[h]%
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontAbad2.pdf}
  \end{subfigure}\\
  \vspace{1cm}
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontAbad3.pdf}
  \end{subfigure}%
  \caption{Thread A}
\end{figure}%
\end{minipage}%
\begin{minipage}{0.5\linewidth}
\begin{figure}[h]%
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontBbad2.pdf}
  \end{subfigure}\\
  \vspace{1cm}
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontBbad3.pdf}
  \end{subfigure}%
  \caption{Thread B}
\end{figure}%
\end{minipage}
\end{frame}
\begin{frame}{\insertsubsection : step 3}
\centering
\begin{minipage}{0.5\linewidth}
\begin{figure}[h]%
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontAbad3.pdf}
  \end{subfigure}\\
  \vspace{1cm}
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontAbad4.pdf}
  \end{subfigure}%
  \caption{Thread A}
\end{figure}%
\end{minipage}%
\begin{minipage}{0.5\linewidth}
\begin{figure}[h]%
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontBbad3.pdf}
  \end{subfigure}\\
  \vspace{1cm}
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontBbad4.pdf}
  \end{subfigure}%
  \caption{Thread B}
\end{figure}%
\end{minipage}
\end{frame}
\begin{frame}{\insertsubsection : step 4}
\centering
\begin{minipage}{0.5\linewidth}
\begin{figure}[h]%
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontAbad4.pdf}
  \end{subfigure}\\
  \vspace{1cm}
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontAbad5.pdf}
  \end{subfigure}%
  \caption{Thread A}
\end{figure}%
\end{minipage}%
\begin{minipage}{0.5\linewidth}
\begin{figure}[h]%
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontBbad4.pdf}
  \end{subfigure}\\
  \vspace{1cm}
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontBbad5.pdf}
  \end{subfigure}%
  \caption{Thread B}
\end{figure}%
\end{minipage}
forwarding data results in processing delay
\end{frame}
\begin{frame}{\insertsubsection : step 5}
\centering
\begin{minipage}{0.5\linewidth}
\begin{figure}[h]%
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontAbad5.pdf}
  \end{subfigure}\\
  \vspace{1cm}
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontAbad6.pdf}
  \end{subfigure}%
  \caption{Thread A}
\end{figure}%
\end{minipage}%
\begin{minipage}{0.5\linewidth}
\begin{figure}[h]%
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontBbad5.pdf}
  \end{subfigure}\\
  \vspace{1cm}
  \begin{subfigure}[b]{\linewidth}%
  \includegraphics[width=.95\linewidth]{figures/datacontBbad6.pdf}
  \end{subfigure}%
  \caption{Thread B}
\end{figure}%
\end{minipage}
forwarding data results in processing delay, AGAIN...
\end{frame}
\subsection{\texttt{simple parallel Seeded Region Growing (simpaSRG)}}
\begin{frame}{\insertsubsection}
  Idea for~\ac{simpa}:
  \begin{enumerate}
    \item Every 1000 successfull voxel markings, try to start a new thread with~\ac{srg}.
    \item Every thread with~\ac{srg} works independent and deactivates itself, when finding no valid voxels.
  \end{enumerate}
\end{frame}
\begin{frame}{\texttt{simpaSRG} : round 0}
  %\vspace{-0.5cm}
\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgthreads2/srg2threads0.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\texttt{simpaSRG} : round 1}
  %\vspace{-0.5cm}
\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgthreads2/srg2threads1.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\texttt{simpaSRG} : round 2}
  %\vspace{-0.5cm}
\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgthreads2/srg2threads2.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\texttt{simpaSRG} : round 3}
  %\vspace{-0.5cm}
\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgthreads2/srg2threads3.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\texttt{simpaSRG} : round 4}
  %\vspace{-0.5cm}
\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgthreads2/srg2threads4.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\texttt{simpaSRG} : round 5}
  %\vspace{-0.5cm}
\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgthreads2/srg2threads5.png}\\
  red voxel: new thread with SRG \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\texttt{simpaSRG} : round 6}
  %\vspace{-0.5cm}
\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgthreads2/srg2threads6.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\texttt{simpaSRG} : round 7}
  %\vspace{-0.5cm}
\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgthreads2/srg2threads7.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\texttt{simpaSRG} : round 8}
  %\vspace{-0.5cm}
\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgthreads2/srg2threads8.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\texttt{simpaSRG} : round 9}
  %\vspace{-0.5cm}
\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgthreads2/srg2threads9.png}\\
  smaller surface of red SRG $\Rightarrow$ faster growing\\
	\rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\texttt{simpaSRG} : round 10}
  %\vspace{-0.5cm}
\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgthreads2/srg2threads10.png}\\
  \rightline{\color{gray} theory}
\end{frame}
\begin{frame}{\texttt{simpaSRG} : round 11}
  %\vspace{-0.5cm}
\includegraphics[trim=5cm 0.7cm 5cm 3cm, clip, width=1\linewidth]{algorithm_visualisation/srgthreads2/srg2threads11.png}\\
  \rightline{\color{gray} theory}
\end{frame}
%\SetAlCapNameFnt{\tiny}
%\SetAlCapFnt{\tiny}
%\SetKwProg{Fn}{Function}{}{end}
%\SetKwFunction{FnWatcher}{FnWatcherThread}%
%\SetKwFunction{FnWorker}{FnWorkerThread}%
%\SetKwFunction{Deactivate}{DeactivateCurrentThread}%
%\SetAlgoLongEnd
%\begin{algorithm}[H]
%  \DontPrintSemicolon
%  \caption{\acf{simpa} 1/2} \label{alg:srgpar}
%  \tiny
%  \KwData{Vector \texttt{data} as voxels with values 0(invalid) or 1(valid)}
%  \KwResult{Vector \texttt{data} as voxels with values 0(invalid), 1(unmarked) and 255(marked)}
%  \Fn(){\FnWatcher{seedpoint,data,$\ldots$}}{
%    read\_data\_from\_disk(); \\
%    start \FnWorker() in new thread; \\
%    \While{AnyWorkerThread.running == true}{
%      sleep\_for\_100milliseconds();
%    }
%    save\_data\_to\_disk();
%  }
%  %
%\end{algorithm}
%\end{frame}
%\begin{frame}{\insertsubsection (2/2)}
%\centering
%\SetAlCapNameFnt{\tiny}
%\SetAlCapFnt{\tiny}
%\SetKwProg{Fn}{Function}{}{end}
%\SetKwFunction{FnWatcher}{FnWatcherThread}%
%\SetKwFunction{FnWorker}{FnWorkerThread}%
%\SetKwFunction{Deactivate}{DeactivateCurrentThread}%
%\SetAlgoLongEnd
%\begin{algorithm}[H]
%  \DontPrintSemicolon
%  \caption{\acf{simpa} 2/2} \label{alg:srgpar}
%  \tiny
%  \KwData{Vector \texttt{data} as voxels with values 0(invalid) or 1(valid)}
%  \KwResult{Vector \texttt{data} as voxels with values 0(invalid), 1(unmarked) and 255(marked)}
%  \Fn(){\FnWorker{seedpoint,data,$\ldots$}}{
%    queue.push(seeding\_point); \\
%    countdown = 1000; \\
%    \While{queue.empty() == false}{
%      first\_element =  queue.front(); \tcp*{$(x,y,z)$, \color{red}\ac{mad}}
%      queue.pop(); \\
%      \ForAll{neighbors of first\_element}{
%        \tcc*{neighbor $\in \{(x\pm 1,y,z),(x,y\pm 1,z),(x,y,z\pm 1)\}$}
%        \If {neighbor $\in \text{Cuboid}(x_\text{max},y_\text{max},z_\text{max})$} {
%          \tcc*{neighbor $(x,y,z)$ is in Cuboid-shaped input data}
%          offset $= x_\text{max}*y_\text{max}*z+x_\text{max}*y+x$;\\
%          neighborValue = \texttt{data}[offset]; \tcp*{\color{red}MAD}
%          \If{neighborValue == 1} {
%            \eIf{countdown == 0}{
%              countdown = 1000; \\
%              \If{try\_to\_start\_\FnWorker() == failure}{
%                neighborValue = 255; \\
%                queue.push(neighbor); \\
%                countdown = countdown-1;
%              }
%            }%else
%            {
%              neighborValue = 255; \\
%              queue.push(neighbor); \\
%              countdown = countdown-1;
%            }
%          }
%        }
%      }
%    }
%    \Deactivate();
%  }
%  %
%\end{algorithm}
%\end{frame}
\subsection{Results}
\begin{frame}{Result for Helixes}
  \begin{adjustbox}{max totalsize={.9\textwidth}{.9\textheight},center}
    {\input{plots/markVoxbytimeHelix.pgf}}
  \end{adjustbox}
\end{frame}
\begin{frame}{Result for Maus\_mit\_Draht}
  \begin{adjustbox}{max totalsize={.9\textwidth}{.7\textheight},center}
    {\input{plots/times_Maus_mit_Draht_495846240.pgf}}
  \end{adjustbox}\\
  single-threaded: ca. 0.1s\\
  multi-threaded: ca. 0.55s
\end{frame}
\begin{frame}{Result for BoneMaskHigh}
  \begin{adjustbox}{max totalsize={.9\textwidth}{.7\textheight},center}
    {\input{plots/times_BoneMaskHigh_2127360000.pgf}}
  \end{adjustbox}\\
  single-threaded: ca. 7.3s\\
  multi-threaded: ca. 1s
\end{frame}
\begin{frame}{Summary of results}
  \centering
  {
    \scriptsize
  \begin{tabularx}{\textwidth}{@{}c@{}|@{}c@{}|@{}c@{}|@{}c@{}|@{}c@{}}
  \textbf{Example} & \textbf{all}[MB] & \textbf{written}[MB] &
    \textbf{speed}(1,\textbf{24}) thr & \textbf{time}[s](1,\textbf{24}) thr\\
  \hline
    Helix\_D1-D5 & 7.63 & 0.007 - 0.177 & (28.1-56.6, \textbf{0.015-0.37}) & (<3.2e-3,\textbf{<501e-3}) \\
    Helix\_D1-D5 & 61.04 & 0.014 - 0.356 & (26.8-57.9, \textbf{0.03-0.73}) & (<6.5e-3, \textbf{<514e-3}) \\
    Helix\_D1-D5 & 488.28 & 0.028 - 0.716 & (24.5-47.2,\textbf{17.2-33.2}) & (<15e-3,\textbf{<22e-3}) \\
    Maus\_mit\_Draht & 472.88 & 4.9 & (51.5, \textbf{9.4}) & (0.10,\textbf{0.55}) \\
    BoneMaskHigh & 2028.8 & 134.11 & (19.2, \textbf{139.4}) & (7.33, \textbf{1.01}) \\
  \end{tabularx}
  }
  \\
  \vspace{1cm}
  \begin{enumerate}
    \item parallelization: voxel writing speed per thread is always below $17 \frac{\text{voxel}}{\mu s}$
    \item long tube-like structures (Helix) perform worst, at maximum roughly $0.5s$
    \item forked structures perform best (BoneMaskHigh)
  \end{enumerate}
\end{frame}
\begin{frame}{Wrap up}
  \centering
  \begin{enumerate}
    \item \ac{mad} (caching) essential for performance
    \item data-contention (cache-coherence) delays processing heavily
    \end{enumerate}
\end{frame}
\begin{frame}{The end}
  \centering
  End, questions?
\end{frame}
\section{Bonus}%
\begin{frame}{\insertsection : Min/Max single core}
  \centering
  {
    \small
  \begin{tabularx}{\textwidth}{@{}c@{}|@{}c@{}|@{}c@{}|@{}c@{}|@{}c@{}}
  \textbf{Example} & \textbf{all}[MB] & \textbf{written}[MB] &
    \textbf{speed}(1,\textbf{24}) thr & \textbf{time}[s](1,\textbf{24}) thr\\
  \hline
%%Minimum single core voxel writing speed
    Helix\_D1-D5 & 61.04 &  0.014 - 0.356 & (26.8-\textbf{57.9}, 0.03-0.73) & (<6.5e-3,<514e-3)\\
%%Maximum single core voxel writing speed
    Sphere & 512e6 &  255.66 & (\textbf{17.1}, 322.3) & (15.63, 0.83)
  \end{tabularx}
  }
  \\
  \vspace{1cm}
  More L3 cache enables faster single-thread writing speed.
\end{frame}
\begin{frame}{\insertsection : Upper memory bound}
  \scriptsize
\begin{align}
  O_n^{z-plane} = \begin{cases}
    4n, &n>0\\
    1,  &n=0
  \end{cases}\label{eq:zplane}
\end{align}
The voxels above the $(z=0)$-plane in the $n-$th round are defined by $O_n^{upper} = \underbrace{(\sum_{i=1}^{n-1} 4*i)}_{=2n^2-2n} + \underbrace{(O_0^{z-plane})}_{= 1} = 2n^2 -2n +1$ and so we get
\begin{align}
  O_n^{upper} =
    \begin{cases} 2n^2 -2n +1, &n>0 \\
                            0, &n=0
    \end{cases}\label{eq:upper}
\end{align}
The total surface in the $n-th$ round is given as $O_n^{SRG} = O_n^{z-plane} + 2*O_n^{upper} = 2*(2n^2 -2n +1) + 4n = 4n^2 + 2$
\begin{align}
  O_n^{SRG} = \begin{cases}
    4n^2 + 2, &n>0 \\
           1, &n=0
  \end{cases}\label{eq:total}
\end{align}
reach any bound in $n=\floor{\frac{a}{2}}$ round
\begin{align}
  O^\text{max}_n = \begin{cases}
    a^2+2, &a \text{ even}\\
    (a-1)^2+2, &a \text{ odd}
  \end{cases}\label{eq:octahedron}
\end{align}
\end{frame}
\begin{frame}{\insertsection : Why do supervoxel-based approaches not work better?}
  Supervoxel = cuboid-shaped region containing multiple voxel\\
  A path may be constructable via a neighbor-supervoxel to 2 distinct voxel regions in a supervoxel.\\
  1. Either keep track of all regions, which is costly\\
  2. Or multiple processing necessary => What is the advantage to "regular SRG"?
\end{frame}
\begin{frame}{\insertsection : Optimise space usage}
  \footnotesize
  Currently we use a queue of position = $(x,y,z)$ = (\texttt{int32,int32,int32}).\\
  It is enough to save a queue of \texttt{offset} = (\texttt{int32}) and use
  \begin{align}
    xy_\text{max} &= x_\text{max}*y_\text{max}\\
    z &= \frac{\texttt{offset\_copy}}{xy_\text{max}}\\
    \texttt{offset\_copy} &-= z*xy_\text{max}\\
    y &= \frac{\texttt{offset\_copy}}{x_\text{max}}\\
    \texttt{offset\_copy} &-= y*x_\text{max}\\
    x &= \texttt{offset\_copy}
  \end{align}
  \begin{align}
    x_{\pm} &= \texttt{offset} \pm 1\\
    y_{\pm} &= \texttt{offset} \pm x_\text{max}\\
    z_{\pm} &= \texttt{offset} \pm xy_\text{max}
  \end{align}
  Only using 4 Byte per position: $\frac{32\text{MB}}{132\text{B}} = 254\_200 \approx 504^2 > 489^2$.\\
  Using new desktop CPU (256MB L3 cache): $\frac{256\text{MB}}{132\text{B}} = 2\_033\_601 \approx 1426^2$.
\end{frame}
\begin{frame}{\insertsection : Optimize cache lines}
  Adjust data (with empty data) to be dividable by 64 on x-coordinate for cache locality and bit shifting $y_\pm$ instead of multiplication.
  Ideally also applied on y and z to a power of 2 to use almost only bit shifting and bit masks instead of arithmetic operations.
  \tikzcuboid{100}{20}{30}{0.07}\\
  \tikzcuboid{128}{20}{30}{0.07}
\end{frame}
\begin{frame}{\insertsection : Fixing data-contention}
  1. Mitigation: identify approximately going along tubes by frequent check of queue size and distance\\
  2. Fix: Use hardware+software for special data merging on CPU core cache eviction:\\
  \centering
\begin{figure}[h]
  \begin{subfigure}[b]{.5\linewidth}%
  \centering
  \includegraphics[width=.95\linewidth]{figures/datacontfixA.pdf}
  \caption{Thread A}
  \end{subfigure}%
  \begin{subfigure}[b]{.5\linewidth}%
  \centering
  \includegraphics[width=.95\linewidth]{figures/datacontfixB.pdf}
  \caption{Thread B}
  \end{subfigure}
  \caption*{}
\end{figure}
  \vspace{-1.2cm}
\begin{figure}[h]
  \centering
  \includegraphics[width=.5\linewidth]{figures/datacontfixRES.pdf}
  \caption*{result}
\end{figure}
  $\Rightarrow$ Write cache memory as bit-wise OR, how much additional hardware complexity?
\end{frame}
\begin{frame}{\insertsection : Environment and hardware}
  1. Other programs can interfere in the cache or execution: On Linux use \texttt{isolcpus} kernel option parameter and \texttt{taskset} or dynamically with \texttt{cset} for reserving CPU cores\\
  2. Micro-architecture-specific optimizations, ie to mitigate port-contention: \texttt{-march=corei7-avx}\\
  %3. SIMD instructions for computing multiple offsets\\
\end{frame}
\begin{frame}{\insertsection : Can we disable cache?}
  In good case \textasciitilde 40 GB/s is throughput limit to get data into (L3) cache
  $\frac{40\text{GB}}{s}*\frac{\text{voxel}}{64\text{B}}$ = $655\_360 \frac{\text{voxel}}{s} \approx 0.65\frac{\text{voxel}}{\mu s}$\par
  Worst single thread performance ca. $17 \frac{\text{voxel}}{\mu s}$
\end{frame}

%0. why SRG? simplicity, speed (orally why)
%why parallelization? (making things faster)
%1. SRG algo (+graphics)
%1.1 effect caching: Graphic with speed comparison
%Explanation on algorithm (queue, take position from queue, compute neighbors, fetch neighbor values, compare ...)
%1.2. good parallizable, small realistic example
%2. simpaSRG (algo only)
%2.1 data-contention between threads
%2.2 good, bad realistic example
%3. summary (simple parallelization feasible, data-contention problem on tube-like (not forked!) structures,
%
%(( in the work I additionally show how we could do better than the cache controller on having control over cache ))
%(( However its extremely hard to make estimations without knowledge what exactly happens in the cache ))
%(( FINAL STATEMENT: Overall CPU data throughput is saturated => cache control + SIMD needed ))
\end{document}
%bonus: upper memmory bound
%optimal algorithm
%exact results
%more plots


\section{t-test}


%%
%% symmetry.tex
%%
%% Made by liufenglai
%% Login   <liufenglai@phoenix>
%%
%% Started on  Wed Aug 19 20:37:30 2009 liufenglai
%% Last update Wed Aug 19 20:40:53 2009 liufenglai
%%
%% modified at Aug, 21th; 2009
%% add the content of Spatial transformation as operator
%% on quantum state
%%
%%
%%
%%
%%
%%
%%
%%
%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{The application of symmetry theory in quantum mechanics}
%
% scheme:
% 1  general discussion to the symmetry theory in quantum mechanics
% 2  what kinds of symmetry operation have in quantum mechanics?
%    mainly concentrating on the spatial transformation
% 3  consider the characters for the operator corresponding the
%    symmetry operation.
% 4  concentrating on the conserved property, several examples;
%    the translation, and the rotation
% 5  symmetry group for Hamiltonian
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
%
% why we have this subject here?
% concept of symmetry operation
%
Here in this chapter we are going to give some general discussions
for the application of symmetry theory in quantum mechanics.

This part of knowledge is very important. In quantum chemistry, as
we investigate the symmetrical molecules (for example, the water
molecule, and the carbon dioxide molecule etc.); it's symmetry
character is able to give us great help in calculation as well as
understanding its properties. For instance, it's symmetry character
determines the excitation energy profile, the transition states for
dipole moment etc.

On the other hand, the symmetry theory in quantum mechanics is also
very important. Interestingly to see, the application of symmetry
theory in quantum mechanics is much more important than it's in
classic mechanics. Why? In quantum mechanics, the particles belongs
to same type are unable to distinguish with each other so that we
can them as ``identical particles'' (see chapter
\ref{identical_particles}), hence; the symmetry operation such as
rotation etc. will make the quantum particle exactly same with the
one before rotation. Intuitively to say, such physical phenomenon
will correspond to some very important physical rules. In the
following content, we will give some detailed analysis on this
issue.

Here we can define a concept of ``symmetry operation''. The symmetry
operation is considered to be some action on some physical objects,
if the physical objects after the action retain to be same with its
state before the action, or in other words; the physical objects are
distinguishable with its initial states. In this circumstance, we
call the operation is ``symmetry operation''.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Types for symmetry operation}
%
%
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{General types of symmetry operation}
%
%   general types of symmetry operations
%
%
Fundamentally there are several symmetry operations in quantum
mechanics, they are depending on the basic variables in the quantum
states. Hence, the symmetry operation can be divided into three
types; namely the transformation on spatial variables and time
variables in the quantum state, and the transformation on the spin
variables in the quantum state.

However, the symmetry transformation for the time variables and spin
variables are rarely referred in quantum chemistry so that we do not
intend to give discussion to them (the reader can refer to the
material in \cite{XingLinKe}). Hence, the discussion will only
concentrate on the spatial transformation.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Spatial transformation}
%
% 1  general character for spatial transformation
% 2  it composes into the group
%
The symmetry spatial transformation on one position of $\bm{r}$ can
be expressed as:
\begin{equation}\label{SYMMETRY_IN_QMeq:1}
\bm{r^{'}} = Q\bm{r}
\end{equation}
Here the particle in position of $\bm{r}$ is transformed to the
location of $\bm{r^{'}}$. The ``symmetry'' character requires that
such transformation should not change the relative position for
particles, else the physical objects can not be same with the one
before the transformation.

Such inherent requirement leads to some important result, that the
spatial symmetry operations are enclosed into some ``group'' for the
given system.

Mathematically, the forming of group demands several conditions;
they are:
\begin{itemize}
  \item The elements in the group should have enclosed property.
  That is to say, the operation between the elements within the
  group should be equal to some element within the same group. Such
  relation can be express that if $A$, $B$ $\in$ group $\Omega$,
  then $AB$ must equal to some element of $C$ $\in$ $\Omega$.
  \item The operation satisfies the associative law. That is to say,
  $A(BC) = (AB)C$.
  \item In the group, the unit element of $I$ should always exist.
  \item Each element has an inverse element: $\forall$ $A$
  $\in$ $\Omega$, we have $A^{-1}A = AA^{-1} = I$.
\end{itemize}

Now let's go to analyze each item. Firstly, for any system, there
always has the ``identical transformation'' which makes the system
unchanged; it amounts to the unit element of $I$ in the group.

Second, since the symmetry operation does not change the relative
position that there always has inverse element of the symmetry
operation to restore the system. Hence the fourth item is satisfied.

third, the consecutive symmetry operations is still some symmetry
operation. So the second item is satisfied. Furthermore, such
operations is naturally satisfy the associative law; hence for any
system the spatial symmetry operations are composed into some group.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Spatial transformation as operator on quantum state}
%
% 1  the spatial transformation as operator on quantum state
%    it's unitary operator, and commute with any physical quantity
% 2  they compose into the group, homomorphism with the group
%    of symmetry operation
%
Mow let's consider some single particle wave function of
$\Psi(\bm{r})$, according to the (\ref{SYMMETRY_IN_QMeq:1}) and the
definition of symmetry operation we have:
\begin{equation}\label{}
\Psi^{'}(\bm{r^{'}}) = \Psi^{'}(Q\bm{r}) = \Psi(\bm{r})
\end{equation}
Here the transformation of $Q\bm{r}$ lead the wave function of
$\Psi$ to some new value so that we label it as $\Psi^{'}$.

Such transformation can be also expressed via the operator:
\begin{equation}\label{SYMMETRY_IN_QMeq:2}
\Psi^{'}(\bm{r^{'}}) = \hat{D}(Q)\Psi(\bm{r}) =
\Psi(Q^{-1}\bm{r^{'}})
\end{equation}
Now let's give some general discussion to the property of the
operator of $\hat{D}(Q)$.

First, because of the superposition principle requirement the
operator of $\hat{D}(Q)$ should be some linear operator:
\begin{equation}\label{}
\begin{split}
  \Psi &= \sum_{i}\Psi_{i}\Rightarrow \\
  \hat{D}(Q)\Psi &= \sum_{i}\hat{D}(Q)\Psi_{i} \\
\end{split}
\end{equation}

Second, Since the symmetry operation $Q$ makes the system exactly
the same with the one before the symmetry operation, thus for an
arbitrary quantum state of $\ket{\Psi}$. and $\ket{\Psi^{'}} =
\hat{D}(Q)\ket{\Psi}$; then we have:
\begin{equation}\label{SYMMETRY_IN_QMeq:3}
\begin{split}
\langle\Psi^{'}|\Psi^{'}\rangle &= \langle\Psi|\Psi\rangle \Rightarrow \\
\bra{\Psi}\hat{D}^{+}(Q)\hat{D}(Q)\ket{\Psi} &=
\langle\Psi|\Psi\rangle \\
\hat{D}^{+}(Q)\hat{D}(Q) &= I
\end{split}
\end{equation}
Here the $\hat{D}^{+}(Q)$ is the adjacent operator of $\hat{D}(Q)$
which is working on the bra of $\bra{\Psi}$. The relation in the
(\ref{SYMMETRY_IN_QMeq:3}) indicates that the operator $\hat{D}(Q)$
is unitary operator.

Furthermore, since the quantum state is unchanged after the symmetry
operation, hence for any physical quantity of $\hat{A}$, we have:
\begin{equation}\label{SYMMETRY_IN_QMeq:4}
\begin{split}
\langle\Psi^{'}|\hat{A}|\Psi^{'}\rangle &=
\langle\Psi|\hat{A}|\Psi\rangle \Rightarrow \\
\bra{\Psi}\hat{D}^{+}(Q)\hat{A}\hat{D}(Q)\ket{\Psi} &=
\langle\Psi|\hat{A}|\Psi\rangle \\
\hat{D}^{+}(Q)\hat{A}\hat{D}(Q) &= \hat{A} \\
\hat{A}\hat{D}(Q) &= \hat{D}(Q)\hat{A} \\
[\hat{A}, \hat{D}(Q)] &= 0
\end{split}
\end{equation}
Therefore, the $\hat{D}(Q)$ is able to commute with any physical
quantity; such character is very similar to the unitary
transformation between the representations ( see
\ref{transformation_in_representation} for more details).

Importantly, if the $\hat{A}$ is the Hamiltonian operator, then we
can see that the $\hat{D}(Q)$ can be included into the ``CSCCO'' so
that it's used to be identified as some ``freedom'' to determine the
quantum state for the system. In a sense, the symmetry character for
the quantum system is just one part of it's physical properties.

Finally, we can see that the operator of $\hat{D}(Q)$ also compose
some group, such group can be express as $\hat{D}(Q), \hat{D}(R),
\hat{D}(S), \hat{D}(T) \cdots$; where it changes as the symmetry
operation changes.

Mathematically, we can prove that such group composed by
$\hat{D}(Q)$ is homomorphism with the group of symmetry operation.
Such relation can be expressed as:
\begin{equation}\label{}
\begin{split}
  \hat{D}(Q)\hat{D}(R) &= \hat{D}(QR)  \\
  \hat{D}^{+}(Q) &= \hat{D}^{-1}(Q) = \hat{D}(Q^{-1})
\end{split}
\end{equation}
Hence, we can safely discuss the symmetry character via the group of
$\hat{D}(Q)$.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Conserved property for symmetry operation}
%
%
%
In quantum mechanics, if an operator is commuting with Hamiltonian
operator, then the physical quantity represented by this operator
does not vary as time alters. Such character is called ``conserved''
property.

In the above section, we have demonstrated that the operators
represented the symmetry operation is able to commute with
$\hat{H}$, so what's the conserved physical property behind them?
Next we are going to show several cases around this issue.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Translation invariance with the momentum conservation}
%
%
%
Suggest that we have some one dimensional system. It makes an
infinitesimal displacement:
\begin{equation}\label{}
x^{'} = x + \delta x
\end{equation}

Assume that the wave function has the translation invariance. Hence
according to the (\ref{SYMMETRY_IN_QMeq:2}) we can express such
invariance relation as:
\begin{equation}\label{}
\begin{split}
   \hat{D}\psi(x + \delta x) &= \psi(x) \Rightarrow \\
   \hat{D}\psi(x) &= \psi(x - \delta x)
\end{split}
\end{equation}

Now let's go to see under such translation invariance what kind of
physical property is conserved?

By using Taylor expansion, we can expand the $\psi(x - \delta x)$
as:
\begin{equation}\label{}
\begin{split}
  \psi(x - \delta x) &= \psi(x) -
\delta x\frac{\partial \psi}{\partial x} + \cdots \\
    &= e^{-\delta x \frac{\partial}{\partial x}} \psi(x) \\
    &= exp(\frac{-i \delta x \hat{p}_{x}}{\hbar}) \psi(x)
\end{split}
\end{equation}
Where in position representation, the momentum operator of
$\hat{p}_{x}$ is expressed as:
\begin{equation}\label{}
\hat{p}_{x} = -i\hbar\frac{\partial}{\partial x}
\end{equation}
Finally, we can express the operator of $\hat{D}$ as:
\begin{equation}\label{}
\hat{D} = exp(\frac{-i \delta x \hat{p}_{x}}{\hbar})
\end{equation}

It's very interesting to see that the expression for the $\hat{D}$
is same with the operator $\hat{q}(\xi)$ in the \ref{PRAMReq:2}.
Therefore, it's easy to know it's unitary character. Now since
$[\hat{D}, \hat{H}] = 0$, it finally turns out that we have:
\begin{equation}\label{}
[\hat{p}_{x}, \hat{H}] = 0
\end{equation}
It means the momentum is the conserved physical quantity for such
translation invariant system.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "../../main"
%%% End: