Changeset 672 for trunk/c++_tools/statistics/utility.cc
- Timestamp:
- Oct 7, 2006, 8:44:31 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/c++_tools/statistics/utility.cc
r616 r672 17 17 return p; 18 18 } 19 20 double mad(const utility::vector& vec, const bool sorted) 21 { 22 double m = median(vec, sorted); 23 std::vector<double> ad; 24 ad.reserve(vec.size()); 25 for (size_t i = 0; i<vec.size(); ++i) 26 ad.push_back(fabs(vec[i]-m)); 27 std::sort(ad.begin(), ad.end()); 28 return median(ad,true); 29 } 30 19 31 20 32 double median(const utility::vector& vec, const bool sorted)
Note: See TracChangeset
for help on using the changeset viewer.