|
latest version v1.9 - last update 10 Apr 2010 |
|
Functor which computes several kinds of means for vectors and matrices. More...
#include <ltiSerialStatsExtFunctor.h>


Classes | |
| class | parameters |
| the parameters for the class meansFunctor More... | |
Public Member Functions | |
| serialStatsExtFunctor () | |
| serialStatsExtFunctor (const serialStatsExtFunctor &other) | |
| virtual | ~serialStatsExtFunctor () |
| virtual const char * | getTypeName () const |
| void | apply (U &mean, U &variance, U &min, U &max) const |
| void | apply (vector< U > &mean, vector< U > &variance, vector< U > &min, vector< U > &max) const |
| void | consider (const T &element) |
| void | consider (const T &element, const int &n) |
| void | consider (const vector< T > &element) |
| void | consider (const vector< T > &element, const int &n) |
| void | considerElements (const vector< T > &elements) |
| void | considerElements (const matrix< T > &elements) |
| void | considerElements (const matrix< T > &elements, const rectangle &rect) |
| void | considerRows (const matrix< T > &elements) |
| U | getMean () const |
| U | getVariance () const |
| U | getMin () const |
| U | getMax () const |
| U | getSumOfElements () const |
| U | getSumOfSquares () const |
| int | getN () const |
| int | getNVectors () const |
| void | getMean (vector< U > &m) const |
| void | getVariance (vector< U > &v) const |
| void | getMin (vector< U > &m) const |
| void | getMax (vector< U > &m) const |
| void | getSumOfVectors (vector< U > &s) const |
| void | getSumOfVectorSquares (vector< U > &s) const |
| const vector< U > & | getSumOfVectors () const |
| const vector< U > & | getSumOfVectorSquares () const |
| void | reset () |
| serialStatsExtFunctor & | copy (const serialStatsExtFunctor &other) |
| virtual functor * | clone () const |
| const parameters & | getParameters () const |
Functor which computes several kinds of means for vectors and matrices.
It also computes the extremes of the given data, which is the main difference with his brother functor lti::serialStatsFunctor
The first template parameter T describes the type of the vectors and matrices to be analysed. The second parameter U (usually the same type as T) specify the type of the statistics.
For example, if you want to compute the mean and variance of the elements {2,5,6,7,9} with double precision, you can use following code:
lti::serialStatsExtFunctor<double> stats; double theAverage,theVariance; double data[] = {2,5,6,7,9}; lti::vector vct(5,data); stats.considerElements(vct); stats.apply(theAverage,theVariance); cout << "Average: " << theAverage << " Variance: " << theVariance << endl;
It is also possible to compute the average/variance for each component withing lti::vectors.
| lti::serialStatsExtFunctor< T, U >::serialStatsExtFunctor | ( | ) |
default constructor
| lti::serialStatsExtFunctor< T, U >::serialStatsExtFunctor | ( | const serialStatsExtFunctor< T, U > & | other | ) |
copy constructor
| other | the object to be copied |
| virtual lti::serialStatsExtFunctor< T, U >::~serialStatsExtFunctor | ( | ) | [virtual] |
destructor
| void lti::serialStatsExtFunctor< T, U >::apply | ( | vector< U > & | mean, | |
| vector< U > & | variance, | |||
| vector< U > & | min, | |||
| vector< U > & | max | |||
| ) | const |
returns mean and variance vectors of the data vectors considered so far.
| mean | the result, where the mean will be put | |
| variance | the result, where the variable will be put | |
| min | contains the minimum value for each dimension found in the data. | |
| max | contains the maximum value for each dimension found in the data. |
| void lti::serialStatsExtFunctor< T, U >::apply | ( | U & | mean, | |
| U & | variance, | |||
| U & | min, | |||
| U & | max | |||
| ) | const |
returns mean and variance of the data elements considered so far.
| mean | the result, where the mean will be put | |
| variance | the result, where the variable will be put | |
| min | the minimum value considered until now | |
| max | the maximum value considered until now |
| virtual functor* lti::serialStatsExtFunctor< T, U >::clone | ( | ) | const [virtual] |
returns a pointer to a clone of this functor.
Reimplemented from lti::statisticsFunctor.
| void lti::serialStatsExtFunctor< T, U >::consider | ( | const vector< T > & | element, | |
| const int & | n | |||
| ) |
This function considers the given vector for computing the mean and variance, as if it were presented n times.
| void lti::serialStatsExtFunctor< T, U >::consider | ( | const vector< T > & | element | ) |
This function considers the given vector for computing the mean and variance.
| void lti::serialStatsExtFunctor< T, U >::consider | ( | const T & | element, | |
| const int & | n | |||
| ) |
This function considers the given element for computing the mean and variance as if it were presented n times.
| void lti::serialStatsExtFunctor< T, U >::consider | ( | const T & | element | ) |
This function considers the given element for computing the mean and variance.
| void lti::serialStatsExtFunctor< T, U >::considerElements | ( | const matrix< T > & | elements, | |
| const rectangle & | rect | |||
| ) |
Consider also all elements of the given matrix which lie within the given rectangle.
| void lti::serialStatsExtFunctor< T, U >::considerElements | ( | const matrix< T > & | elements | ) |
Consider also all elements of the given matrix.
| void lti::serialStatsExtFunctor< T, U >::considerElements | ( | const vector< T > & | elements | ) |
Consider also all elements of the given vector.
| void lti::serialStatsExtFunctor< T, U >::considerRows | ( | const matrix< T > & | elements | ) |
Consider all rows of the given matrix as vectors.
| serialStatsExtFunctor& lti::serialStatsExtFunctor< T, U >::copy | ( | const serialStatsExtFunctor< T, U > & | other | ) |
copy data of "other" functor.
| other | the functor to be copied |
Reimplemented from lti::statisticsFunctor.
| void lti::serialStatsExtFunctor< T, U >::getMax | ( | vector< U > & | m | ) | const |
Get the minimum of all vectors (minimum at each component) considered so far.
| U lti::serialStatsExtFunctor< T, U >::getMax | ( | ) | const |
The maximum value of all values presented until now.
| void lti::serialStatsExtFunctor< T, U >::getMean | ( | vector< U > & | m | ) | const |
The mean of all vectors that have been considered so far.
| U lti::serialStatsExtFunctor< T, U >::getMean | ( | ) | const |
The mean of all elements that have been considered so far.
| void lti::serialStatsExtFunctor< T, U >::getMin | ( | vector< U > & | m | ) | const |
Get the minimum of all vectors (minimum at each component) considered so far.
| U lti::serialStatsExtFunctor< T, U >::getMin | ( | ) | const |
The minimum value of all values presented until now.
| int lti::serialStatsExtFunctor< T, U >::getN | ( | ) | const |
return the number of elements considered so far
| int lti::serialStatsExtFunctor< T, U >::getNVectors | ( | ) | const |
return the number of vectors considered so far
| const parameters& lti::serialStatsExtFunctor< T, U >::getParameters | ( | ) | const |
returns used parameters
Reimplemented from lti::statisticsFunctor.
| U lti::serialStatsExtFunctor< T, U >::getSumOfElements | ( | ) | const |
The sum of all elements that have been considered so far.
| U lti::serialStatsExtFunctor< T, U >::getSumOfSquares | ( | ) | const |
The sum of the squares of of all elements that have been considered so far.
| const vector<U>& lti::serialStatsExtFunctor< T, U >::getSumOfVectors | ( | ) | const |
The sum of all vectors that have been considered so far.
| void lti::serialStatsExtFunctor< T, U >::getSumOfVectors | ( | vector< U > & | s | ) | const |
The sum of all vectors that have been considered so far.
The values will be copied into the given vector.
| const vector<U>& lti::serialStatsExtFunctor< T, U >::getSumOfVectorSquares | ( | ) | const |
The sum of the squares of all vectors that have been considered so far.
| void lti::serialStatsExtFunctor< T, U >::getSumOfVectorSquares | ( | vector< U > & | s | ) | const |
The sum of the squares of all vectors that have been considered so far.
The values will be copied into the given vector.
| virtual const char* lti::serialStatsExtFunctor< T, U >::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("serialStatsExtFunctor")
Reimplemented from lti::statisticsFunctor.
| void lti::serialStatsExtFunctor< T, U >::getVariance | ( | vector< U > & | v | ) | const |
The variance of all vectors that have been considered so far.
| U lti::serialStatsExtFunctor< T, U >::getVariance | ( | ) | const |
The variance of all elements that have been considered so far.
| void lti::serialStatsExtFunctor< T, U >::reset | ( | ) |
Reset the series, i.e.
discard all considered elements.