- galois.generator_to_parity_check_matrix(G: FieldArray) FieldArray
Converts the generator matrix
of a linear code into its parity-check matrix .The generator and parity-check matrices satisfy the equations
.- Parameters¶
- G: FieldArray¶
The
generator matrix in systematic form .
- Returns¶
The
parity-check matrix .
Examples¶
In [1]: g = galois.primitive_poly(2, 3); g Out[1]: Poly(x^3 + x + 1, GF(2)) In [2]: G = galois.poly_to_generator_matrix(7, g); G Out[2]: 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) In [3]: H = galois.generator_to_parity_check_matrix(G); H Out[3]: GF([[1, 1, 1, 0, 1, 0, 0], [0, 1, 1, 1, 0, 1, 0], [1, 1, 0, 1, 0, 0, 1]], order=2) In [4]: G @ H.T Out[4]: GF([[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]], order=2)