optic.comm.fec.encoder

encoder(G, bits, systematic=True)

Encode binary sequences using a generator matrix over GF(2).

Parameters:
  • G (np.array of shape (k, n)) – Binary generator matrix.

  • bits (np.array of shape (k, N)) – Binary input sequences to encode. Each column is a bit sequence of length \(k\).

  • systematic (bool, optional) – If True, the generator matrix is assumed to be in systematic form. If False, the generator matrix is treated as a general linear transformation (default is True).

Returns:

codewords – Encoded binary codewords. Each column corresponds to a codeword of length \(n\) resulting from applying the generator matrix to the respective input bit sequence.

Return type:

np.array of shape (n, N)