Skip to content

komm.ExhaustiveSearchDecoder

Exhaustive search decoder for general block codes. This decoder implements a brute-force search over all possible codewords to find the one that is closest (in terms of Hamming distance, for hard-decision decoding, or Euclidean distance, for soft-decision decoding) to the received word.

Parameters:

  • code (BlockCode) –

    The block 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) or soft (L-values).
  • 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.HammingCode(3)
>>> decoder = komm.ExhaustiveSearchDecoder(code, input_type="hard")
>>> decoder.decode_to_codeword([
...     [1, 1, 0, 1, 0, 1, 1],
...     [1, 0, 1, 1, 0, 0, 0],
... ])
array([[1, 1, 0, 0, 0, 1, 1],
       [1, 0, 1, 1, 0, 1, 0]])
>>> decoder = komm.ExhaustiveSearchDecoder(code, input_type="soft")
>>> decoder.decode_to_codeword([-1.3, -0.8, +1.1, -0.8, +1.2, -0.2, -1.4])
array([1, 1, 0, 0, 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.ExhaustiveSearchDecoder(code, input_type="hard")
>>> decoder.decode([
...     [1, 1, 0, 1, 0, 1, 1],
...     [1, 0, 1, 1, 0, 0, 0],
... ])
array([[1, 1, 0, 0],
       [1, 0, 1, 1]])
>>> decoder = komm.ExhaustiveSearchDecoder(code, input_type="soft")
>>> decoder.decode([-1.3, -0.8, +1.1, -0.8, +1.2, -0.2, -1.4])
array([1, 1, 0, 0])