mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 18:03:34 +08:00
Added coverage to build.
This commit is contained in:
+8
-3
@@ -14,9 +14,14 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "Vector.hpp"
|
||||
|
||||
namespace matrix
|
||||
{
|
||||
|
||||
template <typename Type, size_t M>
|
||||
class Vector;
|
||||
|
||||
template<typename Type, size_t M, size_t N>
|
||||
class Matrix
|
||||
{
|
||||
@@ -173,7 +178,7 @@ public:
|
||||
Matrix<Type, M, N> operator+(Type scalar) const
|
||||
{
|
||||
Matrix<Type, M, N> res;
|
||||
Matrix<Type, M, N> &self = *this;
|
||||
const Matrix<Type, M, N> &self = *this;
|
||||
|
||||
for (size_t i = 0; i < M; i++) {
|
||||
for (size_t j = 0; j < N; j++) {
|
||||
@@ -265,9 +270,9 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
Matrix<Type, M, 1> diagonal() const
|
||||
Vector<Type, M> diagonal() const
|
||||
{
|
||||
Matrix<Type, M, 1> res;
|
||||
Vector<Type, M> res;
|
||||
// force square for now
|
||||
const Matrix<Type, M, M> &self = *this;
|
||||
|
||||
|
||||
+4
-7
@@ -12,6 +12,9 @@
|
||||
namespace matrix
|
||||
{
|
||||
|
||||
template <typename Type, size_t M, size_t N>
|
||||
class Matrix;
|
||||
|
||||
template<typename Type, size_t M>
|
||||
class Vector : public Matrix<Type, M, 1>
|
||||
{
|
||||
@@ -102,12 +105,6 @@ public:
|
||||
self = self - other;
|
||||
}
|
||||
|
||||
void operator*=(const Vector<Type, M> &other)
|
||||
{
|
||||
Vector<Type, M> &self = *this;
|
||||
self = self * other;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scalar Operations
|
||||
*/
|
||||
@@ -127,7 +124,7 @@ public:
|
||||
Vector<Type, M> operator+(Type scalar) const
|
||||
{
|
||||
Vector<Type, M> res;
|
||||
Vector<Type, M> &self = *this;
|
||||
const Vector<Type, M> &self = *this;
|
||||
|
||||
for (size_t i = 0; i < M; i++) {
|
||||
res(i) = self(i) + scalar;
|
||||
|
||||
Reference in New Issue
Block a user