GestureRecognitionToolkit
Version: 0.2.5
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) | |
MatrixFloat (const Vector< VectorFloat > &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 unsigned int rows, const unsigned int cols, const Float &data) | |
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 | resize (const unsigned int r, const unsigned int c, const Float &value) |
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) |
bool | 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 26 of file MatrixFloat.cpp.
MatrixFloat::MatrixFloat | ( | const unsigned int | rows, |
const unsigned int | cols | ||
) |
Constructor, sets the size of the matrix to [rows cols]
rows | sets the number of rows in the matrix, must be a value greater than zero |
cols | sets the number of columns in the matrix, must be a value greater than zero |
Definition at line 35 of file MatrixFloat.cpp.
MatrixFloat::MatrixFloat | ( | const MatrixFloat & | rhs | ) |
Copy Constructor, copies the values from the rhs MatrixFloat to this MatrixFloat instance
rhs | the MatrixFloat from which the values will be copied |
Definition at line 47 of file MatrixFloat.cpp.
MatrixFloat::MatrixFloat | ( | const Matrix< Float > & | rhs | ) |
Copy Constructor, copies the values from the rhs Matrix to this MatrixFloat instance
rhs | the Matrix from which the values will be copied |
Definition at line 57 of file MatrixFloat.cpp.
MatrixFloat::MatrixFloat | ( | const Vector< VectorFloat > & | rhs | ) |
Copy Constructor, copies the values from the rhs vector to this MatrixFloat instance
rhs | a vector of vectors the values will be copied |
Definition at line 67 of file MatrixFloat.cpp.
|
virtual |
Destructor, cleans up any memory
Definition at line 92 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 344 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 368 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 120 of file MatrixFloat.h.
MatrixFloat MatrixFloat::getCovarianceMatrix | ( | ) | const |
Gets the covariance matrix of this matrix and returns this as a MatrixFloat.
Definition at line 507 of file MatrixFloat.cpp.
Float MatrixFloat::getMaxValue | ( | ) | const |
Gets the ranges max value throughout the entire matrix.
Definition at line 470 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 478 of file MatrixFloat.cpp.
Float MatrixFloat::getMinValue | ( | ) | const |
Gets the ranges min value throughout the entire matrix.
Definition at line 462 of file MatrixFloat.cpp.
Gets the ranges (min and max values) of each column in the matrix.
Definition at line 525 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 107 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 493 of file MatrixFloat.cpp.
Float MatrixFloat::getTrace | ( | ) | const |
Gets the trace of this matrix.
Definition at line 538 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 566 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 674 of file MatrixFloat.cpp.
MatrixFloat MatrixFloat::multiple | ( | const Float | value | ) | const |
Performs the multiplication of the data by the scalar value.
Definition at line 224 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 239 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 265 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 294 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 96 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 104 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 112 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 135 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 547 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 670 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 168 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 177 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 401 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 428 of file MatrixFloat.cpp.
bool MatrixFloat::transpose | ( | ) |
Transposes the data.
Definition at line 152 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 193 of file MatrixFloat.cpp.