Guest User

Untitled

a guest
Feb 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. diff --git a/equalizer_lmmse.cpp b/equalizer_lmmse.cpp
  2. index 6e1d818..f8b578e 100644
  3. --- a/equalizer_lmmse.cpp
  4. +++ b/equalizer_lmmse.cpp
  5. @@ -117,55 +117,57 @@ void equalizer_lmmse::build_channel()
  6. add_noise();
  7. }
  8.  
  9. -void equalizer_lmmse::add_bts()
  10. +void equalizer_lmmse::compute_signature(size_t tx, multipath& mp)
  11. {
  12. - for (size_t i = 0; i < base_station::size(); ++i) {
  13. - if (ignore_interference && i != bs_id)
  14. - continue;
  15. + sig_t sig(nr_rx, osr);
  16. + std::vector<ublas::vector<T> > sig_mp(nr_rx);
  17.  
  18. - base_station const& bts = base_station::reg()[i];
  19. + for (size_t rx = 0; rx < nr_rx; ++rx) {
  20. + sig(rx).resize(cest_length);
  21.  
  22. - /* TODO: allow arbitrary precoding matrix (which is currently
  23. - * always the identity) */
  24. + std::vector<T> const& h = mp.front(rx, tx);
  25.  
  26. - multipath& mp = bts.get_multipath(ue_id);
  27. - size_t nr_tx = bts.get_nr_ant();
  28. + sig_mp[rx].resize(filter_length);
  29.  
  30. - for (size_t tx = 0; tx < nr_tx; ++tx) {
  31. - sig_t sig(nr_rx, osr);
  32. - std::vector<ublas::vector<T> > sig_mp(nr_rx);
  33. + int const start = multipath::decimation_filter_delay -
  34. + filter_delay;
  35. + size_t const end = std::min(h.size() - start, filter_length);
  36.  
  37. - for (size_t rx = 0; rx < nr_rx; ++rx) {
  38. - sig(rx).resize(cest_length);
  39. + for (int i = 0; i < -start; ++i)
  40. + sig_mp[rx][i] = 0;
  41.  
  42. - std::vector<T> const& h = mp.front(rx, tx);
  43. + for (size_t i = std::max(0, -start); i < end; ++i)
  44. + sig_mp[rx][i] = h[start + i];
  45.  
  46. - sig_mp[rx].resize(filter_length);
  47. + for (size_t i = end; i < filter_length; ++i)
  48. + sig_mp[rx][i] = 0;
  49.  
  50. - int const start = multipath::decimation_filter_delay
  51. - - filter_delay;
  52. - size_t const end = std::min(h.size() - start,
  53. - filter_length);
  54. + chan_imp_resp(sig(rx), h, cest_delay -
  55. + multipath::decimation_filter_delay);
  56.  
  57. - for (int i = 0; i < -start; ++i)
  58. - sig_mp[rx][i] = 0;
  59. + mp.pop(rx, tx);
  60. + }
  61.  
  62. - for (size_t i = std::max(0, -start); i < end; ++i)
  63. - sig_mp[rx][i] = h[start + i];
  64. + sig_vec.push_back(sig);
  65. + mp_vec.push_back(sig_mp);
  66. +}
  67.  
  68. - for (size_t i = end; i < filter_length; ++i)
  69. - sig_mp[rx][i] = 0;
  70. +void equalizer_lmmse::add_bts()
  71. +{
  72. + for (size_t i = 0; i < base_station::size(); ++i) {
  73. + if (ignore_interference && i != bs_id)
  74. + continue;
  75.  
  76. - chan_imp_resp(sig(rx), mp.front(rx, tx),
  77. - cest_delay -
  78. - multipath::decimation_filter_delay);
  79. + base_station const& bts = base_station::reg()[i];
  80.  
  81. - mp.pop(rx, tx);
  82. - }
  83. + /* TODO: allow arbitrary precoding matrix (which is currently
  84. + * always the identity) */
  85.  
  86. - sig_vec.push_back(sig);
  87. - mp_vec.push_back(sig_mp);
  88. - }
  89. + multipath& mp = bts.get_multipath(ue_id);
  90. + size_t nr_tx = bts.get_nr_ant();
  91. +
  92. + for (size_t tx = 0; tx < nr_tx; ++tx)
  93. + compute_signature(tx, mp);
  94. }
  95. }
  96.  
  97. @@ -263,9 +265,8 @@ void equalizer_lmmse::update_coeff()
  98. size_t const width = sig_vec[j].get_width();
  99.  
  100. sig_vec[j].expand_channel(matrix_range<mat_t>(channel,
  101. - range(0, height),
  102. - range(tx_off, tx_off + width)), filter_length,
  103. - filter_adv);
  104. + range(0, height), range(tx_off, tx_off + width)),
  105. + filter_length, filter_adv);
  106.  
  107. tx_off += width;
  108. }
  109. diff --git a/equalizer_lmmse.h b/equalizer_lmmse.h
  110. index 9446f69..828dc43 100644
  111. --- a/equalizer_lmmse.h
  112. +++ b/equalizer_lmmse.h
  113. @@ -77,6 +77,8 @@ private:
  114. std::ofstream os_debug;
  115. std::ofstream os_debug_snr;
  116.  
  117. + void compute_signature(size_t tx, multipath& mp);
  118. +
  119. public:
  120. template <typename Tfc>
  121. equalizer_lmmse(size_t ue_id, size_t bs_id, float noise_power, Tfc
Add Comment
Please, Sign In to add comment