IT++ Logo
sequence.h
Go to the documentation of this file.
1 
29 #ifndef SEQUENCE_H
30 #define SEQUENCE_H
31 
32 #include <itpp/base/vec.h>
33 #include <itpp/base/mat.h>
34 #include <itpp/itexports.h>
35 
36 namespace itpp
37 {
38 
53 class ITPP_EXPORT LFSR
54 {
55 public:
57  LFSR(void) {};
59  LFSR(const bvec &connections);
61  LFSR(const ivec &connections);
63  void set_connections(const bvec &connections);
65  void set_connections(const ivec &connections);
67  void set_state(const bvec &state);
69  void set_state(const ivec &state);
71  bin shift(void);
73  bvec shift(int no_shifts);
75  int get_length(void);
77  bvec get_state(void);
78 private:
79  bvec memory, Connections;
80 };
81 
86 class ITPP_EXPORT Gold
87 {
88 public:
96  Gold(int degree);
98  Gold(const bvec &mseq1_connections, const bvec &mseq2_connections);
100  Gold(const ivec &mseq1_connections, const ivec &mseq2_connections);
102  void set_state(const bvec &state1, const bvec &state2);
104  void set_state(const ivec &state1, const ivec &state2);
106  bin shift(void);
108  bvec shift(int no_shifts);
110  int get_sequence_length(void);
118  bmat get_family(void);
119 private:
120  int N;
121  LFSR mseq1, mseq2;
122 };
123 
124 // --------------- Inlines ---------------------
125 inline bin LFSR::shift(void) {bin temp = memory * Connections;memory.shift_right(temp);return temp;}
126 inline int LFSR::get_length(void) {return memory.size();}
127 inline bvec LFSR::get_state(void) {return memory;}
128 
129 inline bin Gold::shift(void) {return (mseq1.shift() + mseq2.shift());}
130 inline int Gold::get_sequence_length(void) {return N;}
131 
132 
133 // --------------- Functions ---------------------
134 
142 ITPP_EXPORT smat wcdma_spreading_codes(int SF);
143 
144 } // namespace itpp
145 
146 #endif // #ifndef SEQUENCE_H
SourceForge Logo

Generated on Sat Jul 6 2013 10:54:23 for IT++ by Doxygen 1.8.2