# Message Passing Detectors for UAV-Based Uplink Grant-Free NOMA Systems
## 3 Adaptive UAV-BS Detector Based on the HMP Rule
### Computation of the HMP for GAMP-BG-MC Algorithm
#### 3.1.2. Part II MC Part Messages  
Firstly, the beliefs \(b(p_{k}^{10})=\text{Be}(p_{k}^{10};\hat{\epsilon}_{k},\hat{f}_{k})\) and \(b(p_{k}^{01})=\text{Be}(p_{k}^{01};\hat{\epsilon}_{k},\hat{d}_{k})\) can be initialized, and the parameters are updated later in (26). The MC downward messages are obtained by the HMP rule (Equations (5) and (6) in [15]) as  
\[m_{f_{\tilde{\varsigma}_{k,j}}\to\tilde{\varsigma}_{k,j}}^{ \text{BP}}(\varsigma_{k,j}) =\xi_{k,j}^{\downarrow}\delta(1-s_{k,j})+(1-\xi_{k,j}^{ \downarrow})\delta(s_{k,j}), \tag{14}\] \[n_{\tilde{\varsigma}_{k,j}\to f_{\tilde{\varsigma}_{k,j+1}}}^{ \text{BP}}(\varsigma_{k,j}) =\tilde{\xi}_{k,j}^{\Downarrow}\delta(1-s_{k,j})+(1-\tilde{\xi}_{k,j}^{\Downarrow})\delta(s_{k,j}), \tag{15}\]  
where  
\[ \begin{split}\tilde{\xi}_{k,1}^{\downarrow}& \triangleq\frac{\exp\big{\{}\langle\mathrm{ln}p_{k}^{10}\rangle \big{\}}}{\exp\big{\{}\langle\mathrm{ln}p_{k}^{10}\rangle\big{\}}+\exp\big{\{} \langle\mathrm{ln}(1-p_{k}^{10})\rangle\big{\}}},\\ \tilde{\xi}_{k,j}^{\downarrow}&\triangleq\frac{ \tilde{\xi}_{k,j-1}^{\Downarrow}\varsigma_{1}+(1-\xi_{k,j-1}^{\Downarrow}) \varsigma_{2}}{\tilde{\varsigma}_{k,j-1}^{\Downarrow}(\varsigma_{1}+ \varsigma_{4})+(1-\tilde{\xi}_{k,j-1}^{\Downarrow})(\varsigma_{2}+\varsigma_{3} )},\\ \tilde{\xi}_{k,j}^{\Downarrow}& \triangleq\frac{\tilde{\xi}_{k,j}^{\Downarrow}\overrightarrow{\pi}_{k,j} }{\tilde{\xi}_{k,j}^{\downarrow}\overrightarrow{\pi}_{k,j}+(1-\xi_{k,j}^{ \Downarrow})(1-\overrightarrow{\pi}_{k,j})},\end{split}  \tag{16}\]  
where \(\varsigma_{1},\varsigma_{2},\varsigma_{3},\varsigma_{4}\) denote the constants and are defined as  
\[ \begin{split}\varsigma_{1}&=\exp\big{\langle}\mathrm{ ln}(1-p_{k}^{01})\big{\rangle}\big{\}};\,\,\varsigma_{2}=\exp\{\Big{\langle} \mathrm{ln}p_{k}^{10}\Big{\rangle}\},\\ \varsigma_{3}&=\exp\big{\langle}\mathrm{ln}(1-p_{k}^{ 10})\big{\rangle}\big{\}};\,\,\varsigma_{4}=\exp\{\Big{\langle}\mathrm{ln}p_{k }^{01}\Big{\rangle}\},\end{split}  \tag{17}\]  
where \(\langle\mathrm{ln}x\rangle_{\text{Be}(x;a,b)}=\psi(a)-\psi(a+b)\), \(\langle\mathrm{ln}(1-x)\rangle_{\text{Be}(x;a,b)}=\psi(b)-\psi(a+b)\). Similarly, the MC upward messages passed between \(s_{k,j}\) and \(f_{S_{k,j}}\) can be computed by Equations (5) and (6) in [15], obtaining  
\[n^{\text{BP}}_{s_{k,j}\to f_{S_{k,j}}}(s_{k,j})=\xi^{\dagger}_{k,j} \delta(1-s_{k,j})+(1-\xi^{\dagger}_{k,j})\delta(s_{k,j}), \tag{18}\] \[m^{\text{BP}}_{f_{S_{k,j+1}}\to s_{k,j}}(s_{k,j})=\xi^{\dagger}_{k,j} \delta(1-s_{k,j})+(1-\xi^{\dagger}_{k,j})\delta(s_{k,j}), \tag{19}\]  
where  
\[\xi^{\dagger}_{k,j}\triangleq\overrightarrow{\pi}_{k,j},\ \xi^{\dagger}_{k,j}\triangleq\frac{\xi^{ \dagger}_{k,j}\overrightarrow{\pi}_{k,j}}{\xi^{\dagger}_{k,j}\overrightarrow {\pi}_{k,j}+(1-\xi^{\dagger}_{k,j})(1-\overrightarrow{\pi}_{k,j})}, \tag{20}\] \[\xi^{\dagger}_{k,j}\triangleq\frac{\xi^{\dagger}_{k,j+1}c_{1}+(1 -\xi^{\dagger}_{k,j+1})c_{4}}{\xi^{\dagger}_{k,j+1}(c_{1}+c_{2})+(1-\xi^{ \dagger}_{k,j+1})(c_{3}+c_{4})},\]  
where \(c_{1},c_{2},c_{3},c_{4}\) are the same as (17). The belief \(b(s_{k,1})\) and the combined belief \(b(s_{k,j},s_{k,j-1})\), \(2\leq j\leq J\) are calculated by Equation (8) in [15], resulting in  
\[b(s_{k,1})=B_{s_{k,1}}\delta(1-s_{k,1})+(1-B_{s_{k,1}})\delta(s_{k,1}), \tag{21}\]  
\[b(s_{k,j},s_{k,j-1})= \frac{1}{\rho_{k,j}}\Big{[}B^{00}_{k,j}\delta(s_{k,j-1})\delta(s_ {k,j})+B^{01}_{k,j}\delta(1-s_{k,j-1})\delta(s_{k,j}), \tag{22}\] \[+B^{10}_{k,j}\delta(s_{k,j-1})\delta(1-s_{k,j})+B^{11}_{k,j} \delta(1-s_{k,j-1})\delta(1-s_{k,j})\Big{]},\]  
where the normalized factors are  
\[B_{s_{k,1}}\triangleq\frac{\overrightarrow{\pi}_{k,1}\xi^{\dagger}_{k,1}\xi^ {\dagger}_{k,1}}{\overrightarrow{\pi}_{k,1}\xi^{\dagger}_{k,1}\xi^{\dagger}_ {k,1}+(1-\overrightarrow{\pi}_{k,1})(1-\xi^{\dagger}_{k,1})(1-\xi^{\dagger} _{k,1})}, \tag{23}\]  
\[