IT++ Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
modulator_nd.h
Go to the documentation of this file.
1 
29 #ifndef MODULATOR_ND_H
30 #define MODULATOR_ND_H
31 
32 #include <itpp/base/vec.h>
33 #include <itpp/base/array.h>
34 #include <itpp/comm/llr.h>
35 
36 namespace itpp
37 {
38 
43 // ----------------------------------------------------------------------
44 // Modulator_ND
45 // ----------------------------------------------------------------------
46 
62 {
63 public:
70  };
71 
74  llrcalc(llrcalc_in) {}
77 
79  void set_llrcalc(LLR_calc_unit llrcalc_in) { llrcalc = llrcalc_in; };
80 
82  LLR_calc_unit get_llrcalc() const { return llrcalc; }
83 
85  int get_dim() const { return nt; }
86 
88  ivec get_k() const { return k; }
89 
91  ivec get_M() const { return M; }
92 
93 protected:
95  int nt;
99  ivec k;
101  ivec M;
106 
108  QLLRvec probabilities(QLLR l); // some abuse of what QLLR stands for...
109 
111  Array<QLLRvec> probabilities(const QLLRvec &l);
112 
131  void update_LLR(const Array<QLLRvec> &logP_apriori, const ivec &s,
132  QLLR scaled_norm, QLLRvec &num, QLLRvec &denom);
133 
153  void update_LLR(const Array<QLLRvec> &logP_apriori, int s,
154  QLLR scaled_norm, int j, QLLRvec &num, QLLRvec &denom);
155 };
156 
157 
158 // ----------------------------------------------------------------------
159 // Modulator_NRD
160 // ----------------------------------------------------------------------
161 
190 {
191 public:
196 
198  Array<vec> get_symbols() const { return symbols; }
199 
201  void modulate_bits(const bvec &bits, vec &symbols) const;
202 
204  vec modulate_bits(const bvec &bits) const;
205 
224  void demodulate_soft_bits(const vec &y, const mat &H, double sigma2,
225  const QLLRvec &LLR_apriori,
226  QLLRvec &LLR_aposteriori,
227  Soft_Demod_Method method);
228 
247  QLLRvec demodulate_soft_bits(const vec &y, const mat &H, double sigma2,
248  const QLLRvec &LLR_apriori,
249  Soft_Demod_Method method);
250 
279  void demodulate_soft_bits(const vec &y, const mat &H, double sigma2,
280  const QLLRvec &LLR_apriori,
281  QLLRvec &LLR_aposteriori);
282 
290  void demodulate_soft_bits(const vec &y, const vec &h, double sigma2,
291  const QLLRvec &LLR_apriori,
292  QLLRvec &LLR_aposteriori);
293 
294 
296  friend std::ostream &operator<<(std::ostream &os, const Modulator_NRD &m);
297 
298 protected:
301 
316  void update_norm(double &norm, int k, int sold, int snew, const vec &ytH,
317  const mat &HtH, const ivec &s);
318 };
319 
324 std::ostream &operator<<(std::ostream &os, const Modulator_NRD &m);
325 
326 
327 // ----------------------------------------------------------------------
328 // Modulator_NCD
329 // ----------------------------------------------------------------------
330 
345 {
346 public:
351 
353  Array<cvec> get_symbols() const { return symbols; }
354 
356  void modulate_bits(const bvec &bits, cvec &symbols) const;
357 
359  cvec modulate_bits(const bvec &bits) const;
360 
362 
381  void demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2,
382  const QLLRvec &LLR_apriori,
383  QLLRvec &LLR_aposteriori,
384  Soft_Demod_Method method);
385 
405  QLLRvec demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2,
406  const QLLRvec &LLR_apriori,
407  Soft_Demod_Method method);
408 
437  void demodulate_soft_bits(const cvec &y, const cmat &H, double sigma2,
438  const QLLRvec &LLR_apriori,
439  QLLRvec &LLR_aposteriori);
440 
448  void demodulate_soft_bits(const cvec &y, const cvec &H, double sigma2,
449  const QLLRvec &LLR_apriori,
450  QLLRvec &LLR_aposteriori);
451 
453  friend std::ostream &operator<<(std::ostream &os, const Modulator_NCD &m);
454 
455 protected:
458 
473  void update_norm(double &norm, int k, int sold, int snew, const cvec &ytH,
474  const cmat &HtH, const ivec &s);
475 };
476 
481 std::ostream &operator<<(std::ostream &os, const Modulator_NCD &m);
482 
483 
484 // ----------------------------------------------------------------------
485 // ND_UPAM
486 // ----------------------------------------------------------------------
487 
529 class ND_UPAM : public Modulator_NRD
530 {
531 public:
533  ND_UPAM(int nt = 1, int Mary = 2);
535  ~ND_UPAM() {}
536 
538  void set_M(int nt = 1, int Mary = 2);
539 
541  void set_M(int nt = 1, ivec Mary = "2");
542 
566  int sphere_decoding(const vec &y, const mat &H, double rmin, double rmax,
567  double stepup, QLLRvec &detected_bits);
568 
569 private:
570  // Sphere decoding search with Schnorr Eucner strategy.
571  int sphere_search_SE(const vec &y, const mat &H, const imat &zrange,
572  double r, ivec &zhat);
573 
574  vec spacing; // spacing between the constellation points
575 
576  inline int sign_nozero_i(int a) { return (a > 0 ? 1 : -1); }
577  inline int sign_nozero_i(double a) { return (a > 0.0 ? 1 : -1); }
578 };
579 
580 // ----------------------------------------------------------------------
581 // ND_UQAM
582 // ----------------------------------------------------------------------
583 
591 class ND_UQAM : public Modulator_NCD
592 {
593 public:
595  ND_UQAM(int nt = 1, int Mary = 4);
597  ~ND_UQAM() {}
598 
600  void set_M(int nt = 1, int Mary = 4);
601 
603  void set_M(int nt = 1, ivec Mary = "4");
604 
605 protected:
606  ivec L;
607 };
608 
609 // ----------------------------------------------------------------------
610 // ND_UPSK
611 // ----------------------------------------------------------------------
612 
620 class ND_UPSK : public Modulator_NCD
621 {
622 public:
624  ND_UPSK(int nt = 1, int Mary = 4);
626  ~ND_UPSK() {}
627 
629  void set_M(int nt = 1, int Mary = 4);
630 
632  void set_M(int nt = 1, ivec Mary = "4");
633 };
634 
635 
636 } // namespace itpp
637 
638 #endif // #ifndef MODULATOR_ND_H
639 
SourceForge Logo

Generated on Fri Mar 21 2014 17:14:13 for IT++ by Doxygen 1.8.1.2