# Efficient Low-Complexity Turbo-Hadamard Code in UAV Anti-Jamming Communications
## 3 Low-Complexity Turbo-Hadamard Codes Based on Tail-Biting
### The Tail-Biting Convolutional-Hadamard Encoder  
To avoid the rate loss caused by zero-tail termination in the convolutional coding part of the scheme, a modified convolutional-Hadamard encoder based on tail-biting is proposed to improve the coding rate, which is described in Algorithm 1 in detail.  
```
0: Block information bit \(\{\mathbf{d}_{k}\}\) of size \(K\times r\). Tail-biting convolutional generator \(g(x)\).
0: Tail-biting convolutional-Hadamard code \(\mathbf{C}\).
1: Initialize the state of convolutional encoder into all zeros.
2: Get the parity check bit of \(\mathbf{d}_{k}\) as \(q^{\prime}_{k}\).
3: Calculate the cyclic state \(s_{c}\) based on \(g(x)\) and \(\mathbf{q}^{\prime}=\{q^{\prime}_{k}\}\).
4: Encode \(\mathbf{q}^{\prime}\) using the convolutional code generated by \(g(x)\) with the cyclic state \(s_{c}\), and get the parity check bit stream \(\mathbf{q}\).
5: Encode the \(\{\mathbf{d}_{k},q_{k}\}\) using an order-\(r\) Hadamard code as \(\mathbf{c}_{k}=\{\mathbf{d}_{k},q_{k},\mathbf{p}_{k}\}\).
6: Arrange \(\mathbf{c}_{k}\) as the the \(k\)th row of \(\mathbf{C}\).
```  
**Algorithm 1** Tail-Biting Convolutional-Hadamard Encoder Algorithm.  
* Input: For ease of description, the length-\(W\) uncoded bits \(\mathbf{u}\) are segmented into \(\{\mathbf{d}_{k}\},k=1,2,\cdots,K\). Each row \(\mathbf{d}_{k}\) consists of \(r\) bits, where \(r\) is the order of Hadamard codes. It is worth noting that \(W=K\times r\).
* Line 3 : Cyclic state \(s_{c}\) is the key to keeping the convolutional trellis start state \(s_{i}\) and end state \(s_{t}\) once the input is \(\mathbf{q}^{\prime}\). \(s_{c}\) is calculated by \(g(x)\) with the initial state being all zeros. The details of how to generate \(s_{c}\) are as follows, and as illustrated in Figure 2.  
The feedback coefficients of convolutional generator \(g(x)\) can be represented as the state recursive matrix \(\mathbf{G}\). Moreover, if the generator is described in the mode of a fraction, the denominator of \(g(x)\) is denoted as \(\mathbf{G}\). For example, the state recursive matrix of \(g(x)=1/\left(1+x+x^{2}\right)\) can be given by  
\[\mathbf{G}=\left[\begin{array}{cc}1&1\\ 1&0\end{array}\right].\]  
It is essential to guarantee that the matrix \(\left(\mathbf{I}+\mathbf{G}^{K}\right)^{-1}\) is nonsingular, where \(\mathbf{I}\) denotes the order-\((\eta+1)\) identity matrix, \(\eta\) denotes the memory depth of convolutional generator \(g(x)\) and \((\cdot)^{-1}\) denotes the inverse operator. Thus, we can obtain the final state \(s_{0K}\) after \(K\)-step precoding with \(\mathbf{q}^{\prime}\) from the state-0. The cyclic state \(s_{c}\) is calculated by  
\[s_{c}=\left(\mathbf{I}+\mathbf{G}^{K}\right)^{-1}s_{0K}. \tag{6}\]  
Since the precoder calculates the cyclic state of the convolutional code, the initial state and the terminal state of the convolutional code trellis are same. The states are explained as follows,  
\[s_{i}=s_{t}=s_{c}\in\{s_{0},...,s_{2^{\eta}-1}\}. \tag{7}\]
* Line 5: Encode length-\((r+1)\) using order-\(r\) Hadamard code, which outputs the length-\(2^{r}\) bitstream \(c_{k}\).  
As shown in Figure 3, the component codewords \(\mathbf{C}\) can be expressed as \(\mathbf{C}=\{\mathbf{D},\mathbf{q},\mathbf{P}\}\), where \(\mathbf{D}\) denotes the \(K\times r\) matrix with rows being \(\mathbf{d}_{k}\), and \(\mathbf{P}\) denotes the \(K\times(2^{r}-r-1)\) matrix with rows being \(\mathbf{p}_{k}\).  
Compared with the algorithm [20] in which the trellis state terminates at all zeros, there are no extra redundant bits in our improved algorithm. As a consequence, the code rate of the proposed tail-biting convolution-Hadamard code is  
\[R^{c}_{\text{TB}}=\frac{r}{2^{r}}, \tag{8}\]  
whereas that of the convolution-Hadamard code scheme with the terminating state at zero is  
\[R^{c}_{\text{TO}}=\frac{Kr}{(K+\eta)2^{r}}. \tag{9}\]  
Figure 2: Flow diagram of the tail-biting convolutional-Hadamard encoder.