Add support for Slice to Matrix, SquareMatrix, Vector

This commit is contained in:
Julian Kent
2019-09-16 16:11:08 +02:00
parent af1378cc55
commit 82d565f4d9
8 changed files with 77 additions and 20 deletions
+1 -1
View File
@@ -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,
+13
View File
@@ -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;
}