25 #ifndef TEMPLATEVALUEANALYSATION_H_
26 #define TEMPLATEVALUEANALYSATION_H_
29 #define ANALYSATION_CONTEXT TemplateValueAnalysation<type,zero,lower,higher,doubleDiv,doubleMul,add,sub,mul,div>
30 #define DOUBLE_ANALYSATION_CONTEXT TemplateValueAnalysation<double,defaultZero>
154 bool lower(
const type&,
const type&)=defaultLower<type>,
155 bool higher(
const type&,
const type&)=defaultHigher<type>,
156 type doubleDiv(
const type&,
const double&)=defaultDoubleDiv<type>,
157 type doubleMul(
const type&,
const double&)=defaultDoubleMul<type>,
158 type add(
const type&,
const type&)=defaultAdd<type>,
159 type sub(
const type&,
const type&)=defaultSub<type>,
160 type mul(
const type&,
const type&)=defaultMul<type>,
161 type div(
const type&,
const type&)=defaultDiv<type> >
184 __gnu_cxx::__normal_iterator<type*,std::vector<type,std::allocator<type> > > iter;
187 avg = add(avg,(*iter));
192 avg = doubleDiv(avg,
m_vector.size());
205 __gnu_cxx::__normal_iterator<type*,std::vector<type,std::allocator<type> > > iter =
m_vector.begin();
207 for(iter++; iter !=
m_vector.end(); iter++) {
208 if(lower((*iter),min))
223 __gnu_cxx::__normal_iterator<type*,std::vector<type,std::allocator<type> > > iter =
m_vector.begin();
225 for(iter++; iter !=
m_vector.end(); iter++) {
226 if(lower(max,(*iter)))
243 return sub(dMax,dMin);
256 std::_List_iterator<TYPE_SAVE> iter;
262 for(x=0;x<num;x++) iter++;
265 median = (*iter->pointer);
267 median = add(median,(*iter->pointer));
268 median = doubleMul(median,0.5);
272 median = (*iter->pointer);
288 std::_List_iterator<TYPE_SAVE> iter;
294 for(x=0;x<num;x++) iter++;
297 q = (*iter->pointer);
299 q = add(q,(*iter->pointer));
300 q = doubleMul(q,0.5);
303 q = (*iter->pointer);
319 std::_List_iterator<TYPE_SAVE> iter;
325 for(x=0;x<num;x++) iter++;
328 q = (*iter->pointer);
330 q = add(q,(*iter->pointer));
331 q = doubleMul(q,0.5);
334 q = (*iter->pointer);
363 return doubleMul(dIqr,factor);
377 type dBorder = sub(dQ1,dW);
378 std::_List_iterator<TYPE_SAVE> iter =
m_list.begin();
380 while(lower((*iter->pointer),dBorder) && iter!=
m_list.end()) {
389 return (*iter->pointer);
403 type dBorder = add(dQ3,dW);
404 std::_List_iterator<TYPE_SAVE> iter =
m_list.begin();
406 while(lower((*iter->pointer),dBorder) && iter!=
m_list.end()) {
415 return (*iter->pointer);
426 unsigned int result = 0;
429 std::_List_iterator<TYPE_SAVE> iter =
m_list.begin();
431 while(lower((*iter->pointer),dW1) && iter!=
m_list.end()) {
438 while(!higher((*iter->pointer),dW3) && iter!=
m_list.end()) {
444 while(iter!=
m_list.end()) {
463 std::_List_iterator<TYPE_SAVE> iter =
m_list.begin();
465 while(lower((*iter->pointer),dW1) && iter!=
m_list.end()) {
469 return (*iter->pointer);
476 while(!higher((*iter->pointer),dW3) && iter!=
m_list.end()) {
482 while(iter!=
m_list.end()) {
486 return (*iter->pointer);
508 std::_List_iterator<TYPE_SAVE> iter =
m_list.begin();
510 while(lower((*iter->pointer),z) && iter!=
m_list.end()) {
526 while(!lower((*iter->pointer),z) && iter!=
m_list.begin()) {
534 if(lower(sub(*h,z),sub(z,*l)))
552 return lower((*pointer),(*other.
pointer));
575 __gnu_cxx::__normal_iterator<type*,std::vector<type,std::allocator<type> > > iter;
577 for(iter = m_vector.begin(); iter != m_vector.end(); iter++) {
582 m_listCreated =
true;
std::vector< type > & m_vector
this vector save the giving set.
Definition: templatevalueanalysation.h:559
TemplateValueAnalysation(std::vector< type > &values)
constructor Needs a set of values for which the statistical values will calculate.
Definition: templatevalueanalysation.h:169
type getWhisker(double factor)
this function calculate the whisker distance
Definition: templatevalueanalysation.h:360
type defaultMul(const type &a, const type &b)
default function for mul.
Definition: templatevalueanalysation.h:122
type defaultDoubleMul(const type &a, const double &b)
default function for mul.
Definition: templatevalueanalysation.h:71
type getQuartil1()
this function calculate the under quartil
Definition: templatevalueanalysation.h:284
~TemplateValueAnalysation()
default destructor
Definition: templatevalueanalysation.h:174
type getBest(void)
this function search the value which is next to zero.
Definition: templatevalueanalysation.h:500
unsigned int getNumExtrems(double factor)
this function give you the number of elements in the giving set, which aren't in the whisker distance...
Definition: templatevalueanalysation.h:425
type getQuartil3()
this function calculate the upper quartil.
Definition: templatevalueanalysation.h:315
type getMedian()
this function search the median of the giving set of values.
Definition: templatevalueanalysation.h:252
bool operator<(const TYPE_SAVE &other)
Definition: templatevalueanalysation.h:551
void sort(void)
this function create the sorted list
Definition: templatevalueanalysation.h:574
This template class give you some methods to calculate some statistical values like average...
Definition: templatevalueanalysation.h:162
double defaultZero()
default function for zero double value
Definition: templatevalueanalysation.cpp:27
double max(const matrix::Matrix &v)
returns the largest element
Definition: controller_misc.cpp:318
type defaultAdd(const type &a, const type &b)
default function for add two values
Definition: templatevalueanalysation.h:98
type getExtrem(double factor, unsigned int i)
this function gives one extreme value back
Definition: templatevalueanalysation.h:460
type defaultDoubleDiv(const type &a, const double &b)
default function for divide by a double value.
Definition: templatevalueanalysation.h:59
type getAvg()
this function calculate the average of the giving set
Definition: templatevalueanalysation.h:182
help structur for sorting the set.
Definition: templatevalueanalysation.h:546
type getWhisker1(double factor)
this function search the lowest value in the set which is from under quartil inside the whisker dista...
Definition: templatevalueanalysation.h:373
type defaultSub(const type &a, const type &b)
default function for sub.
Definition: templatevalueanalysation.h:110
type getMin()
this function search the min.
Definition: templatevalueanalysation.h:203
bool m_listCreated
this variable remember if the sorted list is created
Definition: templatevalueanalysation.h:569
bool defaultHigher(const type &a, const type &b)
default function for "higher than" operation.
Definition: templatevalueanalysation.h:83
bool defaultLower(const type &a, const type &b)
default function for "lower as" operation.
Definition: templatevalueanalysation.h:44
type getRange()
this function calculate the range of all values.
Definition: templatevalueanalysation.h:239
double min(const matrix::Matrix &v)
returns the smallest element
Definition: controller_misc.cpp:307
std::list< TYPE_SAVE > m_list
this list saves the sorted set
Definition: templatevalueanalysation.h:564
type getIQR()
this function calculate the range between the upper and under quartil.
Definition: templatevalueanalysation.h:346
TYPE_SAVE(type &a)
Definition: templatevalueanalysation.h:547
type defaultDiv(const type &a, const type &b)
default function for div.
Definition: templatevalueanalysation.h:134
type * pointer
Definition: templatevalueanalysation.h:549
type getMax()
this function search the max.
Definition: templatevalueanalysation.h:221
type getWhisker3(double factor)
this function search the highest value in the set which is from the upper quartil inside the whisker ...
Definition: templatevalueanalysation.h:399