IT++ Logo Newcom Logo

sequence.h

Go to the documentation of this file.
00001 
00033 #ifndef SEQUENCE_H
00034 #define SEQUENCE_H
00035 
00036 #include <itpp/base/vec.h>
00037 #include <itpp/base/mat.h>
00038 
00039 
00040 namespace itpp {
00041 
00054   class LFSR {
00055   public:
00057     LFSR(void) {};
00059     LFSR(const bvec &connections);
00061     LFSR(const ivec &connections);
00063     void set_connections(const bvec &connections);
00065     void set_connections(const ivec &connections);
00067     void set_state(const bvec &state);
00069     void set_state(const ivec &state);
00071     bin shift(void);
00073     bvec shift(int no_shifts);
00075     int get_length(void);
00077     bvec get_state(void);
00078   private:
00079     bvec memory, Connections;
00080   };
00081 
00085   class Gold {
00086   public:
00093     Gold(int degree);
00095     Gold(const bvec &mseq1_connections, const bvec &mseq2_connections);
00097     Gold(const ivec &mseq1_connections, const ivec &mseq2_connections);
00099     void set_state(const bvec &state1, const bvec &state2);
00101     void set_state(const ivec &state1, const ivec &state2);
00103     bin shift(void);
00105     bvec shift(int no_shifts);
00107     int get_sequence_length(void);
00115     bmat get_family(void);
00116   private:
00117     int N;
00118     LFSR mseq1, mseq2;
00119   };
00120 
00121   // --------------- Inlines ---------------------
00122   inline bin LFSR::shift(void) {bin temp=memory*Connections;memory.shift_right(temp);return temp;}
00123   inline int LFSR::get_length(void) {return memory.size();}
00124   inline bvec LFSR::get_state(void) {return memory;}
00125 
00126   inline bin Gold::shift(void) {return (mseq1.shift()+mseq2.shift());}
00127   inline int Gold::get_sequence_length(void) {return N;}
00128 
00129 
00130   // --------------- Functions ---------------------
00131 
00138   smat wcdma_spreading_codes(int SF);
00139 
00140 } // namespace itpp
00141 
00142 #endif // #ifndef SEQUENCE_H
SourceForge Logo

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