IT++ Logo
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
itpp::LDPC_Parity Class Reference

LDPC parity check matrix generic class. More...

#include <itpp/comm/ldpc.h>

Inheritance diagram for itpp::LDPC_Parity:
itpp::BLDPC_Parity itpp::LDPC_Parity_Unstructured itpp::LDPC_Parity_Irregular itpp::LDPC_Parity_Regular

Public Member Functions

 LDPC_Parity ()
 Default constructor.
 
 LDPC_Parity (int ncheck, int nvar)
 Constructor that gives an empty matrix of size ncheck x nvar.
 
 LDPC_Parity (const std::string &filename, const std::string &format)
 Load an LDPC parity check matrix from a file.
 
 LDPC_Parity (const GF2mat_sparse_alist &alist)
 Constructor, from a GF2mat_sparse_alist object.
 
virtual ~LDPC_Parity ()
 Virtual destructor.
 
void initialize (int ncheck, int nvar)
 Initialize an empty matrix of size ncheck x nvar.
 
GF2mat_sparse get_H (bool transpose=false) const
 Get the parity check matrix, optionally its transposed form.
 
Sparse_Vec< binget_col (int c) const
 Get a specific column from the matrix.
 
Sparse_Vec< binget_row (int r) const
 Get a specific row from the matrix.
 
int get_nvar () const
 Get the number of variable nodes (number of columns)
 
int get_ncheck () const
 Get the number of check nodes (number of rows)
 
void set (int i, int j, bin value)
 Set element (i,j) of the parity check matrix to value.
 
bin get (int i, int j) const
 Get element (i,j) of the parity check matrix.
 
bin operator() (int i, int j) const
 Get element (i,j) of the parity check matrix.
 
virtual void display_stats () const
 Display some information about the matrix.
 
double get_rate () const
 Get the code rate.
 
void import_alist (const GF2mat_sparse_alist &H_alist)
 Import matrix from GF2mat_sparse_alist format.
 
GF2mat_sparse_alist export_alist () const
 Export matrix to GF2mat_sparse_alist format.
 
void load_alist (const std::string &alist_file)
 Load matrix from alist_file text file in alist format.
 
void save_alist (const std::string &alist_file) const
 Save matrix to alist_file text file in alist format.
 

Protected Member Functions

int check_for_cycles (int L) const
 Check for cycles of length L.
 
int check_connectivity (int from_m, int from_n, int to_m, int to_n, int g, int L) const
 Check for connectivity between nodes.
 

Protected Attributes

bool init_flag
 Flag that indicates proper initialization.
 
GF2mat_sparse H
 The parity check matrix.
 
GF2mat_sparse Ht
 The transposed parity check matrix.
 
int nvar
 Number of variable nodes.
 
int ncheck
 Number of check nodes.
 
ivec sumX1
 Actual number of ones in each column.
 
ivec sumX2
 Actual number of ones in each row.
 

Static Protected Attributes

static const int Nmax = 200
 Maximum node degree class can handle.
 

Friends

class LDPC_Code
 

Detailed Description

LDPC parity check matrix generic class.

This class provides a basic set of functions needed to represent a parity check matrix, which defines an LDPC code. This class is used as base class for a set of specific LDPC parity check matrix classes, e.g. regular or irregular LDPC codes.

This class stores a parity check matrix as a sparse matrix. The transpose of the matrix is also stored to enable efficient access to its rows.

All parity check matrices can be loaded from (saved to) a file by converting them from (to) a portable GF2mat_sparse_alist format.

However, typically one will want to create a LDPC_Code from the parity check matrix (and optionally a generator) and save the codec binary data instead.

Please refer to the tutorial Generation of LDPC codes for some examples of code generation.

Author
Erik G. Larsson, Mattias Andersson and Adam Piatyszek

Definition at line 71 of file ldpc.h.

Constructor & Destructor Documentation

itpp::LDPC_Parity::LDPC_Parity ( const std::string &  filename,
const std::string &  format 
)

Load an LDPC parity check matrix from a file.

Parameters
filenamefile name
formatfile format
Note
Currently, only "alist" format is supported (see GF2mat_sparse_alist for its definition).
See Also
load_alist() and save_alist()

Definition at line 55 of file ldpc.cpp.

References it_error, and load_alist().

Member Function Documentation

int itpp::LDPC_Parity::check_for_cycles ( int  L) const
protected

Check for cycles of length L.

This function implements a recursive routine to find loops. The function is mainly a tool for testing and debugging more sophisticated functions for graph manipulation.

Parameters
Llength of cycles to look for
Returns
The function returns the number of cycles found of length L or shorter. Cycles may be counted multiple times.
Note
This function can be very slow for large matrices. It is mainly intended as a debugging aid.

Definition at line 249 of file ldpc.cpp.

References check_connectivity(), get_col(), itpp::Sparse_Vec< T >::get_nz_indices(), init_flag, it_assert, itpp::length(), and nvar.

int itpp::LDPC_Parity::check_connectivity ( int  from_m,
int  from_n,
int  to_m,
int  to_n,
int  g,
int  L 
) const
protected

Check for connectivity between nodes.

This function examines whether the point (to_m, to_n) in the matrix can be reached from the point (from_m, from_n) using at most L steps. A recursive search is used.

The function can be used to search for cycles in the matrix. To search for a cycle of length L, set from_m=to_m and from_n=to_n, and godir=0.

Parameters
from_mstarting coordinate, row number
to_mgoal coordinate, row number
from_nstarting coordinate, column number
to_ngoal coordinate, row number
gdirection: 1=start going vertically, 2=start going horizontally
Lnumber of permitted steps
Returns
  • -1 or -3 : destination unreachable
  • -2 : meaningless search (started in a "0" point),
  • -4 : meaningless search
  • >=0 : destination reached with certain number of steps left
Note
This function can be very slow depending on the nature of the matrix.

Note that smaller cycles may appear as longer cycles when using this method. More specifically, suppose the method is run with a given L and there are cycles in the neighborhood of (from_m,from_n) of length L-2 or less, but which do not contain (from_m,from_n). These shorter cycles may then also be reported as a cycle of length L. For example, if one of the immediate neighbors of (from_m,from_n) is part of a cycle of length 4 this method will report that (from_m,from_n) is part of a cycle of length 6, if run with L=6. However, if it is known that there are no cycles of length L-2 or smaller, and check_connectivity(from_m,from_n,from_m,from_n,0,L) returns a non-negative value, then one will know with certainty that the point (from_m,from_n) is part of a cycle of length L. (This behavior is inherent to the simple recursive search used.)

Definition at line 192 of file ldpc.cpp.

References get_col(), itpp::Sparse_Vec< T >::get_nz_indices(), get_row(), init_flag, it_assert, and itpp::length().

Referenced by check_for_cycles(), and itpp::LDPC_Parity_Unstructured::generate_random_H().


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

Generated on Sat Jul 6 2013 10:54:32 for IT++ by Doxygen 1.8.2