feat: add normalized min-sum CN update mode

Add cn_mode ('offset'/'normalized') and alpha parameters to
min_sum_cn_update() in ldpc_sim.py and generic_decode() in
ldpc_analysis.py. Normalized mode scales magnitudes by alpha
(default 0.75) instead of subtracting a fixed offset, which
is better suited for low-rate codes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
cah
2026-02-24 16:35:28 -07:00
parent eb255af067
commit b04813fa7c
3 changed files with 70 additions and 7 deletions

View File

@@ -197,17 +197,21 @@ def sat_sub_q(a, b):
return sat_add_q(a, -b)
def min_sum_cn_update(msgs_in, offset=OFFSET):
def min_sum_cn_update(msgs_in, offset=OFFSET, cn_mode='offset', alpha=0.75):
"""
Offset min-sum check node update.
Min-sum check node update with offset or normalized mode.
For each output j:
sign = XOR of all other input signs
magnitude = min of all other magnitudes - offset (clamp to 0)
magnitude = min of all other magnitudes, corrected by:
- offset mode: mag = max(0, mag - offset)
- normalized mode: mag = floor(mag * alpha)
Args:
msgs_in: list of DC signed integers (Q-bit)
offset: offset correction value
offset: offset correction value (used in offset mode)
cn_mode: 'offset' or 'normalized'
alpha: scaling factor for normalized mode (default 0.75)
Returns:
msgs_out: list of DC signed integers (Q-bit)
@@ -232,7 +236,10 @@ def min_sum_cn_update(msgs_in, offset=OFFSET):
msgs_out = []
for j in range(dc):
mag = min2 if j == min1_idx else min1
mag = max(0, mag - offset) # offset correction
if cn_mode == 'normalized':
mag = int(mag * alpha)
else:
mag = max(0, mag - offset)
sgn = sign_xor ^ signs[j] # extrinsic sign
val = -mag if sgn else mag
msgs_out.append(val)