Skip to content

komm.BCHCode

Bose–Ray-Chaudhuri–Hocquenghem (BCH) code. For given parameters $\mu \geq 2$ and $\delta$ satisfying $2 \leq \delta \leq 2^{\mu} - 1$, a binary BCH code is a cyclic code with generator polynomial given by $$ g(X) = \mathrm{lcm} \left\{ \phi_1(X), \phi_2(X), \ldots, \phi_{\delta - 1}(X) \right\}, $$ where $\phi_i(X)$ is the minimal polynomial of $\alpha^i$, and $\alpha$ is a primitive element of $\mathrm{GF}(2^\mu)$. The parameter $\delta$ must be a Bose distance. The resulting code is denoted by $\bch(\mu, \delta)$, and has the following parameters, where $\delta = 2 \tau + 1$:

  • Length: $n = 2^{\mu} - 1$
  • Dimension: $k \geq n - \mu \tau$
  • Redundancy: $m \leq \mu \tau$
  • Minimum distance: $d \geq \delta$

Only narrow-sense and primitive BCH codes are implemented. For more details, see LC04, Ch. 6 and HP03, Sec. 5.1.

Notes

Parameters:

  • mu (int)

    The parameter $\mu$ of the BCH code.

  • delta (int)

    The Bose distance $\delta$ of the BCH code.

Resources:

Examples:

>>> code = komm.BCHCode(mu=5, delta=7)
>>> (code.length, code.dimension, code.redundancy)
(31, 16, 15)
>>> code.generator_polynomial
BinaryPolynomial(0b1000111110101111)
>>> code.minimum_distance()
7
>>> komm.BCHCode(mu=7, delta=31)
BCHCode(mu=7, delta=31)
>>> komm.BCHCode(mu=7, delta=32)
Traceback (most recent call last):
...
ValueError: 'delta' must be a Bose distance (next one is 43)
>>> komm.BCHCode(mu=7, delta=43)
BCHCode(mu=7, delta=43)