GNU Radio Manual and C++ API Reference
3.8.1.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
* GNU Radio is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 3, or (at your option)
10
* any later version.
11
*
12
* GNU Radio is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with GNU Radio; see the file COPYING. If not, write to
19
* the Free Software Foundation, Inc., 51 Franklin Street,
20
* Boston, MA 02110-1301, USA.
21
*/
22
23
#ifndef LDPC_H
24
#define LDPC_H
25
26
#include <iostream>
27
#include <vector>
28
29
#include "
gnuradio/fec/alist.h
"
30
#include "
gnuradio/fec/gf2mat.h
"
31
#include "
gnuradio/fec/gf2vec.h
"
32
33
34
#include <
gnuradio/fec/api.h
>
35
class
FEC_API
cldpc
36
{
37
public
:
38
//! Default constructor
39
cldpc
(){};
40
41
//! Constructs the LDPC class from given GF2mat X
42
cldpc
(
const
GF2Mat
X);
43
44
//! Constructs the class from the given alist _list
45
cldpc
(
const
alist
_list);
46
47
//! Prints the variable permute
48
void
print_permute();
49
50
/*!
51
\brief Encode the given vector dataword.
52
53
dataword is of length K where K is the dimension of the code.
54
The function returns a vector of length N where N is the
55
block-length of the code.
56
57
For encoding a G matrix in the form [I P] is obtained from the
58
parity matrix H, by (a) Column permutations, (b) Row additions
59
and (c) Row permutations. Details of encoding is given in
60
section A.1 of the reference given below.
61
- "Modern Coding Theory", T Richardson and R Urbanke.
62
*/
63
std::vector<char>
encode
(std::vector<char> dataword);
64
65
//! Returns the dimension of the code
66
int
dimension();
67
68
//! Returns the parity check matrix H
69
GF2Mat
get_H();
70
71
//! Returns the matrix G used in encoding
72
GF2Mat
get_G();
73
74
//! Returns the variable M
75
int
get_M();
76
77
//! Returns the variable N
78
int
get_N();
79
80
//! Returns the syndrome for a given vector "in"
81
std::vector<char> syndrome(
const
std::vector<char> in);
82
83
//! Returns true if "in" is a codeword, else false
84
bool
is_codeword(
const
std::vector<char> in);
85
86
//! Set the variable _list
87
void
set_alist(
const
alist
_list);
88
89
//! Obtain systematic bits from "in"
90
std::vector<char> get_systematic_bits(std::vector<char> in);
91
92
private
:
93
//! The parity check matrix
94
GF2Mat
H;
95
96
//! An equivalent matrix obtained from H used for encoding
97
GF2Mat
G;
98
99
//! Stores the column permutation in obtaining G from H
100
std::vector<int> permute;
101
102
//! Rank of the H matrix
103
int
rank_H;
104
105
//! The number of check nodes in the Tanner-graph
106
int
M;
107
108
//! The number of variable nodes in the Tanner-graph
109
int
N;
110
111
//! The dimension of the code
112
size_t
K;
113
};
114
115
#endif // ifndef LDPC_H
api.h
gr::fec::encode
FEC_API unsigned char encode(unsigned char *symbols, unsigned char *data, unsigned int nbytes, unsigned char encstate)
gf2vec.h
GF2Mat
Definition:
gf2mat.h:29
FEC_API
#define FEC_API
Definition:
gr-fec/include/gnuradio/fec/api.h:30
alist
Definition:
alist.h:44
cldpc
Definition:
cldpc.h:35
gf2mat.h
alist.h
cldpc::cldpc
cldpc()
Default constructor.
Definition:
cldpc.h:39
gr-fec
include
gnuradio
fec
cldpc.h
Generated by
1.8.16