sdr.preferred_pairs(degree: int, poly: PolyLike | None = None) Iterator[tuple[Poly, Poly]]

Generates primitive polynomials of degree \(m\) that produce preferred pair \(m\)-sequences.

Parameters:
degree: int

The degree \(m\) of the \(m\)-sequences.

poly: PolyLike | None = None

The first polynomial \(f(x)\) in the preferred pair. If None, all primitive polynomials of degree \(m\) that yield preferred pair \(m\)-sequences are returned.

Returns:

An iterator of primitive polynomials \((f(x), g(x))\) of degree \(m\) that produce preferred pair \(m\)-sequences.

Notes

A preferred pair of primitive polynomials of degree \(m\) are two polynomials \(f(x)\) and \(g(x)\) such that the periodic cross-correlation of the two \(m\)-sequences generated by \(f(x)\) and \(g(x)\) have only the values in \(\{-1, -t(m), t(m) - 2\}\).

\[\begin{split} t(m) = \begin{cases} 2^{(m+1)/2} + 1 & \text{if $m$ is odd} \\ 2^{(m+2)/2} + 1 & \text{if $m$ is even} \end{cases} \end{split}\]

There are no preferred pairs for degrees divisible by 4.

References

  • John Proakis, Digital Communications, Chapter 12.2-5: Generation of PN Sequences.

Examples

Generate one preferred pair with \(f(x) = x^5 + x^3 + 1\).

In [1]: next(sdr.preferred_pairs(5, poly="x^5 + x^3 + 1"))
Out[1]: (Poly(x^5 + x^3 + 1, GF(2)), Poly(x^5 + x^3 + x^2 + x + 1, GF(2)))

Generate all preferred pairs with \(f(x) = x^5 + x^3 + 1\).

In [2]: list(sdr.preferred_pairs(5, poly="x^5 + x^3 + 1"))
Out[2]: 
[(Poly(x^5 + x^3 + 1, GF(2)), Poly(x^5 + x^3 + x^2 + x + 1, GF(2))),
 (Poly(x^5 + x^3 + 1, GF(2)), Poly(x^5 + x^4 + x^2 + x + 1, GF(2))),
 (Poly(x^5 + x^3 + 1, GF(2)), Poly(x^5 + x^4 + x^3 + x + 1, GF(2))),
 (Poly(x^5 + x^3 + 1, GF(2)), Poly(x^5 + x^4 + x^3 + x^2 + 1, GF(2)))]

Generate all preferred pairs with degree 5.

In [3]: list(sdr.preferred_pairs(5))
Out[3]: 
[(Poly(x^5 + x^2 + 1, GF(2)), Poly(x^5 + x^3 + x^2 + x + 1, GF(2))),
 (Poly(x^5 + x^2 + 1, GF(2)), Poly(x^5 + x^4 + x^2 + x + 1, GF(2))),
 (Poly(x^5 + x^2 + 1, GF(2)), Poly(x^5 + x^4 + x^3 + x + 1, GF(2))),
 (Poly(x^5 + x^2 + 1, GF(2)), Poly(x^5 + x^4 + x^3 + x^2 + 1, GF(2))),
 (Poly(x^5 + x^3 + 1, GF(2)), Poly(x^5 + x^3 + x^2 + x + 1, GF(2))),
 (Poly(x^5 + x^3 + 1, GF(2)), Poly(x^5 + x^4 + x^2 + x + 1, GF(2))),
 (Poly(x^5 + x^3 + 1, GF(2)), Poly(x^5 + x^4 + x^3 + x + 1, GF(2))),
 (Poly(x^5 + x^3 + 1, GF(2)), Poly(x^5 + x^4 + x^3 + x^2 + 1, GF(2))),
 (Poly(x^5 + x^3 + x^2 + x + 1, GF(2)), Poly(x^5 + x^4 + x^2 + x + 1, GF(2))),
 (Poly(x^5 + x^3 + x^2 + x + 1, GF(2)), Poly(x^5 + x^4 + x^3 + x + 1, GF(2))),
 (Poly(x^5 + x^4 + x^2 + x + 1, GF(2)),
  Poly(x^5 + x^4 + x^3 + x^2 + 1, GF(2))),
 (Poly(x^5 + x^4 + x^3 + x + 1, GF(2)),
  Poly(x^5 + x^4 + x^3 + x^2 + 1, GF(2)))]

Note, there are no preferred pairs for degrees divisible by 4.

In [4]: list(sdr.preferred_pairs(4))
Out[4]: []

In [5]: list(sdr.preferred_pairs(8))
Out[5]: []