Ignore:
Timestamp:
Oct 5, 2007, 11:15:07 PM (14 years ago)
Author:
Peter
Message:

mad function now takes iterators

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/statistics/utility.cc

    r932 r933  
    4848  }
    4949
    50   double mad(const utility::vector& vec, const bool sorted)
    51   {
    52     double m = median(vec.begin(), vec.end(), sorted);
    53     std::vector<double> ad;
    54     ad.reserve(vec.size());
    55     for (size_t i = 0; i<vec.size(); ++i)
    56       ad.push_back(fabs(vec[i]-m));
    57     std::sort(ad.begin(), ad.end());
    58     return median(ad.begin(), ad.end(),true);
    59   }
    60  
    6150
    6251  double skewness(const utility::vector& v)
Note: See TracChangeset for help on using the changeset viewer.