Low-Density Parity-Check (LDPC)#

The low-density parity-check (LDPC) code module supports 5G compliant LDPC codes and allows iterative belief propagation (BP) decoding. Further, the module supports rate-matching for 5G and provides a generic linear encoder.

The following code snippets show how to setup and run a rate-matched 5G compliant LDPC encoder and a corresponding belief propagation (BP) decoder.

First, we need to create instances of LDPC5GEncoder and LDPC5GDecoder:

encoder = LDPC5GEncoder(k                 = 100, # number of information bits (input)
                        n                 = 200) # number of codeword bits (output)


decoder = LDPC5GDecoder(encoder           = encoder,
                        num_iter          = 20, # number of BP iterations
                        return_infobits   = True)

Now, the encoder and decoder can be used by:

# --- encoder ---
# u contains the information bits to be encoded and has shape [...,k].
# c contains the encoded codewords and has shape [...,n].
c = encoder(u)

# --- decoder ---
# llr contains the log-likelihood ratios from the demapper and has shape [...,n].
# u_hat contains the estimated information bits and has shape [...,k].
u_hat = decoder(llr)

LDPC5GEncoder(k, n[, num_bits_per_symbol, ...])

5G NR LDPC Encoder following the 3GPP 38.212 including rate-matching.

LDPCBPDecoder(pcm[, cn_update, vn_update, ...])

Iterative belief propagation decoder for low-density parity-check (LDPC) codes and other codes on graphs.

LDPC5GDecoder(encoder[, cn_update, ...])

Iterative belief propagation decoder for 5G NR LDPC codes.