mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 06:33:33 +08:00
Add support for Slice to Matrix, SquareMatrix, Vector
This commit is contained in:
+1
-1
@@ -46,7 +46,7 @@ int main()
|
||||
};
|
||||
|
||||
Matrix<float, 2, 2> C(data_2);
|
||||
A.set(C, 1, 1);
|
||||
A.slice<2, 2>(1, 1) = C;
|
||||
|
||||
float data_2_check[9] = {
|
||||
0, 2, 3,
|
||||
|
||||
@@ -26,6 +26,19 @@ int main()
|
||||
SquareMatrix<float, 3> eA = expm(SquareMatrix<float, 3>(A*dt), 5);
|
||||
SquareMatrix<float, 3> eA_check(data_check);
|
||||
TEST((eA - eA_check).abs().max() < 1e-3f);
|
||||
|
||||
SquareMatrix<float, 2> A_bottomright = A.slice<2,2>(1,1);
|
||||
SquareMatrix<float, 2> A_bottomright2;
|
||||
A_bottomright2 = A.slice<2,2>(1,1);
|
||||
|
||||
float data_bottomright[4] = {5, 6,
|
||||
8, 10
|
||||
};
|
||||
SquareMatrix<float, 2> bottomright_check(data_bottomright);
|
||||
TEST(isEqual(A_bottomright, bottomright_check));
|
||||
TEST(isEqual(A_bottomright2, bottomright_check));
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user