alist2mat#

sionna.phy.fec.utils.alist2mat(alist: List[List[int]], verbose: bool = True) Tuple[numpy.ndarray, int, int, float][source]#

Converts an alist [MacKay] code definition to a NumPy parity-check matrix.

This function converts an alist format representation of a code’s parity-check matrix to a NumPy array. Many example codes in alist format can be found in [UniKL].

About the alist format (see [MacKay] for details):

  • Row 1: Defines the parity-check matrix dimensions m x n.

  • Row 2: Contains two integers, max_CN_degree and max_VN_degree.

  • Row 3: Lists the degrees of all n variable nodes (columns).

  • Row 4: Lists the degrees of all m check nodes (rows).

  • Next n rows: Non-zero entries of each column, zero-padded as needed.

  • Following m rows: Non-zero entries of each row, zero-padded as needed.

Parameters:
  • alist (List[List[int]]) – Nested list in alist format [MacKay] representing the parity-check matrix.

  • verbose (bool) – If True, prints the code parameters.

Outputs:
  • pcm – The parity-check matrix.

  • k – The number of information bits.

  • n – The number of codeword bits.

  • coderate – The code rate.

Notes

Use load_alist() to import an alist from a text file.

Examples

from sionna.phy.fec.coding import load_alist, alist2mat

al = load_alist(path="code.alist")
pcm, k, n, coderate = alist2mat(al)