Block LDPC code parity-check matrix. More...
#include <itpp/comm/ldpc.h>
Public Member Functions | |
BLDPC_Parity () | |
Default constructor. | |
BLDPC_Parity (const imat &base_matrix, int exp_factor) | |
Construct BLDPC matrix from base matrix. | |
BLDPC_Parity (const std::string &filename, int exp_factor) | |
Construct BLDPC matrix parsing base matrix from a text file. | |
void | expand_base (const imat &base_matrix, int exp_factor) |
Create BLDPC matrix from base matrix by expansion. | |
int | get_exp_factor () const |
Get expansion factor. | |
imat | get_base_matrix () const |
Get base matrix. | |
bool | is_valid () const |
Verify initialisation. | |
void | set_exp_factor (int exp_factor) |
Set expansion factor. | |
void | load_base_matrix (const std::string &filename) |
Load base matrix from a text file. | |
void | save_base_matrix (const std::string &filename) const |
Save base matrix to a text file. | |
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. | |
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. | |
Block LDPC code parity-check matrix.
Block LDPC Codes (B-LDPC) are a special class of Quasi-Cyclic LDPC Codes (QC-LDPC). Linear encoding properties and memory efficiency are their main advantages.
B-LDPC codes' parity-check matrix is constructed from so-called base matrix by expansion of each single value with a zero matrix or cyclic-shifted identity matrix of size Z x Z, where Z is an expansion factor. Each non negative value of the base matrix represents the cyclic shift value, e.g. 0 means that the identity matrix should not be shifted; 6 means than the identity matrix should be circularly right-shifted by (6 mod Z). Negative values (usually -1) represents zero matrix of size Z x Z.
Please refer to [MYK05] for more details.
References:
[MYK05] S. Myung, K. Yang, J. Kim, "Quasi-Cyclic LDPC Codes for Fast Encoding", IEEE Trans. on Inform. Theory, vol. 51, no. 8, August 2005
|
inline |
Construct BLDPC matrix from base matrix.
Definition at line 723 of file ldpc.cpp.
References expand_base().
Construct BLDPC matrix parsing base matrix from a text file.
Definition at line 728 of file ldpc.cpp.
References expand_base(), and load_base_matrix().
Create BLDPC matrix from base matrix by expansion.
Definition at line 734 of file ldpc.cpp.
References itpp::LDPC_Parity::initialize(), and itpp::LDPC_Parity::set().
Referenced by BLDPC_Parity(), BLDPC_Parity(), and set_exp_factor().
int itpp::BLDPC_Parity::get_exp_factor | ( | ) | const |
Get expansion factor.
Definition at line 762 of file ldpc.cpp.
Referenced by itpp::BLDPC_Generator::construct().
imat itpp::BLDPC_Parity::get_base_matrix | ( | ) | const |
|
inline |
Verify initialisation.
Definition at line 483 of file ldpc.h.
Referenced by itpp::BLDPC_Generator::construct().
Load base matrix from a text file.
Definition at line 784 of file ldpc.cpp.
References itpp::concat(), itpp::LDPC_Parity::init_flag, it_assert, it_warning, and itpp::Array< T >::size().
Referenced by BLDPC_Parity().
Initialize an empty matrix of size ncheck x nvar.
Definition at line 72 of file ldpc.cpp.
References itpp::LDPC_Parity::H, itpp::LDPC_Parity::Ht, itpp::LDPC_Parity::init_flag, itpp::LDPC_Parity::ncheck, itpp::LDPC_Parity::nvar, itpp::LDPC_Parity::sumX1, itpp::LDPC_Parity::sumX2, and itpp::zeros_i().
Referenced by expand_base(), itpp::LDPC_Parity_Unstructured::generate_random_H(), itpp::LDPC_Parity::import_alist(), and itpp::LDPC_Parity::LDPC_Parity().
|
inlineinherited |
Get the parity check matrix, optionally its transposed form.
Definition at line 104 of file ldpc.h.
References itpp::transpose().
Referenced by itpp::BLDPC_Generator::construct(), and itpp::LDPC_Generator_Systematic::construct().
|
inlineinherited |
Get a specific column from the matrix.
Definition at line 109 of file ldpc.h.
Referenced by itpp::LDPC_Parity::check_connectivity(), itpp::LDPC_Parity::check_for_cycles(), itpp::LDPC_Parity_Unstructured::cycle_removal_MGW(), and itpp::LDPC_Parity::display_stats().
|
inlineinherited |
Get a specific row from the matrix.
Definition at line 112 of file ldpc.h.
Referenced by itpp::LDPC_Parity::check_connectivity(), and itpp::LDPC_Parity::display_stats().
|
inlineinherited |
Get the number of variable nodes (number of columns)
Definition at line 115 of file ldpc.h.
References it_assert_debug.
Referenced by itpp::LDPC_Generator_Systematic::construct().
|
inlineinherited |
Get the number of check nodes (number of rows)
Definition at line 124 of file ldpc.h.
References it_assert_debug.
Referenced by itpp::LDPC_Generator_Systematic::construct().
Set element (i,j) of the parity check matrix to value.
Definition at line 83 of file ldpc.cpp.
References itpp::Sparse_Mat< T >::clear_elem(), itpp::LDPC_Parity::H, itpp::LDPC_Parity::Ht, itpp::LDPC_Parity::init_flag, it_assert, it_assert_debug, itpp::LDPC_Parity::ncheck, itpp::LDPC_Parity::nvar, itpp::Sparse_Mat< T >::set(), itpp::LDPC_Parity::sumX1, and itpp::LDPC_Parity::sumX2.
Referenced by itpp::LDPC_Generator_Systematic::construct(), itpp::LDPC_Parity_Unstructured::cycle_removal_MGW(), expand_base(), itpp::LDPC_Parity_Unstructured::generate_random_H(), and itpp::LDPC_Parity::import_alist().
Get element (i,j) of the parity check matrix.
Definition at line 136 of file ldpc.h.
References it_assert_debug.
Referenced by itpp::LDPC_Parity::check_connectivity(), itpp::LDPC_Parity_Unstructured::cycle_removal_MGW(), and itpp::LDPC_Parity_Unstructured::generate_random_H().
Get element (i,j) of the parity check matrix.
Definition at line 142 of file ldpc.h.
References it_assert_debug.
|
virtualinherited |
Display some information about the matrix.
Reimplemented in itpp::LDPC_Parity_Irregular, itpp::LDPC_Parity_Regular, and itpp::LDPC_Parity_Unstructured.
Definition at line 109 of file ldpc.cpp.
References itpp::elem_mult(), itpp::LDPC_Parity::get_col(), itpp::LDPC_Parity::get_rate(), itpp::LDPC_Parity::get_row(), itpp::LDPC_Parity::init_flag, it_assert, it_info, itpp::Array< T >::length(), itpp::length(), itpp::linspace(), itpp::max(), itpp::LDPC_Parity::ncheck, itpp::LDPC_Parity::nvar, itpp::sum(), itpp::LDPC_Parity::sumX1, itpp::LDPC_Parity::sumX2, itpp::to_ivec(), and itpp::zeros().
Referenced by itpp::LDPC_Parity_Irregular::display_stats(), and itpp::LDPC_Parity_Regular::display_stats().
|
inlineinherited |
Get the code rate.
Definition at line 152 of file ldpc.h.
Referenced by itpp::LDPC_Parity::display_stats().
|
inherited |
Import matrix from GF2mat_sparse_alist
format.
Definition at line 167 of file ldpc.cpp.
References itpp::LDPC_Parity::initialize(), itpp::LDPC_Parity::ncheck, itpp::LDPC_Parity::nvar, and itpp::LDPC_Parity::set().
Referenced by itpp::LDPC_Parity::LDPC_Parity(), and itpp::LDPC_Parity::load_alist().
|
inherited |
Export matrix to GF2mat_sparse_alist
format.
Definition at line 182 of file ldpc.cpp.
References itpp::LDPC_Parity::H, itpp::LDPC_Parity::init_flag, and it_assert.
Referenced by itpp::LDPC_Parity::save_alist().
Load matrix from alist_file
text file in alist format.
Definition at line 155 of file ldpc.cpp.
References itpp::LDPC_Parity::import_alist().
Referenced by itpp::LDPC_Parity::LDPC_Parity().
Save matrix to alist_file
text file in alist format.
Definition at line 160 of file ldpc.cpp.
References itpp::LDPC_Parity::export_alist().
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.
L | length of cycles to look for |
Definition at line 249 of file ldpc.cpp.
References itpp::LDPC_Parity::check_connectivity(), itpp::LDPC_Parity::get_col(), itpp::Sparse_Vec< T >::get_nz_indices(), itpp::LDPC_Parity::init_flag, it_assert, itpp::length(), and itpp::LDPC_Parity::nvar.
|
protectedinherited |
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.
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 |
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 itpp::LDPC_Parity::check_connectivity(), itpp::LDPC_Parity::get(), itpp::LDPC_Parity::get_col(), itpp::Sparse_Vec< T >::get_nz_indices(), itpp::LDPC_Parity::get_row(), itpp::LDPC_Parity::init_flag, it_assert, and itpp::length().
Referenced by itpp::LDPC_Parity::check_connectivity(), itpp::LDPC_Parity::check_for_cycles(), and itpp::LDPC_Parity_Unstructured::generate_random_H().
|
protectedinherited |
Flag that indicates proper initialization.
Definition at line 170 of file ldpc.h.
Referenced by itpp::LDPC_Parity::check_connectivity(), itpp::LDPC_Parity::check_for_cycles(), itpp::LDPC_Parity_Unstructured::cycle_removal_MGW(), itpp::LDPC_Parity::display_stats(), itpp::LDPC_Parity::export_alist(), itpp::LDPC_Parity::initialize(), load_base_matrix(), and itpp::LDPC_Parity::set().
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().
|
protectedinherited |
The parity check matrix.
Definition at line 174 of file ldpc.h.
Referenced by itpp::LDPC_Parity::export_alist(), itpp::LDPC_Parity::initialize(), and itpp::LDPC_Parity::set().
|
protectedinherited |
The transposed parity check matrix.
Definition at line 176 of file ldpc.h.
Referenced by itpp::LDPC_Parity::initialize(), and itpp::LDPC_Parity::set().
|
protectedinherited |
Number of variable nodes.
Definition at line 178 of file ldpc.h.
Referenced by itpp::LDPC_Parity::check_for_cycles(), itpp::LDPC_Parity_Unstructured::cycle_removal_MGW(), itpp::LDPC_Parity::display_stats(), itpp::LDPC_Parity_Unstructured::generate_random_H(), itpp::LDPC_Parity::import_alist(), itpp::LDPC_Parity::initialize(), and itpp::LDPC_Parity::set().
|
protectedinherited |
Number of check nodes.
Definition at line 180 of file ldpc.h.
Referenced by itpp::LDPC_Parity_Unstructured::cycle_removal_MGW(), itpp::LDPC_Parity::display_stats(), itpp::LDPC_Parity_Unstructured::generate_random_H(), itpp::LDPC_Parity::import_alist(), itpp::LDPC_Parity::initialize(), and itpp::LDPC_Parity::set().
|
protectedinherited |
Actual number of ones in each column.
Definition at line 182 of file ldpc.h.
Referenced by itpp::LDPC_Parity::display_stats(), itpp::LDPC_Parity::initialize(), and itpp::LDPC_Parity::set().
|
protectedinherited |
Actual number of ones in each row.
Definition at line 184 of file ldpc.h.
Referenced by itpp::LDPC_Parity::display_stats(), itpp::LDPC_Parity::initialize(), and itpp::LDPC_Parity::set().
Generated on Tue Aug 17 2021 10:59:15 for IT++ by Doxygen 1.9.8