GNU Radio Manual and C++ API Reference 3.9.4.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 <iostream>
15#include <vector>
16
17#include "gnuradio/fec/alist.h"
18#include "gnuradio/fec/gf2mat.h"
19#include "gnuradio/fec/gf2vec.h"
20
21
22#include <gnuradio/fec/api.h>
24{
25public:
26 //! Default constructor
27 cldpc(){};
28
29 //! Constructs the LDPC class from given GF2mat X
30 cldpc(const GF2Mat X);
31
32 //! Constructs the class from the given alist _list
33 cldpc(const alist _list);
34
35 //! Prints the variable permute
37
38 /*!
39 \brief Encode the given vector dataword.
40
41 dataword is of length K where K is the dimension of the code.
42 The function returns a vector of length N where N is the
43 block-length of the code.
44
45 For encoding a G matrix in the form [I P] is obtained from the
46 parity matrix H, by (a) Column permutations, (b) Row additions
47 and (c) Row permutations. Details of encoding is given in
48 section A.1 of the reference given below.
49 - "Modern Coding Theory", T Richardson and R Urbanke.
50 */
51 std::vector<uint8_t> encode(std::vector<uint8_t> dataword);
52
53 //! Returns the dimension of the code
54 int dimension();
55
56 //! Returns the parity check matrix H
58
59 //! Returns the matrix G used in encoding
61
62 //! Returns the variable M
63 int get_M();
64
65 //! Returns the variable N
66 int get_N();
67
68 //! Returns the syndrome for a given vector "in"
69 std::vector<uint8_t> syndrome(const std::vector<uint8_t> in);
70
71 //! Returns true if "in" is a codeword, else false
72 bool is_codeword(const std::vector<uint8_t> in);
73
74 //! Set the variable _list
75 void set_alist(const alist _list);
76
77 //! Obtain systematic bits from "in"
78 std::vector<uint8_t> get_systematic_bits(std::vector<uint8_t> in);
79
80private:
81 //! The parity check matrix
82 GF2Mat H;
83
84 //! An equivalent matrix obtained from H used for encoding
85 GF2Mat G;
86
87 //! Stores the column permutation in obtaining G from H
88 std::vector<int> permute;
89
90 //! Rank of the H matrix
91 int rank_H;
92
93 //! The number of check nodes in the Tanner-graph
94 int M;
95
96 //! The number of variable nodes in the Tanner-graph
97 int N;
98
99 //! The dimension of the code
100 size_t K;
101};
102
103#endif // ifndef LDPC_H
Definition: gf2mat.h:18
Definition: alist.h:33
Definition: cldpc.h:24
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:27
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