10 #include <gtest/gtest.h> 13 #include <Eigen/Dense> 15 TEST(CMatrixDynamic, GetSetEigen)
19 auto em = M.asEigen();
21 for (
int i = 0; i < 3; i++)
EXPECT_EQ(M(i, i), 1.0);
26 for (
int i = 0; i < 3; i++)
27 for (
int j = 0; j < 3; j++)
29 const auto n = ((i + 1) * 3) + (j * 1001);
32 <<
"(i,j)=(" << i <<
"," << j <<
")\n";
36 TEST(CMatrixDynamic, asString)
40 EXPECT_EQ(std::string(
"1 0\n0 1"), M.asString());
43 TEST(CMatrixDynamic, CtorFromArray)
45 const double dat_R[] = {1., 2., 3., 4., 5., 6., 7., 8., 9.};
47 for (
int r = 0; r < 3; r++)
49 for (
int c = 0; c < 3; c++)
52 <<
"(r,c)=(" << r <<
"," << c <<
")\n";
62 TEST(CMatrixDynamic, Resizes)
81 TEST(CVectorDynamic, segment)
86 for (
int i = 0; i < v.size(); i++) v[i] = i;
88 for (
int start = 0; start < 8; start++)
89 for (
int len = 1; len < v.size() - start; len++)
91 const auto s = v.segmentCopy(start, len);
92 for (
int i = 0; i < s.size(); i++)
EXPECT_EQ(v[i + start], s[i]);
static CMatrixDynamic< T > Identity()
CVectorDynamic< double > CVectorDouble
EXPECT_EQ(out.image_pair_was_used.size(), NUM_IMGS)
void resize(std::size_t N, bool zeroNewElements=false)
EXPECT_NEAR(out.cam_params.rightCameraPose.x, 0.1194, 0.005)
EIGEN_MAP asEigen()
Get as an Eigen-compatible Eigen::Map object.
TEST(CMatrixDynamic, GetSetEigen)
CMatrixDynamic< double > CMatrixDouble
Declares a matrix of double numbers (non serializable).