14 using namespace Eigen;
16 template <
typename Scalar,
int Storage>
24 m = n = MatrixType::Random(50,50);
25 m.conservativeResize(1,50);
28 m = n = MatrixType::Random(50,50);
29 m.conservativeResize(50,1);
32 m = n = MatrixType::Random(50,50);
33 m.conservativeResize(50,50);
37 for (
int i=0;
i<25; ++
i)
39 const Index rows = internal::random<Index>(1,50);
40 const Index cols = internal::random<Index>(1,50);
41 m = n = MatrixType::Random(50,50);
42 m.conservativeResize(rows,cols);
47 for (
int i=0;
i<25; ++
i)
49 const Index rows = internal::random<Index>(50,75);
50 const Index cols = internal::random<Index>(50,75);
51 m = n = MatrixType::Random(50,50);
52 m.conservativeResizeLike(MatrixType::Zero(rows,cols));
54 VERIFY( rows<=50 || m.block(50,0,rows-50,cols).sum() ==
Scalar(0) );
55 VERIFY( cols<=50 || m.block(0,50,rows,cols-50).sum() ==
Scalar(0) );
59 template <
typename Scalar>
67 m = n = VectorType::Random(50);
68 m.conservativeResize(1);
71 m = n = VectorType::Random(50);
72 m.conservativeResize(50);
75 m = n = VectorType::Random(50);
76 m.conservativeResize(m.rows(),1);
79 m = n = VectorType::Random(50);
80 m.conservativeResize(m.rows(),50);
84 for (
int i=0;
i<50; ++
i)
86 const int size = internal::random<int>(1,50);
87 m = n = VectorType::Random(50);
88 m.conservativeResize(size);
91 m = n = VectorType::Random(50);
92 m.conservativeResize(m.rows(),
size);
97 for (
int i=0;
i<50; ++
i)
99 const int size = internal::random<int>(50,100);
100 m = n = VectorType::Random(50);
101 m.conservativeResizeLike(VectorType::Zero(size));
103 VERIFY( size<=50 || m.segment(50,size-50).sum() ==
Scalar(0) );
105 m = n = VectorType::Random(50);
108 VERIFY( size<=50 || m.segment(50,size-50).sum() ==
Scalar(0) );
116 CALL_SUBTEST_1((run_matrix_tests<int, Eigen::RowMajor>()));
117 CALL_SUBTEST_1((run_matrix_tests<int, Eigen::ColMajor>()));
118 CALL_SUBTEST_2((run_matrix_tests<float, Eigen::RowMajor>()));
119 CALL_SUBTEST_2((run_matrix_tests<float, Eigen::ColMajor>()));
120 CALL_SUBTEST_3((run_matrix_tests<double, Eigen::RowMajor>()));
121 CALL_SUBTEST_3((run_matrix_tests<double, Eigen::ColMajor>()));
127 CALL_SUBTEST_1((run_vector_tests<int>()));
128 CALL_SUBTEST_2((run_vector_tests<float>()));
129 CALL_SUBTEST_3((run_vector_tests<double>()));
Namespace containing all symbols from the Eigen library.
#define VERIFY_IS_APPROX(a, b)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
void test_conservative_resize()
The matrix class, also used for vectors and row-vectors.