IT++ Logo

punct_convcode.h

Go to the documentation of this file.
00001 
00030 #ifndef PUNCT_CONVCODE_H
00031 #define PUNCT_CONVCODE_H
00032 
00033 #include <itpp/base/vec.h>
00034 #include <itpp/base/mat.h>
00035 #include <itpp/base/array.h>
00036 #include <itpp/comm/convcode.h>
00037 
00038 
00039 namespace itpp {
00040 
00080   class Punctured_Convolutional_Code : public Convolutional_Code {
00081   public:
00083     Punctured_Convolutional_Code(void) : Convolutional_Code() {}
00085     virtual ~Punctured_Convolutional_Code(void) {}
00086 
00093     void set_code(const CONVOLUTIONAL_CODE_TYPE type_of_code, int inverse_rate, int constraint_length)
00094       { Convolutional_Code::set_code(type_of_code, inverse_rate, constraint_length); }
00096     void set_generator_polynomials(const ivec &gen, int constraint_length)
00097       { Convolutional_Code::set_generator_polynomials(gen, constraint_length); }
00099     ivec get_generator_polynomials() const { return gen_pol; }
00100 
00102     virtual double get_rate() const { return rate; }
00103 
00105     void set_method(const CONVOLUTIONAL_CODE_METHOD method) { Convolutional_Code::set_method(method); }
00106 
00108     void set_puncture_matrix(const bmat &pmatrix); // add test of matrix size
00110     bmat get_puncture_matrix() const { return puncture_matrix; }
00112     int get_puncture_period() const { return Period; }
00113 
00115     void init_encoder() { encoder_state = start_state; }
00116 
00118     void encode(const bvec &input, bvec &output);
00120     bvec encode(const bvec &input) { bvec output; encode(input, output); return output; }
00121 
00123     void encode_trunc(const bvec &input, bvec &output);
00125     bvec encode_trunc(const bvec &input) { bvec output; encode_trunc(input, output); return output; }
00126 
00134     void encode_tail(const bvec &input, bvec &output);
00142     bvec encode_tail(const bvec &input) { bvec output; encode_tail(input, output); return output; }
00143 
00145     void encode_tailbite(const bvec &input, bvec &output);
00147     bvec encode_tailbite(const bvec &input)
00148       { bvec output; encode_tailbite(input, output); return output; }
00149 
00150 
00152     virtual void decode(const vec &received_signal, bvec &output);
00154     virtual bvec decode(const vec &received_signal) { bvec output; decode(received_signal, output); return output; }
00155 
00156     // ------------ Hard-decision decoding is not implemented -------------------
00157     virtual void decode(const bvec &coded_bits, bvec &decoded_bits);
00158     virtual bvec decode(const bvec &coded_bits);
00159 
00161     void decode_trunc(const vec &received_signal, bvec &output);
00163     bvec decode_trunc(const vec &received_signal) { bvec output; decode_trunc(received_signal, output); return output; }
00164 
00171     void decode_tail(const vec &received_signal, bvec &output);
00178     bvec decode_tail(const vec &received_signal) { bvec output; decode_tail(received_signal, output); return output; }
00179 
00181     void decode_tailbite(const vec &received_signal, bvec &output);
00183     bvec decode_tailbite(const vec &received_signal)
00184       { bvec output; decode_tailbite(received_signal, output); return output; }
00185 
00186     /*
00187       \brief Calculate the inverse sequence
00188 
00189       Assumes that encode_tail is used in the encoding process. Returns false if there is an error in the coded sequence
00190       (not a valid codeword).
00191     */
00192     bool inverse_tail(const bvec coded_sequence, bvec &input);
00193 
00195     bool catastrophic(void);
00196 
00198     void distance_profile(ivec &dist_prof, int time, int dmax = 100000, bool reverse = false);
00199 
00216     void calculate_spectrum(Array<ivec> &spectrum, int dmax, int no_terms);
00217 
00228     void calculate_spectrum(Array<ivec> &spectrum, int time, int dmax, int no_terms, int block_length=0);
00229 
00246     int fast(Array<ivec> &spectrum, int time, int dfree, int no_terms, int d_best_so_far = 0, bool test_catastrophic = false);
00247 
00248   protected:
00250     int weight(const int state, const int input, int time);
00252     void weight(const int state, int &w0, int &w1, int time);
00254     int weight_reverse(const int state, const int input, int time);
00256     void weight_reverse(const int state, int &w0, int &w1, int time);
00257 
00259     int Period;
00261     int total;
00263     bmat puncture_matrix;
00264   };
00265 
00266 } // namespace itpp
00267 
00268 #endif // #ifndef PUNCT_CONVCODE_H
SourceForge Logo

Generated on Sun Dec 9 17:38:47 2007 for IT++ by Doxygen 1.5.4