Merge pull request #1517 from rowoflo/patch-1

Fixed loop limit errors in Matrix.h
This commit is contained in:
Lorenz Meier 2015-01-04 01:34:01 +01:00
commit 96a8003826
1 changed files with 8 additions and 8 deletions

View File

@ -180,8 +180,8 @@ public:
Matrix<M, N> operator -(void) const {
Matrix<M, N> res;
for (unsigned int i = 0; i < N; i++)
for (unsigned int j = 0; j < M; j++)
for (unsigned int i = 0; i < M; i++)
for (unsigned int j = 0; j < N; j++)
res.data[i][j] = -data[i][j];
return res;
@ -193,16 +193,16 @@ public:
Matrix<M, N> operator +(const Matrix<M, N> &m) const {
Matrix<M, N> res;
for (unsigned int i = 0; i < N; i++)
for (unsigned int j = 0; j < M; j++)
for (unsigned int i = 0; i < M; i++)
for (unsigned int j = 0; j < N; j++)
res.data[i][j] = data[i][j] + m.data[i][j];
return res;
}
Matrix<M, N> &operator +=(const Matrix<M, N> &m) {
for (unsigned int i = 0; i < N; i++)
for (unsigned int j = 0; j < M; j++)
for (unsigned int i = 0; i < M; i++)
for (unsigned int j = 0; j < N; j++)
data[i][j] += m.data[i][j];
return *static_cast<Matrix<M, N>*>(this);
@ -222,8 +222,8 @@ public:
}
Matrix<M, N> &operator -=(const Matrix<M, N> &m) {
for (unsigned int i = 0; i < N; i++)
for (unsigned int j = 0; j < M; j++)
for (unsigned int i = 0; i < M; i++)
for (unsigned int j = 0; j < N; j++)
data[i][j] -= m.data[i][j];
return *static_cast<Matrix<M, N>*>(this);