IT++ Logo

sequence.h

Go to the documentation of this file.
00001 
00030 #ifndef SEQUENCE_H
00031 #define SEQUENCE_H
00032 
00033 #include <itpp/base/vec.h>
00034 #include <itpp/base/mat.h>
00035 
00036 
00037 namespace itpp {
00038 
00053   class LFSR {
00054   public:
00056     LFSR(void) {};
00058     LFSR(const bvec &connections);
00060     LFSR(const ivec &connections);
00062     void set_connections(const bvec &connections);
00064     void set_connections(const ivec &connections);
00066     void set_state(const bvec &state);
00068     void set_state(const ivec &state);
00070     bin shift(void);
00072     bvec shift(int no_shifts);
00074     int get_length(void);
00076     bvec get_state(void);
00077   private:
00078     bvec memory, Connections;
00079   };
00080 
00085   class Gold {
00086   public:
00094     Gold(int degree);
00096     Gold(const bvec &mseq1_connections, const bvec &mseq2_connections);
00098     Gold(const ivec &mseq1_connections, const ivec &mseq2_connections);
00100     void set_state(const bvec &state1, const bvec &state2);
00102     void set_state(const ivec &state1, const ivec &state2);
00104     bin shift(void);
00106     bvec shift(int no_shifts);
00108     int get_sequence_length(void);
00116     bmat get_family(void);
00117   private:
00118     int N;
00119     LFSR mseq1, mseq2;
00120   };
00121 
00122   // --------------- Inlines ---------------------
00123   inline bin LFSR::shift(void) {bin temp=memory*Connections;memory.shift_right(temp);return temp;}
00124   inline int LFSR::get_length(void) {return memory.size();}
00125   inline bvec LFSR::get_state(void) {return memory;}
00126 
00127   inline bin Gold::shift(void) {return (mseq1.shift()+mseq2.shift());}
00128   inline int Gold::get_sequence_length(void) {return N;}
00129 
00130 
00131   // --------------- Functions ---------------------
00132 
00140   smat wcdma_spreading_codes(int SF);
00141 
00142 } // namespace itpp
00143 
00144 #endif // #ifndef SEQUENCE_H
SourceForge Logo

Generated on Sun Apr 20 12:40:06 2008 for IT++ by Doxygen 1.5.5