Install & Compatibility
Where this runs
tested against v2.4.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
py 3.10
✕ build_error
✓ 15.3s
py 3.11
✕ build_error
✓ 14.7s
py 3.12
✕ build_error
✓ 15.6s
py 3.13
✕ build_error
✓ 15.9s
py 3.9
✕ build_error
✕ build_error
398MB installed
● package 398MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
BeliefFindDecoder
✓ from ldpc import BeliefFindDecoder
✗ from ldpc import LdpcCode
BpDecoder
✓ from ldpc import BpDecoder
✗ from ldpc import RandomLdpcCode
UnionFindDecoder
✓ from ldpc import UnionFindDecoder
✗ from ldpc import ProtographLdpcCode
Basic example: create a random LDPC code, encode, add noise, and decode.
import numpy as np
from ldpc import RandomLdpcCode, LdpcEncoder, LdpcDecoder
# Create a random LDPC code with rate 0.5, block length 100
code = RandomLdpcCode(block_len=100, rate=0.5)
# Encode: generate random message
msg = np.random.randint(0, 2, code.k)
codeword = code.encode(msg)
# Introduce noise (BSC)
noise = np.random.binomial(1, 0.1, codeword.shape)
received = (codeword + noise) % 2
# Decode
decoder = code.decoder()
decoded = decoder.decode(received, max_iter=50)
print('Decoded correctly:', np.array_equal(decoded, codeword))
Upgrade
Version history
2.4.1latest on PyPI · released Dec 8, 2025
Audit
Dependencies
numpyrequiredCore dependency for array operations.
scipyrequiredUsed for sparse matrix operations and linear algebra.
numbaoptionalUsed for JIT compilation of decoding loops (optional but recommended for performance).