![]() |
GestureRecognitionToolkit
Version: 1.0 Revision: 04-03-15
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
|
Public Member Functions | |
MatrixDouble () | |
MatrixDouble (const unsigned int rows, const unsigned int cols) | |
MatrixDouble (const MatrixDouble &rhs) | |
MatrixDouble (const Matrix< double > &rhs) | |
virtual | ~MatrixDouble () |
MatrixDouble & | operator= (const MatrixDouble &rhs) |
MatrixDouble & | operator= (const Matrix< double > &rhs) |
MatrixDouble & | operator= (const vector< VectorDouble > &rhs) |
bool | save (const string &filename) const |
bool | load (const string &filename, const char seperator= ',') |
bool | saveToCSVFile (const string &filename) const |
bool | loadFromCSVFile (const string &filename, const char seperator= ',') |
bool | print (const string title="") const |
bool | transpose () |
bool | scale (const double minTarget, const double maxTarget) |
bool | scale (const vector< MinMax > &ranges, const double minTarget, const double maxTarget) |
bool | znorm (const double alpha=0.001) |
MatrixDouble | multiple (const double value) const |
VectorDouble | multiple (const VectorDouble &b) const |
MatrixDouble | multiple (const MatrixDouble &b) const |
bool | multiple (const MatrixDouble &a, const MatrixDouble &b, const bool aTranspose=false) |
bool | add (const MatrixDouble &b) |
bool | add (const MatrixDouble &a, const MatrixDouble &b) |
bool | subtract (const MatrixDouble &b) |
bool | subtract (const MatrixDouble &a, const MatrixDouble &b) |
double | getMinValue () const |
double | getMaxValue () const |
VectorDouble | getMean () const |
VectorDouble | getStdDev () const |
MatrixDouble | getCovarianceMatrix () const |
std::vector< MinMax > | getRanges () const |
double | getTrace () const |
![]() | |
Matrix () | |
Matrix (const unsigned int rows, const unsigned int cols) | |
Matrix (const Matrix &rhs) | |
Matrix (const std::vector< std::vector< double > > &data) | |
virtual | ~Matrix () |
Matrix & | operator= (const Matrix &rhs) |
double * | operator[] (const unsigned int r) |
const double * | operator[] (const unsigned int r) const |
std::vector< double > | getRowVector (const unsigned int r) const |
std::vector< double > | getColVector (const unsigned int c) const |
std::vector< double > | getConcatenatedVector (const bool concatByRow=true) const |
virtual bool | resize (const unsigned int r, const unsigned int c) |
virtual bool | copy (const Matrix< double > &rhs) |
bool | setAllValues (const double &value) |
bool | setRowVector (const std::vector< double > &row, const unsigned int rowIndex) |
bool | setColVector (const std::vector< double > &column, const unsigned int colIndex) |
bool | push_back (const std::vector< double > &sample) |
bool | reserve (const unsigned int capacity) |
void | clear () |
unsigned int | getNumRows () const |
unsigned int | getNumCols () const |
unsigned int | getCapacity () const |
unsigned int | getSize () const |
double ** | getDataPointer () const |
Protected Member Functions | |
double | stringToDouble (const std::string &value) |
Protected Attributes | |
WarningLog | warningLog |
ErrorLog | errorLog |
![]() | |
unsigned int | rows |
The number of rows in the Matrix. | |
unsigned int | cols |
The number of columns in the Matrix. | |
unsigned int | size |
Stores rows * cols. | |
unsigned int | capacity |
The capacity of the Matrix, this will be the number of rows, not the actual memory size. | |
double * | dataPtr |
A pointer to the raw data. | |
double ** | rowPtr |
A pointer to each row in the data. | |
ErrorLog | errorLog |
Definition at line 42 of file MatrixDouble.h.
GRT::MatrixDouble::MatrixDouble | ( | ) |
Default Constructor
Definition at line 25 of file MatrixDouble.cpp.
GRT::MatrixDouble::MatrixDouble | ( | const unsigned int | rows, |
const unsigned int | cols | ||
) |
Constructor, sets the size of the matrix to [rows cols]
const | UINT rows: sets the number of rows in the matrix, must be a value greater than zero |
const | UINT cols: sets the number of columns in the matrix, must be a value greater than zero |
Definition at line 33 of file MatrixDouble.cpp.
GRT::MatrixDouble::MatrixDouble | ( | const MatrixDouble & | rhs | ) |
Copy Constructor, copies the values from the rhs MatrixDouble to this MatrixDouble instance
const | MatrixDouble &rhs: the MatrixDouble from which the values will be copied |
Definition at line 42 of file MatrixDouble.cpp.
GRT::MatrixDouble::MatrixDouble | ( | const Matrix< double > & | rhs | ) |
Copy Constructor, copies the values from the rhs Matrix to this MatrixDouble instance
const | Matrix<double> &rhs: the Matrix from which the values will be copied |
Definition at line 50 of file MatrixDouble.cpp.
|
virtual |
Destructor, cleans up any memory
Definition at line 58 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::add | ( | const MatrixDouble & | b | ) |
Adds the input matrix data (b) to this matrix (a), giving: a = a + b. This rows and cols of b must match that of this matrix.
const | MatrixDouble &a: the matrix to multiple with b |
const | MatrixDouble &b: the matrix to multiple with a |
const | bool aTranspose: a flag to indicate if matrix a should be transposed |
Definition at line 316 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::add | ( | const MatrixDouble & | a, |
const MatrixDouble & | b | ||
) |
Adds the input matrix data (a) to the input matrix (b), storing the data in this matrix (c) giving: c = a + b. The rows and cols in a and b must match. This will resize the current matrix if needed.
const | MatrixDouble &a: the matrix to add with b |
const | MatrixDouble &b: the matrix to add with a |
Definition at line 340 of file MatrixDouble.cpp.
MatrixDouble GRT::MatrixDouble::getCovarianceMatrix | ( | ) | const |
Gets the covariance matrix of this matrix and returns this as a MatrixDouble.
Definition at line 481 of file MatrixDouble.cpp.
double GRT::MatrixDouble::getMaxValue | ( | ) | const |
Gets the ranges max value throughout the entire matrix.
Definition at line 444 of file MatrixDouble.cpp.
VectorDouble GRT::MatrixDouble::getMean | ( | ) | const |
Gets the mean of each column in the matrix and returns this as a VectorDouble.
Definition at line 452 of file MatrixDouble.cpp.
double GRT::MatrixDouble::getMinValue | ( | ) | const |
Gets the ranges min value throughout the entire matrix.
Definition at line 436 of file MatrixDouble.cpp.
std::vector< MinMax > GRT::MatrixDouble::getRanges | ( | ) | const |
Gets the ranges (min and max values) of each column in the matrix.
Definition at line 499 of file MatrixDouble.cpp.
VectorDouble GRT::MatrixDouble::getStdDev | ( | ) | const |
Gets the standard deviation of each column in the matrix and returns this as a VectorDouble.
Definition at line 467 of file MatrixDouble.cpp.
double GRT::MatrixDouble::getTrace | ( | ) | const |
Gets the trace of this matrix.
Definition at line 512 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::load | ( | const string & | filename, |
const char | seperator = ',' |
||
) |
Loads a matrix from a CSV file. This assumes that the data has been saved as rows and columns in the CSV file and that there are an equal number of columns per row.
This replaces the deprecated loadFromCSVFile function.
const | string &filename: the name of the CSV file |
Definition at line 540 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::loadFromCSVFile | ( | const string & | filename, |
const char | seperator = ',' |
||
) |
Loads a matrix from a CSV file. This assumes that the data has been saved as rows and columns in the CSV file and that there are an equal number of columns per row.
const | string &filename: the name of the CSV file |
Definition at line 644 of file MatrixDouble.cpp.
MatrixDouble GRT::MatrixDouble::multiple | ( | const double | value | ) | const |
Performs the multiplication of the data by the scalar value.
Definition at line 196 of file MatrixDouble.cpp.
VectorDouble GRT::MatrixDouble::multiple | ( | const VectorDouble & | b | ) | const |
Performs the multiplcation of this matrix (a) by the vector b. This will return a new vector (c): c = a * b
const | VectorDouble &b: the vector to multiple with this matrix |
Definition at line 211 of file MatrixDouble.cpp.
MatrixDouble GRT::MatrixDouble::multiple | ( | const MatrixDouble & | b | ) | const |
Performs the multiplcation of this matrix (a) by the matrix b. This will return a new matrix (c): c = a * b
const | MatrixDouble &b: the matrix to multiple with this matrix |
Definition at line 237 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::multiple | ( | const MatrixDouble & | a, |
const MatrixDouble & | b, | ||
const bool | aTranspose = false |
||
) |
Performs the multiplcation of the matrix a by the matrix b, directly storing the new data in the this matrix instance. This will resize the current matrix if needed. This makes this matrix c and gives: c = a * b, or if the aTransposed value is true: c = a' * b
const | MatrixDouble &a: the matrix to multiple with b |
const | MatrixDouble &b: the matrix to multiple with a |
const | bool aTranspose: a flag to indicate if matrix a should be transposed |
Definition at line 266 of file MatrixDouble.cpp.
MatrixDouble & GRT::MatrixDouble::operator= | ( | const MatrixDouble & | rhs | ) |
Defines how the data from the rhs MatrixDouble should be copied to this MatrixDouble
const | MatrixDouble &rhs: another instance of a MatrixDouble |
Definition at line 62 of file MatrixDouble.cpp.
MatrixDouble & GRT::MatrixDouble::operator= | ( | const Matrix< double > & | rhs | ) |
Defines how the data from the rhs Matrix<double> should be copied to this MatrixDouble
const | Matrix<double> &rhs: an instance of a Matrix<double> |
Definition at line 70 of file MatrixDouble.cpp.
MatrixDouble & GRT::MatrixDouble::operator= | ( | const vector< VectorDouble > & | rhs | ) |
Defines how the data from the rhs vector of VectorDoubles should be copied to this MatrixDouble
const | vector< VectorDouble> &rhs: a vector of VectorDoubles |
Definition at line 78 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::print | ( | const string | title = "" | ) | const |
Prints the MatrixDouble contents to std::cout
const | string title: sets the title of the data that will be printed to std::cout |
Definition at line 107 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::save | ( | const string & | filename | ) | const |
Resizes the MatrixDouble to the new size of [rows cols]
const | UINT rows: the number of rows, must be greater than zero |
const | UINT cols: the number of columns, must be greater than zero |
const | string &filename: the name of the CSV file |
Definition at line 521 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::saveToCSVFile | ( | const string & | filename | ) | const |
Saves the matrix to a CSV file.
const | string &filename: the name of the CSV file |
Definition at line 640 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::scale | ( | const double | minTarget, |
const double | maxTarget | ||
) |
Scales the matrix to a new range given by the min and max targets.
Definition at line 140 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::scale | ( | const vector< MinMax > & | ranges, |
const double | minTarget, | ||
const double | maxTarget | ||
) |
Scales the matrix to a new range given by the min and max targets using the ranges as the source ranges.
Definition at line 149 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::subtract | ( | const MatrixDouble & | b | ) |
Subtracts the input matrix data (b) from this matrix (a), giving: a = a - b. This rows and cols of b must match that of this matrix.
const | MatrixDouble &a: the matrix to subtract from this instance |
Definition at line 374 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::subtract | ( | const MatrixDouble & | a, |
const MatrixDouble & | b | ||
) |
Subtracts the input matrix data (b) from this matrix (a), giving (c): c = a - b. This rows and cols of b must match that of this matrix. This will resize the current matrix if needed.
const | MatrixDouble &a: the matrix to subtract with b |
const | MatrixDouble &b: the matrix to subtract from a |
Definition at line 402 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::transpose | ( | ) |
Transposes the data.
Definition at line 124 of file MatrixDouble.cpp.
bool GRT::MatrixDouble::znorm | ( | const double | alpha = 0.001 | ) |
Normalizes each row in the matrix by subtracting the row mean and dividing by the row standard deviation. A small amount (alpha) is added to the standard deviation to stop the normalization from exploding.
const | double alpha: a small value that will be added to the standard deviation |
Definition at line 165 of file MatrixDouble.cpp.