# 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
In this, \(w_{n,m,\alpha}\) represents the average probability information of the symbol \(\alpha\) with all the variable nodes adjacent to the \(m\)th check equation. As shown in Equation (4), the formula of \(w_{n,m,\alpha}\) is:  
\[w_{n,m,\alpha}=\sum_{i\in N(m)n}|L_{i,A}|,0\leq n<N,0\leq m<M,\alpha\in \mathrm{GF}_{0}(q) \tag{4}\]  
\(\bullet\) Step 2: Calculating check equation \(s_{h}^{(k)}\)  
We assume that the symbol vector is \(\mathbf{y}^{(k-1)}\) before the \(k(k\geq 1)\) iteration, while the corresponding calibration equation is \(\mathbf{s}_{h}^{(k-1)}=\mathbf{y}^{(k-1)}H^{T}\
eq 0\). Then, the check equation \(\mathbf{s}_{h}^{(k)}\) is calculated, \(\mathbf{s}_{h}^{(k)}=\mathbf{y}^{(k)}H^{T}\). If the check equation \(\mathbf{s}_{h}^{(k)}=0\), the decoding iteration is stopped and the decoding is shown to be successful. \(\bullet\) Step 3: \(k\gets k+1\), if the \(k>k_{\max}\) (\(k_{\max}\) is the maximum number of iterations set for the user), the decoding is declared to fail and stop. The completion of a symbol of the flip need to determine the two parameters: (1) The position of the flip; and (2) the value or amplitude of the flip. \(\bullet\) Step 4: Determining the position of the flip symbol  
We calculated the measured value \(E_{n}^{(k)},0\leq n<N\) for each variable node at the kth iteration. The core of the WSF algorithm involves flipping out the symbols that do not satisfy the check equation. To calculate \(E_{n}^{(k)}\), we first need to calculate the reliability of variable node \(n\), respectively \(\left\{\alpha_{1},\cdots,\alpha_{q-1}\right\}\). \[E_{n,A}^{(k)}=\sum_{m\in M(n)}\left(2s_{h,m}^{(k)}-1\right)w_{n,m,\alpha}-\beta |L_{n,A}| \tag{5}\]  
In Equation (5), \(\beta(\beta\geq 0)\) is the weighting factor. At that time, \(\beta=0\), which allows us to integrate the MSMWSF algorithm into SMWSF algorithm. For the given non-binary LDPC codes, the optimal value of the weighting factor can be obtained by Monte Carlo simulation under the specified number of iterations [30]. After this, we update the check equation to get the adjacency value of the hard decision:  
\[s_{h,m}^{(k)}=\left\{ \begin{array}{l}0,s_{h}^{(k)}=0\\ 1,s_{h}^{(k)}\
eq 0\end{array} \right. \tag{6}\]  
Among them, \(m\) is the CN. If \(\mathbf{s}_{h}^{(k)}=0\), a valid code word is obtained and the search is stopped. If \(\mathbf{s}_{h}^{(k)}\
eq 0\), the flip function \(E_{n}^{(k+1)}\), \(0\leq n<N\) is calculated and looped accordingly. In order to estimate the reliability measure of a symbol, the measure of each symbol must be calculated:  
\[E_{n}^{(k)}=\sum_{a\in\text{GF}_{0}(q)}E_{n,a}^{(k)} \tag{7}\]  
We select the location where the symbol is to be flipped, which is \(n^{(k)},0\leq n<N\). The summation operation in Equation (7) is a weighted method to measure the location possibility of flipping symbols. The sum of the weights of 1 can enhance the measure of the symbol position and provide a more accurate judgment standard. In this way, the symbol corresponding to the maximum value of \(E_{n}^{(k)}\) is the position of the flip symbol, such as the Equation (8). \[n^{(k)}=\text{argmax}E_{n}^{(k)},n\in[1,N],n\
otin A \tag{8}\]  
* Step 5: Determining the value or magnitude of the flip  
For the chosen symbol \(y_{n}^{(k)}\), flip the bit corresponding to the minimum value of \(|r_{ni}|\), where \(0\leq i<b\), and update \(\mathbf{y}^{(k-1)}\). * Step 6: Decoding, according to the results of the flip to get a new hard decision decoding sequence. Assign the value of \(\mathbf{y}^{(k-1)}\) to \(\mathbf{y}^{(k)}\), \(\mathbf{y}^{(k)}\leftarrow\mathbf{y}^{(k-1)}\), and return to the second step.