-
galois.poly_to_generator_matrix(n: int, generator_poly: Poly, systematic: bool =
True
) FieldArray Converts the generator polynomial
into the generator matrix for an cyclic code.Examples¶
Compute the generator matrix for the
code.In [1]: g = galois.primitive_poly(2, 3); g Out[1]: Poly(x^3 + x + 1, GF(2)) In [2]: galois.poly_to_generator_matrix(7, g, systematic=False) Out[2]: GF([[1, 0, 1, 1, 0, 0, 0], [0, 1, 0, 1, 1, 0, 0], [0, 0, 1, 0, 1, 1, 0], [0, 0, 0, 1, 0, 1, 1]], order=2) In [3]: galois.poly_to_generator_matrix(7, g, systematic=True) Out[3]: GF([[1, 0, 0, 0, 1, 0, 1], [0, 1, 0, 0, 1, 1, 1], [0, 0, 1, 0, 1, 1, 0], [0, 0, 0, 1, 0, 1, 1]], order=2)