Web Simulation 

 

 

 

 

LDPC Build c Vector Tutorial 

This tutorial shows how to build an LDPC codeword vector c when the data part is already known but the parity part must be calculated. The goal is not decoding a noisy received vector — it is encoding: choosing parity bits so the final vector satisfies the parity-check equation.

H cT = 0 mod 2

If this equation holds, c is a valid LDPC codeword for the parity-check matrix H.

Mathematical Foundation

Split the codeword into known data bits and unknown parity bits, and split the parity-check matrix the same way (c = [d | p], H = [A | P]). Then the parity-check equation expands to:

H cT = [A | P] [d | p]T = A dT + P pT = 0 mod 2

All addition is XOR because this is binary arithmetic. In GF(2), subtraction equals addition, so:

P pT = A dT mod 2

This is the central idea: first compute the data contribution s = A dT, then choose parity bits so the parity contribution equals the same s. Then s XOR s = 0 for every row.

Concrete Example

Use the default preset H = [A | I] with A = [[1 1 0], [0 1 1], [1 0 1]], P = I, and known data d = [1 0 1]:

Compute each row of s = A dT:

s0 = d0 XOR d1 = 1 XOR 0 = 1
s1 = d1 XOR d2 = 0 XOR 1 = 1
s2 = d0 XOR d2 = 1 XOR 1 = 0 →  s = [1 1 0]

Because P = I, the parity bits are p = [1 1 0], giving c = [d | p] = [1 0 1 1 1 0]. Verify row by row:

r0: d0 XOR d1 XOR p0 = 1 XOR 0 XOR 1 = 0
r1: d1 XOR d2 XOR p1 = 0 XOR 1 XOR 1 = 0
r2: d0 XOR d2 XOR p2 = 1 XOR 1 XOR 0 = 0 →  H cT = [0 0 0]T

When P Is Not Identity

If P is not identity, the parity bits cannot be copied directly from s. You still solve the same equation:

P pT = s mod 2

The simulator includes a Coupled parity P preset. There, one parity equation can depend on multiple parity bits, so the page solves the small binary linear system using row operations over GF(2).

Simulation

The interactive simulator is below. Use the controls to explore the concepts described above.

Known data bits d (click to toggle)

Parity bits p

Build c = [d | p]

Summary

H matrix and final syndrome

Step details

Usage Instructions

  1. Preset: Select a small parity-check matrix. The first columns are data bits and the last columns are parity bits.
  2. Known data bits: Click any data bit to toggle it between 0 and 1. The parity bits are recalculated immediately.
  3. Step Fwd / Step Bwd / Run: Walk through the process: known data, split H, compute data contribution, solve parity, and verify the final syndrome.
  4. H matrix: Blue-highlighted 1s show which bits participate in each row equation. During the data and parity steps, the relevant side of H is emphasized.
  5. Step details: The lower-right panel changes with the selected step. It shows the data vector, H split, data contribution, parity solve, or final row-check equations.

What To Notice

The parity bits are not guessed. They are calculated so every row of H cT becomes 0.

Key observation: for H = [A | I], the parity vector is simply A dT. For a general invertible parity matrix P, the parity vector is found by solving P pT = A dT over GF(2). Changing one data bit may flip several parity bits, because one data bit can participate in several parity-check rows.

Parameters

  • Preset: Defines the small H matrix and the initial data vector.
  • Data bits: Known part of c; user-controlled.
  • Parity bits: Unknown part of c; calculated by the simulator.
  • Syndrome: Final value of H cT mod 2. A valid codeword has an all-zero syndrome.

Limitations

  • Encoding only. This page constructs a valid codeword from known data; it does not decode a noisy received vector. There is no channel, no LLRs, and no belief-propagation decoder.
  • Toy-sized matrices. Presets use tiny H matrices (a few rows/columns) so the GF(2) algebra is visible by hand. Real 5G/Wi-Fi LDPC codes have thousands of variable nodes and use lifted circulants (see [[ldpcbg2h]]).
  • Assumes a solvable parity block. The method requires P to be invertible over GF(2). General LDPC H matrices are not in this convenient [A | P] systematic form and need more elaborate encoding (e.g. Richardson–Urbanke).
  • No performance dimension. Code rate, minimum distance, girth, and error-correction capability are not analyzed — the focus is purely the parity-construction algebra.
  • Dense small example. The illustrative matrices are not sparse in the way real "low-density" parity-check matrices are; sparsity (the defining LDPC property) is not represented at this scale.