aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorRowland O'Flaherty <rowoflo@users.noreply.github.com>2014-12-18 16:56:28 -0800
committerRowland O'Flaherty <rowoflo@users.noreply.github.com>2014-12-18 16:56:28 -0800
commit4d0d6f09ce9aef8875e33ee80aefcc8ed00d4769 (patch)
treee736a99534124b88c8b9bb645a2a1e91d4126ed1 /src/lib
parent5becd2227a26b686c7bbee38e61d19024b5aea5f (diff)
downloadpx4-firmware-4d0d6f09ce9aef8875e33ee80aefcc8ed00d4769.tar.gz
px4-firmware-4d0d6f09ce9aef8875e33ee80aefcc8ed00d4769.tar.bz2
px4-firmware-4d0d6f09ce9aef8875e33ee80aefcc8ed00d4769.zip
Fixed loop limit errors in Matrix.h
In few of the overloaded operators the loop limits (i.e. M and N) were swapped.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/mathlib/math/Matrix.hpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/mathlib/math/Matrix.hpp b/src/lib/mathlib/math/Matrix.hpp
index ca931e2da..ac1f1538f 100644
--- a/src/lib/mathlib/math/Matrix.hpp
+++ b/src/lib/mathlib/math/Matrix.hpp
@@ -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);