lti::varianceFunctor< T > Class Template Reference
Functor which computes several kinds of variances for vectors and matrices.
More...
#include <ltiVarianceFunctor.h>
List of all members.
Classes |
class | parameters |
| the parameters for the class varianceFunctor More...
|
Public Member Functions |
| varianceFunctor () |
| varianceFunctor (const varianceFunctor &other) |
virtual | ~varianceFunctor () |
virtual const char * | getTypeName () const |
T | apply (const vector< T > &srcdest) const |
T & | apply (const vector< T > &src, T &dest) const |
vector< T > & | apply (const matrix< T > &src, vector< T > &dest) const |
void | varianceOfRows (const matrix< T > &src, vector< T > &dest) const |
void | varianceOfColumns (const matrix< T > &src, vector< T > &dest) const |
T | covariance (const vector< T > &a, const vector< T > &b) const |
void | covarianceMatrixOfRows (const matrix< T > &src, matrix< T > &dest) const |
void | covarianceMatrixOfRows (const matrix< T > &src, matrix< T > &dest, vector< T > &mu) const |
void | slowCovarianceMatrixOfRows (const matrix< T > &src, matrix< T > &dest) const |
void | covarianceMatrixOfColumns (const matrix< T > &src, matrix< T > &dest) const |
void | covarianceMatrixOfColumns (const matrix< T > &src, matrix< T > &dest, vector< T > &mu) const |
varianceFunctor & | copy (const varianceFunctor &other) |
virtual functor * | clone () const |
const parameters & | getParameters () const |
Static Public Member Functions |
static void | covar2corrcoef (matrix< T > &cv) |
Detailed Description
template<class T>
class lti::varianceFunctor< T >
Functor which computes several kinds of variances for vectors and matrices.
Be careful with the terms used here. If you have following matrix
| 5 6 10 2 |
| 1 -2 4 4 |
| 3 2 1 -3 |
The (empirical) varianceOfRows means the variance of all rows, i.e. a row vector containing the sum of the square of difference between each row vector and the mean vector of all rows, divided by the number of rows minus 1. This is (4 8 21 13).
The (empirical) varianceOfColumns means the variance of all columns, i.e. a column vector containing the sum of the square of difference between each column vector and the mean vector of all columns, divided by the number of columns minus 1. This is (8.667 4.667 2)^T.
The parameter parameters::rowWise indicates that the matrix will be seen as a set of row vectors (if true), or column vectors (false).
Constructor & Destructor Documentation
copy constructor
- Parameters:
-
Member Function Documentation
The result of this function depends on the value of parameters.rowWise.
If this parameter is true, the functor will compute a vector, whose elements contain each the variance of one column of the matrix (the computes the variance of the rows, where each row is a data point in n-dimensional space. if rowWise is false, the result vector contains the variance of the columns of the matrix (each column a data point).
- Parameters:
-
| src | matrix<T> with the source data. |
| dest | vector<T> where the result will be left. |
- Returns:
- a reference to the
dest
.
computes the variance of the given vector.
- Parameters:
-
| src | vector<T> with the source data. |
| dest | vector<T> where the result will be left. |
- Returns:
- a reference to the
dest
.
returns the variance of the current vector.
- Parameters:
-
| srcdest | vector<T> with the source data. The result will be left here too. |
- Returns:
- a reference to the
srcdest
.
The result is the covariance of these two vectors.
The vectors are regarded as series of outcomes of a twodimensional random variable. This function computes the covariance of both dimensions of the variable.
- Parameters:
-
| a | vector<T> with dimension one of the random variable. |
| b | vector<T> with dimension two of the random variable. |
- Returns:
- covariance between a and b
This function will compute a matrix which contains the covariance matrix of the data points in the first matrix, if each column constitutes a data point in n-dimensional space.
- Parameters:
-
| src | matrix<T> with the source data. |
| dest | matrix<T> where the result will be left. |
| mu | mean value of the data. |
This function will compute a matrix which contains the covariance matrix of the data points in the first matrix, if each column constitutes a data point in n-dimensional space.
- Parameters:
-
| src | matrix<T> with the source data. |
| dest | matrix<T> where the result will be left. |
This function will compute a matrix which contains the covariance matrix of the data points in the first matrix, if each row constitutes a data point in n-dimensional space.
- Parameters:
-
| src | matrix<T> with the source data. |
| dest | matrix<T> where the result will be left. |
| mu | mean value of the data. |
This function will compute a matrix which contains the covariance matrix of the data points in the first matrix, if each row constitutes a data point in n-dimensional space.
- Parameters:
-
| src | matrix<T> with the source data. |
| dest | matrix<T> where the result will be left. |
This function will compute a matrix which contains the covariance matrix of the data points in the first matrix, if each row constitutes a data point in n-dimensional space.
This is an older, slow version which has been left here, because there are a few rare cases when it is still somewhat faster than the new version.
- Parameters:
-
| src | matrix<T> with the source data. |
| dest | matrix<T> where the result will be left. |
The result vector contains the variances of the columns of the matrix (each column a data point).
- Parameters:
-
| src | matrix<T> with the source data. |
| dest | vector<T> where the result will be left. |
This function will compute a vector, whose elements contain each the variance of one column of the matrix (the computes the variance of the rows, where each row is a data point in n-dimensional space).
- Parameters:
-
| src | matrix<T> with the source data. |
| dest | vector<T> where the result will be left. |
The documentation for this class was generated from the following file: