diff options
author | Lorenz Meier <lorenz@px4.io> | 2015-01-04 01:34:01 +0100 |
---|---|---|
committer | Lorenz Meier <lorenz@px4.io> | 2015-01-04 01:34:01 +0100 |
commit | 96a8003826346dd75e336ac496a8527cf0b41a01 (patch) | |
tree | bc1e395c42ec89f339b60582ada76b5d9f776528 | |
parent | c241fca8fe040cea341493e44a656b0cfd1bc8cb (diff) | |
parent | 4d0d6f09ce9aef8875e33ee80aefcc8ed00d4769 (diff) | |
download | px4-firmware-96a8003826346dd75e336ac496a8527cf0b41a01.tar.gz px4-firmware-96a8003826346dd75e336ac496a8527cf0b41a01.tar.bz2 px4-firmware-96a8003826346dd75e336ac496a8527cf0b41a01.zip |
Merge pull request #1517 from rowoflo/patch-1
Fixed loop limit errors in Matrix.h
-rw-r--r-- | src/lib/mathlib/math/Matrix.hpp | 16 |
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); |