51 template <
class ForwardIterator>
52 inline float euclidian(ForwardIterator v1Begin, ForwardIterator v1End,
53 ForwardIterator v2Begin) {
54 float fSum = 0.0, fDiff;
55 for (; v1Begin != v1End; ++v1Begin, ++v2Begin) {
56 fDiff = (*v1Begin-*v2Begin);
68 inline float euclidian(
const std::vector<T> &a,
const std::vector<T> &b) {
70 return euclidian (a.begin(), a.end(), b.begin());
77 template <
class ForwardIterator>
78 inline double mean(ForwardIterator begin, ForwardIterator end){
79 if(begin == end)
return 0;
91 template<>
inline double mean<const icl32f*>(
const icl32f *begin,
const icl32f *end){
93 ippsMean_32f(begin,end-begin,&m,ippAlgHintAccurate);
96 template<>
inline double mean<const icl64f*>(
const icl64f *begin,
const icl64f *end){
98 ippsMean_64f(begin,end-begin,&m);
112 template <
class ForwardIterator>
113 inline double variance(ForwardIterator begin, ForwardIterator end,
double mean,
bool empiricMean =
true){
114 if(begin == end)
return 0;
115 register double sum = 0;
116 register double d = 0;
124 return sum/(empiricMean&&num>1 ? num - 1 : num);
131 template <
class ForwardIterator>
132 inline double variance(ForwardIterator begin, ForwardIterator end){
143 template <
class ForwardIterator>
144 inline double stdDeviation(ForwardIterator begin, ForwardIterator end,
double mean,
bool empiricMean=
true){
152 template <
class ForwardIterator>
153 inline double stdDeviation(ForwardIterator begin, ForwardIterator end){
163 template<
class ForwardIterator>
164 inline std::pair<double,double>
meanAndStdDev(ForwardIterator begin,ForwardIterator end){
165 std::pair<double,double> md;
166 md.first =
mean(begin,end);
ICLQt_API ImgQ sqrt(const ImgQ &image)
calls sqrt( each pixel)
undocument this line if you encounter any issues!
Definition: Any.h:37
std::pair< double, double > meanAndStdDev(ForwardIterator begin, ForwardIterator end)
Calculates mean and standard deviation of given data range simultanously.
Definition: MathFunctions.h:164
double mean(ForwardIterator begin, ForwardIterator end)
computes the mean value of a data range
Definition: MathFunctions.h:78
double variance(ForwardIterator begin, ForwardIterator end, double mean, bool empiricMean=true)
Compute the variance of a given data range with given mean value.
Definition: MathFunctions.h:113
Ipp32f icl32f
32Bit floating point type for the ICL
Definition: BasicTypes.h:55
#define ICLASSERT_RETURN_VAL(X, VALUE)
Definition: Macros.h:148
Ipp64f icl64f
64Bit floating point type for the ICL
Definition: BasicTypes.h:52
double stdDeviation(ForwardIterator begin, ForwardIterator end, double mean, bool empiricMean=true)
Compute std-deviation of a data set with given mean (calls sqrt(variance(..))
Definition: MathFunctions.h:144
float euclidian(ForwardIterator v1Begin, ForwardIterator v1End, ForwardIterator v2Begin)
Calculate the euclidian distance of two vectors v1 and v2.
Definition: MathFunctions.h:52