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 
22 #include<list>
23 #include<vector>
24 
25 using namespace gtsam;
26 
27 const std::vector<size_t> dimensions{3, 2, 1};
28 
29 //*****************************************************************************
30 TEST(VerticalBlockMatrix, Constructor1) {
32  EXPECT_LONGS_EQUAL(6,actual.rows());
33  EXPECT_LONGS_EQUAL(6,actual.cols());
34  EXPECT_LONGS_EQUAL(3,actual.nBlocks());
35 }
36 
37 //*****************************************************************************
38 TEST(VerticalBlockMatrix, Constructor2) {
40  (Matrix(6, 6) << 1, 2, 3, 4, 5, 6, //
41  2, 8, 9, 10, 11, 12, //
42  3, 9, 15, 16, 17, 18, //
43  4, 10, 16, 22, 23, 24, //
44  5, 11, 17, 23, 29, 30, //
45  6, 12, 18, 24, 30, 36).finished());
46  EXPECT_LONGS_EQUAL(6,actual.rows());
47  EXPECT_LONGS_EQUAL(6,actual.cols());
48  EXPECT_LONGS_EQUAL(3,actual.nBlocks());
49 }
50 
51 //*****************************************************************************
52 TEST(VerticalBlockMatrix, Constructor3) {
53  VerticalBlockMatrix actual(dimensions.begin(),dimensions.end(),6);
54  EXPECT_LONGS_EQUAL(6,actual.rows());
55  EXPECT_LONGS_EQUAL(6,actual.cols());
56  EXPECT_LONGS_EQUAL(3,actual.nBlocks());
57 }
58 
59 //*****************************************************************************
60 int main() {
61  TestResult tr;
62  return TestRegistry::runAllTests(tr);
63 }
64 //*****************************************************************************
65 
DenseIndex cols() const
Column size.
static int runAllTests(TestResult &result)
DenseIndex nBlocks() const
Block count.
DenseIndex rows() const
Row size.
A matrix with column blocks of pre-defined sizes. Used in JacobianFactor and GaussianConditional.
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:39
traits
Definition: chartTesting.h:28
#define EXPECT_LONGS_EQUAL(expected, actual)
Definition: Test.h:154
TEST(SmartFactorBase, Pinhole)
const std::vector< size_t > dimensions


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:39:57