# 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.4. Part IV Variance Update Part 3  
The message going out of the MC part from \(s_{k,j}\) to \(f_{B_{k,j}}\) can be computed by Equation (6) in [15].  
\[n_{s_{k,j}\to f_{B_{k,j}}}^{\text{BP}}(s_{k,j})=\overleftarrow{\pi}_{k,j} \delta(1-s_{k,j})+(1-\overleftarrow{\pi}_{k,j})\delta(s_{k,j}), \tag{27}\]  
where  
\[\overleftarrow{\pi}_{k,j}\triangleq\frac{\hat{c}_{k,j}^{\dagger}\hat{c}_{k,j }^{\dagger}}{\hat{c}_{k,j}^{\dagger}\hat{c}_{k,j}^{\dagger}+(1-\hat{c}_{k,j}^ {\dagger})(1-\hat{c}_{k,j}^{\dagger})}. \tag{28}\]  
To update the variance of the BG-MC channel prior distribution, the combined beliefs \(b(b_{k,j},s_{k,j})\) have to be calculated first using Equation (8) in [15] as  
\[b(b_{k,j},s_{k,j})=(1-B_{b_{k,j},\hat{r}_{k,j}})\delta(s_{k,j})\delta(b_{k,j}) +B_{b_{k,j},\hat{r}_{k,j}}\delta(1-s_{k,j})\mathcal{CN}(b_{k,j};\hat{\mu}_{k, j},\theta_{k,j}), \tag{29}\]  
where  
\[\begin{split} B_{b_{k,j},s_{k,j}}&\triangleq \frac{\overleftarrow{\pi}_{k,j}temp_{k,j}}{\overleftarrow{\pi}_{k,j}temp_{ k,j}+(1-\overleftarrow{\pi}_{k,j})},\\ \hat{\theta}_{k,j}&=(v_{q_{k,j}}^{-1}+\frac{\hat{e} _{k,j}}{\hat{\eta}_{k,j}})^{-1},\ \ \hat{\eta}_{k,j}=\frac{\hat{q}_{k,j}}{v_{q_{k,j}}}\hat{\theta}_{k,j},\end{split} \tag{30}\]  
and the temporary variable \(temp_{k,j}\) is defined in (13).  
Then, the message from \(f_{B_{k,j}}\) to variable node \(v_{k,j}\) can be computed with the HMP rule (Equation (7) in [15]) as  
\[m_{f_{B_{k,j}}\to v_{k,j}}^{\text{MF}}(v_{k,j})\propto\text{Ga}(v_{k,j};B_{b _{k,j},\kappa_{j}}+1,B_{b_{k,j},\kappa_{j}}(|\beta_{k,j}|^{2}+\theta_{k,j})). \tag{31}\]  
Given the prior message \(m_{f_{B_{k,j}}\to v_{k,j}}^{\text{MF}}(v_{k,j})=\text{Ga}(v_{k,j};\epsilon_{k, j},\eta_{k,j})\), the belief \(b(v_{k,j})\) of variance variable \(v_{k,j}\) can be expressed as \(b(v_{k,j})=\text{Ga}(v_{k,j};\epsilon_{k,j},\hat{\eta}_{k,j})\), where the parameters are updated through  
\[\begin{split}\hat{e}_{k,j}&=\epsilon_{k,j}+B_{b_{k,j},\kappa_{k,j}},\\ \hat{\eta}_{k,j}&=\eta_{k,j}+B_{b_{k,j},\kappa_{k,j} }(|\hat{\eta}_{k,j}|^{2}+\theta_{k,j}).\end{split} \tag{32}\]  
With the parameters updated in (32), the message from the factor node \(f_{B_{k,j}}\) to the variable node \(b_{k,j}\) can be computed by the HMP rule (Equation (5) in [15]) as  
\[m_{f_{B_{k,j}}\to b_{k,j}}^{\text{BP}}(b_{k,j})=(1-\overleftarrow{\pi}_{k,j}) \delta(b_{k,j})+\overleftarrow{\pi}_{k,j}\frac{\text{e}^{\text{gt}(\hat{e}_{k,j })}}{\hat{e}_{k,j}}\mathcal{CN}\Big{(}b_{k,j};0,\frac{\hat{e}_{k,j}}{\hat{\eta} _{k,j}}\Big{)}. \tag{33}\]Finally, the belief \(b(b_{kj,j})\) of the variable \(b_{kj,j}\) can be expressed as  
\[b(b_{kj,j})=(1-B_{b_{kj}})\delta(b_{kj,j})+B_{b_{kj,j}}\mathcal{CN}(b_{kj,j};\hat{ \mu}_{kj,j},\theta_{kj}), \tag{34}\]  
with the parameter \(B_{b_{kj,j}}=B_{b_{kj,j}\phi_{k,j}}\). Then, the algorithm outputs the mean and variance of the belief \(b(b_{kj,j})\) as  
\[\hat{b}_{kj,j}=\left\langle b_{kj}\right\rangle_{b(b_{kj})}=B_{b _{kj,j}}\hat{\mu}_{kj,j} \tag{35}\] \[v_{b_{kj,j}}=B_{b_{kj,j}}(|\hat{\mu}_{kj,j}|^{2}+\hat{\phi}_{kj,j} )-|\hat{b}_{kj,j}|^{2}.\]