Software for Low Density Parity Check Codes

This collection of programs and modules, written in C, is intended to support research and education concerning Low Density Parity Check (LDPC) codes. (Note, however, that the copyright notice no longer restricts use to these purposes). These error-correcting codes were invented by Robert Gallager in the early 1960's, and re-invented and shown to have very good performance by David MacKay and myself in the mid-1990's. The decoding algorithm for LDPC codes is related to that used for Turbo codes, and to probabilistic inference methods used in other fields. Variations on LDPC and Turbo codes are currently the best practical codes known, in terms of their ability to transmit data at rates approaching channel capacity with very low error probability.

This is a fork of the original library by Radford Neal with the following major updates:

  1. Miscellaneous channel - the original repository provided a few channels for decoding, such as binary symmetric channel (BSC) and the additive white Gaussian noise (AWGN) channel. However in many applications other channels are required. In general, the LDPC decoding requires the channel only to compute the log-likelihood ratio (LLR). Thus, we introduce a misc channel where the input to the LDPC decoder are the LLRs. For any given channel, the LLRs can be computed from the received message and then the decoding can be run with the misc channel. More details are provided here and here. This channel was utilized in for applying LDPC codes for DNA storage, and was also used to enable puncturing in an extension of this library to handle protograph LDPC codes (
  2. Extracting positions of message bits in codeword - The original library provides an extract functionality to obtain the message bits from the codeword. We provide an additional method extract_systematic to extract the positions of these bits in the codeword. This can be useful for certain applications where we need to know where where the message bits reside within the codeword. The documentation is available here.

The source code for this software is hosted at Github.

Also see which extends this library to construct protograph LDPC codes which can provide both near-optimal asymptotic performance and excellent finite-block performance.

The past versions of the software are available here, from Radford Neal's web page. You can find the website for the original repository at

Index to Documentation

Download and installation instructions
How to get and compile the programs and modules.
Software and program usage documentation
General documentation on the methods implemented, and details of program usage.
Examples of program usage
Examples using simple Hamming codes, and using more interesting LDPC codes.
How to modify the programs
Notes on how to add new channel types, new decoding methods, etc.
Module documentation
Modules used by the programs for modulo-2 matrix operations and random number generation.
Classic and more recent papers on LDPC codes and related topics.

Copyright and Lack of Warranty

Except as otherwise specified, all of this software and documentation is copyright © 1995-2012 by Radford M. Neal.

Permission is granted for anyone to copy, use, modify, and distribute these programs and accompanying documents for any purpose, provided this copyright notice is retained and prominently displayed, and note is made of any changes made to these programs. These programs and documents are distributed without any warranty, express or implied. As the programs were written for research purposes only, they have not been tested to the degree that would be advisable in any important application. All use of these programs is entirely at the user's own risk.

Some routines in the module rand.c are taken from the GNU C Library, and are copyrighted as described there and in the file LGPL.