property galois.BCH.generator_poly : Poly

The generator polynomial g(x) over GF(q).

Notes

Every codeword 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 binary narrow-sense BCH(15,7) code with first consecutive root α.

In [1]: bch = galois.BCH(15, 7); bch
Out[1]: <BCH Code: [15, 7, 5] over GF(2)>

In [2]: bch.generator_poly
Out[2]: Poly(x^8 + x^7 + x^6 + x^4 + 1, GF(2))

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

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

Construct a binary non-narrow-sense BCH(15,7) code with first consecutive root α3. Notice the design distance of this code is only 3 and it only has 2 roots in GF(24).

In [5]: bch = galois.BCH(15, 7, c=3); bch
Out[5]: <BCH Code: [15, 7, 3] over GF(2)>

In [6]: bch.generator_poly
Out[6]: Poly(x^8 + x^7 + x^6 + x^4 + 1, GF(2))

In [7]: bch.roots
Out[7]: GF([8, 3], order=2^4)

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