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 { 00039 00054 class LFSR 00055 { 00056 public: 00058 LFSR(void) {}; 00060 LFSR(const bvec &connections); 00062 LFSR(const ivec &connections); 00064 void set_connections(const bvec &connections); 00066 void set_connections(const ivec &connections); 00068 void set_state(const bvec &state); 00070 void set_state(const ivec &state); 00072 bin shift(void); 00074 bvec shift(int no_shifts); 00076 int get_length(void); 00078 bvec get_state(void); 00079 private: 00080 bvec memory, Connections; 00081 }; 00082 00087 class Gold 00088 { 00089 public: 00097 Gold(int degree); 00099 Gold(const bvec &mseq1_connections, const bvec &mseq2_connections); 00101 Gold(const ivec &mseq1_connections, const ivec &mseq2_connections); 00103 void set_state(const bvec &state1, const bvec &state2); 00105 void set_state(const ivec &state1, const ivec &state2); 00107 bin shift(void); 00109 bvec shift(int no_shifts); 00111 int get_sequence_length(void); 00119 bmat get_family(void); 00120 private: 00121 int N; 00122 LFSR mseq1, mseq2; 00123 }; 00124 00125 // --------------- Inlines --------------------- 00126 inline bin LFSR::shift(void) {bin temp = memory * Connections;memory.shift_right(temp);return temp;} 00127 inline int LFSR::get_length(void) {return memory.size();} 00128 inline bvec LFSR::get_state(void) {return memory;} 00129 00130 inline bin Gold::shift(void) {return (mseq1.shift() + mseq2.shift());} 00131 inline int Gold::get_sequence_length(void) {return N;} 00132 00133 00134 // --------------- Functions --------------------- 00135 00143 smat wcdma_spreading_codes(int SF); 00144 00145 } // namespace itpp 00146 00147 #endif // #ifndef SEQUENCE_H
Generated on Fri Aug 14 15:28:21 2009 for IT++ by Doxygen 1.5.9