source: pacpussensors/trunk/Vislab/lib3dv/eigen/test/commainitializer.cpp@ 140

Last change on this file since 140 was 136, checked in by ldecherf, 8 years ago

Doc

File size: 1.1 KB
Line 
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2008 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
12void test_commainitializer()
13{
14 Matrix3d m3;
15 Matrix4d m4;
16
17 VERIFY_RAISES_ASSERT( (m3 << 1, 2, 3, 4, 5, 6, 7, 8) );
18
19 #ifndef _MSC_VER
20 VERIFY_RAISES_ASSERT( (m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10) );
21 #endif
22
23 double data[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
24 Matrix3d ref = Map<Matrix<double,3,3,RowMajor> >(data);
25
26 m3 = Matrix3d::Random();
27 m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9;
28 VERIFY_IS_APPROX(m3, ref );
29
30 Vector3d vec[3];
31 vec[0] << 1, 4, 7;
32 vec[1] << 2, 5, 8;
33 vec[2] << 3, 6, 9;
34 m3 = Matrix3d::Random();
35 m3 << vec[0], vec[1], vec[2];
36 VERIFY_IS_APPROX(m3, ref);
37
38 vec[0] << 1, 2, 3;
39 vec[1] << 4, 5, 6;
40 vec[2] << 7, 8, 9;
41 m3 = Matrix3d::Random();
42 m3 << vec[0].transpose(),
43 4, 5, 6,
44 vec[2].transpose();
45 VERIFY_IS_APPROX(m3, ref);
46
47}
Note: See TracBrowser for help on using the repository browser.