mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 21:43:33 +08:00
Added slice function for matrix.
This commit is contained in:
+2
-1
@@ -1,6 +1,7 @@
|
||||
set(tests
|
||||
setIdentity
|
||||
inverse
|
||||
slice
|
||||
matrixMult
|
||||
vectorAssignment
|
||||
matrixAssignment
|
||||
@@ -33,4 +34,4 @@ if (${CMAKE_BUILD_TYPE} STREQUAL "Profile")
|
||||
WORKING_DIRECTORY ${CMAKE_BUILD_DIR}
|
||||
DEPENDS test_build
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include <matrix/math.hpp>
|
||||
#include "test_macros.hpp"
|
||||
|
||||
using namespace matrix;
|
||||
|
||||
int main()
|
||||
{
|
||||
float data[9] = {0, 2, 3,
|
||||
4, 5, 6,
|
||||
7, 8, 10
|
||||
};
|
||||
float data_check[6] = {
|
||||
4, 5, 6,
|
||||
7, 8, 10
|
||||
};
|
||||
SquareMatrix<float, 3> A(data);
|
||||
Matrix<float, 2, 3> B_check(data_check);
|
||||
Matrix<float, 2, 3> B(A.slice<2, 3>(1, 0));
|
||||
TEST(isEqual(B, B_check));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vim: set et fenc=utf-8 ff=unix sts=0 sw=4 ts=4 : */
|
||||
Reference in New Issue
Block a user