#include "CommonTools/Statistics/interface/StatisticsException.h"
#include <vector>
#include <algorithm>
#include <cmath>
Go to the source code of this file.
|
template<class T > |
T | lms_1d (std::vector< T > values) |
|
template<class T >
T lms_1d |
( |
std::vector< T > |
values | ) |
|
Least Median Sum of Squares in one dimension. T must be sortable, 'addable', and dividable by 2.
Definition at line 15 of file lms_1d.h.
References mps_fire::i, and findQualityFiles::size.
Referenced by lms_3d().
25 const int half = size / 2;
26 const int n_steps = (size + 1) / 2;
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);
tuple size
Write out results.