#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. | |
Private Attributes | |
std::vector< std::vector< T > > | _matrix |
unsigned int | _nRows |
unsigned int | _nCols |
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 [].
Definition at line 45 of file CommonDefs.h.
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. |
Definition at line 58 of file CommonDefs.h.
unsigned int SimpleMatrix< T >::GetNCols | ( | ) | [inline] |
Returns the number of columns.
Definition at line 84 of file CommonDefs.h.
unsigned int SimpleMatrix< T >::GetNRows | ( | ) | [inline] |
std::vector<T>& SimpleMatrix< T >::operator[] | ( | int | i | ) | [inline] |
Standard accessor.
i | The desired row. |
Definition at line 68 of file CommonDefs.h.
std::vector<std::vector<T> > SimpleMatrix< T >::_matrix [private] |
unsigned int SimpleMatrix< T >::_nCols [private] |
unsigned int SimpleMatrix< T >::_nRows [private] |