\section{Proximal Decoding}%
\label{sec:Proximal Decoding}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Decoding Algorithm}%
\label{sub:Decoding Algorithm}

\begin{frame}[t]
    \frametitle{Proximal Decoding: General Approach \citereference{WT22}}

    \vspace*{-0.7cm}

    \begin{itemize}
        \item MAP rule as continuous maximization problem:
            \begin{align*}
                \hat{\boldsymbol{x}}
                    &= \argmax_{\tilde{\boldsymbol{x}}\in\mathbb{R}^n}
                        f_{\boldsymbol{Y}}\left( \boldsymbol{y} | \tilde{\boldsymbol{x}} \right)
                        f_{\boldsymbol{X}}\left( \tilde{\boldsymbol{x}} \right)\\
                    &= \argmax_{\tilde{\boldsymbol{x}}\in\mathbb{R}^n}
                        e^{-L\left( \boldsymbol{y} | \tilde{\boldsymbol{x}}\right)}
                        f_{\boldsymbol{X}}\left( \tilde{\boldsymbol{x}} \right),
                    \hspace{5mm} L\left( \boldsymbol{y} | \tilde{\boldsymbol{x}} \right)
                        = - \ln\left( f_{\boldsymbol{Y}}
                            \left( \boldsymbol{y} | \tilde{\boldsymbol{x}} \right)  \right)
            \end{align*}
        \item Approximation of prior PDF:
            \begin{align*}
                f_{\boldsymbol{X}}\left( \tilde{\boldsymbol{x}} \right)
                    = \frac{1}{\left| \mathcal{C} \right| }
                        \sum_{\boldsymbol{c} \in \mathcal{C} }
                        \delta\left( \tilde{\boldsymbol{x}} - \left( -1 \right)^{\boldsymbol{c}}
                            \right) 
                    \approx \frac{1}{Z} e^{-\gamma h\left( \tilde{\boldsymbol{x}} \right) }
            \end{align*}
        \item Code constraint polynomial:
            \begin{minipage}[c]{0.56\textwidth}
                \raggedright
                
                \begin{align*}
                h\left( \tilde{\boldsymbol{x}} \right) =
                    \underbrace{\sum_{i=1}^{n} \left( \tilde{x}_i^2 - 1 \right)^2}_{\text{Bipolar
                        constraint}}
                    + \underbrace{\sum_{j=1}^{m} \left[ \left(
                        \prod_{i\in N_v\left( j \right)} \tilde{x}_i\right) -1 \right]^2}
                            _{\text{Parity constraint}},
                \end{align*}
            \end{minipage}%
            \begin{minipage}[c]{0.4\textwidth}
                \raggedleft
                \begin{flalign*}
                    \mathcal{I} &:= \left[1\text{ : }n\right],
                    \hspace{2mm} \mathcal{J} := \left[1\text{ : }m\right] \\
                    N_v\left( j \right) &:= \left\{i | i\in \mathcal{I},
                        \boldsymbol{H}_{j,i} = 1
                \right\}, j\in\mathcal{J}\\
                \end{flalign*}
            \end{minipage}
            \hfill
    \end{itemize}

    \smallskip
    \smallskip

    \addreference{WT22}{Tadashi Wadayama; Satoshi Takabe: \emph{Proximal Decoding for LDPC
        Codes}. IEICE Transactions on Fundamentals of Electronics, Communications and Computer
        Sciences advpub (2022), 2022TAP0002.}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
    \frametitle{Proximal Decoding: General Approach}

    \vspace*{-3mm}

    \begin{itemize}
        \item Objective function:
            \begin{align*}
                g\left( \tilde{\boldsymbol{x}} \right)
                    = L\left( \boldsymbol{y} | \tilde{\boldsymbol{x}} \right)
                    + \gamma h\left( \tilde{\boldsymbol{x}} \right)
            \end{align*}
            \note{Notational difference between $f$ and $f_X$ or $f_Y$}
        \item Proximal operator \citereference{PB14}:
            \begin{align*}
                \text{prox}_{\gamma h} \left( \tilde{\boldsymbol{x}} \right) &\equiv
                \argmin_{\boldsymbol{t}\in\mathbb{R}^n}
                    \gamma h\left( \boldsymbol{t} \right) + \frac{1}{2} \lVert \boldsymbol{t}
                            - \tilde{\boldsymbol{x}} \rVert^2 \\
                        &\approx \tilde{\boldsymbol{x}}
                            - \gamma \nabla h\left( \tilde{\boldsymbol{x}} \right),
                        \hspace{5mm} \gamma \text{ small}
            \end{align*}
        \item Iterative decoding process:
            \begin{align*}
                \boldsymbol{r} &\leftarrow \boldsymbol{s}
                    - \omega \nabla L\left( \boldsymbol{y} | \boldsymbol{s}
                    \right), \hspace{5mm} \omega > 0
                    \hspace{10mm} \text{``Gradient descent step''}\\
                \boldsymbol{s} &\leftarrow \boldsymbol{r}
                    - \gamma \nabla h\left( \boldsymbol{r}
                    \right), \hspace{9mm} \gamma > 0
                    \hspace{10mm} \text{``Code proximal step''}
            \end{align*}
    \end{itemize}

    \bigskip

    \addreference{PB14}{Neal Parikh; Stephen Boyd: \emph{Proximal Algorithms}.
        Found. Trends Optim. 1.3 (Jan. 2014), pp. 127–239.}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t, fragile]
    \frametitle{Proximal Decoding: Algorithm}
    \begin{itemize}
        \item Iterative decoding algorithm:
    \end{itemize}
            
    \vspace{2mm}
    \begin{algorithm}[caption={}, label={}]
$\boldsymbol{s} \leftarrow \boldsymbol{0}$
for $K$ iterations do
    $\boldsymbol{r} \leftarrow \boldsymbol{s} - \omega \nabla L \left( \boldsymbol{y} \mid \boldsymbol{s} \right) $
    $\boldsymbol{s} \leftarrow \boldsymbol{r} - \gamma \nabla h\left( \boldsymbol{r} \right) $
    $\boldsymbol{\hat{x}} \leftarrow \text{sign}\left( \boldsymbol{s} \right) $
    if $\boldsymbol{H}\boldsymbol{\hat{c}} = \boldsymbol{0}$ do
        return $\boldsymbol{\hat{c}}$
    end if
end for
return $\boldsymbol{\hat{c}}$
    \end{algorithm}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Simulation Results}%


\begin{frame}[t]
    \frametitle{Proximal Decoding: Bit Error Rate}

    \vspace*{-7mm}

    \begin{itemize} 
        \item (3,6) regular LDPC code with $n=204, k=102$ \citereference{Mac23, 204.33.484}
        \item Comparison of simulation with results of Wadayama et al. \citereference{WT22}
    \end{itemize}

    \begin{figure}[H]
        \centering

        \begin{tikzpicture}
            \begin{axis}[
                grid=both, grid style={line width=.1pt},
                xlabel={$E_b / N_0$ (dB)}, ylabel={BER},
                ymode=log,
                legend pos=outer north east,
                width=0.45\textwidth,
                height=0.3375\textwidth,
                ymax=1.2, ymin=0.8e-4,
                xtick={1, 2, ..., 5},
                xmin=0.9, xmax=5.6,
                legend columns=1,
            ]

            \addplot [scol0, line width=1pt]
                table [x=SNR, y=FER, col sep=comma,
                            discard if not={gamma}{0.15},
                            discard if gt={SNR}{5.5},]
                {res/proximal/2d_ber_fer_dfr_20433484.csv};
            \addlegendentry{$\gamma = 0.15$}
            \addplot [scol1, line width=1pt]
                table [x=SNR, y=FER, col sep=comma,
                            discard if not={gamma}{0.01},
                            discard if gt={SNR}{5.5},]
                {res/proximal/2d_ber_fer_dfr_20433484.csv};
            \addlegendentry{$\gamma = 0.01$}
            
            \addplot [scol2, line width=1pt]
                table [x=SNR, y=FER, col sep=comma,
                            discard if not={gamma}{0.05},
                            discard if gt={SNR}{5.5},]
                {res/proximal/2d_ber_fer_dfr_20433484.csv};
            \addlegendentry{$\gamma = 0.05$}

            \addplot [KITorange, line width=1pt]
                table [x=SNR, y=FER, col sep=comma] {res/generic/bp_20433484.csv};
            \addlegendentry{BP}

            \end{axis}
        \end{tikzpicture}
    \end{figure}
    
    \vspace*{-2mm}

    \bigskip

    \addreference{WT22}{Tadashi Wadayama; Satoshi Takabe: \emph{Proximal Decoding for LDPC
        Codes}. IEICE Transactions on Fundamentals of Electronics, Communications and Computer
        Sciences advpub (2022), 2022TAP0002.}
    \addreference{Mac23}{David J.C. MacKay: \emph{Encyclopedia of Sparse Graph Codes}.
        Jan. 2023. URL: \url{http://www.inference.org.uk/mackay/codes/data.html}}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{frame}[t]
%    \frametitle{Proximal Decoding: Choice of $\gamma$}
%   
%    \begin{minipage}[c]{0.9\textwidth}
%        \centering
%    
%        \begin{figure}[H]
%            \vspace*{-0.5cm}
%            \hspace*{-0.7cm}
%            \centering
%            \begin{subfigure}[c]{0.33\textwidth}
%                \centering
%                \begin{tikzpicture}[scale=0.4]
%                    \begin{axis}[view={75}{30},
%                                 zmode=log,
%                                 xlabel={$E_b / N_0$ (dB)},
%                                 ylabel={$\gamma$},
%                                 zlabel={BER},]
%                        \addplot3[surf,
%                                  mesh/rows=17, mesh/cols=10,
%                                  colormap/viridis] table [col sep=comma,
%                                                           x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_963965.csv};
%                        \addplot3[RedOrange, line width=1.5] table[col sep=comma,
%                                                             discard if not={gamma}{0.05},
%                                                             x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_963965.csv};
%                        \addplot3[NavyBlue, line width=1.5] table[col sep=comma,
%                                                              discard if not={gamma}{0.01},
%                                                              x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_963965.csv};
%                        \addplot3[ForestGreen, line width=1.5] table[col sep=comma,
%                                                               discard if not={gamma}{0.15},
%                                                               x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_963965.csv};
%                    \end{axis}
%                \end{tikzpicture}
%                \caption{$\left( 3, 6 \right)$-regular LDPC code with $n=96, k=48$ \cite[\text{96.3.965}]{mackay_enc}}
%            \end{subfigure}%
%            \begin{subfigure}[c]{0.33\textwidth}
%                \centering
%                \begin{tikzpicture}[scale=0.4]
%                    \begin{axis}[view={75}{30},
%                                 zmode=log,
%                                 xlabel={$E_b/N_0$ (dB)},
%                                 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/proximal/2d_ber_fer_dfr_20433484.csv};
%                        \addplot3[RedOrange, line width=1.5] table[col sep=comma,
%                                                             discard if not={gamma}{0.05},
%                                                             x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
%                        \addplot3[NavyBlue, line width=1.5] table[col sep=comma,
%                                                              discard if not={gamma}{0.01},
%                                                              x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
%                        \addplot3[ForestGreen, line width=1.5] table[col sep=comma,
%                                                               discard if not={gamma}{0.15},
%                                                               x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
%                    \end{axis}
%                \end{tikzpicture}
%            \caption{$\left( 3, 6 \right)$-regular LDPC code with $n=204, k=102$ \cite[\text{204.33.484}]{mackay_enc}}
%            \end{subfigure}%
%            \begin{subfigure}[c]{0.33\textwidth}
%                \centering
%                \begin{tikzpicture}[scale=0.4]
%                    \begin{axis}[view={75}{30},
%                                 zmode=log,
%                                 xlabel={$E_b / N_0$ (dB)},
%                                 ylabel={$\gamma$},
%                                 zlabel={BER},]
%                        \addplot3[surf,
%                                  mesh/rows=17, mesh/cols=10,
%                                  colormap/viridis] table [col sep=comma,
%                                                           x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_40833844.csv};
%                        \addplot3[RedOrange, line width=1.5] table[col sep=comma,
%                                                             discard if not={gamma}{0.05},
%                                                             x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_40833844.csv};
%                        \addplot3[NavyBlue, line width=1.5] table[col sep=comma,
%                                                              discard if not={gamma}{0.01},
%                                                              x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_40833844.csv};
%                        \addplot3[ForestGreen, line width=1.5] table[col sep=comma,
%                                                               discard if not={gamma}{0.15},
%                                                               x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_40833844.csv};
%                    \end{axis}
%                \end{tikzpicture}
%            \caption{$\left( 3, 6 \right)$-regular LDPC code with $n=408, k=204$ \cite[\text{408.33.844}]{mackay_enc}}
%            \end{subfigure}
%            \hspace*{-0.7cm}
%            \begin{subfigure}[c]{0.33\textwidth}
%                \centering
%                \begin{tikzpicture}[scale=0.4]
%                    \begin{axis}[view={75}{30},
%                                 zmode=log,
%                                 xlabel={$E_b / N_0$ (dB)},
%                                 ylabel={$\gamma$},
%                                 zlabel={BER},]
%                        \addplot3[surf,
%                                  mesh/rows=17, mesh/cols=10,
%                                  colormap/viridis] table [col sep=comma,
%                                                           x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_bch_31_26.csv};
%                        \addplot3[RedOrange, line width=1.5] table[col sep=comma,
%                                                             discard if not={gamma}{0.05},
%                                                             x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_bch_31_26.csv};
%                        \addplot3[NavyBlue, line width=1.5] table[col sep=comma,
%                                                              discard if not={gamma}{0.01},
%                                                              x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_bch_31_26.csv};
%                        \addplot3[ForestGreen, line width=1.5] table[col sep=comma,
%                                                               discard if not={gamma}{0.15},
%                                                               x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_bch_31_26.csv};
%                    \end{axis}
%                \end{tikzpicture}
%                \caption{BCH code with $n=31, k=26$\\[2\baselineskip]}
%            \end{subfigure}%
%            \begin{subfigure}[c]{0.33\textwidth}
%                \centering
%                \begin{tikzpicture}[scale=0.4]
%                    \begin{axis}[view={75}{30},
%                                 zmode=log,
%                                 xlabel={$E_b / N_0$ (dB)},
%                                 ylabel={$\gamma$},
%                                 zlabel={BER},]
%                        \addplot3[surf,
%                                  mesh/rows=17, mesh/cols=10,
%                                  colormap/viridis] table [col sep=comma,
%                                                           x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_20455187.csv};
%                        \addplot3[RedOrange, line width=1.5] table[col sep=comma,
%                                                             discard if not={gamma}{0.05},
%                                                             x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_20455187.csv};
%                        \addplot3[NavyBlue, line width=1.5] table[col sep=comma,
%                                                              discard if not={gamma}{0.01},
%                                                              x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_20455187.csv};
%                        \addplot3[ForestGreen, line width=1.5] table[col sep=comma,
%                                                               discard if not={gamma}{0.15},
%                                                               x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_20455187.csv};
%                    \end{axis}
%                \end{tikzpicture}
%            \caption{$\left( 5, 10 \right)$-regular LDPC code with $n=204, k=102$ \cite[\text{204.55.187}]{mackay_enc}}
%            \end{subfigure}%
%            \begin{subfigure}[c]{0.33\textwidth}
%                \centering
%                \begin{tikzpicture}[scale=0.4]
%                    \begin{axis}[view={75}{30},
%                                 zmode=log,
%                                 xlabel={$E_b / N_0$ (dB)},
%                                 ylabel={$\gamma$},
%                                 zlabel={BER},]
%                        \addplot3[surf,
%                                  mesh/rows=17, mesh/cols=10,
%                                  colormap/viridis] table [col sep=comma,
%                                                           x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_pegreg252x504.csv};
%                        \addplot3[RedOrange, line width=1.5] table[col sep=comma,
%                                                             discard if not={gamma}{0.05},
%                                                             x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_pegreg252x504.csv};
%                        \addplot3[NavyBlue, line width=1.5] table[col sep=comma,
%                                                              discard if not={gamma}{0.01},
%                                                              x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_pegreg252x504.csv};
%                        \addplot3[ForestGreen, line width=1.5] table[col sep=comma,
%                                                               discard if not={gamma}{0.15},
%                                                               x=SNR, y=gamma, z=BER]
%                                                        {res/proximal/2d_ber_fer_dfr_pegreg252x504.csv};
%                    \end{axis}
%                \end{tikzpicture}
%            \caption{LDPC code (Progressive Edge Growth Construction) with $n=504, k=252$ \cite[\text{PEGReg252x504}]{mackay_enc}}
%            \end{subfigure}%
%        \end{figure}
%    \end{minipage}%
%    \begin{minipage}[c]{0.1\textwidth}
%        \centering
%
%        \begin{figure}[H]
%            \vspace*{-1.5cm}
%            \hspace*{-0.75cm}
%            \centering
%            \begin{tikzpicture}[scale=0.7]
%                \begin{axis}[hide axis,
%                             xmin=10, xmax=50,
%                             ymin=0, ymax=0.4,
%                             legend style={draw=white!15!black,legend cell align=left}]
%                    \addlegendimage{surf, colormap/viridis}
%                    \addlegendentry{$\gamma = \left[ 0\text{ : }0.01\text{ : }0.16 \right] $};
%                    \addlegendimage{NavyBlue, line width=1.5pt}
%                    \addlegendentry{$\gamma = 0.01$};
%                    \addlegendimage{RedOrange, line width=1.5pt}
%                    \addlegendentry{$\gamma = 0.05$};
%                    \addlegendimage{ForestGreen, line width=1.5pt}
%                    \addlegendentry{$\gamma = 0.15$};
%                \end{axis}
%            \end{tikzpicture}
%        \end{figure}
%    \end{minipage}
%\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Improved Algorithm}%
\begin{frame}[t, fragile]
    \frametitle{Proximal Decoding: Frame Error Rate}

    \vspace*{-3mm}

    \begin{itemize}
        \item (3,6) regular LDPC code with $n=204$,\\
            $k=102$ \citereference{Mac23, 204.33.484}
    \end{itemize}
    
    \vspace*{-2mm}

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

        \begin{figure}[htpb]
            \centering

            \begin{algorithm}[caption={}, label={}]
$\boldsymbol{s} \leftarrow \boldsymbol{0}$
for $K$ iterations do
    $\boldsymbol{r} \leftarrow \boldsymbol{s} - \omega \nabla L \left( \boldsymbol{y} \mid \boldsymbol{s} \right) $
    $\boldsymbol{s} \leftarrow \boldsymbol{r} - \gamma \nabla h\left( \boldsymbol{r} \right) $
    $\boldsymbol{\hat{x}} \leftarrow \text{sign}\left( \boldsymbol{s} \right) $
    if $\boldsymbol{H}\boldsymbol{\hat{c}} = \boldsymbol{0}$ do
        return $\boldsymbol{\hat{c}}$
    end if
end for
return $\boldsymbol{\hat{c}}$
            \end{algorithm}
        \end{figure}

        \vspace*{-4mm}
        \hspace*{-4mm}
        \addreference{Mac23}{David J.C. MacKay: \emph{Encyclopedia of Sparse Graph Codes}.
            Jan. 2023. URL: \url{http://www.inference.org.uk/mackay/codes/data.html}.}
    \end{minipage}%
    \begin{minipage}{.6\textwidth}
        \centering
        \begin{figure}[H]
            \vspace*{-9mm}
            \centering
        
            \begin{tikzpicture}[scale=0.7]
                \begin{axis}[
                    grid=both,
                    xlabel={$E_b / N_0$ (dB)}, ylabel={BER},
                    ymode=log,
                    legend style={at={(0.05,0.05)},anchor=south west},
                    ymax=1.5, ymin=3e-7,
                    width=0.7\textwidth,
                    height=0.6\textwidth,
                ]
                \addplot [scol0, line width=1pt]
                    table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.15}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addlegendentry{$\gamma = 0.15$}
                \addplot [scol1, line width=1pt]
                    table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.01}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addlegendentry{$\gamma = 0.01$}
                \addplot [scol2, line width=1pt]
                    table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.05}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addlegendentry{$\gamma = 0.05$}
                \end{axis}
            \end{tikzpicture}
            \begin{tikzpicture}[scale=0.7]
                \begin{axis}[
                    grid=both,
                    xlabel={$E_b / N_0$ (dB)}, ylabel={FER},
                    ymode=log,
                    legend style={at={(0.05,0.05)},anchor=south west},
                    ymax=1.5, ymin=3e-7,
                    width=0.7\textwidth,
                    height=0.6\textwidth,
                ]
                \addplot [scol0, line width=1pt]
                     table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.15}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addlegendentry{$\gamma = 0.15$}
                \addplot [scol1, line width=1pt]
                     table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.01}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addlegendentry{$\gamma = 0.01$}
                \addplot [scol2, line width=1pt]
                     table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.05}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addlegendentry{$\gamma = 0.05$}
                \end{axis}
            \end{tikzpicture}\\
            \begin{tikzpicture}[scale=0.7]
                \begin{axis}[
                    grid=both,
                    xlabel={$E_b / N_0$ (dB)}, ylabel={Decoding Failure Rate},
                    ymode=log,
                    legend style={at={(0.05,0.05)},anchor=south west},
                    ymax=1.5, ymin=3e-7,
                    width=0.7\textwidth,
                    height=0.6\textwidth,
                ]
                \addplot [scol0, line width=1pt]
                     table [x=SNR, y=DFR, col sep=comma, discard if not={gamma}{0.15}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addlegendentry{$\gamma = 0.15$}
                \addplot [scol1, line width=1pt]
                     table [x=SNR, y=DFR, col sep=comma, discard if not={gamma}{0.01}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addlegendentry{$\gamma = 0.01$}
                \addplot [scol2, line width=1pt]
                     table [x=SNR, y=DFR, col sep=comma, discard if not={gamma}{0.05}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addlegendentry{$\gamma = 0.05$}
                \end{axis}
            \end{tikzpicture}
        \end{figure}
    \end{minipage} 
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
    \frametitle{Proximal Decoding: Oscillation of Estimate}

    \vspace*{-5mm}

    \begin{itemize}
        \item Single decoding using the BCH$\left( 7,4 \right) $ code; $E_b / N_0 = \SI{5}{dB}$
        \item $\nabla L \left( \boldsymbol{y} \mid \tilde{\boldsymbol{x}} \right) $
            and $\nabla h \left( \tilde{\boldsymbol{x}} \right) $ generally end up
            in an equilibrium
    \end{itemize}

    \bigskip

    \begin{figure}[H]
        \centering
        \begin{minipage}[c]{0.25\textwidth}
            \centering

            \begin{tikzpicture}[scale = 0.7]
                \begin{axis}[
                    grid=both,
                    xlabel={Iterations},
                    width=1.2\textwidth,
                    height=0.45\textwidth,
                    scale only axis,
                    xtick={0, 50, ..., 200},
                    xticklabels={0, 25, ..., 100},
                ]
                    \addplot [scol0, mark=none, line width=1]
                        table [col sep=comma, x=k, y=comb_r_s_1]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol1, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_L_1]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol2, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_h_1]
                        {res/proximal/comp_bch_7_4_combined.csv};
                    \addlegendentry{est}
                    \addlegendentry{$\left(\nabla L \right)_2$}
                    \addlegendentry{$\left(\nabla h \right)_2 $}
                \end{axis}
            \end{tikzpicture}\\
            \begin{tikzpicture}[scale = 0.7]
                \begin{axis}[
                    grid=both,
                    xlabel={Iterations},
                    width=1.2\textwidth,
                    height=0.45\textwidth,
                    scale only axis,
                    xtick={0, 50, ..., 200},
                    xticklabels={0, 25, ..., 100},
                ]
                    \addplot [scol0, mark=none, line width=1]
                        table [col sep=comma, x=k, y=comb_r_s_2]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol1, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_L_2]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol2, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_h_2]
                        {res/proximal/comp_bch_7_4_combined.csv};
                    \addlegendentry{est}
                    \addlegendentry{$\left(\nabla L \right)_3$}
                    \addlegendentry{$\left(\nabla h \right)_3 $}
                \end{axis}
            \end{tikzpicture}\\
            \begin{tikzpicture}[scale = 0.7]
                \begin{axis}[
                    grid=both,
                    xlabel={Iterations},
                    width=1.2\textwidth,
                    height=0.45\textwidth,
                    scale only axis,
                    xtick={0, 50, ..., 200},
                    xticklabels={0, 25, ..., 100},
                ]
                    \addplot [scol0, mark=none, line width=1]
                        table [col sep=comma, x=k, y=comb_r_s_3]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol1, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_L_3]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol2, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_h_3]
                        {res/proximal/comp_bch_7_4_combined.csv};
                    \addlegendentry{est}
                    \addlegendentry{$\left(\nabla L \right)_4$}
                    \addlegendentry{$\left(\nabla h \right)_4 $}
                \end{axis}
            \end{tikzpicture}
        \end{minipage}%
        \begin{minipage}[c]{0.5\textwidth}
            \vspace*{-1cm}
            \centering
    
            \begin{tikzpicture}[, spy using outlines={circle, magnification=6,
                                                      connect spies}]
                \begin{axis}[
                    grid=both,
                    xlabel={Iterations},
                    width=0.8\textwidth,
                    height=0.35\textwidth,
                    scale only axis,
                    xtick={0, 50, ..., 200},
                    xticklabels={0, 25, ..., 100},
                ]
                    \addplot [scol0, mark=none, line width=1]
                        table [col sep=comma, x=k, y=comb_r_s_0]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol1, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_L_0]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol2, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_h_0]
                        {res/proximal/comp_bch_7_4_combined.csv};
                    \addlegendentry{est}
                    \addlegendentry{$\left(\nabla L \right)_1$}
                    \addlegendentry{$\left(\nabla h \right)_1 $}
                    
                    \coordinate (spypoint) at (axis cs:100,1.12);
                    \coordinate (magnifyglass) at (axis cs:180,2.75);
                \end{axis}
                \spy [black, size=2cm] on (spypoint)
                   in node[fill=white] at (magnifyglass);
            \end{tikzpicture}
        \end{minipage}%
        \begin{minipage}[c]{0.25\textwidth}
            \centering

            \begin{tikzpicture}[scale = 0.7]
                \begin{axis}[
                    grid=both,
                    xlabel={Iterations},
                    width=1.2\textwidth,
                    height=0.45\textwidth,
                    scale only axis,
                    xtick={0, 50, ..., 200},
                    xticklabels={0, 25, ..., 100},
                ]
                    \addplot [scol0, mark=none, line width=1]
                        table [col sep=comma, x=k, y=comb_r_s_4]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol1, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_L_4]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol2, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_h_4]
                        {res/proximal/comp_bch_7_4_combined.csv};
                    \addlegendentry{est}
                    \addlegendentry{$\left(\nabla L \right)_5$}
                    \addlegendentry{$\left(\nabla h \right)_5 $}
                \end{axis}
            \end{tikzpicture}\\
            \begin{tikzpicture}[scale = 0.7]
                \begin{axis}[
                    grid=both,
                    xlabel={Iterations},
                    width=1.2\textwidth,
                    height=0.45\textwidth,
                    scale only axis,
                    xtick={0, 50, ..., 200},
                    xticklabels={0, 25, ..., 100},
                ]
                    \addplot [scol0, mark=none, line width=1]
                        table [col sep=comma, x=k, y=comb_r_s_5]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol1, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_L_5]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol2, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_h_5]
                        {res/proximal/comp_bch_7_4_combined.csv};
                    \addlegendentry{est}
                    \addlegendentry{$\left(\nabla L \right)_6$}
                    \addlegendentry{$\left(\nabla h \right)_6 $}
                \end{axis}
            \end{tikzpicture}\\
            \begin{tikzpicture}[scale = 0.7]
                \begin{axis}[
                    grid=both,
                    xlabel={Iterations},
                    width=1.2\textwidth,
                    height=0.45\textwidth,
                    scale only axis,
                    xtick={0, 50, ..., 200},
                    xticklabels={0, 25, ..., 100},
                ]
                    \addplot [scol0, mark=none, line width=1]
                        table [col sep=comma, x=k, y=comb_r_s_6]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol1, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_L_6]
                            {res/proximal/comp_bch_7_4_combined.csv};
                    \addplot [scol2, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_h_6]
                        {res/proximal/comp_bch_7_4_combined.csv};
                    \addlegendentry{est}
                    \addlegendentry{$\left(\nabla L \right)_7$}
                    \addlegendentry{$\left(\nabla h \right)_7 $}
                \end{axis}
            \end{tikzpicture}
        \end{minipage}
    \end{figure}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
    \frametitle{Proximal Decoding: Oscillation of Estimate}

    \vspace*{-5mm}

    \begin{figure}[H]
        \centering

        \begin{subfigure}[c]{0.5\textwidth}

            \centering

            \begin{tikzpicture}
                \begin{axis}[xmin = -1.25, xmax=1.25,
                             ymin = -1.25, ymax=1.25,
                             xlabel={$x_1$}, ylabel={$x_2$},
                             width=0.9\textwidth,
                             height=0.8\textwidth,
                             grid=major, grid style={dotted},
                             view={0}{90}]
                    \addplot3[point meta=\thisrow{grad_norm},
                              point meta min=1,
                              point meta max=3,
                              quiver={u=\thisrow{grad_0},
                                      v=\thisrow{grad_1},
                                      scale arrows=.05,
                                      every arrow/.append style={%
                                        line width=.3+\pgfplotspointmetatransformed/1000,
                                        -{Latex[length=0pt 5,width=0pt 3]}
                                      },
                                  },
                                quiver/colored = {mapped color},
                                colormap name={rocket},
                                -stealth,
                              ]
                                table[col sep=comma] {res/proximal/2d_grad_L.csv};
                \end{axis}
            \end{tikzpicture}

            \caption{$\nabla L \left(\boldsymbol{y} \mid \tilde{\boldsymbol{x}} \right)$%
                \footnotemark{} for a repetition code with $n=2$}
        \end{subfigure}%
        \begin{subfigure}[c]{0.5\textwidth}
            \centering

            \begin{tikzpicture}
                \begin{axis}[xmin = -1.25, xmax=1.25,
                             ymin = -1.25, ymax=1.25,
                             width=0.9\textwidth,
                             height=0.8\textwidth,
                             xlabel={$x_1$}, ylabel={$x_2$},
                             grid=major, grid style={dotted},
                             view={0}{90}]
                    \addplot3[point meta=\thisrow{grad_norm},
                              point meta min=1,
                              point meta max=4,
                              quiver={u=\thisrow{grad_0},
                                      v=\thisrow{grad_1},
                                      scale arrows=.03,
                                      every arrow/.append style={%
                                        line width=.3+\pgfplotspointmetatransformed/1000,
                                        -{Latex[length=0pt 5,width=0pt 3]}
                                      },
                                  },
                                quiver/colored = {mapped color},
                                colormap name={rocket},
                                -stealth,
                              ]
                                table[col sep=comma] {res/proximal/2d_grad_h.csv};
                \end{axis}
            \end{tikzpicture}

            \caption{$\nabla h \left( \tilde{\boldsymbol{x}} \right) $ for a repetition code
                with $n=2$}
        \end{subfigure}%
    \end{figure}

    \footnotetext{In an AWGN Channel $\nabla L\left( \boldsymbol{y} \mid
            \tilde{\boldsymbol{x}}\right)
                    \propto \left( \tilde{\boldsymbol{x}} - \boldsymbol{y} \right)$}
\end{frame}


% TODO: Maybe add newly simulated second figure
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
    \frametitle{Proximal Decoding: Oscillation of Estimate}
   
    \vspace*{-3mm}

    \begin{itemize}
        \item Single decoding using a (3,6) regular LDPC code with $n=204, k=102$
            \citereference{Mac23, 204.33.484}
        \item For larger $n$, the gradient itself starts to oscillate
        \item Amplitude of oscillation highly correlated with probability of bit error
    \end{itemize}

    \bigskip

    \begin{figure}
        \centering

        \begin{subfigure}[t]{0.5\textwidth}
            \centering

            \begin{tikzpicture}
                \begin{axis}[
                    grid=both,
                    xlabel={Iterations},
                    width=0.85\textwidth,
                    height=0.4\textwidth,
                    scale only axis,
                    xtick={0, 100, ..., 400},
                    xticklabels={0, 50, ..., 200},
                ]
                    \addplot [scol0, mark=none, line width=1]
                        table [col sep=comma, x=k, y=comb_r_s_0]
                            {res/proximal/extreme_components_20433484_combined.csv};
                    \addplot [scol1, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_L_0]
                            {res/proximal/extreme_components_20433484_combined.csv};
                    \addplot [scol2, mark=none, line width=1]
                        table [col sep=comma, x=k, y=grad_h_0]
                            {res/proximal/extreme_components_20433484_combined.csv};
                    \addlegendentry{est}
                    \addlegendentry{$\left(\nabla L \right)_1$}
                    \addlegendentry{$\left(\nabla h \right)_1$}
                \end{axis}
            \end{tikzpicture}
        \end{subfigure}%
        \begin{subfigure}[t]{0.5\textwidth}
            \centering
            \begin{tikzpicture}
                \begin{axis}[
                    grid=both,
                    ylabel=$P(\hat{c}_{i'} \ne c_{i'})$,
                    xlabel=$i'$,
                    ymode=log,
                    ymin=8e-9,ymax=1e-5,
                    xmin=0,xmax=200,
                    width=0.85\textwidth,
                    height=0.4\textwidth,
                    scale only axis,
                ]
                     \addplot+ [scol0, mark=none, line width=1]
                        table [col sep=comma, y=p_error]{res/new_stuff/p_error.csv};
                \end{axis}
            \end{tikzpicture}
        \end{subfigure}
    \end{figure}

    \bigskip
        
    \addreference{Mac23}{David J.C. MacKay: \emph{Encyclopedia of Sparse Graph Codes}.
        Jan. 2023. URL: \url{http://www.inference.org.uk/mackay/codes/data.html}.}
\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''}
%
%    \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/proximal/2d_ber_fer_dfr_20433484.csv};
%                \addlegendentry{proximal}
%                \addplot table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.05}]
%                    {res/hybrid/2d_ber_fer_dfr_20433484.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/proximal/2d_ber_fer_dfr_20433484.csv};
%                \addlegendentry{proximal}
%                \addplot table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.05}]
%                    {res/hybrid/2d_ber_fer_dfr_20433484.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/proximal/2d_ber_fer_dfr_20433484.csv};
%                \addlegendentry{proximal}
%                \addplot table [x=SNR, y=DFR, col sep=comma, discard if not={gamma}{0.05}]
%                    {res/hybrid/2d_ber_fer_dfr_20433484.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}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t, fragile]
    \frametitle{Improved Algorithm}

    \vspace*{-0.5cm}

    \begin{itemize}
        \item Improvement of proximal decoding by addition of ``ML-in-the-List'' step after
            iterating
    \end{itemize}

    \vspace*{-2mm}

    \begin{minipage}[t]{.48\textwidth}
        \centering

        \begin{figure}
           \centering

           \begin{algorithm}[caption={}, label={}, basicstyle=\fontsize{9.5}{11.5}\selectfont]
$\boldsymbol{s} \leftarrow \boldsymbol{0}$
for $K$ iterations do
    $\boldsymbol{r} \leftarrow \boldsymbol{s} - \omega \nabla L \left( \boldsymbol{y} \mid \boldsymbol{s} \right) $
    $\boldsymbol{s} \leftarrow \boldsymbol{r} - \gamma \nabla h\left( \boldsymbol{r} \right) $
    $\boldsymbol{\hat{x}} \leftarrow \text{sign}\left( \boldsymbol{s} \right) $
    if $\boldsymbol{H}\boldsymbol{\hat{c}} = \boldsymbol{0}$ do
        return $\boldsymbol{\hat{c}}$
    end if
end for
return $\boldsymbol{\hat{c}}$ |\Suppressnumber|


|\phantom{a}||\Reactivatenumber|
            \end{algorithm}
        \end{figure}

    \end{minipage}%
    \hfill\begin{minipage}[t]{.48\textwidth}
        \centering
        \begin{figure}
           \centering 
            
           \begin{algorithm}[caption={}, label={}, basicstyle=\fontsize{9.5}{11.5}\selectfont]
$\boldsymbol{s} \leftarrow \boldsymbol{0}$
for $K$ iterations do
    $\boldsymbol{r} \leftarrow \boldsymbol{s} - \omega \nabla L \left( \boldsymbol{y} \mid \boldsymbol{s} \right) $
    $\boldsymbol{s} \leftarrow \boldsymbol{r} - \gamma \nabla h\left( \boldsymbol{r} \right) $
    $\boldsymbol{\hat{x}} \leftarrow \text{sign}\left( \boldsymbol{s} \right) $
    if $\boldsymbol{H}\boldsymbol{\hat{c}} = \boldsymbol{0}$
        return $\boldsymbol{\hat{c}}$
    end if
end for
$\textcolor{KITblue}{\text{Find }N\text{ most probably wrong bits}}$
$\textcolor{KITblue}{\text{Generate variations } \boldsymbol{\hat{c}}_l\text{ of }\boldsymbol{\hat{c}}\text{ with }N\text{ bits modified}}$
$\textcolor{KITblue}{\text{Compute }\boldsymbol{y}^\text{T}\boldsymbol{ \hat{c}}_l \text{ for all codewords } \boldsymbol{\hat{c}}_l}$
$\textcolor{KITblue}{\textbf{return }\boldsymbol{\hat{c}}_l\text{ with highest }\boldsymbol{y}^\text{T}\boldsymbol{ \hat{c}}_l \text{, prioritizing valid codewords}}$
            \end{algorithm}
        \end{figure}
    \end{minipage} 
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[t]
    \frametitle{Improved Algorithm}
   
    \vspace{-0.6cm}

    \begin{itemize}
        \item (3,6) regular LDPC code with $n=204, k=102$ \citereference{Mac23, 204.33.484}
        \item Up to $\sim \SI{1}{dB}$ improvement
    \end{itemize}

    \begin{figure}[H]
        \centering
    
        \begin{tikzpicture}
            \begin{axis}[
                grid=both,
                xlabel={$E_b / N_0$}, ylabel={BER},
                ymode=log,
                legend columns=2,
                legend style={at={(0.5,-0.45)},anchor=south},
                ymax=1.5, ymin=3e-8,
                width=0.45\textwidth,
                height=0.3\textwidth,
            ]
                \addplot[scol0, line width=1pt]
                    table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.15}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addplot[scol0, only marks, mark=square, line width=1pt]
                    table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.15}]
                        {res/hybrid/2d_ber_fer_dfr_20433484.csv};

                \addplot[scol1, line width=1pt]
                    table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.01}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addplot[scol1, only marks, mark=square, line width=1pt]
                    table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.01}]
                        {res/hybrid/2d_ber_fer_dfr_20433484.csv};
                
                \addplot[scol2, line width=1pt]
                    table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.05}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addplot[scol2, only marks, mark=square, line width=1pt]
                    table [x=SNR, y=BER, col sep=comma, discard if not={gamma}{0.05}]
                        {res/hybrid/2d_ber_fer_dfr_20433484.csv};
            \end{axis}
        \end{tikzpicture}
        \begin{tikzpicture}
            \begin{axis}[
                grid=both,
                xlabel={$E_b / N_0$}, ylabel={FER},
                ymode=log,
                legend columns=2,
                legend style={at={(0.5,-0.45)},anchor=south},
                ymax=1.5, ymin=3e-8,
                width=0.45\textwidth,
                height=0.3\textwidth,
            ]

                \addplot[scol0, line width=1pt]
                    table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.15}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addplot[scol0, only marks, mark=square, line width=1pt]
                    table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.15}]
                        {res/hybrid/2d_ber_fer_dfr_20433484.csv};

                \addplot[scol1, line width=1pt]
                    table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.01}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addplot[scol1, only marks, mark=square, line width=1pt]
                    table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.01}]
                        {res/hybrid/2d_ber_fer_dfr_20433484.csv};
                
                \addplot[scol2, line width=1pt]
                    table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.05}]
                        {res/proximal/2d_ber_fer_dfr_20433484.csv};
                \addplot[scol2, only marks, mark=square, line width=1pt]
                    table [x=SNR, y=FER, col sep=comma, discard if not={gamma}{0.05}]
                        {res/hybrid/2d_ber_fer_dfr_20433484.csv};
            \end{axis}
        \end{tikzpicture}
        \begin{tikzpicture}
            \begin{axis}[hide axis,
                         xmin=10, xmax=50,
                         ymin=0, ymax=0.4,
                         legend columns=3,
                         legend style={draw=white!15!black,legend cell align=left}]

                \addlegendimage{scol0, line width=1pt}
                \addlegendentry{Proximal ($\gamma = 0.15$)}

                \addlegendimage{scol1, line width=1pt}
                \addlegendentry{Proximal ($\gamma = 0.01$)}
                
                \addlegendimage{scol2, line width=1pt}
                \addlegendentry{Proximal ($\gamma = 0.05$)}
                
                \addlegendimage{scol0, only marks, mark=square, line width=1pt}
                \addlegendentry{Improved ($\gamma = 0.15, N=12$)}

                \addlegendimage{scol1, only marks, mark=square, line width=1pt}
                \addlegendentry{Improved ($\gamma = 0.01, N=12$)}
                
                \addlegendimage{scol2, only marks, mark=square, line width=1pt}
                \addlegendentry{Improved ($\gamma = 0.05, N=12$)}
            \end{axis}
        \end{tikzpicture}
    \end{figure}

    \bigskip

    \addreference{Mac23}{David J.C. MacKay: \emph{Encyclopedia of Sparse Graph Codes}.
        Jan. 2023. URL: \url{http://www.inference.org.uk/mackay/codes/data.html}.}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
    \frametitle{Improved Algorithm: Effect of parameter $N$}

    \vspace*{-5mm}

    \begin{itemize}
        \item (3,6) regular LDPC code with $n=204, k=102$ \citereference{Mac23, 204.33.484}
        \item Chosen parameters: $\gamma = 0.05$
    \end{itemize}

    \smallskip

    \begin{figure}[H]
        \centering

        \begin{tikzpicture}

            \begin{axis}[ymode=log,
                         xlabel={$E_b / N_0$ (dB)},
                         ylabel={FER},
                         legend pos=outer north east,
                         width=0.45\textwidth,
                         height=0.3375\textwidth,
                         legend cell align={left}, grid,
                         ]
                    
            \addplot[scol3, line width=1pt]
            table [col sep=comma, discard if not={gamma}{0.05},
                x = SNR, y=FER] {res/new_stuff/2d_ber_fer_dfr_20433484_abs_N_4.csv};
                \addlegendentry{$N=4$}
                
            \addplot[KITorange, line width=1pt]
            table [col sep=comma, discard if not={gamma}{0.05},
                x = SNR, y=FER] {res/new_stuff/2d_ber_fer_dfr_20433484_abs_N_6.csv};
                \addlegendentry{$N=6$}
                
            \addplot[scol2, line width=1pt]
            table [col sep=comma, discard if not={gamma}{0.05},
                x = SNR, y=FER] {res/new_stuff/2d_ber_fer_dfr_20433484_abs_N_8.csv};
                \addlegendentry{$N=8$}
                
            \addplot[scol1, line width=1pt]
            table [col sep=comma, discard if not={gamma}{0.05},
                x = SNR, y=FER] {res/new_stuff/2d_ber_fer_dfr_20433484_abs_N_10.csv};
                \addlegendentry{$N=10$}
            
            \addplot[scol0, line width=1pt]
            table [col sep=comma, discard if not={gamma}{0.05},
                x = SNR, y=FER] {res/new_stuff/2d_ber_fer_dfr_20433484_abs.csv};
                \addlegendentry{$N=12$}

            \end{axis}
        \end{tikzpicture}
    \end{figure}%

    \addreference{Mac23}{David J.C. MacKay: \emph{Encyclopedia of Sparse Graph Codes}.
        Jan. 2023. URL: \url{http://www.inference.org.uk/mackay/codes/data.html}.}
\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}[fragile]
    \frametitle{Improved Algorithm: List Choice Policy}

    \vspace*{-5mm}

    \begin{itemize}
        \item (3,6) regular LDPC code with $n=204, k=102$ \citereference{Mac23, 204.33.484}
        \item Chosen parameters: $N=8, \gamma = 0.05$
    \end{itemize}

    \vspace*{-5mm}

    \begin{figure}
        \centering
        \begin{subfigure}[c]{0.66\textwidth}
            \centering

            \begin{tikzpicture}
                \begin{axis}[
                    grid=both, grid style={line width=.1pt},
                    xlabel={$E_b / N_0$ (dB)},
                    ylabel={BER (\lineintext{}), FER (\lineintext{dashed})},
                    ymode=log,
                    legend cell align={left},
                    legend pos={outer north east},
                    width=0.68\textwidth,
                    height=0.51\textwidth,
                    ymax=1.2, ymin=0.8e-4,
                    xtick={1, 2, ..., 5},
                    xmin=0.9, xmax=5.6,
                    legend columns=1,
                ]

                    %
                    % Proximal
                    %

                    \addplot[name path=maxBER1, mark=none, scol0]
                    table[col sep=comma, x=SNR, y=max_BER]
                        {res/new_stuff/proximal.csv};
                    \addplot[name path=minBER1, mark=none, scol0, forget plot]
                    table[col sep=comma, x=SNR, y=min_BER]
                        {res/new_stuff/proximal.csv};

                    \addplot[scol0!50, forget plot] fill between[of=minBER1 and maxBER1];

                    \addplot[name path=maxFER1, mark=none, scol0, densely dashed, forget plot]
                    table[col sep=comma, x=SNR, y=max_FER]
                        {res/new_stuff/proximal.csv};
                    \addplot[name path=minFER1, mark=none, scol0, densely dashed, forget plot]
                    table[col sep=comma, x=SNR, y=min_FER]
                        {res/new_stuff/proximal.csv};

                    \addplot[scol0!50, forget plot] fill between[of=minFER1 and maxFER1];

                    \addlegendentry{Proximal}

                    %
                    % Improved Random
                    %

                    \addplot[name path=maxBER2, mark=none, scol1]
                    table[col sep=comma, x=SNR, y=max_BER]
                        {res/new_stuff/improved_random.csv};
                    \addplot[name path=minBER2, mark=none, scol1, forget plot]
                    table[col sep=comma, x=SNR, y=min_BER]
                        {res/new_stuff/improved_random.csv};

                    \addplot[scol1!50, forget plot] fill between[of=minBER2 and maxBER2];

                    \addplot[name path=maxFER2, mark=none, scol1, densely dashed, forget plot]
                    table[col sep=comma, x=SNR, y=max_FER]
                        {res/new_stuff/improved_random.csv};
                    \addplot[name path=minFER2, mark=none, scol1, densely dashed, forget plot]
                    table[col sep=comma, x=SNR, y=min_FER]
                        {res/new_stuff/improved_random.csv};

                    %                \addplot[only marks, scol0, forget plot]
                    %                    table[col sep=comma, x=SNR, y=min_DFR]
                    %                        {res/new_stuff/improved_random.csv};

                    \addplot[scol1!50, forget plot] fill between[of=minFER2 and maxFER2];

                    \addlegendentry{Improved: Random}

                    %
                    % Improved ML
                    %

                    \addplot[name path=maxBER4, mark=none, scol2]
                    table[col sep=comma, x=SNR, y=max_BER]
                        {res/new_stuff/improved_ml.csv};
                    \addplot[name path=minBER4, mark=none, scol2, forget plot]
                    table[col sep=comma, x=SNR, y=min_BER]
                        {res/new_stuff/improved_ml.csv};

                    \addplot[scol2!50, forget plot] fill between[of=minBER4 and maxBER4];

                    \addplot[name path=maxFER4, mark=none, scol2, densely dashed, forget plot]
                    table[col sep=comma, x=SNR, y=max_FER]
                        {res/new_stuff/improved_ml.csv};
                    \addplot[name path=minFER4, mark=none, scol2, densely dashed, forget plot]
                    table[col sep=comma, x=SNR, y=min_FER]
                        {res/new_stuff/improved_ml.csv};

                    \addplot[scol2!50, forget plot] fill between[of=minFER4 and maxFER4];

                    \addlegendentry{Improved: ML}

                    %
                    % Improved Hamming
                    %

                    \addplot[name path=maxBER3, mark=none, KITorange]
                    table[col sep=comma, x=SNR, y=max_BER]
                        {res/new_stuff/improved_hamming.csv};
                    \addplot[name path=minBER3, mark=none, KITorange, forget plot]
                    table[col sep=comma, x=SNR, y=min_BER]
                        {res/new_stuff/improved_hamming.csv};

                    \addplot[KITorange!50, forget plot] fill between[of=minBER3 and maxBER3];

                    \addplot[name path=maxFER3, mark=none, KITorange, densely dashed, forget plot]
                    table[col sep=comma, x=SNR, y=max_FER]
                        {res/new_stuff/improved_hamming.csv};
                    \addplot[name path=minFER3, mark=none, KITorange, densely dashed, forget plot]
                    table[col sep=comma, x=SNR, y=min_FER]
                        {res/new_stuff/improved_hamming.csv};

                    \addplot[KITorange!50, forget plot] fill between[of=minFER3 and maxFER3];

                    \addlegendentry{Improved: Hamming}
                \end{axis}
            \end{tikzpicture}

            %\caption{Comparison of FER and BER of the improved algorithm for
            %    different list choice policies.}
        \end{subfigure}%
        \begin{subfigure}[c]{0.33\textwidth}
            \centering

            \begin{tabular}{c c c c c c}
                $E_b/N_0$ & \shortstack{list size\\ mean} & \shortstack{list size\\ var.} \\
                \hline
                1.0 & 1.0            & 0.0 \\
                1.5 & 1.0            & 0.0 \\
                2.0 & 1.0            & 0.0 \\
                2.5 & 1.0            & 0.0 \\
                3.0 & 1.0            & 0.0 \\
                3.5 & 1.0            & 0.0 \\
                4.0 & 1.0            & 0.0 \\
                4.5 & 1.0            & 0.0 \\
                5.0 & 1.0            & 0.0 \\
                5.5 & 1.0            & 0.0
            \end{tabular}

            \caption{List size statistics for successful decodings (no frame error).}
        \end{subfigure}
    \end{figure}

    \addreference{Mac23}{David J.C. MacKay: \emph{Encyclopedia of Sparse Graph Codes}.
        Jan. 2023. URL: \url{http://www.inference.org.uk/mackay/codes/data.html}.}
\end{frame}


