Skip to content

komm.PolarCode

Polar (Arıkan) code. Let $\mu \geq 1$ be an integer, and $\mathcal{F}$ (called the frozen bit indices) be a subset of $[0 : 2^\mu)$. Define $\mathcal{A} = [0 : 2^\mu) \setminus \mathcal{F}$ (called the active bit indices). The polar code with parameters $(\mu, \mathcal{F})$ is the linear block code whose generator matrix is obtained by selecting the rows of the order-$2^\mu$ Walsh-Hadamard matrix, $$ H_{2^\mu} = \begin{bmatrix} 1 & 0 \\ 1 & 1 \end{bmatrix} ^ {\otimes \mu}, $$ corresponding to the active bit indices, where $\otimes$ denotes the Kronecker product. The resulting code has the following parameters:

  • Length: $n = 2^{\mu}$
  • Dimension: $k = |\mathcal{A}|$
  • Redundancy: $m = |\mathcal{F}|$

Parameters:

  • mu (int)

    The parameter $\mu$ of the code.

  • frozen (ArrayLike)

    The frozen bit indices $\mathcal{F}$ of the code.

Examples:

>>> code = komm.PolarCode(4, [0, 1, 2, 3, 4, 8])
>>> (code.length, code.dimension, code.redundancy)
(16, 10, 6)
>>> code.generator_matrix
array([[1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
       [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
       [1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0],
       [1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0],
       [1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0],
       [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0],
       [1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0],
       [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0],
       [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]])
>>> code.minimum_distance()
4