IT++ Logo

modulator_nd.h

Go to the documentation of this file.
00001 
00030 #ifndef MODULATOR_ND_H
00031 #define MODULATOR_ND_H
00032 
00033 #include <itpp/base/vec.h>
00034 #include <itpp/base/array.h>
00035 #include <itpp/comm/llr.h>
00036 
00037 namespace itpp
00038 {
00039 
00044 // ----------------------------------------------------------------------
00045 // Modulator_ND
00046 // ----------------------------------------------------------------------
00047 
00059 class Modulator_ND
00060 {
00061 public:
00063   enum Soft_Demod_Method {
00065     FULL_ENUM_LOGMAP,
00067     ZF_LOGMAP
00068   };
00069 
00071   Modulator_ND(LLR_calc_unit llrcalc_in = LLR_calc_unit()):
00072       llrcalc(llrcalc_in) {}
00074   ~Modulator_ND() {}
00075 
00077   void set_llrcalc(LLR_calc_unit llrcalc_in) { llrcalc = llrcalc_in; };
00078 
00080   LLR_calc_unit get_llrcalc() const { return llrcalc; }
00081 
00083   int get_dim() const { return nt; }
00084 
00086   ivec get_k() const { return k; }
00087 
00089   ivec get_M() const { return M; }
00090 
00091 protected:
00093   int nt;
00095   LLR_calc_unit llrcalc;
00097   ivec k;
00099   ivec M;
00101   Array<bmat> bitmap;
00103   Array<ivec> bits2symbols;
00104 
00106   QLLRvec probabilities(QLLR l); // some abuse of what QLLR stands for...
00107 
00109   Array<QLLRvec> probabilities(const QLLRvec &l);
00110 
00129   void update_LLR(const Array<QLLRvec> &logP_apriori, const ivec &s,
00130                   QLLR scaled_norm, QLLRvec &num, QLLRvec &denom);
00131 
00151   void update_LLR(const Array<QLLRvec> &logP_apriori, int s,
00152                   QLLR scaled_norm, int j, QLLRvec &num, QLLRvec &denom);
00153 };
00154 
00155 
00156 // ----------------------------------------------------------------------
00157 // Modulator_NRD
00158 // ----------------------------------------------------------------------
00159 
00184 class Modulator_NRD : public Modulator_ND
00185 {
00186 public:
00188   Modulator_NRD() {}
00190   ~Modulator_NRD() {}
00191 
00193   Array<vec> get_symbols() const { return symbols; }
00194 
00196   void modulate_bits(const bvec &bits, vec &symbols) const;
00197 
00199   vec modulate_bits(const bvec &bits) const;
00200 
00219   void demodulate_soft_bits(const vec &y, const mat &H, double sigma2,
00220                             const QLLRvec &LLR_apriori,
00221                             QLLRvec &LLR_aposteriori,
00222                             Soft_Demod_Method method);
00223 
00242   QLLRvec demodulate_soft_bits(const vec &y, const mat &H, double sigma2,
00243                                const QLLRvec &LLR_apriori,
00244                                Soft_Demod_Method method);
00245 
00274   void demodulate_soft_bits(const vec &y, const mat &H, double sigma2,
00275                             const QLLRvec &LLR_apriori,
00276                             QLLRvec &LLR_aposteriori);
00277 
00285   void demodulate_soft_bits(const vec &y, const vec &h, double sigma2,
00286                             const QLLRvec &LLR_apriori,
00287                             QLLRvec &LLR_aposteriori);
00288 
00289 
00291   friend std::ostream &operator<<(std::ostream &os, const Modulator_NRD &m);
00292 
00293 protected:
00295   Array<vec> symbols;
00296 
00311   void update_norm(double &norm, int k, int sold, int snew, const vec &ytH,
00312                    const mat &HtH, const ivec &s);
00313 };
00314 
00319 std::ostream &operator<<(std::ostream &os, const Modulator_NRD &m);
00320 
00321 
00322 // ----------------------------------------------------------------------
00323 // Modulator_NCD
00324 // ----------------------------------------------------------------------
00325 
00336 class Modulator_NCD : public Modulator_ND
00337 {
00338 public:
00340   Modulator_NCD() {}
00342   ~Modulator_NCD() {}
00343 
00345   Array<cvec> get_symbols() const { return symbols; }
00346 
00348   void modulate_bits(const bvec &bits, cvec &symbols) const;
00349 
00351   cvec modulate_bits(const bvec &bits) const;
00352 
00354 
00373   void demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2,
00374                             const QLLRvec &LLR_apriori,
00375                             QLLRvec &LLR_aposteriori,
00376                             Soft_Demod_Method method);
00377 
00397   QLLRvec demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2,
00398                                const QLLRvec &LLR_apriori,
00399                                Soft_Demod_Method method);
00400 
00429   void demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2,
00430                             const QLLRvec &LLR_apriori,
00431                             QLLRvec &LLR_aposteriori);
00432 
00440   void demodulate_soft_bits(const cvec &y, const cvec &H, double sigma2,
00441                             const QLLRvec &LLR_apriori,
00442                             QLLRvec &LLR_aposteriori);
00443 
00445   friend std::ostream &operator<<(std::ostream &os, const Modulator_NCD &m);
00446 
00447 protected:
00449   Array<cvec> symbols;
00450 
00465   void update_norm(double &norm, int k, int sold, int snew, const cvec &ytH,
00466                    const cmat &HtH, const ivec &s);
00467 };
00468 
00473 std::ostream &operator<<(std::ostream &os, const Modulator_NCD &m);
00474 
00475 
00476 // ----------------------------------------------------------------------
00477 // ND_UPAM
00478 // ----------------------------------------------------------------------
00479 
00518 class ND_UPAM : public Modulator_NRD
00519 {
00520 public:
00522   ND_UPAM(int nt = 1, int Mary = 2);
00524   ~ND_UPAM() {}
00525 
00527   void set_M(int nt = 1, int Mary = 2);
00528 
00530   void set_M(int nt = 1, ivec Mary = "2");
00531 
00555   int sphere_decoding(const vec &y, const mat &H, double rmin, double rmax,
00556                       double stepup, QLLRvec &detected_bits);
00557 
00558 private:
00559   // Sphere decoding search with Schnorr Eucner strategy.
00560   int sphere_search_SE(const vec &y, const mat &H, const imat &zrange,
00561                        double r, ivec &zhat);
00562 
00563   vec spacing;  // spacing between the constellation points
00564 
00565   inline int sign_nozero_i(int a) { return (a > 0 ? 1 : -1); }
00566   inline int sign_nozero_i(double a) { return (a > 0.0 ? 1 : -1); }
00567 };
00568 
00569 // ----------------------------------------------------------------------
00570 // ND_UQAM
00571 // ----------------------------------------------------------------------
00572 
00577 class ND_UQAM : public Modulator_NCD
00578 {
00579 public:
00581   ND_UQAM(int nt = 1, int Mary = 4);
00583   ~ND_UQAM() {}
00584 
00586   void set_M(int nt = 1, int Mary = 4);
00587 
00589   void set_M(int nt = 1, ivec Mary = "4");
00590 
00591 protected:
00592   ivec L;  
00593 };
00594 
00595 // ----------------------------------------------------------------------
00596 // ND_UPSK
00597 // ----------------------------------------------------------------------
00598 
00603 class ND_UPSK : public Modulator_NCD
00604 {
00605 public:
00607   ND_UPSK(int nt = 1, int Mary = 4);
00609   ~ND_UPSK() {}
00610 
00612   void set_M(int nt = 1, int Mary = 4);
00613 
00615   void set_M(int nt = 1, ivec Mary = "4");
00616 };
00617 
00618 
00619 } // namespace itpp
00620 
00621 #endif // #ifndef MODULATOR_ND_H
00622 
SourceForge Logo

Generated on Sun Jul 26 08:54:28 2009 for IT++ by Doxygen 1.5.9