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 
00044   class Hamming_Code : public Channel_Code {
00045   public:
00047     Hamming_Code(short m);
00048 
00050     virtual ~Hamming_Code(){ }
00051 
00053     virtual void encode(const bvec &uncoded_bits, bvec &coded_bits);
00055     virtual bvec encode(const bvec &uncoded_bits);
00056 
00058     virtual void decode(const bvec &coded_bits, bvec &decoded_bits);
00060     virtual bvec decode(const bvec &coded_bits);
00061 
00062     // Soft-decision decoding is not implemented
00063     virtual void decode(const vec &received_signal, bvec &output);
00064     virtual bvec decode(const vec &received_signal);
00065 
00067     virtual double get_rate() const { return static_cast<double>(k) / n; };
00068 
00070     short get_n() const { return n; };
00072     short get_k() const { return k; };
00074     bmat get_H() const { return H; };
00076     bmat get_G() const { return G; };
00077   private:
00078     short n, k;
00079     bmat H, G;
00080     void generate_H(void);
00081     void generate_G(void);
00082   };
00083 
00084 } // namespace itpp
00085 
00086 #endif // #ifndef HAMMING_H
SourceForge Logo

Generated on Sun Dec 9 17:31:02 2007 for IT++ by Doxygen 1.5.4