15 using namespace Eigen;
17 template <
typename Scalar,
int Storage>
25 m = n = MatrixType::Random(50,50);
26 m.conservativeResize(1,50);
29 m = n = MatrixType::Random(50,50);
30 m.conservativeResize(50,1);
33 m = n = MatrixType::Random(50,50);
34 m.conservativeResize(50,50);
38 for (
int i=0;
i<25; ++
i)
40 const Index rows = internal::random<Index>(1,50);
41 const Index cols = internal::random<Index>(1,50);
42 m = n = MatrixType::Random(50,50);
43 m.conservativeResize(rows,cols);
48 for (
int i=0;
i<25; ++
i)
50 const Index rows = internal::random<Index>(50,75);
51 const Index cols = internal::random<Index>(50,75);
52 m = n = MatrixType::Random(50,50);
53 m.conservativeResizeLike(MatrixType::Zero(rows,cols));
55 VERIFY( rows<=50 || m.block(50,0,rows-50,cols).sum() ==
Scalar(0) );
56 VERIFY( cols<=50 || m.block(0,50,rows,cols-50).sum() ==
Scalar(0) );
60 template <
typename Scalar>
68 m = n = VectorType::Random(50);
69 m.conservativeResize(1);
72 m = n = VectorType::Random(50);
73 m.conservativeResize(50);
76 m = n = VectorType::Random(50);
77 m.conservativeResize(m.rows(),1);
80 m = n = VectorType::Random(50);
81 m.conservativeResize(m.rows(),50);
85 for (
int i=0;
i<50; ++
i)
87 const int size = internal::random<int>(1,50);
88 m = n = VectorType::Random(50);
89 m.conservativeResize(size);
92 m = n = VectorType::Random(50);
93 m.conservativeResize(m.rows(),
size);
98 for (
int i=0;
i<50; ++
i)
100 const int size = internal::random<int>(50,100);
101 m = n = VectorType::Random(50);
102 m.conservativeResizeLike(VectorType::Zero(size));
104 VERIFY( size<=50 || m.segment(50,size-50).sum() ==
Scalar(0) );
106 m = n = VectorType::Random(50);
109 VERIFY( size<=50 || m.segment(50,size-50).sum() ==
Scalar(0) );
120 #ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW 124 VectorType
v0(n),
v1(n);
125 MatrixType m0(n,n),
m1(n,n),
m2(n,n);
126 v0.setOnes(); v1.setOnes();
127 m0.setOnes();
m1.setOnes(); m2.setOnes();
129 m0.conservativeResize(2*n,2*n);
130 VERIFY(m0.topLeftCorner(n,n) ==
m1);
133 v0.conservativeResize(2*n);
153 CALL_SUBTEST_1((run_matrix_tests<int, Eigen::RowMajor | Eigen::DontAlign>()));
161 #ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW
#define CALL_SUBTEST_6(FUNC)
#define CALL_SUBTEST_4(FUNC)
EIGEN_DECLARE_TEST(conservative_resize)
#define CALL_SUBTEST_3(FUNC)
Namespace containing all symbols from the Eigen library.
#define VERIFY_IS_APPROX(a, b)
#define CALL_SUBTEST_1(FUNC)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
#define CALL_SUBTEST_5(FUNC)
#define CALL_SUBTEST_2(FUNC)
The matrix class, also used for vectors and row-vectors.