GNU Radio Manual and C++ API Reference 3.10.5.1
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{
24public:
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
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
79private:
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
Definition: gf2mat.h:18
Definition: alist.h:32
Definition: cldpc.h:23
cldpc(const GF2Mat X)
Constructs the LDPC class from given GF2mat X.
std::vector< uint8_t > get_systematic_bits(std::vector< uint8_t > in)
Obtain systematic bits from "in".
bool is_codeword(const std::vector< uint8_t > in)
Returns true if "in" is a codeword, else false.
void set_alist(const alist _list)
Set the variable _list.
cldpc()
Default constructor.
Definition: cldpc.h:26
GF2Mat get_G()
Returns the matrix G used in encoding.
std::vector< uint8_t > encode(std::vector< uint8_t > dataword)
Encode the given vector dataword.
cldpc(const alist _list)
Constructs the class from the given alist _list.
std::vector< uint8_t > syndrome(const std::vector< uint8_t > in)
Returns the syndrome for a given vector "in".
int get_M()
Returns the variable M.
GF2Mat get_H()
Returns the parity check matrix H.
void print_permute()
Prints the variable permute.
int dimension()
Returns the dimension of the code.
int get_N()
Returns the variable N.
#define FEC_API
Definition: gr-fec/include/gnuradio/fec/api.h:18