Skip to content

komm.BlockDecoder

Decoder for linear block codes.

Attributes:

  • code (BlockCode)

    The block code to be considered.

  • method (str | None)

    The identifier of the method to be used for decoding. The default corresponds to code.default_decoder.

  • decoder_kwargs (dict)

    Additional keyword arguments to be passed to the decoder.

Notes
  • To see the default decoding method for a given code, use code.default_decoder; to see the available decoding methods for a given code, use code.supported_decoders().
Available decoding methods

bcjr: Bahl–Cocke–Jelinek–Raviv (BCJR)

berlekamp: Berlekamp decoder

  • Input type: hard
  • Output type: hard
  • Target: codeword
  • Supported by: BCHCode.

exhaustive_search_hard: Exhaustive search (hard-decision). Minimum Hamming distance decoder

  • Input type: hard
  • Output type: hard
  • Target: codeword
  • Supported by: All codes.

exhaustive_search_soft: Exhaustive search (soft-decision). Minimum Euclidean distance decoder

  • Input type: soft
  • Output type: hard
  • Target: codeword
  • Supported by: All codes.

majority_logic_repetition_code: Majority-logic decoder. A hard-decision decoder for Repetition codes only.

  • Input type: hard
  • Output type: hard
  • Target: message
  • Supported by: RepetitionCode.

meggitt: Meggitt decoder

  • Input type: hard
  • Output type: hard
  • Target: codeword
  • Supported by: BCHCode, CyclicCode.

reed: Reed decoding algorithm for Reed–Muller codes. It's a majority-logic decoding algorithm.

  • Input type: hard
  • Output type: hard
  • Target: message
  • Supported by: ReedMullerCode.

syndrome_table: Syndrome table decoder

  • Input type: hard
  • Output type: hard
  • Target: codeword
  • Supported by: All codes.

viterbi_hard: Viterbi (hard-decision)

viterbi_soft: Viterbi (soft-decision)

wagner: Wagner decoder. A soft-decision decoder for SingleParityCheck codes only.

weighted_reed: Weighted Reed decoding algorithm for Reed–Muller codes.

  • Input type: soft
  • Output type: hard
  • Target: message
  • Supported by: ReedMullerCode.

Input:

  • in0 (Array1D[int] | Array1D[float])

    The (hard or soft) bit sequence to be decoded. Its length must be a multiple of the code's block length $n$.

Output:

  • out0 (Array1D[int])

    The decoded bit sequence. Its length is a multiple of the code's dimension $k$.

Examples:

>>> code = komm.HammingCode(3)
>>> code.default_decoder
'syndrome_table'
>>> code.supported_decoders()
['exhaustive_search_hard', 'exhaustive_search_soft', 'syndrome_table']
>>> decoder = komm.BlockDecoder(code)
>>> decoder([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.BlockDecoder(code, method='exhaustive_search_soft')
>>> decoder([-0.98, -0.85, 1.07, -0.78, 1.11, -0.95, -1.16, -0.87, 1.11, -0.83, -0.95, 0.94, 1.07, 0.91])
array([1, 1, 0, 0, 1, 0, 1, 1])