## 3 Polar Codes for the Multi-Way Relaying System
### Polar Decoding of the Multi-Way Relaying System  
At each terminal receiver, the received symbols in one time slot are first reversely permuted to make the input order consistent with the non-systematic polar code required by SC or SCL decoders. The input channel LLRs of the decoder are calculated as follows:  
\[ \begin{split} L(y_{ij}^{{}^{\prime}}[k])&=\ln \frac{p(y_{ij}^{\prime}[k]|y_{ij}^{\prime}[k-1],x_{i}[k]=0)}{p(y_{ij}^{\prime }[k]|y_{ij}^{\prime}[k-1],x_{i}[k]=1)}\\ &=\ln\frac{p(y_{ij}^{\prime}[k],y_{ij}^{\prime}[k-1]|x_{i}[k]=0) /p(y_{ij}^{\prime}[k-1]|x_{i}[k]=0)}{p(y_{ij}^{\prime}[k],y_{ij}^{\prime}[k-1] |x_{i}[k]=1)/p(y_{ij}^{\prime}[k-1]|x_{i}[k]=1)}\\ &=\ln\frac{p(y_{ij}^{\prime}[k],y_{ij}^{\prime}[k-1]|x_{i}[k]=0) /p(y_{ij}^{\prime}[k-1])}{p(y_{ij}^{\prime}[k],y_{ij}^{\prime}[k-1]|x_{i}[k]=1) /p(y_{ij}^{\prime}[k-1])}\\ &=\ln\frac{p(y_{ij}^{\prime}[k],y_{ij}^{\prime}[k-1]|x_{i}[k]=0) }{p(y_{ij}^{\prime}[k],y_{ij}^{\prime}[k-1]|x_{i}[k]=1)}=\ln\frac{p(y_{ij}^{ \prime}[k],y_{ij}^{\prime}[k-1]|a_{i}[k]=1)}{p(y_{ij}^{\prime}[k],y_{ij}^{ \prime}[k-1]|a_{i}[k]=-1)}\end{split}  \tag{37}\]  
where \(p(y_{ij}^{{}^{\prime}}[k-1])\) does not depend on \(p(x_{i}[k])\); thus, \(p(y_{ij}^{{}^{\prime}}[k-1]|x_{i}[k])=p(y_{ij}^{{}^{\prime}}[k-1])\). The conditional PDF \(p(y_{ij}^{{}^{\prime}}[k],y_{ij}^{{}^{\prime}}[k-1]|a_{i}[k])\) follows a multivariate complex Gaussian distribution when \(a_{i}[k]\) is known, and it has the following form [56]:  
\[ \begin{split} p(y_{ij}^{{}^{\prime}}[k],y_{ij}^{{}^{\prime}}[k-1]| a_{i}[k])=\\ &\frac{1}{\pi^{2}(2P_{i}\sigma_{n}^{2}+\sigma_{n}^{4})}\text{exp}\{ -\frac{1}{2P_{i}\sigma_{n}^{2}+\sigma_{n}^{4}}[(P_{i}+\sigma_{n}^{2})(|y_{ij}^{ \prime}[k]|^{2}+|y_{ij}^{{}^{\prime}}[k-1]|^{2})\\ &-P_{i}a_{i}[k](y_{ij}^{\prime\prime}[k]y_{ij}^{\prime}[k-1]+y_{ ij}^{\prime}[k]y_{ij}^{\prime\prime}[k-1])])\}\end{split}  \tag{38}\]In the log domain,  
\[ \begin{split}&\ln(p(y^{{}^{\prime}}_{ij}[k],y^{{}^{\prime}}_{ij}[k-1 ]|a_{i}[k]))\\ &=\ln[\frac{1}{\pi^{2}(2P_{i}\sigma_{n}^{2}+\sigma_{n}^{4})}]- \frac{1}{2P_{i}\sigma_{n}^{2}+\sigma_{n}^{4}}[(P_{i}+\sigma_{n}^{2})(|y^{{}^{ \prime}}_{ij}[k]|^{2}+|y^{{}^{\prime}}_{ij}[k-1]|^{2})\\ &-P_{i}a_{i}[k](y^{*^{\prime}}_{ij}[k]y^{{}^{\prime}}_{ij}[k-1]+ y^{{}^{\prime}}_{ij}[k]y^{*^{\prime}}_{ij}[k-1])]\end{split}  \tag{39}\]  
Therefore, the channel LLRs in (37) can be written as follows:  
\[ \begin{split} L(y^{{}^{\prime}}_{ij}[k])&=\ln(p(y^ {{}^{\prime}}_{ij}[k],y^{{}^{\prime}}_{ij}[k-1]|a_{i}[k]=1))-\ln(p(y^{{}^{ \prime}}_{ij}[k],y^{{}^{\prime}}_{ij}[k-1]|a_{i}[k]=-1))\\ &=\frac{1}{2P_{i}\sigma_{n}^{2}+\sigma_{n}^{4}}[P_{i}(1-(-1))(y^ {*^{\prime}}_{ij}[k]y^{{}^{\prime}}_{ij}[k-1]+y^{{}^{\prime}}_{ij}[k]y^{*^{ \prime}}_{ij}[k-1])]\\ &=\frac{2P_{i}}{2P_{i}\sigma_{n}^{2}+\sigma_{n}^{4}}[(y^{*^{ \prime}}_{ij}[k]y^{{}^{\prime}}_{ij}[k-1]+y^{{}^{\prime}}_{ij}[k]y^{*^{\prime }}_{ij}[k-1])]\end{split}  \tag{40}\]  
The LLR becomes  
\[ \begin{split}&\ln\frac{p(y^{{}^{\prime}}_{ij}[k]|y^{{}^{\prime}}_{ ij}[k-1],x_{i}[k]=0)}{p(y^{{}^{\prime}}_{ij}[k]|y^{{}^{\prime}}_{ij}[k-1],x_{i}[k]= 1)}=\ln\frac{p(y^{{}^{\prime}}_{ij}[k],y^{{}^{\prime}}_{ij}[k-1]|x_{i}[k]=0)}{p (y^{{}^{\prime}}_{ij}[k],y^{{}^{\prime}}_{ij}[k-1]|x_{i}[k]=1)}\\ &=\ln\frac{p(y^{{}^{\prime}}_{ij}[k],y^{{}^{\prime}}_{ij}[k-1]|m_{ i}[k]=0)}{p(y^{{}^{\prime}}_{ij}[k],y^{{}^{\prime}}_{ij}[k-1]|m_{i}[k]=1)}\\ &=\ln\frac{p(y^{{}^{\prime}}_{ij}[k],y^{{}^{\prime}}_{ij}[k-1]|m_{ i}[k]=0)p(m_{i}[k]=0)/p(y^{{}^{\prime}}_{ij}[k],y^{{}^{\prime}}_{ij}[k-1])}{p(y^{{}^{ \prime}}_{ij}[k],y^{{}^{\prime}}_{ij}[k-1]|m_{i}[k]=1)p(m_{i}[k]=1)/p(y^{{}^{ \prime}}_{ij}[k],y^{{}^{\prime}}_{ij}[k-1])}\\ &=\ln\frac{p(m_{i}[k]=0|y^{{}^{\prime}}_{ij}[k],y^{{}^{\prime}}_{ ij}[k-1])}{p(m_{i}[k]=1|y^{{}^{\prime}}_{ij}[k],y^{{}^{\prime}}_{ij}[k-1])} \end{split}