IT++ Logo

hammcode.h

Go to the documentation of this file.
00001 
00030 #ifndef HAMMING_H
00031 #define HAMMING_H
00032 
00033 #include <itpp/base/vec.h>
00034 #include <itpp/base/mat.h>
00035 #include <itpp/comm/channel_code.h>
00036 
00037 
00038 namespace itpp
00039 {
00040 
00045 class Hamming_Code : public Channel_Code
00046 {
00047 public:
00049   Hamming_Code(short m);
00050 
00052   virtual ~Hamming_Code() { }
00053 
00055   virtual void encode(const bvec &uncoded_bits, bvec &coded_bits);
00057   virtual bvec encode(const bvec &uncoded_bits);
00058 
00060   virtual void decode(const bvec &coded_bits, bvec &decoded_bits);
00062   virtual bvec decode(const bvec &coded_bits);
00063 
00064   // Soft-decision decoding is not implemented
00065   virtual void decode(const vec &received_signal, bvec &output);
00066   virtual bvec decode(const vec &received_signal);
00067 
00069   virtual double get_rate() const { return static_cast<double>(k) / n; };
00070 
00072   short get_n() const { return n; };
00074   short get_k() const { return k; };
00076   bmat get_H() const { return H; };
00078   bmat get_G() const { return G; };
00079 private:
00080   short n, k;
00081   bmat H, G;
00082   void generate_H(void);
00083   void generate_G(void);
00084 };
00085 
00086 } // namespace itpp
00087 
00088 #endif // #ifndef HAMMING_H
SourceForge Logo

Generated on Sun Jul 26 08:36:49 2009 for IT++ by Doxygen 1.5.9