mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-27 14:23:34 +08:00
Fixed loop limit errors in Matrix.h
In few of the overloaded operators the loop limits (i.e. M and N) were swapped.
This commit is contained in:
@@ -180,8 +180,8 @@ public:
|
|||||||
Matrix<M, N> operator -(void) const {
|
Matrix<M, N> operator -(void) const {
|
||||||
Matrix<M, N> res;
|
Matrix<M, N> res;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < N; i++)
|
for (unsigned int i = 0; i < M; i++)
|
||||||
for (unsigned int j = 0; j < M; j++)
|
for (unsigned int j = 0; j < N; j++)
|
||||||
res.data[i][j] = -data[i][j];
|
res.data[i][j] = -data[i][j];
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
@@ -193,16 +193,16 @@ public:
|
|||||||
Matrix<M, N> operator +(const Matrix<M, N> &m) const {
|
Matrix<M, N> operator +(const Matrix<M, N> &m) const {
|
||||||
Matrix<M, N> res;
|
Matrix<M, N> res;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < N; i++)
|
for (unsigned int i = 0; i < M; i++)
|
||||||
for (unsigned int j = 0; j < M; j++)
|
for (unsigned int j = 0; j < N; j++)
|
||||||
res.data[i][j] = data[i][j] + m.data[i][j];
|
res.data[i][j] = data[i][j] + m.data[i][j];
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix<M, N> &operator +=(const Matrix<M, N> &m) {
|
Matrix<M, N> &operator +=(const Matrix<M, N> &m) {
|
||||||
for (unsigned int i = 0; i < N; i++)
|
for (unsigned int i = 0; i < M; i++)
|
||||||
for (unsigned int j = 0; j < M; j++)
|
for (unsigned int j = 0; j < N; j++)
|
||||||
data[i][j] += m.data[i][j];
|
data[i][j] += m.data[i][j];
|
||||||
|
|
||||||
return *static_cast<Matrix<M, N>*>(this);
|
return *static_cast<Matrix<M, N>*>(this);
|
||||||
@@ -222,8 +222,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
Matrix<M, N> &operator -=(const Matrix<M, N> &m) {
|
Matrix<M, N> &operator -=(const Matrix<M, N> &m) {
|
||||||
for (unsigned int i = 0; i < N; i++)
|
for (unsigned int i = 0; i < M; i++)
|
||||||
for (unsigned int j = 0; j < M; j++)
|
for (unsigned int j = 0; j < N; j++)
|
||||||
data[i][j] -= m.data[i][j];
|
data[i][j] -= m.data[i][j];
|
||||||
|
|
||||||
return *static_cast<Matrix<M, N>*>(this);
|
return *static_cast<Matrix<M, N>*>(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user