IT++ Logo
modulator_nd.h
Go to the documentation of this file.
00001 
00029 #ifndef MODULATOR_ND_H
00030 #define MODULATOR_ND_H
00031 
00032 #include <itpp/base/vec.h>
00033 #include <itpp/base/array.h>
00034 #include <itpp/comm/llr.h>
00035 
00036 namespace itpp
00037 {
00038 
00043 // ----------------------------------------------------------------------
00044 // Modulator_ND
00045 // ----------------------------------------------------------------------
00046 
00061 class Modulator_ND
00062 {
00063 public:
00065   enum Soft_Demod_Method {
00067     FULL_ENUM_LOGMAP,
00069     ZF_LOGMAP
00070   };
00071 
00073   Modulator_ND(LLR_calc_unit llrcalc_in = LLR_calc_unit()):
00074       llrcalc(llrcalc_in) {}
00076   ~Modulator_ND() {}
00077 
00079   void set_llrcalc(LLR_calc_unit llrcalc_in) { llrcalc = llrcalc_in; };
00080 
00082   LLR_calc_unit get_llrcalc() const { return llrcalc; }
00083 
00085   int get_dim() const { return nt; }
00086 
00088   ivec get_k() const { return k; }
00089 
00091   ivec get_M() const { return M; }
00092 
00093 protected:
00095   int nt;
00097   LLR_calc_unit llrcalc;
00099   ivec k;
00101   ivec M;
00103   Array<bmat> bitmap;
00105   Array<ivec> bits2symbols;
00106 
00108   QLLRvec probabilities(QLLR l); // some abuse of what QLLR stands for...
00109 
00111   Array<QLLRvec> probabilities(const QLLRvec &l);
00112 
00131   void update_LLR(const Array<QLLRvec> &logP_apriori, const ivec &s,
00132                   QLLR scaled_norm, QLLRvec &num, QLLRvec &denom);
00133 
00153   void update_LLR(const Array<QLLRvec> &logP_apriori, int s,
00154                   QLLR scaled_norm, int j, QLLRvec &num, QLLRvec &denom);
00155 };
00156 
00157 
00158 // ----------------------------------------------------------------------
00159 // Modulator_NRD
00160 // ----------------------------------------------------------------------
00161 
00189 class Modulator_NRD : public Modulator_ND
00190 {
00191 public:
00193   Modulator_NRD() {}
00195   ~Modulator_NRD() {}
00196 
00198   Array<vec> get_symbols() const { return symbols; }
00199 
00201   void modulate_bits(const bvec &bits, vec &symbols) const;
00202 
00204   vec modulate_bits(const bvec &bits) const;
00205 
00224   void demodulate_soft_bits(const vec &y, const mat &H, double sigma2,
00225                             const QLLRvec &LLR_apriori,
00226                             QLLRvec &LLR_aposteriori,
00227                             Soft_Demod_Method method);
00228 
00247   QLLRvec demodulate_soft_bits(const vec &y, const mat &H, double sigma2,
00248                                const QLLRvec &LLR_apriori,
00249                                Soft_Demod_Method method);
00250 
00279   void demodulate_soft_bits(const vec &y, const mat &H, double sigma2,
00280                             const QLLRvec &LLR_apriori,
00281                             QLLRvec &LLR_aposteriori);
00282 
00290   void demodulate_soft_bits(const vec &y, const vec &h, double sigma2,
00291                             const QLLRvec &LLR_apriori,
00292                             QLLRvec &LLR_aposteriori);
00293 
00294 
00296   friend std::ostream &operator<<(std::ostream &os, const Modulator_NRD &m);
00297 
00298 protected:
00300   Array<vec> symbols;
00301 
00316   void update_norm(double &norm, int k, int sold, int snew, const vec &ytH,
00317                    const mat &HtH, const ivec &s);
00318 };
00319 
00324 std::ostream &operator<<(std::ostream &os, const Modulator_NRD &m);
00325 
00326 
00327 // ----------------------------------------------------------------------
00328 // Modulator_NCD
00329 // ----------------------------------------------------------------------
00330 
00344 class Modulator_NCD : public Modulator_ND
00345 {
00346 public:
00348   Modulator_NCD() {}
00350   ~Modulator_NCD() {}
00351 
00353   Array<cvec> get_symbols() const { return symbols; }
00354 
00356   void modulate_bits(const bvec &bits, cvec &symbols) const;
00357 
00359   cvec modulate_bits(const bvec &bits) const;
00360 
00362 
00381   void demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2,
00382                             const QLLRvec &LLR_apriori,
00383                             QLLRvec &LLR_aposteriori,
00384                             Soft_Demod_Method method);
00385 
00405   QLLRvec demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2,
00406                                const QLLRvec &LLR_apriori,
00407                                Soft_Demod_Method method);
00408 
00437   void demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2,
00438                             const QLLRvec &LLR_apriori,
00439                             QLLRvec &LLR_aposteriori);
00440 
00448   void demodulate_soft_bits(const cvec &y, const cvec &H, double sigma2,
00449                             const QLLRvec &LLR_apriori,
00450                             QLLRvec &LLR_aposteriori);
00451 
00453   friend std::ostream &operator<<(std::ostream &os, const Modulator_NCD &m);
00454 
00455 protected:
00457   Array<cvec> symbols;
00458 
00473   void update_norm(double &norm, int k, int sold, int snew, const cvec &ytH,
00474                    const cmat &HtH, const ivec &s);
00475 };
00476 
00481 std::ostream &operator<<(std::ostream &os, const Modulator_NCD &m);
00482 
00483 
00484 // ----------------------------------------------------------------------
00485 // ND_UPAM
00486 // ----------------------------------------------------------------------
00487 
00529 class ND_UPAM : public Modulator_NRD
00530 {
00531 public:
00533   ND_UPAM(int nt = 1, int Mary = 2);
00535   ~ND_UPAM() {}
00536 
00538   void set_M(int nt = 1, int Mary = 2);
00539 
00541   void set_M(int nt = 1, ivec Mary = "2");
00542 
00566   int sphere_decoding(const vec &y, const mat &H, double rmin, double rmax,
00567                       double stepup, QLLRvec &detected_bits);
00568 
00569 private:
00570   // Sphere decoding search with Schnorr Eucner strategy.
00571   int sphere_search_SE(const vec &y, const mat &H, const imat &zrange,
00572                        double r, ivec &zhat);
00573 
00574   vec spacing;  // spacing between the constellation points
00575 
00576   inline int sign_nozero_i(int a) { return (a > 0 ? 1 : -1); }
00577   inline int sign_nozero_i(double a) { return (a > 0.0 ? 1 : -1); }
00578 };
00579 
00580 // ----------------------------------------------------------------------
00581 // ND_UQAM
00582 // ----------------------------------------------------------------------
00583 
00591 class ND_UQAM : public Modulator_NCD
00592 {
00593 public:
00595   ND_UQAM(int nt = 1, int Mary = 4);
00597   ~ND_UQAM() {}
00598 
00600   void set_M(int nt = 1, int Mary = 4);
00601 
00603   void set_M(int nt = 1, ivec Mary = "4");
00604 
00605 protected:
00606   ivec L;  
00607 };
00608 
00609 // ----------------------------------------------------------------------
00610 // ND_UPSK
00611 // ----------------------------------------------------------------------
00612 
00620 class ND_UPSK : public Modulator_NCD
00621 {
00622 public:
00624   ND_UPSK(int nt = 1, int Mary = 4);
00626   ~ND_UPSK() {}
00627 
00629   void set_M(int nt = 1, int Mary = 4);
00630 
00632   void set_M(int nt = 1, ivec Mary = "4");
00633 };
00634 
00635 
00636 } // namespace itpp
00637 
00638 #endif // #ifndef MODULATOR_ND_H
00639 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
SourceForge Logo

Generated on Wed Jul 27 2011 16:27:05 for IT++ by Doxygen 1.7.4