komm.ExhaustiveBitwiseDecoder
Exhaustive bitwise decoder for general block codes. This decoder computes the a posteriori L-value of each bit by summing over all possible codewords, assuming equiprobable messages. Its hard decisions, the signs of the L-values, are the bitwise maximum a posteriori (MAP) decisions, and may not form a codeword. For more details, see MacK03, Sec. 25.1.
Parameters:
-
code(BlockCode) –The block code to be used for decoding.
-
output_type(Literal['hard', 'soft']) –The type of the output. Either
'hard'or'soft'. Default is'soft'.
Notes
- Input type:
soft(L-values). - Output type:
hard(bits) orsoft(L-values).
decode_to_codeword()
Decode received words to estimates of the $n$ code bits. This method takes one or more sequences of received words and returns their corresponding estimated sequences. Depending on the decoder, the estimates may be bits, erasure-marked bits, or L-values, and need not form a valid codeword.
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.
Examples:
>>> code = komm.HammingCode(3)
>>> decoder = komm.ExhaustiveBitwiseDecoder(code)
>>> decoder.decode_to_codeword([-1.3, -0.8, +1.1, -0.8, +1.2, -0.2, -1.4])
array([-1.4867878 , -0.47876436, 1.30351111, -0.2634431 , 1.38090385,
-0.20271875, -1.57367212])
>>> decoder = komm.ExhaustiveBitwiseDecoder(code, output_type="hard")
>>> decoder.decode_to_codeword([-1.3, -0.8, +1.1, -0.8, +1.2, -0.2, -1.4])
array([1, 1, 0, 1, 0, 1, 1])
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.HammingCode(3)
>>> decoder = komm.ExhaustiveBitwiseDecoder(code)
>>> decoder.decode([-1.3, -0.8, +1.1, -0.8, +1.2, -0.2, -1.4])
array([-1.4867878 , -0.47876436, 1.30351111, -0.2634431 ])
>>> decoder = komm.ExhaustiveBitwiseDecoder(code, output_type="hard")
>>> decoder.decode([-1.3, -0.8, +1.1, -0.8, +1.2, -0.2, -1.4])
array([1, 1, 0, 1])