# Adaptive Learned Belief Propagation for Decoding Error-Correcting Codes
## Appendix A Protograph-Based QC-LDPC Codes
### Construction for the Single-Edge Case  
A single-edge PB QC-LDPC code \(\mathcal{C}\) is constructed in two steps. First, a base matrix \(\mathrm{B}\in\mathbb{F}_{2}^{\lambda\times\omega}\) is constructed, where \(\lambda,\omega\in\mathbb{N},\lambda\leq\omega\). Then, \(\mathrm{B}\) is expanded to the PCM of \(\mathcal{C}\) by replacing each zero in \(\mathrm{B}\) with the all-zero matrix \(\mathbf{0}\in\mathbb{F}_{2}^{M\times M}\), where \(M\in\mathbb{N}\) is the lifting factor, and a one in row \(i\) and column \(j\) with a sparse circulant matrix \(\mathrm{H}_{i,j}\in\mathbb{F}_{2}^{M\times M}\).  
Let \(\mathrm{P}\in[-1\!\!:\!M-1]^{\lambda\times\omega}\) be the exponent matrix of the code, with the entries denoted by \(p_{i,j}\). The matrices \(\mathrm{H}_{i,j}\) (and \(\mathrm{B}\)) can be obtained from \(\mathrm{P}\) as follows. Denote by \(\mathrm{I}^{n}\in\mathbb{F}_{2}^{M\times M}\), \(n\in[-1\!\!:\!M-1]\) the circulant permutation matrix obtained by cyclic-shifting of each row of the \(M\times M\) identity matrix \(n\) positions to the right, with the convention that \(\mathrm{I}^{-1}\) is the all-zero matrix. Then, \(\mathrm{H}_{i,j}=\mathrm{I}^{p_{i,j}}\). The PCM \(\mathrm{H}:=\mathrm{H}(\lambda,\omega,M,\mathrm{P})\in\mathbb{F}_{2}^{\omega M \times\lambda M}\) of this QC-LDPC code is  
\[\mathrm{H}=\begin{pmatrix}\mathrm{I}^{p_{1,1}}&\mathrm{I}^{p_{1,2}}&\dots& \mathrm{I}^{p_{1,\omega}}\\ \mathrm{I}^{p_{2,1}}&\mathrm{I}^{p_{2,2}}&\dots&\mathrm{I}^{p_{2,\omega}}\\ \vdots&\vdots&\ddots&\vdots\\ \mathrm{I}^{p_{3,1}}&\mathrm{I}^{p_{3,2}}&\dots&\mathrm{I}^{p_{3,\omega}}\\ \end{pmatrix}. \tag{1}\]  
This code has a length \(n=\omega M,k=\omega M-r\), and a rate \(r=1-r/(\omega M)\), where \(r\leq\lambda M\) is the rank of \(\mathrm{H}\). If \(\mathrm{H}\) is of a full rank, \(r=1-\lambda/\omega\). The base matrix is also obtained from \(\mathrm{P}\), as \(\mathrm{B}_{i,j}=0\) if \(p_{i,j}=-1\) and \(\mathrm{B}_{i,j}=1\) if \(p_{i,j}\
eq-1\).  
Denote the Tanner graph of \(\mathcal{C}\) by \(T_{\mathcal{C}}\), and let \(d_{c}\) and \(d_{v}\) be, respectively, the degree of the check node \(c\) and the variable node \(v\) in \(T_{\mathcal{C}}\). If \(\mathrm{B}\) is regular (i.e., its rows have the same Hamming weight), then \(\mathrm{H}\) is regular, and the check and variable nodes of \(\mathcal{C}\) have the same degrees \(d_{c}\) and \(d_{v}\), respectively. In this case, \(\mathcal{C}\) is said to be \((d_{c},d_{v})\)-regular. More generally, a variable node's degree distribution polynomial can be defined as \(\mathrm{Y}(x)=\sum_{d}\mathrm{Y}_{d}x^{d-1}\), where \(\mathrm{Y}_{d}\) is the fraction of variable nodes of degree \(d\), and a check node degree distribution \(\Lambda(x)=\sum_{d}\Lambda_{d}x^{d-1}\), where \(\Lambda_{d}\) is the fraction of check nodes of degree \(d\).  
The parameter matrices \(\mathrm{B}\) and \(\mathrm{P}\) can be obtained so as to maximize the girth of \(T_{\mathcal{C}}\) using search-based methods such as the PEG algorithm [86; 94], algebraic methods ([69] Section 10), or a combination of them [95].  
**Example A1**.: _Consider \(\lambda=3\), \(\omega=5\), and the base matrix \(\mathrm{B}\in\mathbb{F}_{2}^{3\times 5}\)_  
\[\mathrm{B}=\begin{pmatrix}0&1&1&1&0\\ 1&1&0&1&1\\ 1&0&1&1&1\end{pmatrix}.\]  
_For any exponent matrix \(\mathrm{P}\), \(\mathrm{H}\in\mathbb{F}_{2}^{3M\times 5M}\) is_  
\[\mathrm{H}=\begin{pmatrix}\mathrm{I}^{-1}&\mathrm{I}^{p_{1,2}}&\mathrm{I}^{p_{1,3}}&\mathrm{I}^{p_{1,4}}&\mathrm{I}^{-1}\\ \mathrm{I}^{p_{2,1}}&\mathrm{I}^{p_{2,2}}&\mathrm{I}^{-1}&\mathrm{I}^{p_{2,4}}& \mathrm{I}^{p_{2,5}}\\ \mathrm{I}^{p_{3,1}}&\mathrm{I}^{-1}&\mathrm{I}^{p_{3,3}}&\mathrm{I}^{p_{3,4}}& \mathrm{I}^{p_{3,5}}\\ \end{pmatrix}.\qed\]