Skip to content

spectra-fourier: add Polar codes mode (channel polarization, SC / SC-list / CA-SCL)#671

Merged
github-actions[bot] merged 1 commit into
mainfrom
claude/hopeful-keller-9tb4kf
Jul 24, 2026
Merged

spectra-fourier: add Polar codes mode (channel polarization, SC / SC-list / CA-SCL)#671
github-actions[bot] merged 1 commit into
mainfrom
claude/hopeful-keller-9tb4kf

Conversation

@kkd16

@kkd16 kkd16 commented Jul 24, 2026

Copy link
Copy Markdown
Owner

What

Adds a twentieth mode — Polar — to the existing spectra-fourier-7k9d DSP lab, completing its forward-error-correction pillar with its third and most modern paradigm: Arıkan's channel polarization. Polar codes are the first family proven to achieve the symmetric capacity of any binary-input channel with an explicit, low-complexity construction, and they carry the 5G-NR control channels. Everything is from scratch — no coding libraries.

The change is entirely inside projects/spectra-fourier-7k9d/ (Golden Rule ✓).

New engine — src/lib/polar.ts (~640 lines)

  • Transform / encoderu·F^⊗n as an in-place GF(2) butterfly that is its own inverse; transformStages snapshots each stage for the encoder animation.
  • Two frozen-set constructions — the Bhattacharyya recursion on the erasure channel (z⁻=2z−z², z⁺=z²) and the Gaussian approximation of density evolution on BI-AWGN (mean LLR through the Chung–Richardson–Urbanke φ-function with a bisection inverse). channelCapacities maps both onto one [0,1] capacity axis.
  • SC decoder — the recursive f (exact stable box-plus or min-sum) / g message schedule.
  • SC-list decoder (Tal–Vardy) — the L best paths carried through the same f/g recursion, ranked by the LLR path metric PM += softplus(−(1−2û)·L), pruned to L via a survivor-map that each recursion frame applies to remap its own state.
  • CRC-aided SC-list — bit-wise CRC-6/8/11; returns the lowest-metric survivor whose info bits check (the 5G decoder).
  • Yardsticks — BI-AWGN capacity + binary Shannon limit by adaptive Simpson/bisection, and an adaptive-budget BPSK/AWGN Monte-Carlo waterfall.

New UI — src/modes/Polar.tsx (four deep-linkable tabs)

  • Polarization — the capacity staircase sorting every synthetic channel toward 0/1, the self-similar frozen-set map, Σcapacity ≈ N·C shown conserved.
  • Encoder — the F^⊗n XOR butterfly with a live message flowing through the stages.
  • Decode — one noisy word decoded three ways (greedy SC vs best-metric SCL vs CA-SCL), with the ranked survivor list, path-metric bars and CRC flags.
  • Waterfall — SC · SCL L=2/8 · CA-SCL L=8 racing uncoded BPSK toward the Shannon line.

Wired into src/App.tsx nav; styles added to src/index.css.

Verification

  • 8 new self-tests (119 → 127, all green) in src/lib/selftest.ts: the transform is an involution; SC recovers a clean word; SCL(L=1) ≡ SC bit-for-bit; the CRC self-verifies and catches a flip; BLER SC ≥ SCL(8) ≥ CA-SCL(8) at a fixed SNR; BLER monotone in SNR; BI-AWGN rate-½ Shannon limit ≈ 0.19 dB; the GA φ is a decreasing bijection.
  • Standalone engine bundle: 17 assertions pass, e.g. N=128 K=64 @2 dB BLER SC=0.128 → SCL8=0.059 → CA-SCL8=0.041.
  • CI gate (scope + conformance + lint + build) ✓ — 85 modules.
  • Full self-test suite 127/127 in ~19 s.
  • Drove every Polar tab in headless Chromium (DevTools protocol): all four render, tabs switch, canvases paint, reroll works, zero console/runtime errors.

JOURNAL.md and project.json updated (v16 plan + shipped checklist + session log; card copy bumped to twenty modes with polar tags).

🤖 Generated with Claude Code

https://claude.ai/code/session_011n7XWZKS8M3TYCgMT6y4KV


Generated by Claude Code

…st/CA-SCL)

Twentieth mode for the Spectra DSP lab, completing the FEC pillar with
Arıkan's polar codes — the first capacity-achieving codes with an explicit
construction and the 5G-NR control-channel code. New from-scratch polar.ts:
the u·F^⊗n transform (self-inverse), Bhattacharyya + Gaussian-approximation
constructions, recursive SC, Tal–Vardy SC-list via a survivor-remap, and the
CRC-aided list decoder, plus BI-AWGN capacity and a Monte-Carlo waterfall.
Four-tab Polar.tsx (Polarization / Encoder / Decode / Waterfall). Eight new
self-tests (119→127, all green), verified in headless Chromium with zero
console errors.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Scope + lint + build passed.

@github-actions
github-actions Bot merged commit e31e265 into main Jul 24, 2026
2 checks passed
@github-actions
github-actions Bot deleted the claude/hopeful-keller-9tb4kf branch July 24, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants