Skip to content

v1.1.0: LDPC, Polar & Turbo codes

Choose a tag to compare

@MarvinElling MarvinElling released this 26 Jul 20:48

Highlights

CommPy 1.1.0 adds the three modern standard forward-error-correcting codes —
LDPC, polar, and turbo — that underpin 5G-NR, LTE, Wi-Fi and DVB. All
three decode directly from the soft-decision LLRs produced by
Modulator.soft_demodulate, and the new simulate_coded_ber turns a
coding-gain waterfall into a one-liner.

No breaking changes to the public API (commpy.*).

import numpy as np
from commpy import PolarCode, CRC, MPSKModulator, Channels

mod  = MPSKModulator(2)                                   # BPSK
code = PolarCode(block_length=128, k=64, crc=CRC.crc8())  # CRC-aided SCL (5G-style)

message = np.random.randint(0, 2, code.k)
rx  = Channels.awgn(mod.modulate(code.encode(message)), snr_db=2.0)
llr = mod.soft_demodulate(rx, noise_var=10 ** -0.2)
decoded, codeword, _ = code.decode(llr, list_size=8)

Added

Channel coding (FEC)

  • LDPC — LDPCCode with vectorized belief propagation (sum-product &
    normalized min-sum), Gallager (from_gallager) and quasi-cyclic
    (from_base_graph) constructions, a systematic GF(2) generator that tolerates
    rank-deficient parity-check matrices, and a ready rate-½ QC code.
  • Polar — PolarCode with successive-cancellation (SC) and CRC-aided
    SC-list (CA-SCL) decoding (reuses the CRC class), Bhattacharyya /
    Gaussian-approximation frozen-set construction, and exact log-domain path
    metrics verified equal to maximum-likelihood decoding.
  • Turbo — TurboCode, a rate-⅓ parallel-concatenated code with
    recursive-systematic constituent encoders and iterative log-MAP (BCJR)
    decoding through an interleaver.

Simulation

  • simulate_coded_ber — Monte-Carlo BER sweep for any soft-input code
    (modulate → channel → soft_demodulate → decode); the coded counterpart of
    simulate_ber.

Changed

  • plot_waterfall clamps confidence-interval error bars at 0, so the very small
    error rates typical of coded curves no longer trip a matplotlib error.

Examples

  • ldpc_coding_gain_demo.py, polar_scl_demo.py, turbo_coding_gain_demo.py

Install

pip install --upgrade commpy

Full changelog: v1.0.0...v1.1.0