komm.BerlekampDecoder
Berlekamp decoder for BCH codes and Reed–Solomon codes. For more details, see LC04, Sec. 6.3 and LC04, Sec. 7.4.
Parameters:
-
code(BCHCode | ReedSolomonCode) –The BCH or Reed–Solomon code to be used for decoding.
Notes
- Input type:
hard(bits). - Output type:
hard(bits).
decode_to_codeword()
Decode received words to codewords. This method takes one or more sequences of received words and returns their corresponding estimated codeword sequences.
Parameters:
-
input(ArrayLike) –The input sequence(s). Can be either a single sequence whose length is a multiple of $n$, or a multidimensional array where the last dimension is a multiple of $n$.
Returns:
-
output(NDArray[integer]) –The output sequence(s). Has the same shape as the input.
Examples:
>>> code = komm.BCHCode(4, 7)
>>> decoder = komm.BerlekampDecoder(code)
>>> decoder.decode_to_codeword(
... [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0],
... )
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
>>> code = komm.ReedSolomonCode(3, 5)
>>> decoder = komm.BerlekampDecoder(code)
>>> decoder.decode_to_codeword(
... [1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0],
... )
array([1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0])
decode()
Decode received words. This method takes one or more sequences of received words and returns their corresponding estimated message sequences.
Parameters:
-
input(ArrayLike) –The input sequence(s). Can be either a single sequence whose length is a multiple of $n$, or a multidimensional array where the last dimension is a multiple of $n$.
Returns:
-
output(NDArray[integer | floating]) –The output sequence(s). Has the same shape as the input, with the last dimension contracted from $bn$ to $bk$, where $b$ is a positive integer.
Examples:
>>> code = komm.BCHCode(4, 7)
>>> decoder = komm.BerlekampDecoder(code)
>>> decoder.decode(
... [0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0],
... )
array([0, 0, 0, 0, 0])
>>> code = komm.ReedSolomonCode(3, 5)
>>> decoder = komm.BerlekampDecoder(code)
>>> decoder.decode(
... [1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0],
... )
array([0, 0, 0, 1, 1, 0, 1, 0, 0])