yat
0.14.5pre
|
Centralize a range. More...
#include <yat/normalizer/Centralizer.h>
Public Member Functions | |
Centralizer (void) | |
default constructor More... | |
Centralizer (const UnaryFunction &uf) | |
template<class InputIterator , class OutputIterator > | |
void | operator() (InputIterator first, InputIterator last, OutputIterator result) const |
Centralize a range.
The class centralizes a range [first, last)
in two steps. First, the center value is calculaterd using the functor UnaryFunction
to calculate the center. Second, the center value is subtracted from each element in range [first, last)
. UnaryFunction
must be a functor that has an operator:
where return_type
must be convertible to value_type
of InputIterator
. By default the center value is calculated as the arithmetic mean via class statistics::Average, but this can be changed using an alternative functor such as statistics::Percentiler.
|
inline |
default constructor
Internal UnaryFunction is created using its default constructor.
|
inline |
uf | unary function defining the center. |
|
inline |
Calculates the center c of the range [first, last) using UnaryFunction. This value, c, is then subtracted from each element in the range [first, last) and assigned to the corresponding element in range [result, result + (last-first) ).
It is possible to centralize a range "in place"; it is permissible for the iterators first and result to be the same.
Type Requirements:
InputIterator
is Data IteratorInputIterator
is Readable IteratorInputIterator
is Forward Traversal IteratorOutputIterator
is Data IteratorOutputIterator
is Readable IteratorOutputIterator
is Writable IteratorOutputIterator
is Weighted Iterator, it must be a Forward Traversal Iterator; if unweighted, Single Pass Iterator suffice.