1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
class MatrixHD
{
public:
MatrixHD(size_t rows, size_t cols);
double& operator()(size_t i, size_t j);
double operator()(size_t i, size_t j) const;
private:
size_t mRows;
size_t mCols;
std::vector<double> mData;
};
MatrixHD::MatrixHD(size_t rows, size_t cols)
: mRows(rows),
mCols(cols),
mData(rows * cols)
{
}
double& MatrixHD::operator()(size_t i, size_t j)
{
return mData[i * mCols + j];
}
double MatrixHD::operator()(size_t i, size_t j) const
{
return mData[i * mCols + j];
} |
Partager