\documentclass[xcolor=dvipsnames,t,aspectratio=169]{beamer}
\setbeamersize{text margin left=1cm,text margin right=1cm,}

\usepackage{subcaption}
\usepackage{minted}
\usepackage[minted, most]{tcolorbox}
\usepackage{amsmath}
\usepackage{bm}
\usepackage[dvipsnames]{xcolor}
\usepackage{siunitx}
\usepackage{graphics}
\usepackage{xfp}
\usepackage{quantikz}

\usepackage[T1]{fontenc}
\usepackage[scaled=.92]{helvet}

\usepackage{tikz}
\usetikzlibrary{positioning, arrows.meta, shapes.misc,
decorations.pathreplacing, calc}

\usepackage{pgfplots}
\usepackage{pgffor}
\usepgfplotslibrary{groupplots}

% \usetikzlibrary{external}
% \tikzexternalize

%
%
% Set up the theme
%
%

% General and beamer options

\makeatletter
\addtobeamertemplate{author}{\centering}{}
\addtobeamertemplate{date}{\vspace*{-0.85cm}\centering}{}
\makeatother

\setbeamertemplate{enumerate items}[circle]
\setbeamertemplate{itemize items}[circle]
\setbeamercolor{title}{fg=black}
\setbeamercolor{frametitle}{fg=black}

\setbeamertemplate{footline}[frame number]
\setbeamertemplate{navigation symbols}{}

% \AtBeginSection[]{
%     \begin{frame}
%         \frametitle{Overview}
%         \tableofcontents[currentsection]
%     \end{frame}
% }
%
% \AtBeginSubsection[]{
%     \begin{frame}
%         \frametitle{Overview}
%         \tableofcontents[currentsubsection]
%     \end{frame}
% }

\fontfamily{cmss}\selectfont

\newcommand\wider[2][3em]{%
    \makebox[\linewidth][c]{%
        \begin{minipage}{\dimexpr\textwidth+#1\relax}
            \raggedright#2
        \end{minipage}%
    }%
}

% Code listings

\usemintedstyle{gruvbox-dark}
\definecolor{gruvbox-bg}{HTML}{282828}

% PGF color scheme

\input{lib/latex-common/common.tex}
\pgfplotsset{colorscheme/rocket}

%
%
% Configure document
%
%

\title{Soft-Information Aware Sliding-Window Decoding}
\author{Andreas Tsouchlos}
\date{March 26, 2026}

%
%
% Custom commands
%
%

\newcommand{\red}[1]{\textcolor{red}{#1}}

\newcommand{\linkpython}[1]{
    \scalebox{0.7}{
        \begingroup
        \setbox0=\hbox{\includegraphics[scale=0.18]{\res/python-logo.pdf}}%
        \parbox{\wd0}{\box0}\endgroup
        \hspace{1mm}
        \colorbox{gruvbox-bg}{%
            \textcolor{white}{%
                \texttt{#1}%
            }%
        }%
    }%
}

%
%
% Content
%
%

\begin{document}

\frame[plain]{\titlepage}
\setcounter{framenumber}{0}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Motivation and Core Idea}
\label{sec:Motivation and Core Idea}

\newsavebox{\innercircuit}
\begin{frame}
    \frametitle{Sliding-Window Decoding for Fault-Tolerant QEC}

    % \vspace*{-5mm}

    \begin{figure}
        \scalebox{0.8}{
            \savebox{\innercircuit}{
                \begin{tikzpicture}[
                        block/.style={draw, rectangle, minimum
                            height=1cm, minimum width=1.2cm, align=center,
                        fill=white, font=\small},
                        container/.style={draw, thick, inner sep=0.6cm}
                    ]
                    % Internal blocks
                    \node (se1) [block]
                    {$\text{SE}_1$ \\ + noise};
                    \node (se2) [block, right=0.5cm of se1]
                    {$\text{SE}_2$ \\ + noise};
                    \node (dots) [right=0.3cm of se2] {\dots};

                    % Wires
                    \draw (se1.west) -- ++(-0.4,0);
                    \draw (se1.east) -- (se2.west);
                    \draw (se2.east) -- (dots.west);
                    \draw (dots.east) -- ++(0.4,0);

                    % The "Circuit" container
                    \node (box) [
                        container, fit=(se1) (se2) (dots),
                        label={[anchor=north west, xshift=2pt]
                        north west:Complete circuit}
                    ] {};
                \end{tikzpicture}
            }

            \begin{tikzpicture}[
                    every edge/.style = {draw, -{latex}}
                ]
                \node (pcm) {Code~/~$\bm{H}_\text{PCM}$};

                \node[
                    rectangle,
                    draw=black,
                    minimum width=2cm, minimum height=1cm,
                    right=of pcm,
                    align=center
                ] (sec) {Single\\ SE Circ.};

                \node[right=of sec] (qc) {\usebox{\innercircuit}};

                \node[right=of qc] (dem) {$\bm{H}_\text{DEM}$};

                \draw (pcm.east) edge[bend left] (sec.west);
                \draw (sec.east) edge[bend left] ($(qc.west) + (0.22,0)$);
                \draw ($(qc.east) + (-0.22,0)$) edge[bend left]
                node[midway, above] {Stim} (dem.west);
            \end{tikzpicture}
        }
    \end{figure}

    \only<1>{
        \begin{figure}[H]
            \centering
            \includegraphics[scale=0.55]{./res/pcm.png}
        \end{figure}
    }
    \only<2->{
        \begin{figure}[H]
            \centering
            \includegraphics[scale=0.55]{./res/windowing.png}
        \end{figure}
    }

    \vspace*{-5mm}

    \visible<2->{
        \begin{align*}
            \colorbox{red!20}{$\bm{H}_1 \bm{e}_1 = \bm{s}_1$}
            \hspace{2mm}\rightarrow\hspace{2mm} \hat{\bm{e_1}} = \cdots
            \hspace{2mm}\rightarrow\hspace{2mm} \bm{s}_2' = \cdots \\
            \colorbox{ForestGreen!20}{$\bm{H}_2 \bm{e}_2 = \bm{s}_2'$}
            \hspace{2mm}\rightarrow\hspace{2mm} \hat{\bm{e_2}} = \cdots
            \hspace{2mm}\rightarrow\hspace{2mm} \bm{s}_3' = \cdots \\
            \colorbox{blue!20}{$\bm{H}_3 \bm{e}_3 = \bm{s}_3'$}
            \hspace{2mm}\rightarrow\hspace{2mm} \hat{\bm{e_3}} = \cdots
            \hspace{2mm}\rightarrow\hspace{2mm} \bm{s}_4' = \cdots
            % &\hspace{2.25mm}\vdots
        \end{align*}
    }
\end{frame}

\begin{frame}
    \frametitle{Similarities to Spatially-Coupled LDPC Codes}

    \begin{figure}[H]
        \centering
        \includegraphics[scale=0.1]{./res/sc-tanner-graph.png}
        \includegraphics[scale=0.1]{./res/sc-pcm.png}
    \end{figure}
\end{frame}

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

\begin{frame}
    \frametitle{An ``Upper Bound'' on the Performance Gain}

    \begin{minipage}{0.65\textwidth}
        \begin{figure}[H]
            % \centering
            \hspace*{-8mm}
            \begin{tikzpicture}
                \begin{axis}[
                        width=10cm,
                        height=8cm,
                        ymode=log,
                        ylabel={LER},
                        xlabel={Physical error rate},
                        legend pos=south east,
                        legend style={
                            cells={anchor=west},
                            cells={align=left},
                        },
                        xticklabel style={/pgf/number format/fixed},
                        xticklabel style={/pgf/number format/precision=4},
                        scaled x ticks=false,
                        grid=both,
                        xtick={0.001,0.0015,...,0.004},
                        xmin=0.001, xmax=0.004,
                        ymin=1e-2, ymax=1,
                    ]

                    \addplot+[NavyBlue, mark=none, line width=1pt]
                    table[col sep=comma, x=p, y=LER_sw]
                    {res/whole_vs_windowed_spa.csv};
                    \addlegendentry{Windowed - SPA}

                    \addplot+[BurntOrange, mark=none, line width=1pt]
                    table[col sep=comma, x=p, y=LER_sw]
                    {res/whole_vs_windowed_min_sum.csv};
                    \addlegendentry{Windowed - Min-Sum}

                    \addplot+[NavyBlue, mark=none, line width=1pt,
                    densely dashed]
                    table[col sep=comma, x=p, y=LER_whole]
                    {res/whole_vs_windowed_spa.csv};
                    \addlegendentry{Whole - SPA}

                    \addplot+[BurntOrange, mark=none, line width=1pt,
                    densely dashed]
                    table[col sep=comma, x=p, y=LER_whole]
                    {res/whole_vs_windowed_min_sum.csv};
                    \addlegendentry{Whole - Min-Sum}

                \end{axis}
            \end{tikzpicture}
        \end{figure}
    \end{minipage}%
    \begin{minipage}{0.35\textwidth}
        \begin{itemize}
            \item $[[144,12,12]]$ BB code
            \item $n_\text{rounds} = 12$
            \item $W=3$, $F=1$
        \end{itemize}
    \end{minipage}
\end{frame}

\begin{frame}
    \frametitle{Soft- vs. Hard-Information Decoding Behavior I}

    \begin{minipage}{0.65\textwidth}
        \begin{figure}[H]
            % \centering
            \hspace*{-8mm}
            \begin{tikzpicture}
                \begin{axis}[
                        width=10cm,
                        height=8cm,
                        ymode=log,
                        ylabel={LER},
                        xlabel={Physical error rate},
                        legend pos=south east,
                        legend style={
                            cells={anchor=west},
                            cells={align=left},
                        },
                        xticklabel style={/pgf/number format/fixed},
                        xticklabel style={/pgf/number format/precision=4},
                        scaled x ticks=false,
                        grid=both,
                        xtick={0.001,0.0015,...,0.004},
                        xmin=0.001, xmax=0.004,
                        ymin=1e-2, ymax=1,
                    ]

                    \addplot+[BurntOrange, mark=none,
                    line width=1pt]
                    table[col sep=comma, x=p, y=LER_soft]
                    {res/hard_vs_soft_spa.csv};
                    \addlegendentry{Soft info - SPA}

                    \addplot+[BurntOrange, densely dashed, mark=none,
                    line width=1pt]
                    table[col sep=comma, x=p, y=LER_hard]
                    {res/hard_vs_soft_spa.csv};
                    \addlegendentry{Hard info - SPA}

                    \addplot+[NavyBlue, mark=none, line width=1pt]
                    table[col sep=comma, x=p, y=LER_soft]
                    {res/hard_vs_soft_min_sum.csv};
                    \addlegendentry{Soft info - Min-Sum}

                    \addplot+[NavyBlue, densely dashed, mark=none,
                    line width=1pt]
                    table[col sep=comma, x=p, y=LER_hard]
                    {res/hard_vs_soft_min_sum.csv};
                    \addlegendentry{Hard info - Min-Sum}
                \end{axis}
            \end{tikzpicture}
        \end{figure}
    \end{minipage}%
    \begin{minipage}{0.35\textwidth}
        \begin{itemize}
            \item $[[144,12,12]]$ BB code
            \item $n_\text{rounds} = 12$
            \item $W=3$, $F=1$
        \end{itemize}
    \end{minipage}

    % \begin{itemize}
    %     \item \red{Soft vs hard for min sum and spa (4 plots)}
    %     \item \red{Different window sizes}
    % \end{itemize}
\end{frame}

% \begin{frame}
%     \frametitle{Soft- vs. Hard-Information Decoding Behavior II}
%
%     \begin{itemize}
%         \item \red{Comparison of numbers of iterations for soft vs hard}
%         \item \red{Convergence analysis}
%     \end{itemize}
% \end{frame}
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \section{Future Work and Open Questions}
% \label{sec:Future Work and Open Questions}
%
% \begin{frame}
%     \frametitle{Future Work}
%
%     \vspace*{15mm}
%
%     \begin{itemize}
%         \item Look at behavior during iterations
%         \item Move from BP to BPGD
%
%             \vspace{15mm}
%
%         \item Q: Theoretically rigorous proof for the
%             ``window-friendly'' structure of the detector error matrix?
%         \item Q: Min-sum seems to perform better than SPA? \red{Make
%             sure this question even makes sense}
%     \end{itemize}
% \end{frame}
%
% % TODOs
% % - Whole vs windowed for min sum and spa
% %    - Basic implementation
% %    - Choose parameters (e.g., window sizes)
% % - soft vs hard for min sum and spa (4 plots)
% %    - Basic implementation
% %    - Choose parameters (e.g., window sizes)
% % - Comparison of numbers of iterations for soft vs hard
% %    - Basic implementation (more or less done)
% %    - Choose parameters
% % - Convergence analysis
% %    - Basic implementation (more or less done)
% %    - Choose parameters
% % - Make sure min sum vs spa question makes sense
% % - Think of a few words for each slide (and take notes)

\end{document}

