1 #ifndef CommonTools_Statistics_hsm_1d_h
2 #define CommonTools_Statistics_hsm_1d_h
13 sort(values.begin(), values.end());
15 typename std::vector<T>::iterator
begin = values.begin();
16 typename std::vector<T>::iterator
end = values.end() - 1;
19 const int size = (int)(end - begin);
21 int stepsize =
static_cast<int>(floor(.4999999999 + size * .5));
26 T div = (
T)fabs((
T)(*end) - (
T)(*begin));
27 typename std::vector<T>::iterator new_begin =
begin;
28 typename std::vector<T>::iterator new_end =
end;
30 for (
typename std::vector<T>::iterator
i = (begin + 1);
i != (begin + size - stepsize + 1); ++
i) {
34 div = (
T)((
T)(*new_end) - (
T)(*new_begin));
43 std::pair<typename std::vector<T>::iterator,
typename std::vector<T>::iterator>
ret(begin, end);
54 switch (values.size()) {
58 return (
T) * (values.begin());
60 return (
T)((*(values.begin()) + *(values.end() - 1)) / 2);
62 std::pair<typename std::vector<T>::iterator,
typename std::vector<T>::iterator> itors =
64 T ret = ((
T)(*(itors.first)) + (
T)(*(itors.second))) / (
T)2.;
tuple ret
prodAgent to be discontinued
T hsm_1d(std::vector< T > values)
std::pair< typename std::vector< T >::iterator, typename std::vector< T >::iterator > hsm_1d_returning_iterators(std::vector< T > &values)
tuple size
Write out results.