skillfed

ldpc

LDPC: Python Tools for Low Density Parity Check Codes

ldpc v2.4.1 121.3K downloads/30d#11,989 on PyPI
Permissive license MIT License Copyright (c) 2024 Joschka Roffe Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal… (full text in the JSON record) AGING released

What it is and what it does

LDPC is a Python library for decoding low-density parity check codes, with a focus on quantum error correction. It provides multiple decoder implementations—belief propagation (BP), ordered statistics decoding (OSD), union-find matching, and hybrid approaches like BP+LSD and BeliefFind—suitable for both classical and quantum codes. The package wraps C++ code via Cython and depends on numpy, scipy, tqdm, pytest, stim, sinter, and pymatching for its runtime.

The library is designed for researchers and practitioners working with error-correcting codes, particularly in quantum computing contexts. Installation requires a C compiler and Python 3.10 or later. It provides utilities for constructing codes (e.g., Hamming codes), computing code parameters via GF2 linear algebra, and decoding syndromes using configurable algorithms. The package is in beta status and remains a work in progress, with ongoing development for parallel processing and additional decoder implementations.

Use it for:

  • Decode quantum surface codes and other matchable syndromes using the union-find or BeliefFind decoders
  • Benchmark belief propagation with ordered statistics decoding (BP+OSD) for quantum error correction research
  • Compute low-density parity check code parameters and perform GF2 linear algebra operations
  • Simulate quantum error correction pipelines by integrating with stim and sinter for code construction and syndrome generation
  • Evaluate BP+LSD (belief propagation plus localized statistics decoding) as an alternative to OSD-based approaches

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides decoders for low-density parity check (LDPC) codes, including belief propagation, ordered statistics decoding, union-find matching, and hybrid approaches for classical and quantum error correction.

Yes, with conditions. Install if you are working on quantum error correction research or classical LDPC decoding and can meet the C compiler requirement. The MIT license and broad platform support (wheels for macOS, Linux, Windows) are favorable. However, the aging maintenance status (249 days since last release) and beta classification mean you should verify that the package meets your specific decoding accuracy and performance needs before committing to production use. No known security vulnerabilities.

Install

ldpc on PyPI

pip

pip install ldpc

uv

uv add ldpc

poetry

poetry add ldpc

Installing ldpc

Before you install

Medium install friction due to C++ compilation requirement (needs a C compiler like gcc or clang). Supports current Python versions (3.10+) with prebuilt wheels for common platforms. Maintenance status is aging—last release was 249 days ago—though the package remains functional.

License in practice

MIT License permits free use, modification, and distribution with minimal restrictions, making it suitable for both academic and commercial projects.

Quickstart

pip install ldpc

import numpy as np
import ldpc.codes
from ldpc.bplsd_decoder import BpLsdDecoder

H = ldpc.codes.hamming_code(5)
decoder = BpLsdDecoder(H, error_rate=0.1, lsd_order=0)
syndrome = np.random.randint(0, 2, size=H.shape[0], dtype=np.uint8)
decoding = decoder.decode(syndrome)

Requires a C compiler (gcc on Linux, clang on macOS/Windows) and Python >= 3.10 to build from source or install wheels.

Verify before relying

  • Whether the package is actively maintained or in maintenance-only mode beyond the aging status flag
  • Performance characteristics and decoding accuracy compared to other LDPC implementations
  • Stability of the C++ rewrite relative to LDPCv1, given the documented possibility of breaking changes

Package facts

License MIT License Copyright (c) 2024 Joschka Roffe Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.10)
Install friction medium — platform-specific wheel
Runtime dependencies 7 — numpy, scipy, tqdm, pytest, stim, sinter, pymatching
Maintenance aging — 249 days since the last release
First released
Downloads 121,267/month — #11,989 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ldpc-2.4.1-cp310-cp310-macosx_10_9_x86_64.whl; ldpc-2.4.1-cp310-cp310-macosx_11_0_arm64.whl; ldpc-2.4.1-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; ldpc-2.4.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; ldpc-2.4.1-cp310-cp310-win_amd64.whl; ldpc-2.4.1-cp311-cp311-macosx_10_9_x86_64.whl; ldpc-2.4.1-cp311-cp311-macosx_11_0_arm64.whl; ldpc-2.4.1-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; ldpc-2.4.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; ldpc-2.4.1-cp311-cp311-win_amd64.whl; ldpc-2.4.1-cp312-cp312-macosx_10_13_x86_64.whl; ldpc-2.4.1-cp312-cp312-macosx_11_0_arm64.whl; ldpc-2.4.1-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; ldpc-2.4.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; ldpc-2.4.1-cp312-cp312-win_amd64.whl; ldpc-2.4.1-cp313-cp313-macosx_10_13_x86_64.whl; ldpc-2.4.1-cp313-cp313-macosx_11_0_arm64.whl; ldpc-2.4.1-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl; ldpc-2.4.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; ldpc-2.4.1-cp313-cp313-win_amd64.whl

Development Status :: 4 - Beta

Tags

LDPC decoderparity check code decodingquantum error correctionbelief propagation decodersyndrome decodingerror correction codesquantum code simulation
quantum-error-correctionerror-correcting-codesdecoding-algorithms

More Scientific/Engineering packages