load_parity_check_examples#

sionna.phy.fec.utils.load_parity_check_examples(pcm_id: int, verbose: bool = False) Tuple[numpy.ndarray, int, int, float][source]#

Loads parity-check matrices of built-in example codes.

This utility function loads predefined example codes, including Hamming, BCH, and LDPC codes. The following codes are available:

  • pcm_id =0 : (7,4) Hamming code with k=4 information bits and n=7 codeword length.

  • pcm_id =1 : (63,45) BCH code with k=45 information bits and n=63 codeword length.

  • pcm_id =2 : (127,106) BCH code with k=106 information bits and n=127 codeword length.

  • pcm_id =3 : Random LDPC code with variable node degree 3 and check node degree 6, with k=50 information bits and n=100 codeword length.

  • pcm_id =4 : 802.11n LDPC code with k=324 information bits and n=648 codeword length.

Parameters:
  • pcm_id (int) – An integer identifying the code matrix to load.

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

Outputs:
  • pcm – The parity-check matrix (values are 0 and 1).

  • k – The number of information bits.

  • n – The number of codeword bits.

  • coderate – The code rate, assuming full rank of the parity-check matrix.

Examples

from sionna.phy.fec.coding import load_parity_check_examples

pcm, k, n, coderate = load_parity_check_examples(0)
print(f"n={n}, k={k}, rate={coderate:.3f}")