Go to the documentation of this file.
38 #include <itpp/itexports.h>
92 LDPC_Parity(
const std::string& filename,
const std::string& format);
101 void initialize(
int ncheck,
int nvar);
117 "LDPC_Parity::get_nvar(): Internal error");
119 "LDPC_Parity::get_nvar(): Internal error");
126 "LDPC_Parity::get_ncheck(): Internal error");
128 "LDPC_Parity::get_ncheck(): Internal error");
133 void set(
int i,
int j,
bin value);
137 it_assert_debug(H(i, j) == Ht(j, i),
"LDPC_Parity::get(): Internal error");
144 "LDPC_Parity::operator(): Internal error");
149 virtual void display_stats()
const;
153 return (1.0 -
static_cast<double>(ncheck) / nvar);
163 void load_alist(
const std::string& alist_file);
166 void save_alist(
const std::string& alist_file)
const;
172 static const int Nmax = 200;
201 int check_for_cycles(
int L)
const;
246 int check_connectivity(
int from_m,
int from_n,
int to_m,
int to_n,
279 virtual void display_stats()
const = 0;
299 int cycle_removal_MGW(
int L);
303 void generate_random_H(
const ivec& C,
const ivec& R,
const ivec& cycopt);
318 void compute_CR(
const vec& var_deg,
const vec& chk_deg,
const int Nvar,
339 const std::string& method =
"rand",
340 const ivec& options =
"200 6");
380 void generate(
int Nvar,
const vec& var_deg,
const vec& chk_deg,
381 const std::string& method =
"rand",
382 const ivec& options =
"200 6");
404 const std::string& method =
"rand",
405 const ivec& options =
"200 6");
425 void generate(
int Nvar,
int k,
int l,
426 const std::string& method =
"rand",
427 const ivec& options =
"200 6");
471 BLDPC_Parity(
const std::string &filename,
int exp_factor);
474 void expand_base(
const imat &base_matrix,
int exp_factor);
477 int get_exp_factor()
const;
480 imat get_base_matrix()
const;
483 bool is_valid()
const {
return H_b_valid && init_flag; }
486 void set_exp_factor(
int exp_factor);
489 void load_base_matrix(
const std::string &filename);
492 void save_base_matrix(
const std::string &filename)
const;
500 void calculate_base_matrix();
529 type(new std::string(type_in)) {}
534 virtual void encode(
const bvec &input, bvec &output) = 0;
549 virtual void save(
const std::string& filename)
const = 0;
551 virtual void load(
const std::string& filename) = 0;
577 bool natural_ordering =
false,
578 const ivec& ind =
"");
584 virtual void encode(
const bvec &input, bvec &output);
619 ivec construct(
LDPC_Parity*
const H,
bool natural_ordering =
false,
620 const ivec& ind =
"");
624 virtual void save(
const std::string& filename)
const;
626 virtual void load(
const std::string& filename);
652 const std::string type =
"BLDPC");
658 void encode(
const bvec &input, bvec &output);
665 void save(
const std::string &filename)
const;
667 void load(
const std::string &filename);
748 bool perform_integrity_check =
true);
770 bool perform_integrity_check =
true);
785 void load_code(
const std::string& filename,
LDPC_Generator*
const G = 0);
795 void save_code(
const std::string& filename)
const;
806 void set_decoding_method(
const std::string& method);
821 void set_exit_conditions(
int max_iters,
822 bool syndr_check_each_iter =
true,
823 bool syndr_check_at_start =
false);
840 virtual void encode(
const bvec &input, bvec &output);
842 virtual bvec encode(
const bvec &input);
848 virtual void decode(
const bvec &, bvec &) {
849 it_error(
"LDPC_Code::decode(): Hard input decoding not implemented");
853 it_error(
"LDPC_Code::decode(): Hard input decoding not implemented");
858 virtual void decode(
const vec &llr_in, bvec &syst_bits);
860 virtual bvec decode(
const vec &llr_in);
863 void decode_soft_out(
const vec &llr_in, vec &llr_out);
865 vec decode_soft_out(
const vec &llr_in);
889 int bp_decode(
const QLLRvec &LLRin, QLLRvec &LLRout);
899 bool syndrome_check(
const QLLRvec &LLR)
const;
902 bool syndrome_check(
const bvec &b)
const;
912 QLLRvec soft_syndrome_check(
const QLLRvec &LLR)
const;
918 return (1.0 -
static_cast<double>(ncheck) / nvar);
944 void decoder_parameterization(
const LDPC_Parity*
const H);
947 void integrity_check();
950 void setup_decoder();
960 std::string* dec_method;
966 ivec C, V, sumX1, sumX2, iind, jind;
972 static const int max_cnd = 200;
980 ITPP_EXPORT std::ostream &
operator<<(std::ostream &os,
const LDPC_Code &C);
virtual bvec decode(const bvec &)
Inherited from the base class - not implemented here.
Pure abstract class for unstructured LDPC matrices.
int N
Codeword length = H_enc.cols()
int M
Number of parity check bits = H_enc.rows()
bool is_valid() const
Verify initialisation.
Regular LDPC code generator class.
int get_ncheck() const
Get the number of check nodes (number of rows)
BLDPC_Generator(const std::string type="BLDPC")
Default constructor.
LDPC Generator pure virtual base class.
LDPC parity check matrix generic class.
bin get(int i, int j) const
Get element (i,j) of the parity check matrix.
ivec sumX1
Actual number of ones in each column.
GF2mat_sparse Ht
The transposed parity check matrix.
void display_stats() const
Display some information about the matrix.
Channel Code class virtual interface.
Systematic LDPC Generator class.
std::ostream & operator<<(std::ostream &output, const bin &inbin)
Output stream of bin.
double get_rate() const
Get the code rate.
Binary arithmetic (boolean) class.
virtual void decode(const bvec &, bvec &)
Inherited from the base class - not implemented here.
Sparse_Vec< bin > get_row(int r) const
Get a specific row from the matrix.
bin operator()(int i, int j) const
Get element (i,j) of the parity check matrix.
virtual ~LDPC_Code()
Destructor.
Class for numerically efficient log-likelihood algebra.
#define it_assert_debug(t, s)
Abort if t is not true and NDEBUG is not defined.
Definition of classes for random number generators.
int get_nvar() const
Get the number of variable nodes.
void display_stats() const
Display some information about the matrix.
virtual ~LDPC_Parity()
Virtual destructor.
GF2mat H_enc
Preprocessed parity check matrix.
int nvar
Number of variable nodes.
void mark_initialized()
Mark generator as initialized.
ivec sumX2
Actual number of ones in each row.
virtual ~LDPC_Generator_Systematic()
Virtual destructor.
Block LDPC code parity-check matrix.
std::string get_decoding_method() const
Return the decoding method.
std::string get_type() const
Return generator type.
int get_nrof_iterations() const
Get the maximum number of iterations of the decoder.
int get_exp_factor() const
Get expansion factor.
Low-density parity check (LDPC) codec.
Parameterized "alist" representation of sparse GF(2) matrix.
#define it_error(s)
Abort unconditionally.
void transpose(const Mat< T > &m, Mat< T > &out)
Transposition of the matrix m returning the transposed matrix in out.
int get_ninfo() const
Get the number of information bits per codeword.
Definition of a class for algebra on GF(2) (binary) matrices.
Log-likelihood algebra calculation unit.
Class for dense GF(2) matrices.
BLDPC_Parity()
Default constructor.
bool is_initialized() const
Check if generator is initialized.
virtual ~LDPC_Generator()
Virtual destructor.
Block LDPC Generator class.
LLR_calc_unit get_llrcalc() const
Get LLR calculation unit used in decoder.
int get_ncheck() const
Get the number of check nodes.
int get_nvar() const
Get the number of variable nodes (number of columns)
Generic Channel Code class.
LDPC_Parity_Irregular()
Default constructor.
int K
Number of information bits = N-M.
LDPC_Parity()
Default constructor.
Sparse_Vec< bin > get_col(int c) const
Get a specific column from the matrix.
GF2mat_sparse get_H(bool transpose=false) const
Get the parity check matrix, optionally its transposed form.
bool init_flag
Flag that indicates proper initialization.
int ncheck
Number of check nodes.
double get_rate() const
Get the coderate.
LDPC_Generator_Systematic()
Default constructor.
LDPC_Parity_Regular()
Default constructor.
GF2mat_sparse H
The parity check matrix.
virtual void display_stats() const
Display some information about the matrix.
LDPC_Generator(const std::string &type_in="")
Default constructor.
Irregular LDPC code generator class.
Generated on Mon Apr 25 2022 14:03:04 for IT++ by Doxygen 1.8.17