Skip to main content

LDPC: Python Tools for Low Density Parity Check Codes

Project description

LDPC version 2

LDPC Version 2: A C++ rewrite of the LDPCv1 package for decoding low density parity check checks. Warning, whilst efforts have been made to provide backwards compatability with LDPCv1, the new version may introduce breaking changes.

Documentation

The documentation for LDPCv2 can be found here

Installation

The easiest way to install the package is via pip. Python versions >=3.9 are supported.

pip install -U ldpc

Python - Installation from source

The C++ source code can be found in src_cpp. Python bindings are implemented using Cython and can be found in src/ldpc. To install the Python version of the repository follows the instructions below:

  • Download the repo.
  • Navigate to the root.
  • Pip install with python>=3.8. Note: installation requires a C compiler. Eg. gcc on Linux or clang on Windows.
git clone git@github.com:quantumgizmos/ldpc_v2.git
cd ldpc
pip install -Ue .

LDPCv1

If your package requires LDPCv1, this can be installed from PyPi as follows:

pip install -U ldpc==0.1.60

New features

  • A new C++ template class GF2Sparse. This is a more flexible implementation of the mod2sparse data structure used in the LDPCv1. This will make it much easier to expand the package.
  • Serial schedules for the BP decoder.
  • Run-time improvements for BP+OSD OSD-0. The decoder now implements the fast-syndrome OSD-0 implementation (https://arxiv.org/abs/1904.02703), where Gaussian elimination is terminated as soon as the syndrome becomes linearly dependent on the reduced columns.
  • BP+LSD: Belief propagation plus localised statistics decoding. A parallel decoding algorithm that matches the perforance of BP+OSD. Note that the version implemented currenlty runs in serial. We are working on the parallel version! See our paper: https://arxiv.org/abs/2406.18655
  • The union-find matching decoder (https://arxiv.org/abs/1709.06218). This is an implementation of the Delfosse-Nickerson union-find decoder that is suitable for decoding surface codes and other codes with "matchable" syndromes.
  • The BeliefFind decoder. A decoder that first runs belief propagation, and falls back on union-find if if the BP decoder fails to converge as proposed by Oscar Higgott in https://arxiv.org/abs/2203.04948
  • Flip and P-flip decoders as introduced by Thomas Scruby in https://arxiv.org/abs/2212.06985.
  • Improved GF2 linear algebra routines (useful for computing code parameters)

ToDos

LDPCv2 is still a work in progress. Ongoing projects are listed below:

  • Implement parallel version of BP+LSD algorithm using OpenMP.
  • Improve support for parallel processing across the package.
  • More decoders could be implemented (eg. small set-flip, https://arxiv.org/abs/1810.03681)
  • Stabiliser inactivation BP (https://arxiv.org/abs/2205.06125)
  • Generalised BP (https://arxiv.org/abs/2212.03214)
  • Functions need to be properly documented (in progress)
  • Further STIM integration
  • More functionality for studying classical codes. Eg. support for received vector decoding and the AWGN noise channel.

BP+LSD Quickstart

Usage of the new BP+LSD decoder from https://arxiv.org/abs/2406.18655. Similar to BP+OSD, the LSD decoder can be applied to any parity check matrix. We recommend you start with lsd_order=0. The speed/accuracy trade-off for higher order values can be explored from there. Example below:

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

H = ldpc.codes.hamming_code(5)

## The
bp_osd = BpLsdDecoder(
            H,
            error_rate = 0.1,
            bp_method = 'product_sum',
            max_iter = 2,
            schedule = 'serial',
            lsd_method = 'lsd_cs',
            lsd_order = 0
        )

syndrome = np.random.randint(size=H.shape[0], low=0, high=2).astype(np.uint8)

print(f"Syndrome: {syndrome}")
decoding = bp_osd.decode(syndrome)
print(f"Decoding: {decoding}")
decoding_syndrome = H@decoding % 2
print(f"Decoding syndrome: {decoding_syndrome}")

Attribution

If you use this software in your research please cite as follows:

@software{Roffe_LDPC_Python_tools_2022,
author = {Roffe, Joschka},
title = {{LDPC: Python tools for low density parity check codes}},
url = {https://pypi.org/project/ldpc/},
year = {2022}
}

If you have used the BP+OSD class for quantum error correction, please also cite the following paper:

@article{roffe_decoding_2020,
   title={Decoding across the quantum low-density parity-check code landscape},
   volume={2},
   ISSN={2643-1564},
   url={http://dx.doi.org/10.1103/PhysRevResearch.2.043423},
   DOI={10.1103/physrevresearch.2.043423},
   number={4},
   journal={Physical Review Research},
   publisher={American Physical Society (APS)},
   author={Roffe, Joschka and White, David R. and Burton, Simon and Campbell, Earl},
   year={2020},
   month={Dec}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ldpc-2.1.2.tar.gz (872.7 kB view details)

Uploaded Source

Built Distributions

ldpc-2.1.2-cp313-cp313-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.13 Windows x86-64

ldpc-2.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.9 MB view details)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

ldpc-2.1.2-cp313-cp313-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.13 macOS 11.0+ ARM64

ldpc-2.1.2-cp313-cp313-macosx_10_13_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.13 macOS 10.13+ x86-64

ldpc-2.1.2-cp312-cp312-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.12 Windows x86-64

ldpc-2.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.9 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

ldpc-2.1.2-cp312-cp312-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

ldpc-2.1.2-cp312-cp312-macosx_10_13_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12 macOS 10.13+ x86-64

ldpc-2.1.2-cp311-cp311-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.11 Windows x86-64

ldpc-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.9 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

ldpc-2.1.2-cp311-cp311-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

ldpc-2.1.2-cp311-cp311-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

ldpc-2.1.2-cp310-cp310-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.10 Windows x86-64

ldpc-2.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

ldpc-2.1.2-cp310-cp310-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

ldpc-2.1.2-cp310-cp310-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

ldpc-2.1.2-cp39-cp39-win_amd64.whl (1.5 MB view details)

Uploaded CPython 3.9 Windows x86-64

ldpc-2.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.8 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

ldpc-2.1.2-cp39-cp39-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

ldpc-2.1.2-cp39-cp39-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

File details

Details for the file ldpc-2.1.2.tar.gz.

File metadata

  • Download URL: ldpc-2.1.2.tar.gz
  • Upload date:
  • Size: 872.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ldpc-2.1.2.tar.gz
Algorithm Hash digest
SHA256 7efef851110d267eb3e87e1f30832e3d99787c58075ca0224fc8a51c0e0335df
MD5 3935c1c1a816c5f1d7119e50d77343cf
BLAKE2b-256 5a0772f0cf9d5f6275c5db0016bd64a772b3478174a89cc9d3e86f0982c66745

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: ldpc-2.1.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ldpc-2.1.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5f4940c3574defef4a16b9c95664747eeb886b21b85a107f35da83adf158e87f
MD5 d233d795116e7fff36311f1779726a74
BLAKE2b-256 be1e1d56fe810199158a7d4cfcbbbacba086b29828b456d076abee8f8305fb64

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f291ff59bfe2ffc96c2d58beabd17632a588da450152c82a38b50ad4b4014416
MD5 a4256b65fdb7a2008f81c4fecfa4a16f
BLAKE2b-256 042e21451f181171441a0f8272b4a8a2fc94741e8f7e7a9a3f9ad5d854a42fc3

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d8ed6406fd2b52f20bad6dc044cf9452ca9b998ca2f6356db8b01880054a6038
MD5 b9a30e4f502ea955e2eea26dc3bafcc0
BLAKE2b-256 ab6e9e78314eb9d79662a1340ff404fee6d1eae4d41d32bb7aec53bce1880071

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 81d82206f742d47bb2317b6767dc7730504a4074d15a6d6a5a48ae496dfe95b4
MD5 4690a0544632c414c31df79f34c97a38
BLAKE2b-256 ca39850a6e837c8f4c3e6cbe7a3f336c62dbd0e4954a983e98f9f39ebd01d51b

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: ldpc-2.1.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ldpc-2.1.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 1f936eaafc114778c7fdf091dc46645becd0b6e6f215423e0a4f46ee2983839a
MD5 7d25736c555938fa8c9ca2a07e218d4f
BLAKE2b-256 78afa5a96e546afc7655a77279ff686e70f4ff2c94a027dfa4fcc137722b8933

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7a5f3d068b38fd749522382ea97538e3d29dba3bcc76b4fe0ab6f0a10dfde273
MD5 820e7dc8e0001c94b25e3d1379e9ef16
BLAKE2b-256 9e152bcff6ddc56886e75dbfd42d8cf5d390f6a004b88b6aa65a1098f320ec4c

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 693399b2f2cc24f84e4551139d64645d23a5f8bd62fc8147797cfec2998e13a7
MD5 fd01b55ea9919df0e5cc65cc37c0fce8
BLAKE2b-256 c7d3fac0e8c0f206f362e1ac66d1d2a8d19594a85ea5a9af95d42ede0c234f4f

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 89008dd7eaa0deb1ce8cead284a83b5425e9dffaa5d3353be8f106dd033eaf82
MD5 c2c22fec74b8105cfeae0f0cbfe25d45
BLAKE2b-256 705456fcf60cef9bda4bf34f1a3b8bf91e86e937b3a82de780012ad612c7a237

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: ldpc-2.1.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ldpc-2.1.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 9ef630a59f70bd103a79144a73f5d3be3cd522b70a6fb1e332f0acc5baaa51a8
MD5 d28890db20708bb4d1abd5b8a9c88687
BLAKE2b-256 8814f96c34c884990270ba18245ada7e0889ba2ee7ae2965996360385dcda686

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0f7f16ce92c78eda88bbaf99e6656f1b410300ff7a82b417be6b986400e5883d
MD5 09b3906f2c457c99ecbc07e6a41e22cb
BLAKE2b-256 07b4387f3d60709cb10a6715da10d4b11811c436ba6b52b396e4052f2ca44786

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a7219081cbc68acbe580fb14a162e60235e3d6070c114f5b9bfb0c9cc85b1372
MD5 e4aeacf39689f0719e929100d6861c7b
BLAKE2b-256 b43a851e12ac203ca6cba9e43aa30dd53f323be32cf7adcf6f01e52a36f1386c

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2f84ef90cced42e477e9d56300310e4bba3f8aa9bf5f299d7746f48ebe71801b
MD5 9f3e95e41de086b32e81c534ab172416
BLAKE2b-256 80572f8bd9a90b8a908344d99254046aa3b855baeb7d53388423ae40d3ccd10b

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: ldpc-2.1.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ldpc-2.1.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f8925c59a069a97ffe9a2640857ff3ccb32bfce0bd1a7d77b02a8940c25733fb
MD5 e1fbbd7b0da716fa4ff7643e3ae86720
BLAKE2b-256 b00f9c581713dd8c2cb71c81a10f42647e881c2a77feb345c66547e9448e81b6

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6cac570e6942c964eb491f760d92c9556beaa54a7b4d6d5c662b998bba2e88d0
MD5 e4e3988b9d410bcd407d764c3e3276f6
BLAKE2b-256 e0ad732b466df855f95a82bb722481d82494cb8f75ba9b854abea693371dbd19

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4eb5b2840b334ee2259143bfa0451bb67045904bf9b6311fba33f2911777b6e9
MD5 b8bf30429903d7a782aff2aa4b05bda4
BLAKE2b-256 6caaf1f3277e789372e7db7e530a8313372ec38d146cd6ec07057090fb31aa2a

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 684cc40cb8153901fb41cd565145c651063881a5971c8f40ae40ec89dee41396
MD5 61024a5eef69cc443b786072bcc18245
BLAKE2b-256 0761ff5ee1ec4aeec86c45c20c5e659ca1926b6a3f64647b6204be750ed36865

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: ldpc-2.1.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for ldpc-2.1.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 c843a0f99bc6539bb3148237ab52785b227e464afb4ed282bddae14f79cb1077
MD5 0a44cba519456f423cf484565ea82ade
BLAKE2b-256 c5f4184738d78aa86f68b7a7785fd4f1a7fc3894e3bbb378766f78f84977a5af

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0aa8ff16c964b2a34bafd500a393d3be76b014485eb0bd53e0e432a8e297ffe6
MD5 c07391f7033042dd15dd3cc991bbf1f0
BLAKE2b-256 47a7fe6eab6a97a7c0019038891a92f4e3a09b6d9cf9cf6c06a5667069018ce4

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0cfa5e5bfcd91d8a44e322a9fcf6656edadbfac91367e6208753d08d23dc8adc
MD5 fa141c40df7d2d4e20203ea4127d2c2a
BLAKE2b-256 1f9b46f42be79dbd7c0857ec2c1f5cbcee9314f5833cbd180c663913ab7c74f8

See more details on using hashes here.

File details

Details for the file ldpc-2.1.2-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for ldpc-2.1.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 189187edeb1fed90cf77690c9ce1f74ba55bd3789d41c1a2c1f2daa18f0d6b8e
MD5 f6fb9fadbe7d18afbab2a46f0c699976
BLAKE2b-256 d21d902bea0da9546ca7811f8f043c1b0737bc06135830feb25d685de12fc392

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page