mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 20:33:35 +08:00
Added coverage to build.
This commit is contained in:
+8
-3
@@ -14,9 +14,14 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "Vector.hpp"
|
||||||
|
|
||||||
namespace matrix
|
namespace matrix
|
||||||
{
|
{
|
||||||
|
|
||||||
|
template <typename Type, size_t M>
|
||||||
|
class Vector;
|
||||||
|
|
||||||
template<typename Type, size_t M, size_t N>
|
template<typename Type, size_t M, size_t N>
|
||||||
class Matrix
|
class Matrix
|
||||||
{
|
{
|
||||||
@@ -173,7 +178,7 @@ public:
|
|||||||
Matrix<Type, M, N> operator+(Type scalar) const
|
Matrix<Type, M, N> operator+(Type scalar) const
|
||||||
{
|
{
|
||||||
Matrix<Type, M, N> res;
|
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 i = 0; i < M; i++) {
|
||||||
for (size_t j = 0; j < N; j++) {
|
for (size_t j = 0; j < N; j++) {
|
||||||
@@ -265,9 +270,9 @@ public:
|
|||||||
return res;
|
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
|
// force square for now
|
||||||
const Matrix<Type, M, M> &self = *this;
|
const Matrix<Type, M, M> &self = *this;
|
||||||
|
|
||||||
|
|||||||
+4
-7
@@ -12,6 +12,9 @@
|
|||||||
namespace matrix
|
namespace matrix
|
||||||
{
|
{
|
||||||
|
|
||||||
|
template <typename Type, size_t M, size_t N>
|
||||||
|
class Matrix;
|
||||||
|
|
||||||
template<typename Type, size_t M>
|
template<typename Type, size_t M>
|
||||||
class Vector : public Matrix<Type, M, 1>
|
class Vector : public Matrix<Type, M, 1>
|
||||||
{
|
{
|
||||||
@@ -102,12 +105,6 @@ public:
|
|||||||
self = self - other;
|
self = self - other;
|
||||||
}
|
}
|
||||||
|
|
||||||
void operator*=(const Vector<Type, M> &other)
|
|
||||||
{
|
|
||||||
Vector<Type, M> &self = *this;
|
|
||||||
self = self * other;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scalar Operations
|
* Scalar Operations
|
||||||
*/
|
*/
|
||||||
@@ -127,7 +124,7 @@ public:
|
|||||||
Vector<Type, M> operator+(Type scalar) const
|
Vector<Type, M> operator+(Type scalar) const
|
||||||
{
|
{
|
||||||
Vector<Type, M> res;
|
Vector<Type, M> res;
|
||||||
Vector<Type, M> &self = *this;
|
const Vector<Type, M> &self = *this;
|
||||||
|
|
||||||
for (size_t i = 0; i < M; i++) {
|
for (size_t i = 0; i < M; i++) {
|
||||||
res(i) = self(i) + scalar;
|
res(i) = self(i) + scalar;
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
if (COVERALLS)
|
||||||
|
add_library(coverage
|
||||||
|
coverage.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(tests
|
set(tests
|
||||||
setIdentity
|
setIdentity
|
||||||
inverse
|
inverse
|
||||||
|
|||||||
+8
-4
@@ -7,7 +7,11 @@
|
|||||||
#include <Scalar.hpp>
|
#include <Scalar.hpp>
|
||||||
#include <Quaternion.hpp>
|
#include <Quaternion.hpp>
|
||||||
|
|
||||||
template Vector<float, 2>;
|
namespace matrix {
|
||||||
template Euler<float>;
|
|
||||||
template Scalar<float>;
|
template class Vector<float, 2>;
|
||||||
template Matrix<float, 3, 3>;
|
template class Euler<float>;
|
||||||
|
template class Scalar<float>;
|
||||||
|
template class Matrix<float, 3, 3>;
|
||||||
|
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user