00001
00029 #ifndef SPREAD_H
00030 #define SPREAD_H
00031
00032 #include <itpp/base/vec.h>
00033 #include <itpp/base/mat.h>
00034
00035
00036 namespace itpp
00037 {
00038
00099 class Spread_1d
00100 {
00101 public:
00103 Spread_1d() { }
00105 Spread_1d(const vec &incode);
00107 void spread(const vec &symbols, vec &out);
00109 vec spread(const vec &symbols) { vec out; spread(symbols, out); return out; }
00113 void despread(const vec &rec_signal, vec &out, int timing);
00117 vec despread(const vec &rec_signal, int timing)
00118 { vec out; despread(rec_signal, out, timing); return out; }
00120 void set_code(const vec &incode);
00122 vec get_code();
00124 int get_period() { return N; }
00125 protected:
00127 vec code;
00129 int N;
00130 };
00131
00152 class Spread_2d
00153 {
00154 public:
00156 Spread_2d() { }
00158 Spread_2d(const vec &incodeI, const vec &incodeQ);
00160 void spread(const cvec &symbols, cvec &out);
00162 cvec spread(const cvec &symbols) { cvec out; spread(symbols, out); return out; }
00166 void despread(const cvec &rec_signal, cvec &out, int timing);
00170 cvec despread(const cvec &rec_signal, int timing)
00171 { cvec out; despread(rec_signal, out, timing); return out; }
00173 void set_code(const vec &incodeI, const vec &incodeQ);
00175 vec get_codeI();
00177 vec get_codeQ();
00179 int get_period() { return spreadI.get_period(); }
00180 protected:
00183 Spread_1d spreadI, spreadQ;
00185 };
00186
00199 class Multicode_Spread_1d
00200 {
00201 public:
00203 Multicode_Spread_1d() { }
00205 Multicode_Spread_1d(const mat &incodes);
00207 vec spread(const vec &symbols);
00209 vec despread(const vec &receivedsignal, int timing);
00211 void set_codes(const mat &incodes);
00213 mat get_codes();
00215 int get_period() { return N; }
00217 int get_nocodes() { return L; }
00218 protected:
00220 mat codes;
00222 int L;
00224 int N;
00225 };
00226
00247 class Multicode_Spread_2d
00248 {
00249 public:
00251 Multicode_Spread_2d() { }
00253 Multicode_Spread_2d(const mat &incodesI, const mat &incodesQ);
00255 cvec spread(const cvec &symbols);
00257 cvec despread(const cvec &receivedsignal, int timing);
00264 void set_codes(const mat &incodesI, const mat &incodesQ);
00266 mat get_codesI();
00268 mat get_codesQ();
00270 int get_period() { return mcspreadI.get_period(); }
00271 protected:
00274 Multicode_Spread_1d mcspreadI, mcspreadQ;
00276 };
00277
00278 }
00279
00280 #endif // #ifndef SPREAD_H