IT++ Logo
sequence.h
Go to the documentation of this file.
00001 
00029 #ifndef SEQUENCE_H
00030 #define SEQUENCE_H
00031 
00032 #include <itpp/base/vec.h>
00033 #include <itpp/base/mat.h>
00034 
00035 
00036 namespace itpp
00037 {
00038 
00053 class LFSR
00054 {
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 
00086 class Gold
00087 {
00088 public:
00096   Gold(int degree);
00098   Gold(const bvec &mseq1_connections, const bvec &mseq2_connections);
00100   Gold(const ivec &mseq1_connections, const ivec &mseq2_connections);
00102   void set_state(const bvec &state1, const bvec &state2);
00104   void set_state(const ivec &state1, const ivec &state2);
00106   bin shift(void);
00108   bvec shift(int no_shifts);
00110   int get_sequence_length(void);
00118   bmat get_family(void);
00119 private:
00120   int N;
00121   LFSR mseq1, mseq2;
00122 };
00123 
00124 // --------------- Inlines ---------------------
00125 inline bin LFSR::shift(void) {bin temp = memory * Connections;memory.shift_right(temp);return temp;}
00126 inline int LFSR::get_length(void) {return memory.size();}
00127 inline bvec LFSR::get_state(void) {return memory;}
00128 
00129 inline bin Gold::shift(void) {return (mseq1.shift() + mseq2.shift());}
00130 inline int Gold::get_sequence_length(void) {return N;}
00131 
00132 
00133 // --------------- Functions ---------------------
00134 
00142 smat wcdma_spreading_codes(int SF);
00143 
00144 } // namespace itpp
00145 
00146 #endif // #ifndef SEQUENCE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SourceForge Logo

Generated on Sat Jul 9 2011 15:21:31 for IT++ by Doxygen 1.7.4