itpp::LDPC_Parity_Unstructured Class Referenceabstract

Pure abstract class for unstructured LDPC matrices. More...

`#include <itpp/comm/ldpc.h>`

Inheritance diagram for itpp::LDPC_Parity_Unstructured:

## Public Member Functions

virtual void | display_stats () const =0
| Display some information about the matrix.
int | cycle_removal_MGW (int L)
| Remove cycles (loops) from unstructured parity check matrix.
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< bin > | get_col (int c) const
| Get a specific column from the matrix.
Sparse_Vec< bin > | get_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.
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

void | generate_random_H (const ivec &C, const ivec &R, const ivec &cycopt)
| Generate a random parity check matrix.
void | compute_CR (const vec &var_deg, const vec &chk_deg, const int Nvar, ivec &C, ivec &R)
| Compute target number of columns (C) and rows (R) with a specific number of ones.
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.

## Detailed Description

Pure abstract class for unstructured LDPC matrices.

This class provides a common set of methods for unstructured LDPC matrices. For unstructured codes the parity checks are distributed at random rather than according to a specific pattern, and the generation of a parity matrix can be viewed as drawing a random sample from an ensemble of graphs (matrices) that are described by a specific degree distribution.

This class is used as base for the `LDPC_Parity_Irregular` and `LDPC_Parity_Regular` generator classes.

Author
  Erik G. Larsson, Mattias Andersson and Adam Piatyszek

Definition at line 275 of file ldpc.h.

## Member Function Documentation

## display_stats()

virtual void itpp::LDPC_Parity_Unstructured::display_stats | ( |  | ) | const

pure virtual

Display some information about the matrix.

Reimplemented from itpp::LDPC_Parity.

Implemented in itpp::LDPC_Parity_Irregular, and itpp::LDPC_Parity_Regular.

References compute_CR(), cycle_removal_MGW(), and generate_random_H().

## cycle_removal_MGW()

int itpp::LDPC_Parity_Unstructured::cycle_removal_MGW | ( | int | L | ) |

Remove cycles (loops) from unstructured parity check matrix.

This function implements the cycle removal algorithm presented by McGowan and Williamson at the IT workshop 2003. The maximum girth of the graph that will be attempted is L. The algorithm is bound to remove all loops of length L, insofar this is possible. I.e., it does not terminate until it is impossible to remove more cycles by swapping two edges.

Parameters

  L | Target girth. For example, L=6 attempts to removes all 4-cycles.

Returns
  The girth of the graph, i.e. the length of the shortest cycle. For example, a return value of 6 means that there are no 4-cycles.

Note
  This algorithm can take a long time to run for large L or large graphs.

Definition at line 292 of file ldpc.cpp.

References itpp::elem_mult(), itpp::floor_i(), itpp::LDPC_Parity::get(), itpp::LDPC_Parity::get_col(), itpp::Sparse_Vec< T >::get_nz_index(), itpp::LDPC_Parity::init_flag, it_assert, it_assert_debug, it_info_debug, itpp::length(), itpp::LDPC_Parity::ncheck, itpp::Sparse_Vec< T >::nnz(), itpp::LDPC_Parity::nvar, itpp::randi(), itpp::randu(), itpp::LDPC_Parity::set(), and itpp::Array< T >::set_size().

Referenced by display_stats().

## generate_random_H()

void itpp::LDPC_Parity_Unstructured::generate_random_H | ( | const ivec & | C,
|  | const ivec & | R,
|  | const ivec & | cycopt )

protected

Generate a random parity check matrix.

Definition at line 462 of file ldpc.cpp.

References itpp::LDPC_Parity::check_connectivity(), itpp::LDPC_Parity::get(), itpp::LDPC_Parity::initialize(), it_assert, it_info_debug, itpp::length(), itpp::LDPC_Parity::ncheck, itpp::LDPC_Parity::Nmax, itpp::LDPC_Parity::nvar, itpp::randi(), itpp::randu(), itpp::LDPC_Parity::set(), itpp::sum(), and itpp::zeros_i().

Referenced by display_stats(), itpp::LDPC_Parity_Irregular::generate(), and itpp::LDPC_Parity_Regular::generate().

## compute_CR()

void itpp::LDPC_Parity_Unstructured::compute_CR | ( | const vec & | var_deg,
|  | const vec & | chk_deg,
|  | const int | Nvar,
|  | ivec & | C,
|  | ivec & | R )

protected

Compute target number of columns (C) and rows (R) with a specific number of ones.

Parameters

  var_deg | vector of variable degree distributions, from an edge perspective
  chk_deg | vector of check degree distributions, from an edge perspective
  Nvar | number of variable nodes
  C | number of columns with a specific number of ones
  R | number of rows with a specific number of ones

The result is passed by reference and saved in C and R.

Definition at line 598 of file ldpc.cpp.

References itpp::concat(), itpp::elem_div(), itpp::elem_mult(), itpp::find(), it_info_debug, itpp::length(), itpp::linspace(), itpp::max(), itpp::LDPC_Parity::Nmax, itpp::round(), itpp::sum(), itpp::to_ivec(), itpp::to_vec(), and itpp::zeros_i().

Referenced by display_stats(), itpp::LDPC_Parity_Irregular::generate(), and itpp::LDPC_Parity_Regular::generate().

## initialize()

void itpp::LDPC_Parity::initialize | ( | int | ncheck,
|  | int | nvar )

inherited

Initialize an empty matrix of size ncheck x nvar.

Definition at line 72 of file ldpc.cpp.

References H, Ht, init_flag, ncheck, nvar, sumX1, sumX2, and itpp::zeros_i().

Referenced by itpp::BLDPC_Parity::expand_base(), itpp::LDPC_Parity_Unstructured::generate_random_H(), import_alist(), and LDPC_Parity().

## get_H()

GF2mat_sparse itpp::LDPC_Parity::get_H | ( | bool | transpose = false | ) | const

inline inherited

Get the parity check matrix, optionally its transposed form.

Definition at line 104 of file ldpc.h.

References H, Ht, and itpp::transpose().

Referenced by itpp::BLDPC_Generator::construct(), and itpp::LDPC_Generator_Systematic::construct().

## get_col()

Sparse_Vec< bin > itpp::LDPC_Parity::get_col | ( | int | c | ) | const

inline inherited

Get a specific column from the matrix.

Definition at line 109 of file ldpc.h.

References H.

Referenced by check_connectivity(), check_for_cycles(), itpp::LDPC_Parity_Unstructured::cycle_removal_MGW(), itpp::LDPC_Code::decoder_parameterization(), and display_stats().

## get_row()

Sparse_Vec< bin > itpp::LDPC_Parity::get_row | ( | int | r | ) | const

inline inherited

Get a specific row from the matrix.

Definition at line 112 of file ldpc.h.

References Ht.

Referenced by check_connectivity(), itpp::LDPC_Code::decoder_parameterization(), and display_stats().

## get_nvar()

int itpp::LDPC_Parity::get_nvar | ( |  | ) | const

inline inherited

Get the number of variable nodes (number of columns).

Definition at line 115 of file ldpc.h.

References H, Ht, it_assert_debug, and nvar.

Referenced by itpp::LDPC_Generator_Systematic::construct().

## get_ncheck()

int itpp::LDPC_Parity::get_ncheck | ( |  | ) | const

inline inherited

Get the number of check nodes (number of rows).

Definition at line 124 of file ldpc.h.

References H, Ht, it_assert_debug, and ncheck.

Referenced by itpp::LDPC_Generator_Systematic::construct().

## set()

void itpp::LDPC_Parity::set | ( | int | i,
|  | int | j,
|  | bin | value )

inherited

Set element (i,j) of the parity check matrix to value.

Definition at line 83 of file ldpc.cpp.

References H, Ht, init_flag, it_assert, it_assert_debug, ncheck, nvar, sumX1, and sumX2.

Referenced by itpp::LDPC_Generator_Systematic::construct(), itpp::LDPC_Parity_Unstructured::cycle_removal_MGW(), itpp::BLDPC_Parity::expand_base(), itpp::LDPC_Parity_Unstructured::generate_random_H(), and import_alist().

## get()

bin itpp::LDPC_Parity::get | ( | int | i,
|  | int | j ) const

inline inherited

Get element (i,j) of the parity check matrix.

Definition at line 136 of file ldpc.h.

References H, Ht, and it_assert_debug.

Referenced by check_connectivity(), itpp::LDPC_Parity_Unstructured::cycle_removal_MGW(), and itpp::LDPC_Parity_Unstructured::generate_random_H().

## operator()()

bin itpp::LDPC_Parity::operator() | ( | int | i,
|  | int | j ) const

inline inherited

Get element (i,j) of the parity check matrix.

Definition at line 142 of file ldpc.h.

References H, Ht, and it_assert_debug.

## get_rate()

double itpp::LDPC_Parity::get_rate | ( |  | ) | const

inline inherited

Get the code rate.

Definition at line 152 of file ldpc.h.

References ncheck, and nvar.

Referenced by display_stats().

## import_alist()

void itpp::LDPC_Parity::import_alist | ( | const GF2mat_sparse_alist & | H_alist | ) |

inherited

Import matrix from `GF2mat_sparse_alist` format.

Definition at line 167 of file ldpc.cpp.

References itpp::Sparse_Mat< T >::cols(), initialize(), ncheck, nvar, itpp::Sparse_Mat< T >::rows(), set(), and itpp::GF2mat_sparse_alist::to_sparse().

Referenced by LDPC_Parity(), and load_alist().

## export_alist()

GF2mat_sparse_alist itpp::LDPC_Parity::export_alist | ( |  | ) | const

inherited

Export matrix to `GF2mat_sparse_alist` format.

Definition at line 182 of file ldpc.cpp.

References itpp::GF2mat_sparse_alist::from_sparse(), H, init_flag, and it_assert.

Referenced by save_alist().

## load_alist()

void itpp::LDPC_Parity::load_alist | ( | const std::string & | alist_file | ) |

inherited

Load matrix from `alist_file` text file in alist format.

Definition at line 155 of file ldpc.cpp.

References import_alist().

Referenced by LDPC_Parity().

## save_alist()

void itpp::LDPC_Parity::save_alist | ( | const std::string & | alist_file | ) | const

inherited

Save matrix to `alist_file` text file in alist format.

Definition at line 160 of file ldpc.cpp.

References export_alist(), and itpp::GF2mat_sparse_alist::write().

## check_for_cycles()

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

protected inherited

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

  L | length 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.

## check_connectivity()

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

protected inherited

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_m | starting coordinate, row number
  to_m | goal coordinate, row number
  from_n | starting coordinate, column number
  to_n | goal coordinate, row number
  g | direction: 1=start going vertically, 2=start going horizontally
  L | number 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 check_connectivity(), get(), get_col(), itpp::Sparse_Vec< T >::get_nz_indices(), get_row(), init_flag, it_assert, and itpp::length().

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

## Member Data Documentation

## init_flag

bool itpp::LDPC_Parity::init_flag

protected inherited

Flag that indicates proper initialization.

Definition at line 170 of file ldpc.h.

Referenced by check_connectivity(), check_for_cycles(), itpp::LDPC_Parity_Unstructured::cycle_removal_MGW(), display_stats(), export_alist(), initialize(), itpp::BLDPC_Parity::is_valid(), LDPC_Parity(), LDPC_Parity(), LDPC_Parity(), LDPC_Parity(), itpp::BLDPC_Parity::load_base_matrix(), and set().

## Nmax

const int itpp::LDPC_Parity::Nmax = 200

static protected inherited

Maximum node degree class can handle.

Definition at line 172 of file ldpc.h.

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

## H

GF2mat_sparse itpp::LDPC_Parity::H

protected inherited

The parity check matrix.

Definition at line 174 of file ldpc.h.

Referenced by export_alist(), get(), get_col(), get_H(), get_ncheck(), get_nvar(), initialize(), operator()(), and set().

## Ht

GF2mat_sparse itpp::LDPC_Parity::Ht

protected inherited

The transposed parity check matrix.

Definition at line 176 of file ldpc.h.

Referenced by get(), get_H(), get_ncheck(), get_nvar(), get_row(), initialize(), operator()(), and set().

## nvar

int itpp::LDPC_Parity::nvar

protected inherited

Number of variable nodes.

Definition at line 178 of file ldpc.h.

Referenced by check_for_cycles(), itpp::LDPC_Parity_Unstructured::cycle_removal_MGW(), itpp::LDPC_Code::decoder_parameterization(), display_stats(), itpp::LDPC_Parity_Unstructured::generate_random_H(), get_nvar(), get_rate(), import_alist(), initialize(), and set().

## ncheck

int itpp::LDPC_Parity::ncheck

protected inherited

Number of check nodes.

Definition at line 180 of file ldpc.h.

Referenced by itpp::LDPC_Parity_Unstructured::cycle_removal_MGW(), itpp::LDPC_Code::decoder_parameterization(), display_stats(), itpp::LDPC_Parity_Unstructured::generate_random_H(), get_ncheck(), get_rate(), import_alist(), initialize(), and set().

## sumX1

ivec itpp::LDPC_Parity::sumX1

protected inherited

Actual number of ones in each column.

Definition at line 182 of file ldpc.h.

Referenced by itpp::LDPC_Code::decoder_parameterization(), display_stats(), initialize(), and set().

## sumX2

ivec itpp::LDPC_Parity::sumX2

protected inherited

Actual number of ones in each row.

Definition at line 184 of file ldpc.h.

Referenced by itpp::LDPC_Code::decoder_parameterization(), display_stats(), initialize(), and set().

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

- itpp/comm/ldpc.h
- itpp/comm/ldpc.cpp

Generated on for IT++ by Doxygen 1.15.0