Skip to content

komm.CordaroWagnerCode

Cordaro–Wagner code. For a given length $n \geq 2$, it is the linear block code with dimension $k = 2$ which is optimum for the BSC with sufficiently small crossover probability. For more details, see CW67.

  • Length: $n$
  • Dimension: $k = 2$
  • Redundancy: $m = n - 2$
  • Minimum distance: $d = \left\lceil 2n / 3 \right\rceil - 1$

Attributes:

  • n (int)

    The length $n$ of the code. Must satisfy $n \geq 2$.

Examples:

>>> code = komm.CordaroWagnerCode(11)
>>> (code.length, code.dimension, code.minimum_distance)
(11, 2, 7)
>>> code.generator_matrix
array([[1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1],
       [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]])
>>> code.codeword_weight_distribution
array([1, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0, 0])
>>> code.coset_leader_weight_distribution
array([  1,  11,  55, 165, 226,  54,   0,   0,   0,   0,   0,   0])