00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00026 #ifndef __punct_convcode_h
00027 #define __punct_convcode_h
00028
00029 #include "convcode.h"
00030 #include <vector.h>
00031 #include <matrix.h>
00032 #include <array.h>
00033 namespace SPUC {
00072 class Punctured_Convolutional_Code : protected Convolutional_Code {
00073 public:
00075 Punctured_Convolutional_Code(void) : Convolutional_Code() {}
00077 virtual ~Punctured_Convolutional_Code(void) {}
00078
00085 void set_code(string type_of_code, int inverse_rate, int constraint_length)
00086 { Convolutional_Code::set_code(type_of_code, inverse_rate, constraint_length); }
00088 void set_generator_polynomials(const ivec &gen, int constraint_length)
00089 { Convolutional_Code::set_generator_polynomials(gen, constraint_length); }
00091 ivec get_generator_polynomials(void) { return gen_pol; }
00093 double get_rate(void) { return rate; }
00094
00096 void set_puncture_matrix(const bmat &pmatrix);
00098 bmat get_puncture_matrix(void) { return puncture_matrix; }
00100 int get_puncture_period(void) { return Period; }
00101
00103 void init_encoder() { encoder_state = start_state; }
00104
00106 void encode(const bvec &input, bvec &output);
00108 bvec encode(const bvec &input) { bvec output; encode(input, output); return output; }
00109
00117 void encode_tail(const bvec &input, bvec &output);
00125 bvec encode_tail(const bvec &input) { bvec output; encode_tail(input, output); return output; }
00126
00128 void decode(const vec &received_signal, bvec &output);
00130 bvec decode(const vec &received_signal) { bvec output; decode(received_signal, output); return output; }
00131
00138 void decode_tail(const vec &received_signal, bvec &output);
00145 bvec decode_tail(const vec &received_signal) { bvec output; decode_tail(received_signal, output); return output; }
00146
00147
00148
00149
00150
00151
00152
00153 bool inverse_tail(const bvec coded_sequence, bvec &input);
00154
00156 bool catastrophic(void);
00157
00159 void distance_profile(llvec &dist_prof, int time, int dmax = 100000, bool reverse = false);
00160
00175 void calculate_spectrum(Array<llvec> &spectrum, int dmax, int no_terms);
00176
00177
00178
00179
00190 void calculate_spectrum(Array<llvec> &spectrum, int time, int dmax, int no_terms, int block_length=0);
00191
00206 int fast(Array<llvec> &spectrum, int time, int dfree, int no_terms, int d_best_so_far = 0, bool test_catastrophic = false);
00207
00208 protected:
00210 int weight(const int state, const int input, int time);
00212 void weight(const int state, int &w0, int &w1, int time);
00214 int weight_reverse(const int state, const int input, int time);
00216 void weight_reverse(const int state, int &w0, int &w1, int time);
00217
00219 int Period;
00221 bmat puncture_matrix;
00222 };
00223 }
00224 #endif // __punct_convcode_h