komm.ViterbiStreamDecoder
Convolutional stream decoder using Viterbi algorithm. Decode a (hard or soft) bit stream given a convolutional code, assuming a traceback length (path memory) of $\tau$. At time $t$, the decoder chooses the path survivor with best metric at time $t - \tau$ and outputs the corresponding information bits. The output stream has a delay equal to $k \tau$, where $k$ is the number of input bits of the convolutional code. As a rule of thumb, the traceback length is chosen as $\tau = 5\mu$, where $\mu$ is the memory order of the convolutional code.
Parameters:
-
convolutional_code(ConvolutionalCode) –The convolutional code.
-
traceback_length(int) –The traceback length (path memory) $\tau$ of the decoder.
-
state(int) –The current state of the decoder. The default value is
0. -
input_type(Literal['hard', 'soft']) –The type of the input sequence, either
hardorsoft. The default value ishard.
decode()
Parameters:
-
input(ArrayLike) –The (hard or soft) bit sequence to be decoded.
Returns:
-
output(NDArray[integer]) –The decoded bit sequence.
Examples:
>>> decoder = komm.ViterbiStreamDecoder(
... convolutional_code=komm.ConvolutionalCode([[0b111, 0b101]]),
... traceback_length=10,
... )
>>> decoder.decode([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
array([0, 0, 0, 0, 0, 0, 0, 0])
>>> decoder.decode([1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1])
array([0, 0, 0, 0, 0, 0, 0, 0])
>>> decoder.decode([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
array([0, 0, 1, 0, 1, 1, 1, 0])