GestureRecognitionToolkit
Version: 0.1.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
|
Public Member Functions | |
MatrixFloat () | |
MatrixFloat (const unsigned int rows, const unsigned int cols) | |
MatrixFloat (const MatrixFloat &rhs) | |
MatrixFloat (const Matrix< Float > &rhs) | |
virtual | ~MatrixFloat () |
MatrixFloat & | operator= (const MatrixFloat &rhs) |
MatrixFloat & | operator= (const Matrix< Float > &rhs) |
MatrixFloat & | operator= (const Vector< VectorFloat > &rhs) |
VectorFloat | getRow (const unsigned int r) const |
VectorFloat | getCol (const unsigned int c) const |
bool | save (const std::string &filename) const |
bool | load (const std::string &filename, const char seperator= ',') |
bool | saveToCSVFile (const std::string &filename) const |
bool | loadFromCSVFile (const std::string &filename, const char seperator= ',') |
bool | print (const std::string title="") const |
bool | transpose () |
bool | scale (const Float minTarget, const Float maxTarget) |
bool | scale (const Vector< MinMax > &ranges, const Float minTarget, const Float maxTarget) |
bool | znorm (const Float alpha=0.001) |
MatrixFloat | multiple (const Float value) const |
VectorFloat | multiple (const VectorFloat &b) const |
MatrixFloat | multiple (const MatrixFloat &b) const |
bool | multiple (const MatrixFloat &a, const MatrixFloat &b, const bool aTranspose=false) |
bool | add (const MatrixFloat &b) |
bool | add (const MatrixFloat &a, const MatrixFloat &b) |
bool | subtract (const MatrixFloat &b) |
bool | subtract (const MatrixFloat &a, const MatrixFloat &b) |
Float | getMinValue () const |
Float | getMaxValue () const |
VectorFloat | getMean () const |
VectorFloat | getStdDev () const |
MatrixFloat | getCovarianceMatrix () const |
Vector< MinMax > | getRanges () const |
Float | getTrace () const |
Public Member Functions inherited from Matrix< Float > | |
Matrix () | |
Matrix (const unsigned int rows, const unsigned int cols) | |
Matrix (const Matrix &rhs) | |
Matrix (const Vector< Vector< Float > > &data) | |
virtual | ~Matrix () |
Matrix & | operator= (const Matrix &rhs) |
Float * | operator[] (const unsigned int r) |
const Float * | operator[] (const unsigned int r) const |
Vector< Float > | getRowVector (const unsigned int r) const |
Vector< Float > | getColVector (const unsigned int c) const |
Vector< Float > | getConcatenatedVector (const bool concatByRow=true) const |
virtual bool | resize (const unsigned int r, const unsigned int c) |
virtual bool | copy (const Matrix< Float > &rhs) |
bool | setAllValues (const Float &value) |
bool | setAll (const Float &value) |
bool | setRowVector (const Vector< Float > &row, const unsigned int rowIndex) |
bool | setColVector (const Vector< Float > &column, const unsigned int colIndex) |
bool | push_back (const Vector< Float > &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 |
Float ** | getDataPointer () const |
Float * | getData () const |
Protected Member Functions | |
Float | stringToFloat (const std::string &value) |
Protected Attributes | |
WarningLog | warningLog |
ErrorLog | errorLog |
Protected Attributes inherited from Matrix< Float > | |
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. | |
Float * | dataPtr |
A pointer to the raw data. | |
Float ** | rowPtr |
A pointer to each row in the data. | |
ErrorLog | errorLog |
Definition at line 36 of file MatrixFloat.h.
GRT_BEGIN_NAMESPACE MatrixFloat::MatrixFloat | ( | ) |
Default Constructor
Definition at line 25 of file MatrixFloat.cpp.
MatrixFloat::MatrixFloat | ( | 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 MatrixFloat.cpp.
MatrixFloat::MatrixFloat | ( | const MatrixFloat & | rhs | ) |
Copy Constructor, copies the values from the rhs MatrixFloat to this MatrixFloat instance
const | MatrixFloat &rhs: the MatrixFloat from which the values will be copied |
Definition at line 42 of file MatrixFloat.cpp.
MatrixFloat::MatrixFloat | ( | const Matrix< Float > & | rhs | ) |
Copy Constructor, copies the values from the rhs Matrix to this MatrixFloat instance
const | Matrix< Float > &rhs: the Matrix from which the values will be copied |
Definition at line 50 of file MatrixFloat.cpp.
|
virtual |
Destructor, cleans up any memory
Definition at line 58 of file MatrixFloat.cpp.
bool MatrixFloat::add | ( | const MatrixFloat & | 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.
a | the matrix to multiple with b |
b | the matrix to multiple with a |
aTranspose | a flag to indicate if matrix a should be transposed |
Definition at line 310 of file MatrixFloat.cpp.
bool MatrixFloat::add | ( | const MatrixFloat & | a, |
const MatrixFloat & | 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.
a | the matrix to add with b |
b | the matrix to add with a |
Definition at line 334 of file MatrixFloat.cpp.
|
inline |
Gets a column vector [rows 1] from the Matrix at the column index c
c | the index of the column, this should be in the range [0 cols-1] |
Definition at line 113 of file MatrixFloat.h.
MatrixFloat MatrixFloat::getCovarianceMatrix | ( | ) | const |
Gets the covariance matrix of this matrix and returns this as a MatrixFloat.
Definition at line 473 of file MatrixFloat.cpp.
Float MatrixFloat::getMaxValue | ( | ) | const |
Gets the ranges max value throughout the entire matrix.
Definition at line 436 of file MatrixFloat.cpp.
VectorFloat MatrixFloat::getMean | ( | ) | const |
Gets the mean of each column in the matrix and returns this as a VectorFloat.
Definition at line 444 of file MatrixFloat.cpp.
Float MatrixFloat::getMinValue | ( | ) | const |
Gets the ranges min value throughout the entire matrix.
Definition at line 428 of file MatrixFloat.cpp.
Gets the ranges (min and max values) of each column in the matrix.
Definition at line 491 of file MatrixFloat.cpp.
|
inline |
Gets a row vector [1 cols] from the Matrix at the row index r
r | the index of the row, this should be in the range [0 rows-1] |
Definition at line 100 of file MatrixFloat.h.
VectorFloat MatrixFloat::getStdDev | ( | ) | const |
Gets the standard deviation of each column in the matrix and returns this as a VectorFloat.
Definition at line 459 of file MatrixFloat.cpp.
Float MatrixFloat::getTrace | ( | ) | const |
Gets the trace of this matrix.
Definition at line 504 of file MatrixFloat.cpp.
bool MatrixFloat::load | ( | const std::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.
filename | the name of the CSV file |
Definition at line 532 of file MatrixFloat.cpp.
bool MatrixFloat::loadFromCSVFile | ( | const std::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.
filename | the name of the CSV file |
Definition at line 640 of file MatrixFloat.cpp.
MatrixFloat MatrixFloat::multiple | ( | const Float | value | ) | const |
Performs the multiplication of the data by the scalar value.
Definition at line 190 of file MatrixFloat.cpp.
VectorFloat MatrixFloat::multiple | ( | const VectorFloat & | b | ) | const |
Performs the multiplcation of this matrix (a) by the vector b. This will return a new vector (c): c = a * b
b | the vector to multiple with this matrix |
Definition at line 205 of file MatrixFloat.cpp.
MatrixFloat MatrixFloat::multiple | ( | const MatrixFloat & | b | ) | const |
Performs the multiplcation of this matrix (a) by the matrix b. This will return a new matrix (c): c = a * b
b | the matrix to multiple with this matrix |
Definition at line 231 of file MatrixFloat.cpp.
bool MatrixFloat::multiple | ( | const MatrixFloat & | a, |
const MatrixFloat & | 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
a | the matrix to multiple with b |
b | the matrix to multiple with a |
aTranspose | a flag to indicate if matrix a should be transposed |
Definition at line 260 of file MatrixFloat.cpp.
MatrixFloat & MatrixFloat::operator= | ( | const MatrixFloat & | rhs | ) |
Defines how the data from the rhs MatrixFloat should be copied to this MatrixFloat
rhs | another instance of a MatrixFloat |
Definition at line 62 of file MatrixFloat.cpp.
MatrixFloat & MatrixFloat::operator= | ( | const Matrix< Float > & | rhs | ) |
Defines how the data from the rhs Matrix< Float > should be copied to this MatrixFloat
rhs | an instance of a Matrix< Float > |
Definition at line 70 of file MatrixFloat.cpp.
MatrixFloat & MatrixFloat::operator= | ( | const Vector< VectorFloat > & | rhs | ) |
Defines how the data from the rhs Vector of VectorFloats should be copied to this MatrixFloat
rhs | a Vector of VectorFloats |
Definition at line 78 of file MatrixFloat.cpp.
bool MatrixFloat::print | ( | const std::string | title = "" | ) | const |
Prints the MatrixFloat contents to std::cout
title | sets the title of the data that will be printed to std::cout |
Definition at line 101 of file MatrixFloat.cpp.
bool MatrixFloat::save | ( | const std::string & | filename | ) | const |
Resizes the MatrixFloat to the new size of [rows cols]
rows | the number of rows, must be greater than zero |
cols | the number of columns, must be greater than zero |
filename | the name of the CSV file |
Definition at line 513 of file MatrixFloat.cpp.
bool MatrixFloat::saveToCSVFile | ( | const std::string & | filename | ) | const |
Saves the matrix to a CSV file.
filename | the name of the CSV file |
Definition at line 636 of file MatrixFloat.cpp.
bool MatrixFloat::scale | ( | const Float | minTarget, |
const Float | maxTarget | ||
) |
Scales the matrix to a new range given by the min and max targets.
Definition at line 134 of file MatrixFloat.cpp.
bool MatrixFloat::scale | ( | const Vector< MinMax > & | ranges, |
const Float | minTarget, | ||
const Float | 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 143 of file MatrixFloat.cpp.
bool MatrixFloat::subtract | ( | const MatrixFloat & | 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.
a | the matrix to subtract from this instance |
Definition at line 367 of file MatrixFloat.cpp.
bool MatrixFloat::subtract | ( | const MatrixFloat & | a, |
const MatrixFloat & | 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.
a | the matrix to subtract with b |
b | the matrix to subtract from a |
Definition at line 394 of file MatrixFloat.cpp.
bool MatrixFloat::transpose | ( | ) |
Transposes the data.
Definition at line 118 of file MatrixFloat.cpp.
bool MatrixFloat::znorm | ( | const Float | 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.
alpha | a small value that will be added to the standard deviation |
Definition at line 159 of file MatrixFloat.cpp.