# Blind Recognition of Forward Error Correction Codes Based on a Depth Distribution Algorithm
## 4 Depth Distribution Algorithm Based on Linear Block Codes  
### The Algorithm of Code Length Recognition  
According to the definition of linear block code, the dimension of vector space composed of all code words is \(k\). The basic theorem of matrix analysis is given in [30]. **Theorem 3**. : _For \(p\times q\) order matrix \(X(q<p,p>2n)\) constituted by \((n,k)\) linear block code, when \(q\) is an integer multiple of \(n\), the dimension of the unit matrix in the upper left corner after unitization is equal, and the rank of the matrix is not equal to the number of columns \(q\)._  
**Theorem 4**. : _For \(p\times q\) order matrix \(X(q\) is a multiple of \(n,p>2n)\) constituted by \((n,k)\) linear block code, when the starting point of the block code coincides with the starting point of each row of the matrix, the rank of the matrix is minimum._  
Although matrix analysis algorithm is simple and easy to implement, under the condition of the Gaussian white noise channel, the correlation between codes is destroyed and the recognition effect is poor, cannot meet the requirements of the algorithm, and the practicability is not high. Therefore, an improved algorithm based on a Gaussian elimination method is adopted in this paper to achieve an accurate recognition in the condition of noise. Let \(x_{i}^{j}\) represents the element in row \(i\), column \(j\) of matrix \(X\), and \(x_{i}\) represents row \(i\); \(x^{j}\) represents column \(j\); \(\mbox{`}\oplus\mbox{`}\) represents binary field addition. \(A,B\) are initialized to unit matrix of \(M\times M,n\times n\). Make Gaussian column elimination of \(X\), and the formula is:  
\[MXN=\overset{\sim}{X} \tag{3}\]  
Loop from 1 to \(n\), and the steps of each step are as follows:  
Step 1: If \(x_{i}^{i}\) equals to 0, \(x_{i}^{j}\) is the first element which equals to 1 on the right side of \(x_{i}^{i}\), changes \(x_{i}^{i}\) and \(x_{i}^{j}\), and changes \(n_{i},n_{j}\) of matrix \(N\) at the same time;  
Step 2: If \(x_{i}^{i}\) equals to 0, \(x_{j}^{j}\) is the first element which equals to 1 belows \(x_{i}^{i}\), changes \(x_{j}^{i}\) and \(x_{i}^{j}\), and changes \(m_{i},m_{j}\) of matrix \(M\) at the same time;  
Step 3: If \(x_{i}^{i}\) equals to 1, calculate as \(x^{i}\oplus x^{j}\), \(x_{i}^{j^{\prime}}\) includes all the elements on the right-hand side of \(x_{i}^{i}\) that are equal to 1. And calculate as \(n^{i}\oplus n^{\prime}\) of matrix \(N\) at the same time. Which is shown in Figure 2.  
After the above steps, the matrix \(X\) converts into the lower triangular matrix \(\overset{\sim}{X}\) as shown in Figure 2, and unit matrix \(M,N\) converts into \(\overset{\sim}{M},\overset{\sim}{N}\). The formula is:  
\[\overset{\sim}{MX\overset{\sim}{N}}=\overset{\sim}{X} \tag{4}\]Because \(\widetilde{M}\) is the elementary row operations of matrices \(X\), based on matrix symmetry, the column vectors of \(X\widetilde{N}\) and \(\widetilde{X}\) have the same weight distribution. Meanwhile, let \(\widetilde{M}X\widetilde{n^{\prime}}=\widetilde{x^{\prime}}\). If \(n=n_{0}\), there are linearly dependent column directions of \(X\), and there will be column vectors in \(\widetilde{x^{\prime}}\) where all the elements are zero or where the hamming weight is small after Gaussian column elimination. At the same time, column vectors \(\widetilde{n^{\prime}}\) exists in the dual space \(H\) with high probability. For \(\widetilde{x^{\prime}_{i}}\) in \(\widetilde{x^{\prime}}\)[31], the formula of \((0,1)\) distribution probability is:  
\[P(\widetilde{x^{\prime}_{i}}=0)=\frac{1+(1-2p_{e})^{W_{n}}}{2} \tag{5}\]  
\[P(\widetilde{x^{\prime}_{i}}=1)=\frac{1-(1-2p_{e})^{W_{n}}}{2} \tag{6}\]  
In Formulas (5) and (6), \(p_{e}\) is the bit error rate of linear block codes; \(W_{n}\) is the code weight of \(\widetilde{n^{\prime}}\); \(N_{j}\) is the code weight of \(\widetilde{x^{\prime}}\), and it satisfies a binomial distribution \(B(M,(1-(1-2p_{e})^{W_{n}}/2)\).