generate_reg_ldpc#
- sionna.phy.fec.utils.generate_reg_ldpc(v: int, c: int, n: int, allow_flex_len: bool = True, verbose: bool = True) Tuple[numpy.ndarray, int, int, float][source]#
Generates a random regular (v, c) LDPC code.
This function generates a random Low-Density Parity-Check (LDPC) parity-check matrix of length
nwhere each variable node (VN) has degreevand each check node (CN) has degreec. Note that the generated LDPC code is not optimized to avoid short cycles, which may result in a non-negligible error floor. For encoding, theLinearEncoderblock can be used, but the construction does not guarantee that the parity-check matrix (pcm) has full rank.- Parameters:
v (int) – Desired degree of each variable node (VN).
c (int) – Desired degree of each check node (CN).
n (int) – Desired codeword length.
allow_flex_len (bool) – If True, the resulting codeword length may be slightly increased to meet the degree requirements.
verbose (bool) – If True, prints code parameters.
- Outputs:
pcm – The parity-check matrix.
k – The number of information bits.
n – The codeword length.
coderate – The code rate.
Notes
This algorithm is designed only for regular node degrees. To achieve state-of-the-art bit-error-rate performance, optimizing irregular degree profiles is usually necessary (see [tenBrink]).
Examples
from sionna.phy.fec.coding import generate_reg_ldpc pcm, k, n, rate = generate_reg_ldpc(3, 6, 100, verbose=False) print(f"Generated LDPC code: n={n}, k={k}, rate={rate:.3f}")