IT++
4.3.1
Toggle main menu visibility
itpp
comm
hammcode.h
Go to the documentation of this file.
1
28
29
#ifndef HAMMING_H
30
#define HAMMING_H
31
32
#include <
itpp/base/vec.h
>
33
#include <
itpp/base/mat.h
>
34
#include <
itpp/comm/channel_code.h
>
35
#include <itpp/itexports.h>
36
37
namespace
itpp
38
{
39
44
class
ITPP_EXPORT
Hamming_Code
:
public
Channel_Code
45
{
46
public
:
48
Hamming_Code
(
int
m);
49
51
virtual
~Hamming_Code
() { }
52
54
virtual
void
encode(
const
bvec &uncoded_bits, bvec &coded_bits);
56
virtual
bvec encode(
const
bvec &uncoded_bits);
57
59
virtual
void
decode(
const
bvec &coded_bits, bvec &decoded_bits);
61
virtual
bvec decode(
const
bvec &coded_bits);
62
63
// Soft-decision decoding is not implemented
64
virtual
void
decode(
const
vec &received_signal, bvec &output);
65
virtual
bvec decode(
const
vec &received_signal);
66
68
virtual
double
get_rate
()
const
{
return
static_cast<
double
>
(k) / n; };
69
71
int
get_n
()
const
{
return
n; };
73
int
get_k
()
const
{
return
k; };
75
bmat
get_H
()
const
{
return
H; };
77
bmat
get_G
()
const
{
return
G; };
78
private
:
79
int
n, k;
80
bmat
H, G;
81
void
generate_H(
void
);
82
void
generate_G(
void
);
83
};
84
85
}
// namespace itpp
86
87
#endif
// #ifndef HAMMING_H
channel_code.h
Channel Code class virtual interface.
itpp::Channel_Code::Channel_Code
Channel_Code()
Default constructor.
Definition
channel_code.h:54
itpp::Hamming_Code::get_H
bmat get_H() const
Gets the parity check matrix for the code.
Definition
hammcode.h:75
itpp::Hamming_Code::get_rate
virtual double get_rate() const
Get the code rate.
Definition
hammcode.h:68
itpp::Hamming_Code::get_G
bmat get_G() const
Gets the generator matrix for the code.
Definition
hammcode.h:77
itpp::Hamming_Code::~Hamming_Code
virtual ~Hamming_Code()
Destructor.
Definition
hammcode.h:51
itpp::Hamming_Code::get_n
int get_n() const
Gets the code length n.
Definition
hammcode.h:71
itpp::Hamming_Code::Hamming_Code
Hamming_Code(int m)
Constructor for hamming(n,k). n = pow(2,m)-1 and k = pow(2,m)-m-1.
Definition
hammcode.cpp:37
itpp::Hamming_Code::get_k
int get_k() const
Gets the number of information bits per code word, k.
Definition
hammcode.h:73
mat.h
Matrix Class Definitions.
bmat
Mat< bin > bmat
bin matrix
Definition
mat.h:508
itpp
itpp namespace
Definition
itmex.h:37
vec.h
Templated Vector Class Definitions.
Generated by
1.17.0