- property galois.BCH.H : FieldArray
The parity-check matrix \(\mathbf{H}\) with shape \((n - 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.H Out[2]: GF([[1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1]], order=2) In [3]: bch.parity_check_poly Out[3]: Poly(x^7 + x^6 + x^4 + 1, GF(2))
Construct a non-primitive \(\textrm{BCH}(13, 4)\) code over \(\mathrm{GF}(3)\).
In [4]: bch = galois.BCH(13, 4, field=galois.GF(3)); bch Out[4]: <BCH Code: [13, 4, 7] over GF(3)> In [5]: bch.H Out[5]: GF([[1, 0, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 2, 2, 1, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 2, 2, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 2, 2, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 1, 0, 2, 2, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 2, 2, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 2, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 2, 1]], order=3) In [6]: bch.parity_check_poly Out[6]: Poly(x^4 + 2x^3 + 2x^2 + 1, GF(3))