komm.ViterbiDecoder
Viterbi decoder for terminated convolutional codes. For more details, see LC04, Sec. 12.1.
Parameters:
-
code
(TerminatedConvolutionalCode
) –The terminated convolutional code to be used for decoding.
-
input_type
(Literal['hard', 'soft']
) –The type of the input. Either
'hard'
or'soft'
. Default is'hard'
.
Notes
- Input type:
hard
(bits) orsoft
(either L-values or channel outputs). - Output type:
hard
(bits).
__call__()
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:
>>> convolutional_code = komm.ConvolutionalCode([[0b011, 0b101, 0b111]])
>>> code = komm.TerminatedConvolutionalCode(
... convolutional_code,
... num_blocks=5,
... mode="zero-termination",
... )
>>> decoder = komm.ViterbiDecoder(code, input_type="hard")
>>> decoder([1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1])
array([1, 1, 0, 0, 1])
>>> convolutional_code = komm.ConvolutionalCode([[0b111, 0b101]])
>>> code = komm.TerminatedConvolutionalCode(
... convolutional_code,
... num_blocks=4,
... mode="direct-truncation",
... )
>>> decoder = komm.ViterbiDecoder(code, input_type="soft")
>>> decoder([-0.7, -0.5, -0.8, -0.6, -1.1, +0.4, +0.9, +0.8])
array([1, 0, 0, 0])