Forward Error Correction

This section contains classes and functions for constructing forward error correction codes.

FEC classes

BCH(n, k[, primitive_poly, ...])

A primitive, narrow-sense binary \(\textrm{BCH}(n, k)\) code.

ReedSolomon(n, k[, c, primitive_poly, ...])

A general \(\textrm{RS}(n, k)\) code.

Linear block code functions


Converts the generator matrix \(\mathbf{G}\) of a linear \([n, k]\) code into its parity-check matrix \(\mathbf{H}\).


Converts the parity-check matrix \(\mathbf{H}\) of a linear \([n, k]\) code into its generator matrix \(\mathbf{G}\).

Cyclic code functions

bch_valid_codes(n[, t_min])

Returns a list of \((n, k, t)\) tuples of valid primitive binary BCH codes.

poly_to_generator_matrix(n, generator_poly)

Converts the generator polynomial \(g(x)\) into the generator matrix \(\mathbf{G}\) for an \([n, k]\) cyclic code.

roots_to_parity_check_matrix(n, roots)

Converts the generator polynomial roots into the parity-check matrix \(\mathbf{H}\) for an \([n, k]\) cyclic code.

Last update: Jul 12, 2022