property galois.ReedSolomon.generator_poly : Poly

The generator polynomial \(g(x)\) over \(\mathrm{GF}(q)\).

Notes

Every codeword \(\mathbf{c}\) can be represented as a degree-\(n\) polynomial \(c(x)\). Each codeword polynomial \(c(x)\) is a multiple of \(g(x)\).

Examples

Construct a narrow-sense \(\textrm{RS}(15, 9)\) code over \(\mathrm{GF}(2^4)\) with first consecutive root \(\alpha\).

In [1]: rs = galois.ReedSolomon(15, 9); rs
Out[1]: <Reed-Solomon Code: [15, 9, 7] over GF(2^4)>

In [2]: rs.generator_poly
Out[2]: Poly(x^6 + 7x^5 + 9x^4 + 3x^3 + 12x^2 + 10x + 12, GF(2^4))

In [3]: rs.roots
Out[3]: GF([ 2,  4,  8,  3,  6, 12], order=2^4)

# Evaluate the generator polynomial at its roots in GF(q)
In [4]: rs.generator_poly(rs.roots)
Out[4]: GF([0, 0, 0, 0, 0, 0], order=2^4)

Construct a non-narrow-sense \(\textrm{RS}(15, 9)\) code over \(\mathrm{GF}(2^4)\) with first consecutive root \(\alpha^3\).

In [5]: rs = galois.ReedSolomon(15, 9, c=3); rs
Out[5]: <Reed-Solomon Code: [15, 9, 7] over GF(2^4)>

In [6]: rs.generator_poly
Out[6]: Poly(x^6 + 15x^5 + 8x^4 + 7x^3 + 9x^2 + 3x + 8, GF(2^4))

In [7]: rs.roots
Out[7]: GF([ 8,  3,  6, 12, 11,  5], order=2^4)

# Evaluate the generator polynomial at its roots in GF(q)
In [8]: rs.generator_poly(rs.roots)
Out[8]: GF([0, 0, 0, 0, 0, 0], order=2^4)