Changeset 1043 for trunk/yat/statistics
- Timestamp:
- Feb 6, 2008, 8:30:03 PM (16 years ago)
- Location:
- trunk/yat/statistics
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/statistics/AveragerPair.h
r1000 r1043 70 70 void add(const double x, const double y, const unsigned long n=1); 71 71 72 /// 73 /// Adding pairs of arrays with data points \a x and \a y. 74 /// 75 /// The requirements for the types T1 and T2 of the arrays \a x 76 /// and \a y are: operator[] returning an element and function 77 /// size() returning the number of elements. 78 /// 79 template <typename T1, typename T2> 80 void add_values(const T1& x, const T2& y); 81 82 /// 83 /// \f$ \frac{\sum_i (x_i-m_x)(y_i-m_y)}{\sum_i 84 /// (x_i-m_x)^2+\sum_i (y_i-m_y)^2 + n(m_x-m_y)^2} \f$ 85 /// 86 /// In case of a zero denominator - zero is returned. 87 /// 88 /// @return Concordence correlation coefficient. 89 /// 72 /** 73 \f$ \frac{\sum_i (x_i-m_x)(y_i-m_y)}{\sum_i 74 (x_i-m_x)^2+\sum_i (y_i-m_y)^2 + n(m_x-m_y)^2} \f$ 75 76 In case of a zero denominator - zero is returned. 77 78 @return Concordence correlation coefficient. 79 */ 90 80 double ccc(void) const; 91 81 … … 172 162 173 163 /** 174 \brief adding a ranges of values to AveragerPair \a ap164 \brief adding data from two ranges to AveragerPair \a ap 175 165 */ 176 166 template <class Iter1, class Iter2> … … 184 174 185 175 186 // Template implementations187 template <typename T1, typename T2>188 void AveragerPair::add_values(const T1& x, const T2& y)189 {190 for (size_t i=0; i<x.size(); i++)191 add(x[i],y[i]);192 }193 194 195 176 }}} // of namespace statistics, yat, and theplu 196 177 -
trunk/yat/statistics/AveragerPairWeighted.cc
r1000 r1043 58 58 wxy_ += w*x*y; 59 59 w_ +=w; 60 }61 62 63 void AveragerPairWeighted::add(const classifier::DataLookup1D& x,64 const classifier::DataLookupWeighted1D& y)65 {66 assert(x.size()==y.size());67 for (size_t i=0; i<x.size(); ++i)68 add(x(i), y.data(i), 1.0, y.weight(i));69 }70 71 72 void AveragerPairWeighted::add(const classifier::DataLookupWeighted1D& x,73 const classifier::DataLookup1D& y)74 {75 add(y,x);76 }77 78 79 void AveragerPairWeighted::add(const classifier::DataLookupWeighted1D& x,80 const classifier::DataLookupWeighted1D& y)81 {82 assert(x.size()==y.size());83 for (size_t i=0; i<x.size(); ++i)84 add(x.data(i), y.data(i), x.weight(i), y.weight(i));85 60 } 86 61 -
trunk/yat/statistics/AveragerPairWeighted.h
r1009 r1043 73 73 void add(const double x, const double y, 74 74 const double wx, const double wy); 75 76 ///77 /// Adding two sequences of data @a x and @a y. The data78 /// should be paired so \f$ x(i) \f$ is associated to \f$ y(i) \f$79 /// @a x will be treated as having all weights equal to unity80 ///81 void add(const classifier::DataLookup1D& x,82 const classifier::DataLookupWeighted1D& y);83 84 ///85 /// Adding two sequences of data @a x and @a y. The data should be86 /// paired so \f$ x(i) \f$ is associated to \f$ y(i) \f$87 /// @a y will be treated as having all weights equal to unity88 ///89 void add(const classifier::DataLookupWeighted1D& x,90 const classifier::DataLookup1D& y);91 92 ///93 /// Adding two sequences of weighted data @a x and @a y. The data94 /// should be paired so \f$ x(i) \f$ is associated to \f$ y(i) \f$95 ///96 void add(const classifier::DataLookupWeighted1D& x,97 const classifier::DataLookupWeighted1D& y);98 99 ///100 /// Adding pair of data and corresponding pair of weights in arrays101 ///102 ///103 /// The requirements for the types T1, T2, T3 and T4 of the arrays104 /// are: operator[] returning an element and function /// size()105 /// returning the number of elements.106 ///107 template <typename T1,typename T2,typename T3,typename T4>108 void add_values(const T1& x,109 const T2& y,110 const T3& wx,111 const T4& wy);112 75 113 76 /// … … 194 157 195 158 196 template <typename T1,typename T2,typename T3,typename T4> 197 void AveragerPairWeighted::add_values(const T1& x, 198 const T2& y, 199 const T3& wx, 200 const T4& wy) 159 /** 160 \brief adding four ranges of values to AveragerPairWeighted \a ap 161 */ 162 template <class Iter1, class Iter2, class Iter3, class Iter4> 163 void add(AveragerPairWeighted& ap, Iter1 x, Iter1 xlast, Iter2 y, Iter3 wx, 164 Iter4 wy) 201 165 { 202 for (size_t i=0; i<x.size(); ++i){ 203 utility::yat_assert<std::runtime_error>(!std::isnan(x(i))); 204 add(x[i],y[i],wx[i],wy[i]); 166 utility::check_iterator_is_unweighted(x); 167 utility::check_iterator_is_unweighted(y); 168 utility::check_iterator_is_unweighted(wx); 169 utility::check_iterator_is_unweighted(wy); 170 while (x!=xlast) { 171 ap.add(*x, *y, *wx, *wy); 172 ++x; 173 ++y; 174 ++wx; 175 ++wy; 205 176 } 206 177 } 178 207 179 208 180 }}} // of namespace statistics, yat, and theplu -
trunk/yat/statistics/AveragerWeighted.h
r1000 r1043 211 211 /** 212 212 \brief adding a range of values to AveragerWeighted \a a 213 214 If iterator is non-weighted unitary weights are used. 213 215 */ 214 216 template <typename Iter>
Note: See TracChangeset
for help on using the changeset viewer.