LP-311 Remove basic/advanced stabilization tab auto-switch (autotune/txpid lock issues)
[librepilot.git] / ground / gcs / src / libs / eigen / test / resize.cpp
blob4adaafe5695a982d500e35f3992a63008c806ae3
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2009 Keir Mierle <mierle@gmail.com>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include "main.h"
12 template<DenseIndex rows, DenseIndex cols>
13 void resizeLikeTest()
15 MatrixXf A(rows, cols);
16 MatrixXf B;
17 Matrix<double, rows, cols> C;
18 B.resizeLike(A);
19 C.resizeLike(B); // Shouldn't crash.
20 VERIFY(B.rows() == rows && B.cols() == cols);
22 VectorXf x(rows);
23 RowVectorXf y;
24 y.resizeLike(x);
25 VERIFY(y.rows() == 1 && y.cols() == rows);
27 y.resize(cols);
28 x.resizeLike(y);
29 VERIFY(x.rows() == cols && x.cols() == 1);
32 void resizeLikeTest12() { resizeLikeTest<1,2>(); }
33 void resizeLikeTest1020() { resizeLikeTest<10,20>(); }
34 void resizeLikeTest31() { resizeLikeTest<3,1>(); }
36 void test_resize()
38 CALL_SUBTEST(resizeLikeTest12() );
39 CALL_SUBTEST(resizeLikeTest1020() );
40 CALL_SUBTEST(resizeLikeTest31() );