GNU Radio C++ API Reference  3.10.12.0
The Free & Open Software Radio Ecosystem
cldpc.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2015 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef LDPC_H
12 #define LDPC_H
13 
14 #include <vector>
15 
16 #include "gnuradio/fec/alist.h"
17 #include "gnuradio/fec/gf2mat.h"
18 #include "gnuradio/fec/gf2vec.h"
19 
20 
21 #include <gnuradio/fec/api.h>
23 {
24 public:
25  //! Default constructor
26  cldpc(){};
27 
28  //! Constructs the LDPC class from given GF2mat X
29  cldpc(const GF2Mat X);
30 
31  //! Constructs the class from the given alist _list
32  cldpc(const alist _list);
33 
34  //! Prints the variable permute
35  void print_permute();
36 
37  /*!
38  \brief Encode the given vector dataword.
39 
40  dataword is of length K where K is the dimension of the code.
41  The function returns a vector of length N where N is the
42  block-length of the code.
43 
44  For encoding a G matrix in the form [I P] is obtained from the
45  parity matrix H, by (a) Column permutations, (b) Row additions
46  and (c) Row permutations. Details of encoding is given in
47  section A.1 of the reference given below.
48  - "Modern Coding Theory", T Richardson and R Urbanke.
49  */
50  std::vector<uint8_t> encode(std::vector<uint8_t> dataword);
51 
52  //! Returns the dimension of the code
53  int dimension();
54 
55  //! Returns the parity check matrix H
57 
58  //! Returns the matrix G used in encoding
60 
61  //! Returns the variable M
62  int get_M();
63 
64  //! Returns the variable N
65  int get_N();
66 
67  //! Returns the syndrome for a given vector "in"
68  std::vector<uint8_t> syndrome(const std::vector<uint8_t> in);
69 
70  //! Returns true if "in" is a codeword, else false
71  bool is_codeword(const std::vector<uint8_t> in);
72 
73  //! Set the variable _list
74  void set_alist(const alist _list);
75 
76  //! Obtain systematic bits from "in"
77  std::vector<uint8_t> get_systematic_bits(std::vector<uint8_t> in);
78 
79 private:
80  //! The parity check matrix
81  GF2Mat H;
82 
83  //! An equivalent matrix obtained from H used for encoding
84  GF2Mat G;
85 
86  //! Stores the column permutation in obtaining G from H
87  std::vector<int> permute;
88 
89  //! Rank of the H matrix
90  int rank_H;
91 
92  //! The number of check nodes in the Tanner-graph
93  int M;
94 
95  //! The number of variable nodes in the Tanner-graph
96  int N;
97 
98  //! The dimension of the code
99  size_t K;
100 };
101 
102 #endif // ifndef LDPC_H
cldpc::set_alist
void set_alist(const alist _list)
Set the variable _list.
cldpc::get_N
int get_N()
Returns the variable N.
api.h
cldpc::get_G
GF2Mat get_G()
Returns the matrix G used in encoding.
gf2vec.h
GF2Mat
Definition: gf2mat.h:18
FEC_API
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:18
alist
Definition: alist.h:33
cldpc::cldpc
cldpc(const GF2Mat X)
Constructs the LDPC class from given GF2mat X.
cldpc
Definition: cldpc.h:23
gf2mat.h
cldpc::get_systematic_bits
std::vector< uint8_t > get_systematic_bits(std::vector< uint8_t > in)
Obtain systematic bits from "in".
alist.h
cldpc::get_M
int get_M()
Returns the variable M.
cldpc::print_permute
void print_permute()
Prints the variable permute.
cldpc::cldpc
cldpc()
Default constructor.
Definition: cldpc.h:26
cldpc::dimension
int dimension()
Returns the dimension of the code.
cldpc::get_H
GF2Mat get_H()
Returns the parity check matrix H.
cldpc::syndrome
std::vector< uint8_t > syndrome(const std::vector< uint8_t > in)
Returns the syndrome for a given vector "in".
cldpc::cldpc
cldpc(const alist _list)
Constructs the class from the given alist _list.
cldpc::encode
std::vector< uint8_t > encode(std::vector< uint8_t > dataword)
Encode the given vector dataword.
cldpc::is_codeword
bool is_codeword(const std::vector< uint8_t > in)
Returns true if "in" is a codeword, else false.