00001 00033 #ifndef MODULATOR_ND_H 00034 #define MODULATOR_ND_H 00035 00036 #include <itpp/base/vec.h> 00037 #include <itpp/comm/llr.h> 00038 00039 namespace itpp { 00040 00044 // ------------------------- N-dimensional ("MIMO") MODULATOR CLASSES --------------------------------- 00045 00049 class Modulator_ND { 00050 public: 00052 Modulator_ND(LLR_calc_unit llrcalc_in=LLR_calc_unit()) { llrcalc=llrcalc_in; }; 00054 ~Modulator_ND() {}; 00055 00057 int get_dim() { return nt; } 00058 00060 LLR_calc_unit get_llrcalc() const { return llrcalc; } 00061 00063 ivec get_k() { return k; } 00064 00066 ivec get_M() { return M; } 00067 00068 protected: 00070 int nt; 00072 LLR_calc_unit llrcalc; 00074 ivec k; 00076 ivec M; 00078 Vec<bmat> bitmap; 00080 Vec<ivec> bits2symbols; 00081 00083 QLLRvec probabilities(QLLR l); // some abuse of what QLLR stands for... 00084 00086 Vec<QLLRvec> probabilities(QLLRvec &l); // some abuse of what QLLR stands for... 00087 00103 void update_LLR(Vec<QLLRvec> &logP_apriori, QLLRvec &numerator, QLLRvec &denominator, ivec &s, QLLR x); 00104 00120 void update_LLR(Vec<QLLRvec> &logP_apriori, QLLRvec &numerator, QLLRvec &denominator, 00121 int s, QLLR scaled_norm, int j); 00122 00123 }; 00124 00146 class Modulator_NRD : public Modulator_ND { 00147 public: 00149 Modulator_NRD() {}; 00151 ~Modulator_NRD() {}; 00152 00154 Vec<vec> get_symbols() { return symbols; } 00155 00162 vec modulate_bits(const bvec &bits) const; 00163 00190 void map_demod(QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori, double sigma2, mat &H, vec &y); 00191 00197 void map_demod(QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori, double sigma2, vec &h, vec &y); 00198 00199 00201 friend std::ostream &operator<<(std::ostream &os, const Modulator_NRD &mod); 00202 00203 protected: 00204 00206 Vec<vec> symbols; 00207 00220 void update_norm(double &norm, int k, int sold, int snew, vec &ytH, mat &HtH, ivec &s); 00221 }; 00222 00226 std::ostream &operator<<(std::ostream &os, const Modulator_NRD &mod); 00227 00228 00236 class Modulator_NCD : public Modulator_ND { 00237 public: 00239 Modulator_NCD() {}; 00241 ~Modulator_NCD() {}; 00242 00244 Vec<cvec> get_symbols() { return symbols; } 00245 00247 cvec modulate_bits(const bvec &bits) const; 00248 00275 void map_demod(QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori, double sigma2, cmat &H, cvec &y) ; 00276 00282 void map_demod(QLLRvec &LLR_apriori, QLLRvec &LLR_aposteriori, double sigma2, cvec &H, cvec &y) ; 00283 00285 friend std::ostream &operator<<(std::ostream &os, const Modulator_NCD &mod); 00286 00287 protected: 00288 00290 Vec<cvec> symbols; 00291 00292 void update_norm(double &norm, int k, int sold, int snew, cvec &ytH, cmat &HtH, ivec &s); 00293 }; 00294 00298 std::ostream &operator<<(std::ostream &os, const Modulator_NCD &mod); 00299 00336 class ND_UPAM : public Modulator_NRD { 00337 public: 00339 ND_UPAM(int nt_in=1, int Mary=2); 00341 ~ND_UPAM() {}; 00342 00344 void set_Gray_PAM(int nt_in=1, int Mary=2); 00345 00347 void set_Gray_PAM(int nt_in=1, ivec Mary="2"); 00348 00369 int sphere_decoding(vec &y, mat &H, double rmin, double rmax, 00370 double stepup, QLLRvec &detected_bits); 00371 00373 void ZF_demod(QLLRvec &detected_bits, double sigma2, mat &H, vec &y); 00374 00376 void MMSE_demod(QLLRvec &detected_bits, double sigma2, mat &H, vec &y); 00377 00378 00379 private: 00380 // Sphere decoding search with Schnorr Eucner strategy. 00381 int sphere_search_SE(vec &y_in, mat &H, imat &zrange, double r, ivec &zhat); 00382 00383 vec spacing; // spacing between the constellation points 00384 00385 }; 00386 00387 00389 class ND_UQAM : public Modulator_NCD { 00390 public: 00392 ND_UQAM(int nt_in=1, int Mary=4); 00394 ~ND_UQAM() {}; 00395 00397 void set_Gray_QAM(int nt_in=1, int Mary=4); 00398 00400 void set_Gray_QAM(int nt_in=1, ivec Mary="4"); 00401 00402 00403 protected: 00404 ivec L; // the square root of M 00405 00406 }; 00407 00408 00410 class ND_UPSK : public Modulator_NCD { 00411 public: 00413 ND_UPSK(int nt_in=1, int Mary=2); 00415 ~ND_UPSK() {}; 00416 00418 void set_Gray_PSK(int nt_in=1, int Mary=4); 00419 00421 void set_Gray_PSK(int nt_in=1, ivec Mary="4"); 00422 }; 00423 00424 00425 } // namespace itpp 00426 00427 #endif // #ifndef MODULATOR_ND_H 00428
Generated on Sat Aug 25 23:40:27 2007 for IT++ by Doxygen 1.5.2