generate_dense_polar#

sionna.phy.fec.polar.utils.generate_dense_polar(frozen_pos: numpy.ndarray, n: int, verbose: bool = True) Tuple[numpy.ndarray, numpy.ndarray][source]#

Generate naive (dense) Polar parity-check and generator matrix.

This function follows Lemma 1 in [Goala_LP] and returns a parity-check matrix for Polar codes.

Notes

The resulting matrix can be used for decoding with the LDPCBPDecoder class. However, the resulting parity-check matrix is (usually) not sparse and, thus, not suitable for belief propagation decoding as the graph has many short cycles. Please consider PolarBPDecoder for iterative decoding over the encoding graph.

Parameters:
  • frozen_pos (numpy.ndarray) – Array of int defining the n-k indices of the frozen positions.

  • n (int) – The codeword length.

  • verbose (bool) – If True, the code properties are printed.

Outputs:
  • pcm – The parity-check matrix of shape [n-k, n].

  • gm – The generator matrix of shape [k, n].

Raises:

Examples

from sionna.phy.fec.polar.utils import generate_5g_ranking, generate_dense_polar

frozen_pos, _ = generate_5g_ranking(k=32, n=64)
pcm, gm = generate_dense_polar(frozen_pos, n=64, verbose=False)
print(f"PCM shape: {pcm.shape}, GM shape: {gm.shape}")
# PCM shape: (32, 64), GM shape: (32, 64)