property galois.BCH.G : FieldArray

The generator matrix $$\mathbf{G}$$ with shape $$(k, n)$$.

Examples

Construct a binary primitive $$\textrm{BCH}(15, 7)$$ code.

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

In [2]: bch.G
Out[2]:
GF([[1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0],
[0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0],
[0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0],
[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1],
[0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0],
[0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1],
[0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1]], order=2)


Construct a non-primitive $$\textrm{BCH}(13, 4)$$ code over $$\mathrm{GF}(3)$$.

In [3]: bch = galois.BCH(13, 4, field=galois.GF(3)); bch
Out[3]: <BCH Code: [13, 4, 7] over GF(3)>

In [4]: bch.G
Out[4]:
GF([[1, 0, 0, 0, 2, 2, 1, 0, 2, 0, 1, 1, 0],
[0, 1, 0, 0, 0, 2, 2, 1, 0, 2, 0, 1, 1],
[0, 0, 1, 0, 1, 1, 1, 2, 2, 0, 1, 2, 1],
[0, 0, 0, 1, 1, 2, 0, 1, 0, 2, 2, 0, 2]], order=3)

In [5]: bch = galois.BCH(13, 4, field=galois.GF(3), systematic=False); bch
Out[5]: <BCH Code: [13, 4, 7] over GF(3)>

In [6]: bch.G
Out[6]:
GF([[1, 1, 2, 0, 1, 0, 2, 2, 0, 2, 0, 0, 0],
[0, 1, 1, 2, 0, 1, 0, 2, 2, 0, 2, 0, 0],
[0, 0, 1, 1, 2, 0, 1, 0, 2, 2, 0, 2, 0],
[0, 0, 0, 1, 1, 2, 0, 1, 0, 2, 2, 0, 2]], order=3)

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