24 Matrix(
size_t numRows,
size_t numCols);
29 const std::vector<T>&
operator [](
size_t row)
const;
44 Assert(numRows>=1 && numCols >= 1);
45 myElements.resize(numRows);
46 for(
size_t i = 0; i < myElements.size(); ++i)
48 myElements[i].resize(numCols);
61 return myElements[row];
67 return myElements[row];
73 return myElements.size();
78 if (myElements.empty())
80 return myElements[0].size();
86 const Matrix& lhsMatrix = *
this;
90 for(
size_t i = 0; i < result.getNumRows(); ++i)
92 for (
size_t j = 0; j < result.getNumCols(); ++j)
95 for(
size_t k = 0; k < result.getNumCols(); ++k)
97 result[i][j] += lhsMatrix[i][k]*rhsMatrix[k][j];
std::vector< T > & operator[](size_t row)
Definition: DtMatrix.h:59
n dimensional matrix
Definition: DtMatrix.h:21
virtual ~Matrix()
Definition: DtMatrix.h:53
size_t getNumRows(void) const
Definition: DtMatrix.h:71
Matrix operator*(const Matrix &rhsMatrix) const
Definition: DtMatrix.h:84
size_t getNumElements(void) const
Definition: DtMatrix.h:36
std::vector< std::vector< T > > myElements
Definition: DtMatrix.h:38
Matrix(size_t numRows, size_t numCols)
Definition: DtMatrix.h:42
size_t getNumCols(void) const
Definition: DtMatrix.h:76
#define Assert(exp)
Definition: DtAssert.h:25