#include <CommonDefs.h>
Public Member Functions | |
SimpleMatrix (unsigned int nRows, unsigned int nCols, T elements=T()) | |
Constructor. | |
std::vector< T > & | operator[] (int i) |
Standard accessor. | |
unsigned int | GetNRows () |
Returns the number of rows. | |
unsigned int | GetNCols () |
Returns the number of columns. |
This class defines a matrix built by STL vectors. It is basically a variable-dimension vector of vectors; the dimension is defined at construction and cannot be changed in current implementation. It is intended as a container and not for algebraic manipulations. The class provides a standard access operator [].
SimpleMatrix< T >::SimpleMatrix | ( | unsigned int | nRows, | |
unsigned int | nCols, | |||
T | elements = T() | |||
) | [inline] |
Constructor.
The constructor will build an nRows x nCols matrix, initialized with a default value. If T is a class with no default constructor, a default value for T must be provided, which will be replicated in every matrix element.
nRows | The number of rows. | |
nCols | The number of columns | |
elements | The initialization value for the matrix elements. |
unsigned int SimpleMatrix< T >::GetNCols | ( | ) | [inline] |
Returns the number of columns.
unsigned int SimpleMatrix< T >::GetNRows | ( | ) | [inline] |
Returns the number of rows.
std::vector<T>& SimpleMatrix< T >::operator[] | ( | int | i | ) | [inline] |
Standard accessor.
i | The desired row. |