punct_convcode.h
Go to the documentation of this file.
#ifndef PUNCT_CONVCODE_H
#define PUNCT_CONVCODE_H
#include <itpp/base/vec.h>
#include <itpp/base/mat.h>
#include <itpp/base/array.h>
#include <itpp/comm/convcode.h>
#include <itpp/itexports.h>
namespace itpp
{
class ITPP_EXPORT Punctured_Convolutional_Code : public Convolutional_Code
{
public:
Punctured_Convolutional_Code(void) : Convolutional_Code() {}
virtual ~Punctured_Convolutional_Code(void) {}
void set_code(const CONVOLUTIONAL_CODE_TYPE type_of_code, int inverse_rate, int constraint_length)
{ Convolutional_Code::set_code(type_of_code, inverse_rate, constraint_length); }
void set_generator_polynomials(const ivec &gen, int constraint_length)
{ Convolutional_Code::set_generator_polynomials(gen, constraint_length); }
ivec get_generator_polynomials() const { return gen_pol; }
virtual double get_rate() const { return rate; }
void set_method(const CONVOLUTIONAL_CODE_METHOD method) { Convolutional_Code::set_method(method); }
void set_puncture_matrix(const bmat &pmatrix); // add test of matrix size
bmat get_puncture_matrix() const { return puncture_matrix; }
int get_puncture_period() const { return Period; }
void init_encoder() { encoder_state = start_state; }
void encode(const bvec &input, bvec &output);
bvec encode(const bvec &input) { bvec output; encode(input, output); return output; }
void encode_trunc(const bvec &input, bvec &output);
bvec encode_trunc(const bvec &input) { bvec output; encode_trunc(input, output); return output; }
void encode_tail(const bvec &input, bvec &output);
bvec encode_tail(const bvec &input) { bvec output; encode_tail(input, output); return output; }
void encode_tailbite(const bvec &input, bvec &output);
bvec encode_tailbite(const bvec &input)
{ bvec output; encode_tailbite(input, output); return output; }
virtual void decode(const vec &received_signal, bvec &output);
virtual bvec decode(const vec &received_signal) { bvec output; decode(received_signal, output); return output; }
// ------------ Hard-decision decoding is not implemented -------------------
virtual void decode(const bvec &coded_bits, bvec &decoded_bits);
virtual bvec decode(const bvec &coded_bits);
void decode_trunc(const vec &received_signal, bvec &output);
bvec decode_trunc(const vec &received_signal) { bvec output; decode_trunc(received_signal, output); return output; }
void decode_tail(const vec &received_signal, bvec &output);
bvec decode_tail(const vec &received_signal) { bvec output; decode_tail(received_signal, output); return output; }
void decode_tailbite(const vec &received_signal, bvec &output);
bvec decode_tailbite(const vec &received_signal)
{ bvec output; decode_tailbite(received_signal, output); return output; }
/*
\brief Calculate the inverse sequence
Assumes that encode_tail is used in the encoding process. Returns false if there is an error in the coded sequence
(not a valid codeword).
*/
bool inverse_tail(const bvec coded_sequence, bvec &input);
bool catastrophic(void);
void distance_profile(ivec &dist_prof, int time, int dmax = 100000, bool reverse = false);
void calculate_spectrum(Array<ivec> &spectrum, int dmax, int no_terms);
void calculate_spectrum(Array<ivec> &spectrum, int time, int dmax, int no_terms, int block_length = 0);
int fast(Array<ivec> &spectrum, int time, int dfree, int no_terms, int d_best_so_far = 0, bool test_catastrophic = false);
protected:
int weight(const int state, const int input, int time);
void weight(const int state, int &w0, int &w1, int time);
int weight_reverse(const int state, const int input, int time);
void weight_reverse(const int state, int &w0, int &w1, int time);
int Period;
int total;
bmat puncture_matrix;
};
} // namespace itpp
#endif // #ifndef PUNCT_CONVCODE_H
itpp::Punctured_Convolutional_Code::get_generator_polynomials
ivec get_generator_polynomials() const
Get generator polynomials.
Definition: punct_convcode.h:100
itpp::Punctured_Convolutional_Code::set_code
void set_code(const CONVOLUTIONAL_CODE_TYPE type_of_code, int inverse_rate, int constraint_length)
Set the code according to built-in tables.
Definition: punct_convcode.h:94
bmat
Mat< bin > bmat
bin matrix
Definition: mat.h:508
itpp::Punctured_Convolutional_Code::decode_trunc
bvec decode_trunc(const vec &received_signal)
Viterbi decoding using truncation of memory (default = 5*K)
Definition: punct_convcode.h:164
itpp::Convolutional_Code::set_generator_polynomials
void set_generator_polynomials(const ivec &gen, int constraint_length)
Set generator polynomials. Given in Proakis integer form.
Definition: convcode.cpp:555
itpp
itpp namespace
Definition: itmex.h:36
itpp::Punctured_Convolutional_Code
Binary Punctured Convolutional Code Class.
Definition: punct_convcode.h:80
itpp::Punctured_Convolutional_Code::decode_tailbite
bvec decode_tailbite(const vec &received_signal)
Decode a block of encoded data where encode_tailbite has been used. Tries all start states.
Definition: punct_convcode.h:184
mat.h
Matrix Class Definitions.
itpp::Punctured_Convolutional_Code::encode_tail
bvec encode_tail(const bvec &input)
Encoding that begins and ends in the zero state.
Definition: punct_convcode.h:143
array.h
Definition of Array class (container)
itpp::Punctured_Convolutional_Code::total
int total
The number of "1" in the puncture matrix.
Definition: punct_convcode.h:262
itpp::Array< ivec >
itpp::Punctured_Convolutional_Code::puncture_matrix
bmat puncture_matrix
The puncture matrix (n rows and Period columns)
Definition: punct_convcode.h:264
itpp::Convolutional_Code
Binary Convolutional rate 1/n class.
Definition: convcode.h:104
itpp::Punctured_Convolutional_Code::get_puncture_period
int get_puncture_period() const
Get puncturing period.
Definition: punct_convcode.h:113
itpp::Convolutional_Code::set_code
void set_code(const CONVOLUTIONAL_CODE_TYPE type_of_code, int inverse_rate, int constraint_length)
Set the code according to built-in tables.
Definition: convcode.cpp:537
itpp::Punctured_Convolutional_Code::decode_tail
bvec decode_tail(const vec &received_signal)
Decode a block of encoded data where encode_tail has been used.
Definition: punct_convcode.h:179
itpp::Punctured_Convolutional_Code::~Punctured_Convolutional_Code
virtual ~Punctured_Convolutional_Code(void)
Destructor.
Definition: punct_convcode.h:86
itpp::CONVOLUTIONAL_CODE_TYPE
CONVOLUTIONAL_CODE_TYPE
Type of Convolutional Code.
Definition: convcode.h:47
itpp::Punctured_Convolutional_Code::get_rate
virtual double get_rate() const
Return rate of code.
Definition: punct_convcode.h:103
itpp::Punctured_Convolutional_Code::encode
bvec encode(const bvec &input)
Encode a binary vector of inputs using specified method.
Definition: punct_convcode.h:121
itpp::Punctured_Convolutional_Code::Period
int Period
The puncture period (i.e. the number of columns in the puncture matrix)
Definition: punct_convcode.h:260
itpp::Punctured_Convolutional_Code::init_encoder
void init_encoder()
Set the encoder internal state in start_state (set by set_start_state()).
Definition: punct_convcode.h:116
itpp::Convolutional_Code::set_method
void set_method(const CONVOLUTIONAL_CODE_METHOD method)
Set encoding and decoding method (Trunc, Tail, or Tailbite)
Definition: convcode.h:117
itpp::Punctured_Convolutional_Code::Punctured_Convolutional_Code
Punctured_Convolutional_Code(void)
Constructor.
Definition: punct_convcode.h:84
itpp::Punctured_Convolutional_Code::encode_tailbite
bvec encode_tailbite(const bvec &input)
Encode a binary vector of inputs using tailbiting.
Definition: punct_convcode.h:148
itpp::CONVOLUTIONAL_CODE_METHOD
CONVOLUTIONAL_CODE_METHOD
Encoding and decoding methods for Convolutional codes.
Definition: convcode.h:53
vec.h
Templated Vector Class Definitions.
itpp::spectrum
vec spectrum(const vec &v, int nfft, int noverlap)
Power spectrum calculation.
Definition: sigfun.cpp:267
itpp::weight
int weight(const bvec &a)
Calculate the Hamming weight of a.
Definition: commfunc.cpp:71
convcode.h
Definition of a binary convolutional encoder class.
itpp::Punctured_Convolutional_Code::set_method
void set_method(const CONVOLUTIONAL_CODE_METHOD method)
Set encoding and decoding method (Trunc, Tail, or Tailbite)
Definition: punct_convcode.h:106
itpp::Punctured_Convolutional_Code::set_generator_polynomials
void set_generator_polynomials(const ivec &gen, int constraint_length)
Set generator polynomials. Given in Proakis integer form.
Definition: punct_convcode.h:97
itpp::Punctured_Convolutional_Code::get_puncture_matrix
bmat get_puncture_matrix() const
Get puncture matrix.
Definition: punct_convcode.h:111
itpp::reverse
Vec< T > reverse(const Vec< T > &in)
Reverse the input vector.
Definition: matfunc.h:777
itpp::Punctured_Convolutional_Code::encode_trunc
bvec encode_trunc(const bvec &input)
Encode a binary vector of inputs starting from state set by the set_state function.
Definition: punct_convcode.h:126
itpp::Punctured_Convolutional_Code::decode
virtual bvec decode(const vec &received_signal)
Viterbi decoding using specified method.
Definition: punct_convcode.h:155

Generated on Mon Mar 23 2020 06:18:03 for IT++ by Doxygen 1.8.17