# algdeintrlv

Restore ordering of symbols using algebraically derived permutation table

## Syntax

```deintrlvd = algdeintrlv(data,num,'takeshita-costello',k,h) deintrlvd = algdeintrlv(data,num,'welch-costas',alph) ```

## Description

`deintrlvd = algdeintrlv(data,num,'takeshita-costello',k,h)` restores the original ordering of the elements in `data` using a permutation table that is algebraically derived using the Takeshita-Costello method. `num` is the number of elements in `data` if `data` is a vector, or the number of rows of `data` if `data` is a matrix with multiple columns. In the Takeshita-Costello method, `num` must be a power of 2. The multiplicative factor, `k`, must be an odd integer less than `num`, and the cyclic shift, `h`, must be a nonnegative integer less than `num`. If `data` is a matrix with multiple rows and columns, the function processes the columns independently.

`deintrlvd = algdeintrlv(data,num,'welch-costas',alph)` uses the Welch-Costas method. In the Welch-Costas method, `num+1` must be a prime number. `alph` is an integer between 1 and `num` that represents a primitive element of the finite field GF(`num+1`).

To use this function as an inverse of the `algintrlv` function, use the same inputs in both functions, except for the `data` input. In that case, the two functions are inverses in the sense that applying `algintrlv` followed by `algdeintrlv` leaves data unchanged.

## Examples

collapse all

This example uses the Takeshita-Costello method of `algintrlv` and `algdeintrlv`.

Generate random data symbols to interleave. The number of rows of input data, `num`, must be a power of two.

```num = 16; ncols = 3; data = rand(num,ncols)```
```data = 16×3 0.8147 0.4218 0.2769 0.9058 0.9157 0.0462 0.1270 0.7922 0.0971 0.9134 0.9595 0.8235 0.6324 0.6557 0.6948 0.0975 0.0357 0.3171 0.2785 0.8491 0.9502 0.5469 0.9340 0.0344 0.9575 0.6787 0.4387 0.9649 0.7577 0.3816 ⋮ ```

Interleave the symbols using the Takeshita-Costello method. Set the multiplicative factor, `k`, to an odd integer less than `num`, and the cyclic shift, `h`, to a nonnegative integer less than `num`.

```k = 3; h = 4; intdata = algintrlv(data,num,'takeshita-costello',k,h)```
```intdata = 16×3 0.9572 0.6555 0.1869 0.2785 0.8491 0.9502 0.1576 0.7431 0.7655 0.0975 0.0357 0.3171 0.8147 0.4218 0.2769 0.1270 0.7922 0.0971 0.9058 0.9157 0.0462 0.9575 0.6787 0.4387 0.5469 0.9340 0.0344 0.1419 0.0318 0.6463 ⋮ ```

Deinterleave the symbols to obtain the original order.

`deintdata = algdeintrlv(intdata,num,'takeshita-costello',k,h)`
```deintdata = 16×3 0.8147 0.4218 0.2769 0.9058 0.9157 0.0462 0.1270 0.7922 0.0971 0.9134 0.9595 0.8235 0.6324 0.6557 0.6948 0.0975 0.0357 0.3171 0.2785 0.8491 0.9502 0.5469 0.9340 0.0344 0.9575 0.6787 0.4387 0.9649 0.7577 0.3816 ⋮ ```

## References

 Heegard, Chris, and Stephen B. Wicker, Turbo Coding, Boston, Kluwer Academic Publishers, 1999.

 Takeshita, O. Y., and D. J. Costello, Jr., “New Classes Of Algebraic Interleavers for Turbo-Codes,” Proc. 1998 IEEE International Symposium on Information Theory, Boston, Aug. 16–21, 1998. p. 419.

## Version History

Introduced before R2006a