# Adaptive Learned Belief Propagation for Decoding Error-Correcting Codes
## Appendix B Spatially Coupled LDPC Codes
### Sliding Window Decoder  
Consider the SC LDPC code \(\mathrm{H}_{\mathrm{SC}}(\lambda,\omega,M,\mathrm{P},m_{s},L,\mathbb{B})\) in Appendix B.1. Note that any two variable-nodes in the Tanner graph of the code whose corresponding columns in \(\mathrm{H}_{\mathrm{SC}}\) are at least \((m_{s}+1)M\omega\) columns apart do not share any common check-nodes. Thus, they are not involved in the same parity-check equation. The SWD uses this property and runs a local BP decoder on windows of \(\mathrm{H}_{\mathrm{SC}}\) shown in Figure A1.  
SWD works through a sequence of spatial iterations \(\ell\), where a rectangular window slides from the top-left to the bottom-right side of \(\mathrm{H}_{\mathrm{SC}}\). In general, a window matrix \(\mathrm{H}_{w}\) of size \(m_{w}\) consists of \(m_{w}\lambda M\) consecutive rows and \(m_{w}\omega M\) consecutive columns in \(\mathrm{H}_{\mathrm{SC}}\). At each iteration \(\ell\), it moves \(\lambda M\) rows down and \(\omega M\) columns to the right in \(\mathrm{H}_{\mathrm{SC}}\). Thus, a window is an \(m_{w}\times m_{w}\) block, starting from the top left and moving diagonally one block down per iteration. There is a special case where the window reaches the boundary. The way the windows near the boundary are terminated impacts performance [98; 99]. Our setup for window termination at boundary is _early termination_, which is discussed in section III-B1 [99].  
Denote the variable nodes in window \(\ell\) by  
\[V(\ell)=\Big{\{}v_{i}\in V:i=(\ell-1)\omega M,\cdots,(m_{w}+\ell-1)\omega M-1 \Big{\}}.\]  
The check-nodes directly connected to \(V(\ell)\) are \(C(\ell)\). Define \(\tilde{V}(\ell)=\cup_{\ell^{\prime}<\ell}\{v\in V(\ell^{\prime})\setminus V( \ell),\,v\text{ connected to }C(\ell)\}\) (the variable nodes in the previous windows not in the current window, shown in green in Figure A1) \(\tilde{V}(\ell)=\cup_{\ell^{\prime}<\ell}\{v\in V(\ell^{\prime})\cap V(\ell),\,v \text{ connected to }C(\ell)\}\) (the variable nodes in the current window and any previous window, shown in blue in Figure A1), and \(\tilde{V}(\ell)=\cup_{\ell^{\prime}<\ell}\{v\in V(\ell)\setminus V(\ell^{ \prime}),\,v\text{ connected to }C(\ell)\}\) (the variables nodesin the current window not in any previous window, shown in red in Figure 11). Let \(\mathrm{L}_{v2c}^{(t,\ell)}\) and \(\mathrm{L}_{c2v}^{(t,\ell)}\) be LLRs in window \(\ell\) and iteration \(t\in[T_{\ell}]\) in BP. At \(t=1\), the BP is initialized as  
\[\mathrm{L}^{(1,\ell)}(v)=\begin{cases}\mathrm{L}^{(T_{\ell-1,\ell-1})}(v),&v \in\tilde{V}(\ell)\cup\tilde{V}(\ell),\\ \mathrm{L}(\mathbf{y}),&v\in\tilde{V}(\ell)\end{cases} \tag{11}\]  
The update equation for the variable node is  
\[\mathrm{L}_{v2c}^{(t,\ell)}=\begin{cases}\mathrm{L}_{v2c}^{(T_{\ell-1,\ell-1} )},&v\in\tilde{V}(\ell),\\ \mathrm{L}(\mathbf{y})+\sum\limits_{\ell^{\prime}\in\mathcal{C}_{v}\setminus \{c\}}\mathrm{L}_{v2v}^{(t-1),\ell},&v\in\tilde{V}(\ell)\\ \mathrm{L}(\mathbf{y}),&v\in\tilde{V}(\ell).\end{cases}\]  
The update relation for \(\mathrm{L}_{c2v}^{(t,\ell)}\) is given by (9), with no weights, applied for \(c\in C(\ell)\) and \(v\in V(\ell)\). After \(T_{\ell}\) iterations, the variables in the window \(\ell\), called target symbols, are decoded. The SWD is illustrated in Figure 11.