# Sum of the Magnitude for Hard Decision Decoding Algorithm Based on Loop Update Detection
## 3 Algorithm Description
### Loop Update Detection Algorithm  
Due to the possibility of an infinite loop in the process of symbol flipping, the symbol after the current flipping is still an error symbol and cannot be flipped to correct the symbol. Therefore, this paper proposes a loop update detection algorithm to further improve the decoding performance and speed up the convergence. Firstly, the output symbol sequence matrix and the infinite loop detection matrix are defined, which involves the sequential traversal of each symbol. After this, sorting them from smallest to largest, we determine the location of the flip symbol. From the second smallest symbol, we re-flip the same error symbol, which is converted to the bit value. The wrong bits are sorted from smallest to largest. According to the definition of small to large index value, the bit is flipped and then converted into a symbol value to replace the previous decoding symbol. The symbol position corresponding to the maximum value is placed in the exclusion sequence. Essentially, after the symbol position corresponding to the maximum value is excluded, the maximum value error symbol is searched again. This process is repeated for decoding the iteration. The specific decoding process is as follows. * Step 1: Initialization  
The excluded sequence \(A\) is initialized to an empty set, which is used to store the position corresponding to the symbol that does not satisfy the flipping function. The bit flipping identifier \(F\) is defined and initialized to 1, which is used as the counter. The maximum value is \(b\) (\(1 bq\)) and the value of \(F\) determines the number of bits to be flipped in the flip symbol. * Step 2: Determining the magnitude of symbol flipping  
The bit position to be flipped in the symbol position \(n^{(k)}\) is determined by the binary sequence \(\mathbf{r}=[r_{0},r_{1},\cdots,r_{Nb-1}]\), which is transmitted after the AWGN channel is transmitted. The symbol at position \(n^{(k)}\) of the symbol in the to-be-flipped state can be converted into b bits, which correspond to \(\left[r_{nb},r_{nb+1},\cdots,r_{(n+1)b-1}\right]\) in \(\mathbf{r}\). We sort \(|r_{i}|(nb\leq i\leq(n+1)b-1)\) from largest to smallest, with a smaller \(|r_{i}|\) indicating lower reliability of the corresponding bit. Therefore, the \(\mathbf{F}\) bit position with the smallest absolute value in \(\left[r_{nb},r_{nb+1},\cdots,r_{(n+1)b-1}\right]\) is selected according to the bit flipping identifier \(\mathbf{F}\), while the F bits in the corresponding position are reversed to obtain a new symbol sequence \(\mathbf{y}^{(k)}=[y_{0},y_{1},\cdots,y_{N-1}]\). * Step 3: Detects whether there is an infinite loop  
The loop update detection algorithm (LUD) is as follows. First, the output symbol sequence matrix \(Y_{(k+1)\times N}\) is defined, as shown in Equation (9). \[\mathbf{Y}=\left[ \begin{array}{c}y^{(0)}\\ y^{(1)}\\ \vdots\\ y^{(k)}\end{array} \right] \tag{9}\]  
Following this, an infinite loop detection matrix \(\mathbf{E}_{k\times N}\) is defined, as shown in Equation (10). \[\mathbf{E}=\left[ \begin{array}{c}y^{(k)}-y^{(0)}\\ y^{(k)}-y^{(1)}\\ \vdots\\ y^{(k)}-y^{(k-1)}\end{array} \right] \tag{10}\]  
As long as all the elements of one row in an infinite loop matrix are 0, an infinite loop is detected. Otherwise, an infinite loop is not detected. * If an infinite loop is detected and F does not reach the maximum \(\mathbf{b}\), we increase the value of \(\mathbf{F}\) by 1. After this, we return to step 2 to re-determine the position of the specific bit to be flipped by the symbol, before flipping the \(\mathbf{F}\) bits of the corresponding position. * If an infinite loop is detected but \(\mathbf{F}\) has reached the maximum \(\mathbf{b}\), the currently selected flip symbol position is stored in the exclusion symbol sequence \(\mathbf{A}\). \(\mathbf{F}\) is set to 1 and the flip symbol position is rediscovered.