# DLSTM-Based Successive Cancellation Flipping Decoder for Short Polar Codes
## 2 Preliminary
### Polar Codes  
A polar code of length \(N\) with \(K\) information bits can be represented by \(P(N,\,K)\). The code rate is \(R=K/N,0<K<N\). The \(K\) most reliable channels are selected to transmit the information bits and the remaining \(N-K\) channels transmit the frozen bits. The set of information bit indices and frozen bit indices are denoted by \(\mathcal{A}\) and its complement \(\mathcal{A}^{\text{C}}\). The sequence \(\boldsymbol{u}_{1}^{N}=\{u_{1},u_{2},\ldots,u_{N}\}\) is obtained by mixing the information bits \(u_{\mathcal{A}}\) and the frozen bits \(u_{\mathcal{A}^{\text{C}}}\), and a polar codeword \(\boldsymbol{x}_{1}^{N}\) is generated by generator matrix \(\mathbf{G}_{N}\):  
\[\boldsymbol{x}_{1}^{N}=\boldsymbol{u}_{1}^{N}\mathbf{G}_{N}, \tag{1}\]where \(\mathbf{x}_{1}^{N}=\{x_{1},x_{2},\ldots,x_{N}\}\), \(\mathbf{G}_{N}=\mathbf{B}_{N}\mathbf{F}^{\otimes n}\), \(n=\log_{2}N\), \(\mathbf{B}_{N}\) is a \(N\!\times\!N\) bit-reversal permutation matrix, and \(\mathbf{F}^{\otimes n}\) denotes the \(n\)th Kronecker power of \(\mathbf{F}\), with  
\[\mathbf{F}=\left[\begin{array}{cc}1&0\\ 1&1\end{array}\right]. \tag{2}\]  
The butterfly-based decoding structure is shown in Figure 1. The SC decoding starts by computing an estimate value \(\hat{u}_{1}\) of \(u_{1}\) based only on the received value \(y_{1}^{N}\). Then, \(y_{1}^{N}\) and \(\hat{u}_{i-1}\) are used to estimate \(\hat{u}_{i}\), \(i=2,\ldots,N\). A binary input memoryless channel \(W_{n}\) generates \(N\) sub-channels by channel splitting, defining \(W_{n}^{(i)}\Big{(}y_{1}^{N},\hat{u}_{1}^{i-1}|u_{i}\Big{)}\), \(i=1,\ldots,N\). Let the LLR of \(W_{n}^{(i)}\Big{(}y_{1}^{N},\hat{u}_{1}^{i-1}|u_{i}\Big{)}\) be defined as  
\[L_{n}^{(i)}\Big{(}y_{1}^{N},\hat{u}_{1}^{i-1}|u_{i}\Big{)}\triangleq\log\left( \frac{W_{n}^{(i)}\Big{(}y_{1}^{N},\hat{u}_{1}^{i-1}|u_{i}=0\Big{)}}{W_{n}^{(i )}\Big{(}y_{1}^{N},\hat{u}_{1}^{i-1}|u_{i}=1\Big{)}}\right). \tag{3}\]  
The decision of LLR can be calculated by the \(f\) and \(g\) operations in Figure 1. The \(f\) and \(g\) operations are:  
\[f(L_{1},L_{2})=\text{sign}(L_{1})\text{sign}(L_{2})\text{min}(|L_{1}|,|L_{2}|)\ \, \tag{4}\]  
\[g(L_{1},L_{2},u)=(-1)^{n}L_{1}+L_{2}\ \, \tag{5}\]  
where \(L_{1},L_{2}\in\mathbb{R}\) are the two inputs for the \(f\) and \(g\) operations and \(u\in\{0,1\}\) is the partial sum for \(g\) operation. The decision of LLR is expressed as  
\[L_{N}^{(2i-1)}\Big{(}y_{1}^{N},\hat{u}_{1}^{2i-2}\Big{)}=f\Big{(}L_{N/2}^{(i )}\Big{(}y_{1}^{N/2},\hat{u}_{1,\rho}^{2i-2}\oplus\hat{u}_{1,\sigma}^{2i-2} \Big{)},\]  
\[L_{N/2}^{(i)}\Big{(}y_{N/2\,+1}^{N},\hat{u}_{1,\sigma}^{2i-2}\Big{)}\Big{)},\]  
\[L_{N}^{(2)}\Big{(}y_{1}^{N},\hat{u}_{1}^{2i-1}\Big{)}=g\Big{(}L_{N/2}^{(i)} \Big{(}y_{1}^{N/2},\hat{u}_{1,\rho}^{2i-2}\oplus\hat{u}_{1,\sigma}^{2i-2} \Big{)},\]  
\[L_{N/2}^{(i)}\Big{(}y_{N/2\,+1}^{N},\hat{u}_{1,\sigma}^{2i-2}\Big{)},\hat{u}_{2 i-1}\Big{)}\.\]  
Finally, we obtain \(\hat{u}_{i}\) as  
\[\hat{u}_{i}=\left\{\begin{array}{ll}0,&L_{N}^{(i)}\Big{(}y_{1}^{N},\hat{u}_ {1}^{i-1}\Big{)}\geq 0\text{ and }i\in\mathcal{A}\\ 1,&L_{N}^{(i)}\Big{(}y_{1}^{N},\hat{u}_{1}^{i-1}\Big{)}<0\text{ and }i\in\mathcal{A}\ \ \ \.\end{array}\right. \tag{8}\]  
Figure 1: A butterfly-based decoder with \(N=8\).