00001 00029 #ifndef HAMMING_H 00030 #define HAMMING_H 00031 00032 #include <itpp/base/vec.h> 00033 #include <itpp/base/mat.h> 00034 #include <itpp/comm/channel_code.h> 00035 00036 00037 namespace itpp 00038 { 00039 00044 class Hamming_Code : public Channel_Code 00045 { 00046 public: 00048 Hamming_Code(int m); 00049 00051 virtual ~Hamming_Code() { } 00052 00054 virtual void encode(const bvec &uncoded_bits, bvec &coded_bits); 00056 virtual bvec encode(const bvec &uncoded_bits); 00057 00059 virtual void decode(const bvec &coded_bits, bvec &decoded_bits); 00061 virtual bvec decode(const bvec &coded_bits); 00062 00063 // Soft-decision decoding is not implemented 00064 virtual void decode(const vec &received_signal, bvec &output); 00065 virtual bvec decode(const vec &received_signal); 00066 00068 virtual double get_rate() const { return static_cast<double>(k) / n; }; 00069 00071 int get_n() const { return n; }; 00073 int get_k() const { return k; }; 00075 bmat get_H() const { return H; }; 00077 bmat get_G() const { return G; }; 00078 private: 00079 int n, k; 00080 bmat H, G; 00081 void generate_H(void); 00082 void generate_G(void); 00083 }; 00084 00085 } // namespace itpp 00086 00087 #endif // #ifndef HAMMING_H
Generated on Sat Jul 9 2011 15:21:31 for IT++ by Doxygen 1.7.4