00001
00002
00008 #if !defined(__ads_algorithm_statistics_h__)
00009 #define __ads_algorithm_statistics_h__
00010
00011 #include "../defs.h"
00012
00013 #include <algorithm>
00014 #include <iostream>
00015 #include <limits>
00016
00017 #include <cmath>
00018 #include <cassert>
00019
00020 BEGIN_NAMESPACE_ADS
00021
00022
00024
00025
00026
00028 template<typename InputIterator>
00029 typename std::iterator_traits<InputIterator>::value_type
00030 computeMinimum(InputIterator beginning, InputIterator end);
00031
00032
00034 template<typename InputIterator>
00035 typename std::iterator_traits<InputIterator>::value_type
00036 computeMaximum(InputIterator beginning, InputIterator end);
00037
00038
00040 template<typename InputIterator, typename T>
00041 void
00042 computeMinimumAndMaximum(InputIterator beginning, InputIterator end,
00043 T* minimum, T* maximum);
00044
00045
00047 template<typename InputIterator>
00048 typename std::iterator_traits<InputIterator>::value_type
00049 computeMean(InputIterator beginning, InputIterator end);
00050
00051
00053 template<typename InputIterator, typename T>
00054 void
00055 computeMinimumMaximumAndMean(InputIterator beginning, InputIterator end,
00056 T* minimum, T* maximum, T* mean);
00057
00058
00060
00072 template<typename ForwardIterator, typename T>
00073 void
00074 computeMeanAndVariance(ForwardIterator beginning, ForwardIterator end,
00075 T* mean, T* variance);
00076
00077
00079 template<typename ForwardIterator>
00080 inline
00081 typename std::iterator_traits<ForwardIterator>::value_type
00082 computeVariance(ForwardIterator beginning, ForwardIterator end) {
00083 typename std::iterator_traits<ForwardIterator>::value_type mean, variance;
00084 computeMeanAndVariance(beginning, end, &mean, &variance);
00085 return variance;
00086 }
00087
00088
00090
00116 template<typename ForwardIterator, typename T>
00117 void
00118 computeMeanAbsoluteDeviationVarianceSkewAndCurtosis
00119 (ForwardIterator beginning, ForwardIterator end,
00120 T* mean, T* absoluteDeviation, T* variance, T* skew, T* curtosis);
00121
00122
00123
00124
00125 END_NAMESPACE_ADS
00126
00127 #define __ads_algorithm_statistics_ipp__
00128 #include "statistics.ipp"
00129 #undef __ads_algorithm_statistics_ipp__
00130
00131 #endif