source: pacpussensors/trunk/Vislab/lib3dv/eigen/test/eigen2/eigen2_product_large.cpp@ 136

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

Doc

File size: 1.6 KB
Line 
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra. Eigen itself is part of the KDE project.
3//
4// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@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/.
9
10#include "product.h"
11
12void test_eigen2_product_large()
13{
14 for(int i = 0; i < g_repeat; i++) {
15 CALL_SUBTEST_1( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );
16 CALL_SUBTEST_2( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) );
17 CALL_SUBTEST_3( product(MatrixXi(ei_random<int>(1,320), ei_random<int>(1,320))) );
18 CALL_SUBTEST_4( product(MatrixXcf(ei_random<int>(1,50), ei_random<int>(1,50))) );
19 CALL_SUBTEST_5( product(Matrix<float,Dynamic,Dynamic,RowMajor>(ei_random<int>(1,320), ei_random<int>(1,320))) );
20 }
21
22#ifdef EIGEN_TEST_PART_6
23 {
24 // test a specific issue in DiagonalProduct
25 int N = 1000000;
26 VectorXf v = VectorXf::Ones(N);
27 MatrixXf m = MatrixXf::Ones(N,3);
28 m = (v+v).asDiagonal() * m;
29 VERIFY_IS_APPROX(m, MatrixXf::Constant(N,3,2));
30 }
31
32 {
33 // test deferred resizing in Matrix::operator=
34 MatrixXf a = MatrixXf::Random(10,4), b = MatrixXf::Random(4,10), c = a;
35 VERIFY_IS_APPROX((a = a * b), (c * b).eval());
36 }
37
38 {
39 MatrixXf mat1(10,10); mat1.setRandom();
40 MatrixXf mat2(32,10); mat2.setRandom();
41 MatrixXf result = mat1.row(2)*mat2.transpose();
42 VERIFY_IS_APPROX(result, (mat1.row(2)*mat2.transpose()).eval());
43 }
44#endif
45}
Note: See TracBrowser for help on using the repository browser.