1 #ifndef _theplu_yat_normalizer_z_score_ 2 #define _theplu_yat_normalizer_z_score_ 28 #include "yat/statistics/Averager.h" 29 #include "yat/statistics/AveragerWeighted.h" 31 #include "yat/utility/concept_check.h" 32 #include "yat/utility/iterator_traits.h" 34 #include <boost/concept_check.hpp> 38 namespace normalizer {
69 template<
class InputIterator,
class OutputIterator>
71 OutputIterator result)
const 78 normalize(first, last, result, tag);
82 template<
class ForwardIterator,
class OutputIterator>
83 void normalize(ForwardIterator first, ForwardIterator last,
84 OutputIterator result,
90 BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<ForwardIterator>));
92 BOOST_CONCEPT_ASSERT((boost_concepts::WritableIterator<OutputIterator>));
99 *result = (*first - m) / std;
105 template<
class ForwardIterator,
class OutputIterator>
106 void normalize(ForwardIterator first, ForwardIterator last,
107 OutputIterator result,
113 BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<ForwardIterator>));
115 BOOST_CONCEPT_ASSERT((boost_concepts::WritableIterator<OutputIterator>));
117 BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<OutputIterator>));
118 detail::copy_weight_if_weighted(first, last, result);
125 while (first!=last) {
126 out_trait.
data(result) = (in_trait.
data(first) - m) / std;
double std(void) const
The standard deviation is defined as the square root of the variance.
Definition: averager_base.h:206
data_reference data(Iter iter) const
Definition: iterator_traits.h:440
Zero mean and unity variance.
Definition: Zscore.h:56
Concept check for Data Iterator.
Definition: concept_check.h:240
Class to calculate simple (first and second moments) averages.
Definition: Averager.h:46
Definition: iterator_traits.h:412
double mean(void) const
Calculate the weighted mean.
The Department of Theoretical Physics namespace as we define it.
Class to calulate averages with weights.
Definition: AveragerWeighted.h:66
Definition: iterator_traits.h:47
Definition: stl_utility.h:64
double std(void) const
The standard deviation is defined as the square root of the variance().
Definition: iterator_traits.h:55
void operator()(InputIterator first, InputIterator last, OutputIterator result) const
Definition: Zscore.h:70
double mean(void) const
mean
Definition: averager_base.h:97
detail::unweighted_type_and< w_type1, w_type2 >::type type
return unweighted if both are unweighted
Definition: iterator_traits.h:165