IT++ Logo

itpp::LDPC_Code Class Reference
[Forward Error Correcting Codes]

#include <itpp/comm/ldpc.h>

Inheritance diagram for itpp::LDPC_Code:

itpp::Channel_Code

List of all members.


Detailed Description

Low-density parity check (LDPC) codec.

This class provides the functionality for encoding and decoding of LDPC codes defined via LDPC_Parity and LDPC_Generator classes.

LDPC codecs are constructed from parity check and generator matrices. Since the procedure of constructing the codec can be time-consuming (for example, due to optimization of the parity matrix and computation of the generator matrix), codecs can be saved to a file for later use. This class provides functionality and a special file format (the file format is designed to optimize the operation of the decoder) to do this. Some examples of load and save operations follow:

Saving a codec without generator matrix:

    // assume the parity matrix is already defined and stored in H
    LDPC_Code C(&H);
    C.save_code("filename.it");

Saving a codec with generator matrix (for the example of systematic generator):

    // assume the parity matrix is already defined and stored in H
    LDPC_Generator_Systematic G(&H); // create generator
    LDPC_Code C(&H, &G);
    C.save_code("filename.it");

Loading a codec without a generator:

    LDPC_Code("filename.it");

Loading a codec with a generator (systematic in this example):

    LDPC_Generator_Systematic G; // the generator object must be created first
    LDPC_Code("filename.it", &G);

Note:
Please refer to the tutorials Generation of LDPC codes and Simulation of LDPC codes the AWGN channel for extensive examples of how to use LDPC codes.
Author:
Erik G. Larsson and Adam Piatyszek

Definition at line 717 of file ldpc.h.


Public Member Functions

 LDPC_Code ()
 Default constructor.
 LDPC_Code (const LDPC_Parity *const H, LDPC_Generator *const G=0)
 Constructor, from a parity check matrix and optionally a generator.
 LDPC_Code (const std::string &filename, LDPC_Generator *const G=0)
 Constructor, from a saved file.
virtual ~LDPC_Code ()
 Destructor.
void set_code (const LDPC_Parity *const H, LDPC_Generator *const G=0)
 Set the codec, from a parity check matrix and optionally a generator.
void load_code (const std::string &filename, LDPC_Generator *const G=0)
 Set the codec, by reading from a saved file.
void save_code (const std::string &filename) const
 Save the codec to a file.
void set_decoding_method (const std::string &method)
 Set the decoding method.
void set_exit_conditions (int max_iters, bool syndr_check_each_iter=true, bool syndr_check_at_start=false)
 Set the decoding loop exit conditions.
void set_llrcalc (const LLR_calc_unit &llrcalc)
 Set LLR calculation unit.
virtual void encode (const bvec &input, bvec &output)
 Encode codeword.
virtual bvec encode (const bvec &input)
 Encode codeword.
virtual void decode (const bvec &coded_bits, bvec &decoded_bits)
 Inherited from the base class - not implemented here.
virtual bvec decode (const bvec &coded_bits)
 Inherited from the base class - not implemented here.
virtual void decode (const vec &llr_in, bvec &syst_bits)
 This function outputs systematic bits of the decoded codeword.
virtual bvec decode (const vec &llr_in)
 This function outputs systematic bits of the decoded codeword.
void decode_soft_out (const vec &llr_in, vec &llr_out)
 This function is a wrapper for bp_decode().
vec decode_soft_out (const vec &llr_in)
 This function is a wrapper for bp_decode().
int bp_decode (const QLLRvec &LLRin, QLLRvec &LLRout)
 Belief propagation decoding.
bool syndrome_check (const QLLRvec &LLR) const
 Syndrome check, on QLLR vector.
bool syndrome_check (const bvec &b) const
 Syndrome check, on bit vector.
double get_rate () const
 Get the coderate.
int get_nvar () const
 Get the number of variable nodes.
int get_ncheck () const
 Get the number of check nodes.
std::string get_decoding_method () const
 Return the decoding method.
int get_nrof_iterations () const
 Get the maximum number of iterations of the decoder.
LLR_calc_unit get_llrcalc () const
 Get LLR calculation unit used in decoder.

Protected Member Functions

void decoder_parameterization (const LDPC_Parity *const H)
 Function to compute decoder parameterization.
void integrity_check ()
 Function to check the integrity of the parity check matrix and generator.
void setup_decoder ()
 Initialize decoder.

Protected Attributes

bool H_defined
 true if parity check matrix is defined
bool G_defined
 true if generator is defined
int nvar
 Number of variable nodes.
int ncheck
 Number of check nodes.
LDPC_GeneratorG
 Generator object pointer.
std::string dec_method
 Decoding method.
int max_iters
 Maximum number of iterations.
bool psc
 check syndrom after each iteration
bool pisc
 check syndrom before first iteration
LLR_calc_unit llrcalc
 LLR calculation unit.

Friends

std::ostream & operator<< (std::ostream &os, const LDPC_Code &C)
 Print some properties of the codec in plain text.

Constructor & Destructor Documentation

itpp::LDPC_Code::LDPC_Code ( const LDPC_Parity *const   H,
LDPC_Generator *const   G = 0 
)

Constructor, from a parity check matrix and optionally a generator.

This constructor simply calls set_code().

Definition at line 1205 of file ldpc.cpp.

References set_code().

itpp::LDPC_Code::LDPC_Code ( const std::string &  filename,
LDPC_Generator *const   G = 0 
)

Constructor, from a saved file.

This constructor simply calls load_code().

Definition at line 1213 of file ldpc.cpp.

References load_code().


Member Function Documentation

void itpp::LDPC_Code::set_code ( const LDPC_Parity *const   H,
LDPC_Generator *const   G = 0 
)

Set the codec, from a parity check matrix and optionally a generator.

Parameters:
H The parity check matrix
G A pointer to the optional generator object

Definition at line 1222 of file ldpc.cpp.

References decoder_parameterization(), G, G_defined, integrity_check(), and setup_decoder().

Referenced by LDPC_Code().

void itpp::LDPC_Code::load_code ( const std::string &  filename,
LDPC_Generator *const   G = 0 
)

Set the codec, by reading from a saved file.

The file format is defined in the source code. LDPC codecs can be saved with the function save_code().

Parameters:
filename Name of the file where the codec is stored
G A pointer to the optional generator object
Note:
If G points at 0 (default), the generator data is not read from the saved file. This means that the encoding can not be performed.

Definition at line 1234 of file ldpc.cpp.

References itpp::it_ifile::close(), G, G_defined, H_defined, it_assert, it_info_debug, itpp::LDPC_Generator::load(), ncheck, nvar, and setup_decoder().

Referenced by LDPC_Code().

void itpp::LDPC_Code::save_code ( const std::string &  filename  )  const

Save the codec to a file.

Parameters:
filename Name of the file where to store the codec
Note:
The decoder parameters (max_iters, syndr_check_each_iter, syndr_check_at_start and llrcalc) are not saved to a file.

Definition at line 1276 of file ldpc.cpp.

References itpp::it_file::close(), G, G_defined, H_defined, it_assert, it_info_debug, ncheck, nvar, itpp::it_file::open(), and itpp::LDPC_Generator::save().

void itpp::LDPC_Code::set_decoding_method ( const std::string &  method  ) 

Set the decoding method.

Currently only a belief propagation method ("BP" or "bp") is supported.

Note:
The default method set in the class constructors is "BP".

Definition at line 1310 of file ldpc.cpp.

References dec_method, and it_assert.

void itpp::LDPC_Code::set_exit_conditions ( int  max_iters,
bool  syndr_check_each_iter = true,
bool  syndr_check_at_start = false 
)

Set the decoding loop exit conditions.

Parameters:
max_iters Maximum number of the decoding iterations
syndr_check_each_iter If true, break the decoding loop as soon as valid codeword is found. Recommended value: true.
syndr_check_at_start If true, perform a syndrome check before entering the decoding loop. If LLRin corresponds to a valid codeword, set LLRout = LLRin. Recommended value: false.
Note:
The default values set in the class constructor are: "50", "true" and "false", respectively.

Definition at line 1317 of file ldpc.cpp.

References it_assert, max_iters, pisc, and psc.

void itpp::LDPC_Code::encode ( const bvec &  input,
bvec &  output 
) [virtual]

Encode codeword.

This is a wrapper functions which calls a proper implementation from the LDPC_Generator object.

Parameters:
input Vector of ncheck input bits
output Vector of nvar output bits

Implements itpp::Channel_Code.

Definition at line 1334 of file ldpc.cpp.

References itpp::LDPC_Generator::encode(), G, G_defined, it_assert, it_assert_debug, and syndrome_check().

Referenced by encode().

int itpp::LDPC_Code::bp_decode ( const QLLRvec &  LLRin,
QLLRvec &  LLRout 
)

Belief propagation decoding.

This function implements the sum-product message passing decoder (Pearl's belief propagation) using LLR values as messages. A fast update mechanism is used for nodes with large degrees.

Parameters:
LLRin vector of nvar input LLR values
LLRout vector of nvar output LLR values
If the decoder converged to a valid codeword, the function returns the number of iterations performed. Otherwise the function returns the number of iterations performed but with negative sign.

One can use set_exit_conditions() method to change the number of decoding iterations and related parameters parameters. The decoding function uses LLR_calc_unit to implement table-lookup for the Boxplus operator. By setting the parameters of the LLR_calc_unit provided in set_llrcalc(), one can change the resolution, for example to use a logmax approximation. See the documentation of LLR_calc_unit for details on how to do this.

Definition at line 1380 of file ldpc.cpp.

References itpp::LLR_calc_unit::Boxplus(), H_defined, it_assert, it_error, it_info_debug, it_info_no_endl_debug, llrcalc, max_iters, ncheck, nvar, pisc, psc, and syndrome_check().

Referenced by decode(), and decode_soft_out().

bool itpp::LDPC_Code::syndrome_check ( const QLLRvec &  LLR  )  const

Syndrome check, on QLLR vector.

This function performs a syndrome check on a softbit (LLR vector). The function returns true for a valid codeword, false else.

Parameters:
LLR LLR-vector to check

Definition at line 1842 of file ldpc.cpp.

References ncheck.

Referenced by bp_decode(), encode(), integrity_check(), and syndrome_check().


Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  os,
const LDPC_Code C 
) [friend]

Print some properties of the codec in plain text.

Print some properties of the LDPC codec in plain text.

Definition at line 1974 of file ldpc.cpp.


The documentation for this class was generated from the following files:
SourceForge Logo

Generated on Mon Jan 7 22:29:03 2008 for IT++ by Doxygen 1.5.4