testVerticalBlockMatrix.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
21 #include <boost/assign/list_of.hpp>
22 
23 using namespace std;
24 using namespace gtsam;
25 using boost::assign::list_of;
26 
27 list<size_t> L = list_of(3)(2)(1);
28 vector<size_t> dimensions(L.begin(),L.end());
29 
30 //*****************************************************************************
31 TEST(VerticalBlockMatrix, Constructor1) {
33  EXPECT_LONGS_EQUAL(6,actual.rows());
34  EXPECT_LONGS_EQUAL(6,actual.cols());
35  EXPECT_LONGS_EQUAL(3,actual.nBlocks());
36 }
37 
38 //*****************************************************************************
39 TEST(VerticalBlockMatrix, Constructor2) {
41  (Matrix(6, 6) << 1, 2, 3, 4, 5, 6, //
42  2, 8, 9, 10, 11, 12, //
43  3, 9, 15, 16, 17, 18, //
44  4, 10, 16, 22, 23, 24, //
45  5, 11, 17, 23, 29, 30, //
46  6, 12, 18, 24, 30, 36).finished());
47  EXPECT_LONGS_EQUAL(6,actual.rows());
48  EXPECT_LONGS_EQUAL(6,actual.cols());
49  EXPECT_LONGS_EQUAL(3,actual.nBlocks());
50 }
51 
52 //*****************************************************************************
53 TEST(VerticalBlockMatrix, Constructor3) {
54  VerticalBlockMatrix actual(dimensions.begin(),dimensions.end(),6);
55  EXPECT_LONGS_EQUAL(6,actual.rows());
56  EXPECT_LONGS_EQUAL(6,actual.cols());
57  EXPECT_LONGS_EQUAL(3,actual.nBlocks());
58 }
59 
60 //*****************************************************************************
61 int main() {
62  TestResult tr;
63  return TestRegistry::runAllTests(tr);
64 }
65 //*****************************************************************************
66 
TEST(VerticalBlockMatrix, Constructor1)
static int runAllTests(TestResult &result)
list< size_t > L
A matrix with column blocks of pre-defined sizes. Used in JacobianFactor and GaussianConditional.
Definition: Half.h:150
vector< size_t > dimensions(L.begin(), L.end())
DenseIndex nBlocks() const
Block count.
traits
Definition: chartTesting.h:28
#define EXPECT_LONGS_EQUAL(expected, actual)
Definition: Test.h:155
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Matrix
DenseIndex cols() const
Column size.
DenseIndex rows() const
Row size.


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:50:25