Changeset 916 for trunk/yat/statistics/AveragerWeighted.h
 Timestamp:
 Sep 30, 2007, 2:50:10 AM (14 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/yat/statistics/AveragerWeighted.h
r915 r916 83 83 84 84 /// 85 /// Adding each value in an array \a x and corresponding value in86 /// weight array \a w.87 ///88 /// The requirements for the types T1 and T2 of the arrays \a x89 /// and \a w are: operator[] returning an element and function90 /// size() returning the number of elements.91 ///92 template <typename T1, typename T2>93 void add_values(const T1& x, const T2& w);94 95 ///96 85 /// @brief Calculate the weighted mean 97 86 /// … … 221 210 222 211 /** 223 \brief adding a range sof values to AveragerWeighted \a a212 \brief adding a range of values to AveragerWeighted \a a 224 213 */ 225 214 template <typename Iter> … … 230 219 } 231 220 232 // Template implementations 233 template <typename T1, typename T2> 234 void AveragerWeighted::add_values(const T1& x, const T2& w) 221 /** 222 \brief add values from two ranges to AveragerWeighted \a a 223 224 Add data from range [first1, last1) with their corresponding 225 weight in range [first2, first2 + distance(first, last) ). 226 227 Requirement: Iter1 and Iter2 are unweighted iterators. 228 */ 229 template <typename Iter1, typename Iter2> 230 void add(AveragerWeighted& a, Iter1 first1, Iter1 last1, Iter2 first2) 235 231 { 236 for (size_t i=0; i<x.size(); i++) 237 add(x[i],w[i]); 232 utility::check_iterator_is_unweighted(first1); 233 utility::check_iterator_is_unweighted(first2); 234 for ( ; first1 != last1; ++first1, ++first2) 235 a.add(*first1, *first2); 238 236 } 239 237 240 ///241 /// The AveragerWeighted output operator242 ///243 ///std::ostream& operator<<(std::ostream& s,const AveragerWeighted&);244 245 238 }}} // of namespace statistics, yat, and theplu 246 239
Note: See TracChangeset
for help on using the changeset viewer.