IT++ Logo Newcom Logo

hammcode.h

Go to the documentation of this file.
00001 
00033 #ifndef HAMMING_H
00034 #define HAMMING_H
00035 
00036 #include <itpp/base/vec.h>
00037 #include <itpp/base/mat.h>
00038 #include <itpp/comm/channel_code.h>
00039 
00040 
00041 namespace itpp {
00042 
00047   class Hamming_Code : public Channel_Code {
00048   public:
00050     Hamming_Code(short m);
00051 
00053     virtual ~Hamming_Code(){ }
00054 
00056     virtual void encode(const bvec &uncoded_bits, bvec &coded_bits);
00058     virtual bvec encode(const bvec &uncoded_bits);
00059 
00061     virtual void decode(const bvec &coded_bits, bvec &decoded_bits);
00063     virtual bvec decode(const bvec &coded_bits);
00064 
00065     // Soft-decision decoding is not implemented
00066     virtual void decode(const vec &received_signal, bvec &output);
00067     virtual bvec decode(const vec &received_signal);
00068 
00070     virtual double get_rate() { return (double)k/(double)n; };
00071 
00073     short get_n() { return n; };
00075     short get_k() { return k; };
00077     bmat get_H() { return H; };
00079     bmat get_G() { return G; };
00080   private:
00081     short n, k; 
00082     bmat H, G;
00083     void generate_H(void);
00084     void generate_G(void);
00085   };
00086 
00087 } // namespace itpp
00088 
00089 #endif // #ifndef HAMMING_H
SourceForge Logo

Generated on Thu Apr 19 14:43:44 2007 for IT++ by Doxygen 1.5.1