- property galois.BCH.is_narrow_sense : bool
Indicates if the BCH code is narrow-sense, meaning the roots of the generator polynomial are consecutive powers of \(\alpha\) starting at 1, that is \(\alpha, \dots, \alpha^{d-1}\).
Examples¶
Construct a binary narrow-sense \(\textrm{BCH}(15, 7)\) code with first consecutive root \(\alpha\).
In [1]: bch = galois.BCH(15, 7); bch Out[1]: <BCH Code: [15, 7, 5] over GF(2)> In [2]: bch.is_narrow_sense Out[2]: True In [3]: bch.c == 1 Out[3]: True In [4]: bch.generator_poly Out[4]: Poly(x^8 + x^7 + x^6 + x^4 + 1, GF(2)) In [5]: bch.roots Out[5]: GF([2, 4, 8, 3], 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.
In [6]: bch = galois.BCH(15, 7, c=3); bch Out[6]: <BCH Code: [15, 7, 3] over GF(2)> In [7]: bch.is_narrow_sense Out[7]: False In [8]: bch.c == 1 Out[8]: False In [9]: bch.generator_poly Out[9]: Poly(x^8 + x^7 + x^6 + x^4 + 1, GF(2)) In [10]: bch.roots Out[10]: GF([8, 3], order=2^4)