eigen2_product_large.cpp
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra. Eigen itself is part of the KDE project.
00003 //
00004 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
00005 //
00006 // Eigen is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 3 of the License, or (at your option) any later version.
00010 //
00011 // Alternatively, you can redistribute it and/or
00012 // modify it under the terms of the GNU General Public License as
00013 // published by the Free Software Foundation; either version 2 of
00014 // the License, or (at your option) any later version.
00015 //
00016 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00017 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00018 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00019 // GNU General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License and a copy of the GNU General Public License along with
00023 // Eigen. If not, see <http://www.gnu.org/licenses/>.
00024 
00025 #include "product.h"
00026 
00027 void test_eigen2_product_large()
00028 {
00029   for(int i = 0; i < g_repeat; i++) {
00030     CALL_SUBTEST_1( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );
00031     CALL_SUBTEST_2( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) );
00032     CALL_SUBTEST_3( product(MatrixXi(ei_random<int>(1,320), ei_random<int>(1,320))) );
00033     CALL_SUBTEST_4( product(MatrixXcf(ei_random<int>(1,50), ei_random<int>(1,50))) );
00034     CALL_SUBTEST_5( product(Matrix<float,Dynamic,Dynamic,RowMajor>(ei_random<int>(1,320), ei_random<int>(1,320))) );
00035   }
00036 
00037 #ifdef EIGEN_TEST_PART_6
00038   {
00039     // test a specific issue in DiagonalProduct
00040     int N = 1000000;
00041     VectorXf v = VectorXf::Ones(N);
00042     MatrixXf m = MatrixXf::Ones(N,3);
00043     m = (v+v).asDiagonal() * m;
00044     VERIFY_IS_APPROX(m, MatrixXf::Constant(N,3,2));
00045   }
00046 
00047   {
00048     // test deferred resizing in Matrix::operator=
00049     MatrixXf a = MatrixXf::Random(10,4), b = MatrixXf::Random(4,10), c = a;
00050     VERIFY_IS_APPROX((a = a * b), (c * b).eval());
00051   }
00052 
00053   {
00054     MatrixXf mat1(10,10); mat1.setRandom();
00055     MatrixXf mat2(32,10); mat2.setRandom();
00056     MatrixXf result = mat1.row(2)*mat2.transpose();
00057     VERIFY_IS_APPROX(result, (mat1.row(2)*mat2.transpose()).eval());
00058   }
00059 #endif
00060 }


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:31:04