\section{Examination Results}%
\label{sec:Examination Results}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Proximal Decoding}%
\label{sub:Ex Proximal Decoding}

\begin{frame}[t]
    \frametitle{Proximal Decoding: Bit Error Rate and Performance}
    \begin{itemize}
        \item Comparison of simulation
            \footnote{(3,6) regular LDPC Code with $n=204, k=102$
             \cite[Code: 204.33.484]{mackay_enc}}
            with results of Wadayama and Takabe

            \begin{figure}[H]
                \centering

                \begin{subfigure}{0.5\textwidth}
                    \centering

                    \begin{tikzpicture}[scale=0.45]
                        \begin{axis}[
                            grid=both,
                            xlabel={SNR (dB)}, ylabel={Bit Error Rate},
                            ymode=log,
                            legend style={at={(0.05,0.05)},anchor=south west},
                            width=11.5cm,
                            height=8cm,
                            ytick={0, 1e-1, 1e-2, 1e-3, 1e-4},
                            xtick={1, 2, 3, 4, 5},
                            ymax=1.2, ymin=0.8e-4,
                            xmin=0.9, xmax=5.6,
                        ]
                        \addplot table [x=SNR, y=BER,
                                        col sep=comma, discard if not={gamma}{0.15}]
                            {res/2d_ber_fer_dfr_20433484_proximal.csv};
                        \addlegendentry{$\gamma = 0.15$}
                        \addplot table [x=SNR, y=BER,
                                        col sep=comma, discard if not={gamma}{0.01}]
                            {res/2d_ber_fer_dfr_20433484_proximal.csv};
                        \addlegendentry{$\gamma = 0.01$}
                        \addplot table [x=SNR, y=BER,
                                        col sep=comma, discard if not={gamma}{0.05}]
                            {res/2d_ber_fer_dfr_20433484_proximal.csv};
                        \addlegendentry{$\gamma = 0.05$}
                        \end{axis}
                    \end{tikzpicture}
                
                    \caption{Simulation results for $\omega = 0.05, K=100$}
                    \label{fig:sim_results_prox}
                \end{subfigure}%
                \begin{subfigure}{0.5\textwidth}
                    \centering

                    \includegraphics[scale=0.6]{res/ber_paper}

                    \caption{Results from ``Proximal Decoding for LDPC Codes''}
                    \label{fig:paper_results_prox}
                \end{subfigure}%
                
            \end{figure}

        \item $\mathcal{O}\left(n  \right) $ time complexity - same as BP;
            Only multiplication and addition necessary \cite{proximal_paper}
        \item Measured Performance: Between $\SI{0.5}{\mega\bit / \second}$ and
            $\SI{2.5}{\mega\bit / \second}$ - Intel Core i7-7700HQ @ 2.80GHz%
%            \\ ($\sim \SI{10}{\second}$ for the shown plot)
    \end{itemize}
    \vspace{3mm}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
    \frametitle{Proximal Decoding: Choice of $\gamma$}
    \setcounter{footnote}{0} 
    
    \begin{itemize}
        \item Comparison of simulation
            \footnote{(3,6) regular LDPC Code with $n=204, k=102$
                \cite[Code: 204.33.484]{mackay_enc}}
            results for different values of $\gamma$
    \end{itemize}

    \begin{figure}[H]
        \centering
        
        \begin{subfigure}[c]{0.5\textwidth}
            \centering
            \begin{tikzpicture}[scale=0.52]
                \begin{semilogyaxis}[xlabel={SNR}, ylabel={BER},
                                     grid=both, grid style={line width=.1pt},
                                     legend style={at={(0.05,0.05)},anchor=south west},
                                     ymin=3e-7, ymax=1.5,]
                    \foreach \gamma in {0.01, 0.05, 0.15}{
                        \addplot table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{\gamma}] {res/2d_ber_fer_dfr_20433484_proximal.csv};
                        \legend{\gamma}
                    }
                    \legend{$\gamma=0.01$, $\gamma=0.05$, $\gamma=0.15$}
                \end{semilogyaxis}
            \end{tikzpicture}
        \end{subfigure}%
        \begin{subfigure}[c]{0.5\textwidth}
            \centering
        
            \begin{tikzpicture}[scale=0.55]
                \begin{axis}[view={75}{60},
                             zmode=log,
                             xlabel={SNR},
                             ylabel={$\gamma$},
                             zlabel={BER},]
                    \addplot3[surf, mesh/rows=17, mesh/cols=14, colormap/viridis] table [col sep=comma, x=SNR, y=gamma, z=BER] {res/2d_ber_fer_dfr_20433484_proximal.csv};
                    \addlegendentry{$\gamma = \left[ 0\text{:}.01\text{:}.16 \right] $}
                    \addplot3[red, line width=1.5] table[col sep=comma, discard if not={gamma}{0.05}, x=SNR, y=gamma, z=BER] {res/2d_ber_fer_dfr_20433484_proximal.csv};
                    \addlegendentry{$\gamma = 0.05$}
                    \addplot3[blue, line width=1.5] table[col sep=comma, discard if not={gamma}{0.01}, x=SNR, y=gamma, z=BER] {res/2d_ber_fer_dfr_20433484_proximal.csv};
                    \addlegendentry{$\gamma = 0.01$}
                    \addplot3[brown, line width=1.5] table[col sep=comma, discard if not={gamma}{0.15}, x=SNR, y=gamma, z=BER] {res/2d_ber_fer_dfr_20433484_proximal.csv};
                    \addlegendentry{$\gamma = 0.15$}
                \end{axis}
            \end{tikzpicture}
        \end{subfigure}

        \caption{BER for $\omega = 0.05, K=100$}
        \label{fig:ber_3d}
    \end{figure}

    \begin{itemize}
        \item Not great benefit in finding the optimal value for $\gamma$
    \end{itemize}
    \vspace{3mm}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t, fragile]
    \frametitle{Proximal Decoding: Frame Error Rate}
    \setcounter{footnote}{0} 

    \begin{itemize}
        \item Comparison of simulated
            \footnote{(3,6) regular LDPC Code with $n=204, k=102$
                \cite[Code: 204.33.484]{mackay_enc}}
            BER and FER
    \end{itemize}

    \begin{minipage}{.4\textwidth}
        \centering

        \begin{algorithm}[caption={}, label={},
            basicstyle=\fontsize{7.5}{9.5}\selectfont
            ]
$\boldsymbol{s}^{\left( 0 \right)} = \boldsymbol{0}$
for $k=0$ to $K-1$ do
    $\boldsymbol{r}^{\left( k+1 \right)} = \boldsymbol{s}^{(k)} - \omega \nabla L \left( \boldsymbol{s}^{(k)}; \boldsymbol{y} \right) $
    Compute $\nabla h\left( \boldsymbol{r}^{\left( k+1 \right) } \right)$
    $\boldsymbol{s}^{\left( k+1 \right)} = \boldsymbol{r}^{(k+1)} - \gamma \nabla h\left( \boldsymbol{r}^{\left( k+1 \right) } \right) $
    $\boldsymbol{\hat{x}} = \text{sign}\left( \boldsymbol{s}^{\left( k+1 \right) } \right) $
    If $\boldsymbol{\hat{x}}$ passes the parity check condition, break the loop.
end for
Output $\boldsymbol{\hat{x}}$
        \end{algorithm}
    \end{minipage}%
    \begin{minipage}{.6\textwidth}
        \centering
        \begin{figure}[H]
            \vspace*{-8mm}
            \centering
        
            \begin{tikzpicture}[scale=0.42]
                \begin{axis}[
                    grid=both,
                    xlabel={SNR}, ylabel={BER},
                    ymode=log,
                    legend style={at={(0.05,0.05)},anchor=south west},
                    ymax=1.5, ymin=3e-7,
                ]
                \addplot table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.15}]
                    {res/2d_ber_fer_dfr_20433484_proximal.csv};
                \addlegendentry{$\gamma = 0.15$}
                \addplot table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.01}]
                    {res/2d_ber_fer_dfr_20433484_proximal.csv};
                \addlegendentry{$\gamma = 0.01$}
                \addplot table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.05}]
                    {res/2d_ber_fer_dfr_20433484_proximal.csv};
                \addlegendentry{$\gamma = 0.05$}
                \end{axis}
            \end{tikzpicture}
            \begin{tikzpicture}[scale=0.42]
                \begin{axis}[
                    grid=both,
                    xlabel={SNR}, ylabel={FER},
                    ymode=log,
                    legend style={at={(0.05,0.05)},anchor=south west},
                    ymax=1.5, ymin=3e-7,
                ]
                \addplot table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.15}]
                    {res/2d_ber_fer_dfr_20433484_proximal.csv};
                \addlegendentry{$\gamma = 0.15$}
                \addplot table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.01}]
                    {res/2d_ber_fer_dfr_20433484_proximal.csv};
                \addlegendentry{$\gamma = 0.01$}
                \addplot table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.05}]
                    {res/2d_ber_fer_dfr_20433484_proximal.csv};
                \addlegendentry{$\gamma = 0.05$}
                \end{axis}
            \end{tikzpicture}\\
            \begin{tikzpicture}[scale=0.42]
                \begin{axis}[
                    grid=both,
                    xlabel={SNR}, ylabel={Decoding Failure Rate},
                    ymode=log,
                    legend style={at={(0.05,0.05)},anchor=south west},
                    ymax=1.5, ymin=3e-7,
                ]
                \addplot table [x=SNR, y=DFR, col sep=comma, discard if not={gamma}{0.15}]
                    {res/2d_ber_fer_dfr_20433484_proximal.csv};
                \addlegendentry{$\gamma = 0.15$}
                \addplot table [x=SNR, y=DFR, col sep=comma, discard if not={gamma}{0.01}]
                    {res/2d_ber_fer_dfr_20433484_proximal.csv};
                \addlegendentry{$\gamma = 0.01$}
                \addplot table [x=SNR, y=DFR, col sep=comma, discard if not={gamma}{0.05}]
                    {res/2d_ber_fer_dfr_20433484_proximal.csv};
                \addlegendentry{$\gamma = 0.05$}
                \end{axis}
            \end{tikzpicture}
        
            \caption{Simulation results for $\omega = 0.05, K=100$}
            \label{fig:simulation_results_ber_fer_dfr}
        \end{figure}
    \end{minipage} 
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\tikzbracemark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

\newcommand*{\AddNote}[4]{%
    \begin{tikzpicture}[overlay, remember picture]
        \draw [decoration={brace,amplitude=0.5em},decorate,ultra thick]
            ($(#3)!([yshift=1.5ex]#1)!($(#3)-(0,1)$)$) --  
            ($(#3)!(#2)!($(#3)-(0,1)$)$)
                node [align=center, text width=2cm, pos=0.5, anchor=west] {#4};
    \end{tikzpicture}
}%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t, fragile]
    \frametitle{Proximal Decoding: Improvement using ``ML-on-List''}
    \setcounter{footnote}{0} 

    \begin{itemize}
        \item Comparison of proximal \& hybrid-proximal-ML\\
            decoding simulation
            \footnote{(3,6) regular LDPC Code with $n=204, k=102$
                \cite[Code: 204.33.484]{mackay_enc}}
            results
    \end{itemize}

    \begin{minipage}{.4\textwidth}
        \centering

        \begin{algorithm}[caption={}, label={},
            basicstyle=\fontsize{6.5}{7.5}\selectfont
            ]
$\boldsymbol{s}^{\left( 0 \right)} = \boldsymbol{0}$$\hspace{4.185cm}\tikzbracemark{prox-start}$
for $k=0$ to $K-1$ do
    $\boldsymbol{r}^{\left( k+1 \right)} = \boldsymbol{s}^{(k)} - \omega \nabla L \left( \boldsymbol{s}^{(k)}; \boldsymbol{y} \right) $
    Compute $\nabla h\left( \boldsymbol{r}^{\left( k+1 \right) } \right)$
    $\boldsymbol{s}^{\left( k+1 \right)} = \boldsymbol{r}^{(k+1)} - \gamma \nabla h\left( \boldsymbol{r}^{\left( k+1 \right) } \right) $
    $\boldsymbol{\hat{x}} = \text{sign}\left( \boldsymbol{s}^{\left( k+1 \right) } \right) $
    If $\boldsymbol{\hat{x}}$ passes the parity check condition, output $\boldsymbol{\hat{x}}$
end for $\tikzbracemark{prox-end}$
Find $N$ most probably wrong bits $\hspace{2cm}\tikzbracemark{ml-start}$
Generate variations $\boldsymbol{\tilde{x}}_n$ of $\boldsymbol{\hat{x}}$ with the $N$ bits modified
Compute $d\left( \boldsymbol{ \tilde{x}}_n, \boldsymbol{\hat{x}} \right) \forall n \in \left[ 1 : N-1 \right] $
Output $\boldsymbol{\tilde{x}}_n$ with lowest $d\left( \boldsymbol{ \tilde{x}}_n, \boldsymbol{\hat{x}} \right)$ $\tikzbracemark{ml-end}$
        \end{algorithm}

    \AddNote{prox-start}{prox-end}{prox-start}{\small Proximal\\Decoding}
    \AddNote{ml-start}{ml-end}{ml-start}{\small ML-on-List}
    \end{minipage}%
    \begin{minipage}{.6\textwidth}
        \centering
        \begin{figure}[H]
            \centering
            \vspace*{-12mm}
        
            \begin{tikzpicture}[scale=0.42]
                \begin{axis}[
                    grid=both,
                    xlabel={SNR}, ylabel={BER},
                    ymode=log,
                    legend style={at={(0.05,0.05)},anchor=south west},
                    ymax=1.5, ymin=3e-8,
                ]

                \addplot table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.05}]
                    {res/2d_ber_fer_dfr_20433484_proximal.csv};
                \addlegendentry{proximal}
                \addplot table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.05}]
                    {res/2d_ber_fer_dfr_20433484_hybrid.csv};
                \addlegendentry{hybrid prox. \& ML}
                \end{axis}
            \end{tikzpicture}
            \begin{tikzpicture}[scale=0.42]
                \begin{axis}[
                    grid=both,
                    xlabel={SNR}, ylabel={FER},
                    ymode=log,
                    legend style={at={(0.05,0.05)},anchor=south west},
                    ymax=1.5, ymin=3e-8,
                ]

                \addplot table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.05}]
                    {res/2d_ber_fer_dfr_20433484_proximal.csv};
                \addlegendentry{proximal}
                \addplot table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.05}]
                    {res/2d_ber_fer_dfr_20433484_hybrid.csv};
                \addlegendentry{hybrid prox. \& ML}
                \end{axis}
            \end{tikzpicture}\\
            \begin{tikzpicture}[scale=0.42]
                \begin{axis}[
                    grid=both,
                    xlabel={SNR}, ylabel={Decoding Failure Rate},
                    ymode=log,
                    legend style={at={(0.05,0.05)},anchor=south west},
                    ymax=1.5, ymin=3e-8,
                ]

                \addplot table [x=SNR, y=DFR, col sep=comma, discard if not={gamma}{0.05}]
                    {res/2d_ber_fer_dfr_20433484_proximal.csv};
                \addlegendentry{proximal}
                \addplot table [x=SNR, y=DFR, col sep=comma, discard if not={gamma}{0.05}]
                    {res/2d_ber_fer_dfr_20433484_hybrid.csv};
                \addlegendentry{hybrid prox. \& ML}
                \end{axis}
            \end{tikzpicture}
        
            \caption{Simulation results for $\gamma = 0.05, \omega = 0.05, K=200, N=12$}
            \label{fig:simulation_results_hybrid}
        \end{figure}
    \end{minipage} 
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{ADMM: Examination Results}%
\label{sub:Ex ADMM}

\begin{frame}[t]
    \frametitle{ADMM}

    \todo{TODO}
\end{frame}

