示例#1
0
void prof_burst::updateresults(libbase::vector<double>& result,
      const libbase::vector<int>& source, const libbase::vector<int>& decoded) const
   {
   assert(source.size() == get_symbolsperblock());
   assert(decoded.size() == get_symbolsperblock());
   // Update the relevant count for every symbol in error
   // Check the first symbol first
   assert(source(0) != fsm::tail);
   if (source(0) != decoded(0))
      result(0)++;
   // For each remaining symbol
   for (int t = 1; t < get_symbolsperblock(); t++)
      {
      if (source(t - 1) != decoded(t - 1))
         result(3)++;
      assert(source(t) != fsm::tail);
      if (source(t) != decoded(t))
         {
         // Keep separate counts, depending on whether the previous symbol was in error
         if (source(t - 1) != decoded(t - 1))
            result(2)++;
         else
            result(1)++;
         }
      }
   }
void experiment_normal::accumulate_state(const libbase::vector<double>& state)
   {
   assert(state.size() > 0);
   // divide state into constituent components and accumulate
   const int n = state.size() / 2;
   assert(state.size() == 2 * n);
   safe_accumulate(sum, state.extract(0, n));
   safe_accumulate(sumsq, state.extract(n, n));
   }
示例#3
0
void lut_interleaver<real>::transform(const libbase::vector<int>& in,
      libbase::vector<int>& out) const
   {
   const int tau = lut.size();
   assertalways(in.size() == tau);
   out.init(in.size());
   for (int t = 0; t < tau; t++)
      if (lut(t) == fsm::tail)
         out(t) = fsm::tail;
      else
         out(t) = in(lut(t));
   }
void experiment_binomial::derived_accumulate(
      const libbase::vector<double>& result)
   {
   assert(result.size() > 0);
   // accumulate results
   safe_accumulate(sum, result);
   }
void experiment_normal::derived_accumulate(
      const libbase::vector<double>& result)
   {
   assert(result.size() > 0);
   // accumulate results
   libbase::vector<double> sample = result;
   safe_accumulate(sum, sample);
   sample.apply(square);
   safe_accumulate(sumsq, sample);
   }
示例#6
0
void ccbfsm::reset(const libbase::vector<int>& state)
   {
   fsm::reset(state);
   assert(state.size() == nu);
   reg = 0;
   int j = 0;
   for (int t = 0; t < nu; t++)
      for (int i = 0; i < k; i++)
         if (reg(i).size() > t)
            reg(i) |= bitfield(state(j++) << t, reg(i).size());
   assert(j == nu);
   }
void experiment_binomial::accumulate_state(const libbase::vector<double>& state)
   {
   assert(state.size() > 0);
   // accumulate results from saved state
   safe_accumulate(sum, state);
   }