Reorder symbols using algebraically derived permutation table
intrlvd = algintrlv(data,num,'takeshita-costello',k,h)
intrlvd = algintrlv(data,num,'welch-costas',alph)
intrlvd = algintrlv(data,num,'takeshita-costello',k,h) rearranges 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.
intrlvd = algintrlv(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). This means that every nonzero element of GF(num+1) can be expressed as alph raised to some integer power.
This example illustrates how to use the Welch-Costas method of algebraic interleaving.
Define num and the data to interleave.
num = 10; % Integer such that num+1 is prime ncols = 3; % Number of columns of data to interleave data = randi([0 num-1], num, ncols); % Random data to interleave
Find primitive polynomials of the finite field GF(num+1). The gfprimfd function represents each primitive polynomial as a row containing the coefficients in order of ascending powers.
pr = gfprimfd(1,'all',num+1) % Primitive polynomials of GF(num+1) pr = 3 1 4 1 5 1 9 1
Notice from the output that pr has two columns and that the second column consists solely of 1s. In other words, each primitive polynomial is a monic degree-one polynomial. This is because num+1 is prime. As a result, to find the primitive element that is a root of each primitive polynomial, find a root of the polynomial by subtracting the first column of pr from num+1.
primel = (num+1)-pr(:,1) % Primitive elements of GF(num+1) primel = 8 7 6 2
Now define alph as one of the elements of primel and use algintrlv.
alph = primel(1); % Choose one primitive element. intrlvd = algintrlv(data,num,'Welch-Costas',alph); % Interleave.
A Takeshita-Costello interleaver uses a length-num cycle vector whose nth element is mod(k*(n-1)*n/2, num) for integers n between 1 and num. The function creates a permutation vector by listing, for each element of the cycle vector in ascending order, one plus the element's successor. The interleaver's actual permutation table is the result of shifting the elements of the permutation vector left by h. (The function performs all computations on numbers and indices modulo num.)
A Welch-Costas interleaver uses a permutation that maps an integer K to mod(AK,num+1)-1.
 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.