8 #ifndef SRC_INCLUDE_AVERAGE_H_     9 #define SRC_INCLUDE_AVERAGE_H_    65 std::pair<std::vector<T>, std::vector<T>> 
dedup_avg(
const std::vector<T>& x,
    66                                                     const std::vector<T>& y) {
    67   if (x.size() != y.size()) {
    69     ss << 
"x and y have to be of same size: " << x.size() << 
" != " << y.size();
    70     throw std::runtime_error(ss.str());
    73     throw std::runtime_error(
"x cannot be empty.");
    76   new_x.reserve(x.size());
    78   new_y.reserve(y.size());
    81   for (
size_t i = 0; i < x.size(); i++) {
    86       new_x.push_back(x[i - 1]);
    93   new_x.push_back(x.back());
    95   return std::make_pair(std::move(new_x), std::move(new_y));
   100 #endif  // SRC_INCLUDE_AVERAGE_H_ Calculate an average value incrementally. 
 
void clear()
Reset the average to 0. 
 
void add(T x)
Add a value x to the set of numbers defining the average. 
 
uint64_t number_of_values() const 
 
std::pair< std::vector< T >, std::vector< T > > dedup_avg(const std::vector< T > &x, const std::vector< T > &y)
Remove duplicates from data (x, y) by averaging y. 
 
Average()
Create a new object to calculate an average.