1 #ifndef CommonTools_Statistics_lms_1d_h
2 #define CommonTools_Statistics_lms_1d_h
16 switch (values.size()) {
20 return (
T) * (values.begin());
22 return (
T)((*(values.begin()) + *(values.end() - 1)) / 2);
24 const int size = values.size();
25 const int half = size / 2;
26 const int n_steps = (size + 1) / 2;
28 sort(values.begin(), values.end());
30 T i_begin = *(values.begin());
31 T i_end = *(values.begin() + half);
32 T div = (
T)fabs(i_begin - i_end);
33 for (
typename std::vector<T>::const_iterator
i = values.begin();
i != (values.begin() + n_steps); ++
i) {
34 if (fabs((*
i) - (*(
i + half))) < div) {
37 div = (
T)fabs(i_begin - i_end);
41 return (
T)((i_begin + i_end) / 2);
T lms_1d(std::vector< T > values)
tuple size
Write out results.