is_same_dense.cpp
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>
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/.
9 
10 #include "main.h"
11 
13 
15 {
16  typedef Matrix<double,Dynamic,Dynamic,ColMajor> ColMatrixXd;
18  ColMatrixXd m1(10,10);
19  ColMatrixXcd m2(10,10);
20  Ref<ColMatrixXd> ref_m1(m1);
21  Ref<ColMatrixXd,0, Stride<Dynamic,Dynamic> > ref_m2_real(m2.real());
22  Ref<const ColMatrixXd> const_ref_m1(m1);
23 
25  VERIFY(is_same_dense(m1,ref_m1));
26  VERIFY(is_same_dense(const_ref_m1,m1));
27  VERIFY(is_same_dense(const_ref_m1,ref_m1));
28 
29  VERIFY(is_same_dense(m1.block(0,0,m1.rows(),m1.cols()),m1));
30  VERIFY(!is_same_dense(m1.row(0),m1.col(0)));
31 
32  Ref<const ColMatrixXd> const_ref_m1_row(m1.row(1));
33  VERIFY(!is_same_dense(m1.row(1),const_ref_m1_row));
34 
35  Ref<const ColMatrixXd> const_ref_m1_col(m1.col(1));
36  VERIFY(is_same_dense(m1.col(1),const_ref_m1_col));
37 
38 
39  VERIFY(!is_same_dense(m1, ref_m2_real));
40  VERIFY(!is_same_dense(m2, ref_m2_real));
41 }
m1
Matrix3d m1
Definition: IOFormat.cpp:2
m2
MatrixType m2(n_dims)
Eigen::Dynamic
const int Dynamic
Definition: Constants.h:22
EIGEN_DECLARE_TEST
EIGEN_DECLARE_TEST(is_same_dense)
Definition: is_same_dense.cpp:14
Eigen::Ref
A matrix or vector expression mapping an existing expression.
Definition: Ref.h:281
main.h
Eigen::internal::is_same_dense
EIGEN_DEVICE_FUNC bool is_same_dense(const T1 &mat1, const T2 &mat2, typename enable_if< possibly_same_dense< T1, T2 >::value >::type *=0)
Definition: XprHelper.h:695
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
Eigen::ColMajor
@ ColMajor
Definition: Constants.h:319
VERIFY
#define VERIFY(a)
Definition: main.h:380


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:31