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.
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_product_large()
00028 {
00029   for(int i = 0; i < g_repeat; i++) {
00030     CALL_SUBTEST_1( product(MatrixXf(internal::random<int>(1,320), internal::random<int>(1,320))) );
00031     CALL_SUBTEST_2( product(MatrixXd(internal::random<int>(1,320), internal::random<int>(1,320))) );
00032     CALL_SUBTEST_3( product(MatrixXi(internal::random<int>(1,320), internal::random<int>(1,320))) );
00033     CALL_SUBTEST_4( product(MatrixXcf(internal::random<int>(1,150), internal::random<int>(1,150))) );
00034     CALL_SUBTEST_5( product(Matrix<float,Dynamic,Dynamic,RowMajor>(internal::random<int>(1,320), internal::random<int>(1,320))) );
00035   }
00036 
00037 #if defined 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     // check the functions to setup blocking sizes compile and do not segfault
00055     // FIXME check they do what they are supposed to do !!
00056     std::ptrdiff_t l1 = internal::random<int>(10000,20000);
00057     std::ptrdiff_t l2 = internal::random<int>(1000000,2000000);
00058     setCpuCacheSizes(l1,l2);
00059     VERIFY(l1==l1CacheSize());
00060     VERIFY(l2==l2CacheSize());
00061     std::ptrdiff_t k1 = internal::random<int>(10,100)*16;
00062     std::ptrdiff_t m1 = internal::random<int>(10,100)*16;
00063     std::ptrdiff_t n1 = internal::random<int>(10,100)*16;
00064     // only makes sure it compiles fine
00065     internal::computeProductBlockingSizes<float,float>(k1,m1,n1);
00066   }
00067 
00068   {
00069     // test regression in row-vector by matrix (bad Map type)
00070     MatrixXf mat1(10,32); mat1.setRandom();
00071     MatrixXf mat2(32,32); mat2.setRandom();
00072     MatrixXf r1 = mat1.row(2)*mat2.transpose();
00073     VERIFY_IS_APPROX(r1, (mat1.row(2)*mat2.transpose()).eval());
00074 
00075     MatrixXf r2 = mat1.row(2)*mat2;
00076     VERIFY_IS_APPROX(r2, (mat1.row(2)*mat2).eval());
00077   }
00078 #endif
00079 }


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