property galois.BCH.generator_poly : Poly

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

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 binary narrow-sense $$\textrm{BCH}(15, 7)$$ code with first consecutive root $$\alpha$$.

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

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

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

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


Construct a binary non-narrow-sense $$\textrm{BCH}(15, 7)$$ code with first consecutive root $$\alpha^3$$. Notice the design distance of this code is only 3 and it only has 2 roots in $$\mathrm{GF}(2^4)$$.

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

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

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

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