mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-02 05:04:08 +08:00
Added coverage to build.
This commit is contained in:
parent
6458c0477e
commit
3477ff2adb
@ -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;
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
if (COVERALLS)
|
||||
add_library(coverage
|
||||
coverage.cpp)
|
||||
endif()
|
||||
|
||||
set(tests
|
||||
setIdentity
|
||||
inverse
|
||||
|
||||
@ -7,7 +7,11 @@
|
||||
#include <Scalar.hpp>
|
||||
#include <Quaternion.hpp>
|
||||
|
||||
template Vector<float, 2>;
|
||||
template Euler<float>;
|
||||
template Scalar<float>;
|
||||
template Matrix<float, 3, 3>;
|
||||
namespace matrix {
|
||||
|
||||
template class Vector<float, 2>;
|
||||
template class Euler<float>;
|
||||
template class Scalar<float>;
|
||||
template class Matrix<float, 3, 3>;
|
||||
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user