Polyphase alternating codes

This work introduces a method for constructing polyphase alternating codes in which the length of a code transmission cycle can be $p^m$ or $p-1$, where $p$ is a prime number and $m$ is a positive integer. The relevant properties leading to the construction alternating codes and the algorithm for generating alternating codes is described. Examples of all practical and some not that practical polyphase code lengths are given.


Introduction
Alternating codes (Lehtinen, 1986) are widely used in incoherent scatter radar measurements and their properties are well known.Currently, the only so called type 1 code lengths are powers of two, which sometimes causes inflexibility when designing radar experiments.With this in mind, Sulzer (1993) proposed a new type of alternating codes (type 2) that made it possible to use other code lengths.These codes also produce unambiguous back-scatter autocorrelation function estimates of the target.But there does not exist a search strategy efficient enough for finding longer type 2 codes.To best of our knowledge, the longest type 2 alternating code length is 14, which is not necessarily large enough for all applications.
In this paper we generalize previous work (Markkanen and Nygrén, 1997) and apply it to polyphase codes, i.e., codes that are phase coded with two or more different phases.We have identified two different types of polyphase alternating codes.The first type includes codes that have p phases and code lengths of p m , where p is a prime number and m is a positive integer.The other class contains codes with p − 1 phases and code length p − 1.The number of codes in these kinds of alternating code sets is the same as the number of Correspondence to: Juha Vierinen (j@sgo.fi)q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 0 10 20 This paper concentrates on polyphase alternating codes satisfying the so called weak condition.Strong codes can be generated from weak codes using the method described by Sulzer (1989).This method also works for the polyphase alternating codes presented in this work.To create an alternating code set satisfying the strong condition, the code set is duplicated.For each code in the duplicated part, bauds with even indices are multiplied by −1.

Construction of p-nary alternating codes
By a p-nary radar pulse we mean a phase modulated pulse, where the complex phases of bauds belong to set E p = {1, α, . . ., α p−1 }, where α = e 2πi/p .In what follows, p is a prime number unless otherwise stated.A p-nary alternating code of length n is a set of sequences A 0 = (a 0,0 , . . ., a 0,n−1 ), . . ., A n = (a n−1,0 , . . ., a n−1,n−1 ) of pnary pulses satisfying the natural extension of the weak condition given in Lehtinen (1986) for binary codes: Condition 1.For each i, i , j and j where j−i = j −i , i = j, and i = i .
Let us denote by M the operator, which shifts the elements of a sequence cyclically by one, that is M (a 0 , . . ., a n−1 ) = (a 1 , . . ., a n−1 , a 0 ).
Let A = (a 0 , . . ., a n−1 ) be a p-nary sequence and let us denote by U the unit sequence U = (1, 1, . . ., 1).By multiplication of two sequences we mean pointwise multiplication of them and will denote it by ⊗.Similarly we will mean by conjugate of A the pointwise complex conjugate of A and denote it by A.
Let us denote by C the set of sequences A, M A, . . ., M n−1 A, U .
Here M i means i repeated cyclical shift operations.We will show that when A satisfies the following two conditions, C will constitute a p-nary alternating code set: To prove this, we need the following properties of the sequences satisfying conditions 2 and 3: This can be seen by considering the sequence which equals (s + 1)U (the sequences A, . . ., M n−1 A contain in each location all the elements of A in some cyclic order).Because by condition 3 multiplication by A permutes the terms of S, A ⊗ S = S, and because A ⊗ U = A, it follows that (s + 1)A = (s + 1)U.Now condition 2 requires that A = U .Thus s + 1 = 0 and s = −1.
Notice that in the case of p = 2, when E p = {1, −1}, it follows from property 1 that n is odd.Property 2. There exists i 0 so that M i A = M i+i0 A for all i.

By condition 3 there is
Let as denote by A i the sequence formed by taking the the i th elements of sequences A 0 , . . ., A n−1 .Condition 1 is then the requirement that sum of elements of sequence Property 2 says then that D ∈ C and if we can show that D = U , it follows from property 1 that the sum of elements of D is indeed −1. Because (1) Now the left hand side is ) and similarly the right hand side is M i (A ⊗ M j −i +i0 A).Because j − i = j − i , the sequences inside parentheses are equal, and because i = j they are not equal to U .Then indeed M i (. ..) = M i (. ..), because i = i .
We will finally make the number of codes and the length of them equal by copying the first element of each sequence the end of the sequence.Then A n = A = M n A.
To see that condition 1 is still satisfied, let us first suppose that n is in the set {i, j, i , j } but 0 is not.Then that condition follows trivially from what was said above (by dropping the first element of each sequence we have the same codes, only in order M A, . . ., M n−1 A, A, U ).If both 0 and n belong to the set {i, j, i , j }, the only possibility is i = 0, j = i = n/2.Then n must be even, so we can suppose that p = 2.With the above choice of indices the left hand side of Eq. 1 is A ⊗ M n/2 A and the right hand side is M n/2 A ⊗ A. As they are conjugates, they are unequal, unless they are both equal to U .But M n/2 A = A and thus A ⊗ M n/2 A = A ⊗ A = U , and so D = U , meaning that condition 1 is satisfied also in this case.
The requirement that p is prime is necessary for this method of constructing alternating codes, with composite p there isn't any sequences A satisfying conditions 2 and 3 (unless the elements of A belong already to E p for some prime number p dividing p).The essential reason for that is that for composite p sequences A, A ⊗ A, A ⊗ A ⊗ A, . . .can have different number of ones.
3 Construction of sequence A Instead of set E p we will consider the set Z p = {0, . . ., p − 1} mod p of possible exponents of α.Instead of sequences with elements in E p we then have vectors in vector space Z n p , multiplication of sequences corresponds to addition, multiplication by complex conjugate corresponds to subtraction and U is replaced by 0-vector 0 ∈ Z n p .The operator M corresponds to a linear operator mapping each base vector of Z n p to the previous one, except the first one, which is mapped to the last one.
Let us thus have a vector A = (a 0 , . . ., a n−1 ) ∈ Z n p and set C = {A, M A, . . ., M n−1 A, 0} ⊂ Z n p .Conditions 2 and 3 then correspond to the following conditions: Condition 3a.Adding a fixed vector of C to all vectors belonging to it permutes C.
The sum of any two vectors in C belong to C by condition 3a.In fact, when condition 2a is satisfied, condition 3a is equivalent to the condition that sum of any two vectors in C belong to C, because addition of a fixed vector is then bijection.Because for any B ∈ C also 2B = B + B ∈ C and similarly for any k ∈ Z p by induction, it follows that C is a vector subspace of Let us now consider in Z p a m th -order difference equation with b 0 , . . ., b m−1 ∈ Z p .Because there is only a finite number of different m-tuples of elements of Z p , any sequence, which is solution of (2), is periodic (possible beginning with a non-periodic part if b 0 = 0).Let us suppose that (2) has a solution A = {a i } ∞ i=0 with period n = p m − 1.Then the vector A = (a 0 , . . ., a n−1 ) ∈ Z n p satisfies conditions 2a and 3a.
Thus, in order to satisfy the original condition for alternating codes, it is sufficient that the following condition is satisfied:  2) is where α 1 , . . ., α m are the roots of Q(x) and c 1 , . . ., c m are arbitrary coefficients.
and there is no integer d smaller than n such that Q(x) divides x d − 1, the roots of Q(x) are different and the period of all sequences {1, α i , α 2 i , . ..} is n, and so is then also the period of sequence {x 0 , x 1 , . ..}.Thus each m-degree polynomial Q(x) ∈ Z p [x] satisfying the above mentioned conditions determines a p-nary alternating code, and it is easy to see that different Q:s determine different codes by comparing for all locations of 1, the elements following m-tuple (0, . . ., 0, 1, 0, . . ., 0) in the solutions of corresponding difference equations.
It is possible to show (e.g., Lidl and Niederreiter, 1997, p. 85) that the number of different polynomials N c satisfying the above mentioned conditions is Here ϕ(i) is the Euler ϕ-function, which is the number of integers smaller than i which do not have a common factor with i.It can also be shown that there are no other sets C satisfying conditions 1a and 2a, so the number N c given above is the number of different alternating codes satisfying those conditions.This means especially that for any prime number p and any positive integer m there exist p-nary alternating codes of length p m .
Let us suppose that b 0 is a generator of Z * p and A is the solution of the corresponding difference equation (3).It was shown in section 3 that the sequence kA belongs to the code for all k = 0, . . ., p − 1, and by changing the order of sequences we thus have C = {0, A, 2A, . . ., (p − 1)A}.This means that the columns of the alternating code are suitably chosen columns of the unnormalized Fourier matrix The columns of F p are orthogonal and form a closed set under pointwise multiplication.This is true for arbitrary p and we can use them, or rather the columns of corresponding exponents for searching p-nary alternating codes for any p, analogously to the use of Walsh sequences in Lehtinen (1986).
Because all the pointwise products of columns of F p and their conjugates are also columns of F p , set C is an alternating code if the pointwise products of it's columns corresponding indices of condition 1 are different from U .As was said earlier, multiplication by complex conjugate corresponds subtraction of exponents, and then for arbitrary p the set C = {0, A, 2A, . . ., (p−1)A} with the defining sequence A = (a 0 , . . ., a n−1 ) ∈ Z n p is an alternating code if A satisfies the following condition (analogous to the condition for Walsh indices given in Lehtinen (1986)) Condition 5.For each i, i , j and j where j−i = j −i , i = j, and i = i , The above condition can be rephrased as: all differences (mod p) of values a i , a j of elements of A with fixed difference of indices i, j are different.
We will now consider again for a prime p the sequence A = {1, b 0 , . . ., b p−2 0 } mod p, which defines an alternating code of length p − 1 (we drop away the duplicate element from the end).
Because of periodicity of b i 0 the sequence A satisfies an even stronger condition: all differences (mod p) of values a i , a j of elements of A 1 with fixed difference (mod p − 1) of indices i, j are different.
Then it trivially satisfies also the following condition: all differences ( mod p − 1) of indices i, j of elements of A with fixed difference (mod p) of values a i , a j are different.
For the "dual" sequence A with indices 1, b 0 , . . ., b p−2 0 and corresponding values 0, 1 . . ., p − 2 this means that all differences (mod p − 1) of values of elements of A with fixed difference (mod p) of indices are different.
But this is again stronger than the condition for (p − 1)nary alternating codes: all differences ( mod p − 1) of values of elements of A with fixed difference of indices are different, and thus the sequence A defines a (p − 1)-nary alternating code of length p − 1!
It can be noted that whereas in p-nary codes the first and last columns are identical and the constant column of F p is not in the code, in (p−1)-nary codes all the columns of F p−1 are in the code once.
The number of p-nary alternating codes of length p is ϕ(p − 1) and one could think that it is also the number of (p − 1)-nary alternating codes of length p − 1.However, this is not the case, instead different p-nary codes give only different sequences of the same (p − 1)-nary code, and thus the construction presented here gives only one (p−1)-nary alternating code for each prime p.This can be seen by noticing that if b 0 and b 1 are generators of Z * p , there is k 0 such that b 0 = b k0 1 .If then A = {a 1 , a 2 , . ..} and A = {a 1 , a 2 , . ..} are dual sequences of {1, b 0 , . ..} and {1, b 1 , . ..}, 6 Algorithm for generating p m -length alternating codes Finding alternating codes is a fairly simple computation that involves going through all possible m-tuples b = (b 0 , ..., b m−1 ) with elements in Z p .This involves going through only p m alternatives.For each b, we check if the corresponding m th order difference equation ( 2) has a period of p m − 1 (notice that the equation is calculated in modulo p arithmetic).If this is true, then the difference equation with coefficients b is a generator for an alternating code set, which can then be defined as where α = e 2πi/p and x i are the values of the generating difference equation (2), using initial values x 1 , ..., x m−1 = 0 and x m = 1.Fig. 2. The phases of a 25 baud alternating code.The cyclic nature of the code can be easily seen.One can also see property 2, which states that each code is conjugate symmetric.
To generate a (p − 1)-nary code, one first generates the corresponding p-nary code and then forms the code group using the transformation described in Sect. 5.
Table 1 lists alternating codes up to code length 366, only one code per code length is listed.The codes are expressed in terms of number of phases p, generating coefficients b = (b 0 , ..., b m−1 ) and code length.As an example, a 25 baud alternating code set is shown as phases in Fig. 2. A program for generating weak and strong polyphase alternating codes is available at request from the authors.

Discussion
It is also possible to use truncated polyphase alternating codes in a similar manner as binary phase alternating codes, in order to have smaller number of scans.
Like binary alternating codes, also general p-nary codes made in this way have the worst possible covariance structure, and need randomization as described by Lehtinen et al. (1997).The covariance structures of (p − 1)-nary codes have not been studied yet.
We have also done a complete search of codes with columns from F p for all numbers up to p = 15.For numbers followed by a prime there is indeed an unique code.On the other hand, for the numbers 8, 9, 14 and 15 there are no alternating code sets.These are the first composite numbers not followed by a prime.This small search hints to the pos-sibility that there are no p-nary alternating codes of length p formed from F p , except when p or p + 1 is a prime.

Conclusions
Signal processing hardware today can easily generate arbitrary waveforms, this includes the polyphase codes presented in this paper.Because these codes also have a constant amplitude, there is no transmission power trade-off compared to binary phase codes.It should be pretty straightforward to modify existing correlators to use these new codes.The main benefit of polyphase alternating codes is the larger set of code lengths compared to binary phase codes.

Fig. 1 .
Fig. 1.First 50 alternating code lengths, solid black circles represent known binary phase alternating codes, open circles represent new polyphase alternating code lengths.

Condition 2 .
All the sequences of C are different.Condition 3. Multiplying all the sequences of C by a fixed one of it permutes C.

Condition 4 .
The m th order difference equation in Z p has a period p m − 1 4 The number of p m -type alternating codes If all the roots of polynomial Q(x) = x m − b m−1 x m−1 − . . .− b 0 are different, the general solution of the difference equation (

Table 1 .
Alternating codes with lengths up to 366, only one code for each number of phases.The number of phases is denoted by Np, the number of different code sets Nc and the generator coefficients are denoted by b.The (p − 1)-nary codes are generated from the next consecutive prime.