yat  0.14.5pre
Public Member Functions | List of all members
theplu::yat::normalizer::Centralizer< UnaryFunction > Class Template Reference

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
 

Detailed Description

template<class UnaryFunction = statistics::Average>
class theplu::yat::normalizer::Centralizer< UnaryFunction >

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:

return_type operator()(InputIterator, InputIterator) const

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.

Since
New in yat 0.5

Constructor & Destructor Documentation

template<class UnaryFunction = statistics::Average>
theplu::yat::normalizer::Centralizer< UnaryFunction >::Centralizer ( void  )
inline

default constructor

Internal UnaryFunction is created using its default constructor.

template<class UnaryFunction = statistics::Average>
theplu::yat::normalizer::Centralizer< UnaryFunction >::Centralizer ( const UnaryFunction &  uf)
inline
Parameters
ufunary function defining the center.

Member Function Documentation

template<class UnaryFunction = statistics::Average>
template<class InputIterator , class OutputIterator >
void theplu::yat::normalizer::Centralizer< UnaryFunction >::operator() ( InputIterator  first,
InputIterator  last,
OutputIterator  result 
) const
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:

See Also
std::transform

The documentation for this class was generated from the following file:

Generated on Tue Sep 26 2017 02:33:29 for yat by  doxygen 1.8.5