From ac9dca07818b4c27d396fe7265de0abeccc3cc97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 28 Jan 2013 17:56:11 +0100 Subject: [PATCH] Math: access RectangularMatrix's own data directly. --- src/Math/RectangularMatrix.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Math/RectangularMatrix.h b/src/Math/RectangularMatrix.h index ffc8248b1..84a7eca5e 100644 --- a/src/Math/RectangularMatrix.h +++ b/src/Math/RectangularMatrix.h @@ -41,6 +41,8 @@ of @f$ \boldsymbol A_{ij} @f$). template class RectangularMatrix { static_assert(cols != 0 && rows != 0, "RectangularMatrix cannot have zero elements"); + template friend class RectangularMatrix; + public: typedef T Type; /**< @brief Data type */ const static std::size_t Cols = cols; /**< @brief %Matrix column count */ @@ -279,7 +281,7 @@ template class RectangularMatrix { for(std::size_t col = 0; col != size; ++col) for(std::size_t row = 0; row != rows; ++row) for(std::size_t pos = 0; pos != cols; ++pos) - out[col][row] += (*this)[pos][row]*other[col][pos]; + out[col][row] += _data[pos][row]*other._data[col][pos]; return out; } @@ -302,7 +304,7 @@ template class RectangularMatrix { for(std::size_t col = 0; col != cols; ++col) for(std::size_t row = 0; row != rows; ++row) - out[row][col] = (*this)[col][row]; + out[row][col] = _data[col][row]; return out; }