# Sum of the Magnitude for Hard Decision Decoding Algorithm Based on Loop Update Detection
## 3 Algorithm Description  
### Sum of the Magnitude of Weighted Symbol Flipping Decoding Algorithm  
The WSF decoding algorithm uses the information derived from the channel to calculate the reliability [15; 20]. The core idea is to compute the measure of each symbol according to the reliability of the check equation. According to the size of the measured value, the most unreliable symbol is selected to be flipped. It is the simplest SF decoding algorithm based on the hard decision. The flip function \(E_{n,A}^{(k)}\) of the MWSF algorithm and the IMWSF algorithm takes into account the information carried by the symbol itself, but still neglects the reliability information of a large number of variable nodes when calculating the reliability of the check equation \(w_{n,m,A}\)[19; 25]. However, the variable node involved in each check equation is a set and the reliability calculation of the check equation should also contain the reliability information for each variable node in the set. Therefore, in this paper, the reliability and flip function are redefined. Based on the hard decision decoding, some soft information from the channel is used to calculate the reliability. The sum of the amplitude of the variable nodes connected to the check node is used as the reliability of the check equation, the influence of all symbols is added into the reliability of the check equation and the weighting factor is introduced. Using \(|L_{n,A}|\) as part of the flip function, we obtained the WSF algorithm based on the sum of the magnitude (SMWSF). The specific process of SMWSF decoding algorithm is as follows. * Step 1: Initialization parameters 1. Set initial iterations \(k=0\) 2. Calculate the initial hard decision output sequence, before using this sequence as the output of the decoding iteration in \(k=0\), which is denoted as \(y^{(0)}\)  
Firstly, the hard decision sequence \(\mathbf{x}=[x_{0},x_{1},\cdots,x_{Nb-1}]\) is obtained by the hard decision of the binary sequence \(r\) of channel output. The rules of the decision are as follows: If \(r_{i}\geq 0\), the \(x_{i}\) is determined to be 1; if \(r_{i}<0\), the \(x_{i}\) is determined to be 0 (\(0\leq i<Nb-1\)). As the hard decision is a binary sequence, so according to the binary and q-ary conversion principle, converted to \(N\) length, the sequence becomes \(\mathbf{y}=[y_{0},y_{1},\cdots,y_{N-1}]\). The sequence of \(\mathbf{y}=[y_{0},y_{1},\cdots,y_{N-1}]\) is the output sequence. Calculate the probability vector \(L_{n}(\alpha)\)  
After the hard decision, it is necessary to calculate the initial likelihood probability of the symbol and to prepare the average likelihood probability of the check equation adjacent to all variable nodes in the subsequent iterative decoding process. The definition \(\mathrm{GF}_{0}(q)=\left\{\alpha_{1},\cdots,\alpha_{q-1}\right\}\) to remove the Galois field of zero element, while \(\mathrm{GF}(q)\) does not contain zero elements. Gives the reliability vector \(\alpha\) on the nth symbol:  
\[\mathbf{L}_{n}=\left[L_{n,A_{1}},\cdots,L_{n,A},\cdots,L_{n,A_{q-1}}\right] \tag{2}\]  
where the symbol probability log likelihood is shown as follows:  
\[L_{n,A}=\ln\frac{P(a=\alpha_{i})}{P(a=0)}=\frac{2}{\delta^{2}}\sum_{j\
eq( \alpha)j=+1}r_{nb+j} \tag{3}\]  
Obviously, the log likelihood ratio of symbol probability is directly proportional to \(\sum_{j\
eq(\alpha)_{j}=+1}r_{nb+j}\). In this present study, we ignored the coefficient \(\frac{\delta^{2}}{2}\) related to channel noise [29] and used \(\sum_{j\
eq(\alpha)_{j}=+1}r_{nb+j}\) approximation as the symbol probability log likelihood ratio, without any effect on performance. 4. Compute the reliability \(w_{n,m,\alpha}\) of the external information of the received symbol \(y_{n}\)  
We defined \(L_{n,A}=\sum_{j\
eq(\alpha)_{j}=+1}r_{nb+j}(0\leq j\leq b-1)\) and used Equation (3) to calculate probability matrix \(\mathbf{L}_{n}=[L_{n,A}],0\leq n<N,\alpha_{1}\leq\alpha<\alpha_{q-1}\).