diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 10 | ||||
-rw-r--r-- | test/eigensolver.cpp | 4 | ||||
-rw-r--r-- | test/product.h (renamed from test/product.cpp) | 22 | ||||
-rw-r--r-- | test/product_large.cpp | 40 | ||||
-rw-r--r-- | test/product_small.cpp | 35 |
5 files changed, 85 insertions, 26 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 14ed29a3d..97c7f4937 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -38,7 +38,12 @@ MACRO(EI_ADD_TEST testname) SET(targetname test_${testname}) - ADD_EXECUTABLE(${targetname} ${testname}.cpp) + IF(${ARGC} EQUAL 2) + SET(filename ${ARGV1}) + ELSE(${ARGC} EQUAL 2) + SET(filename ${testname}.cpp) + ENDIF(${ARGC} EQUAL 2) + ADD_EXECUTABLE(${targetname} ${filename}) IF(NOT EIGEN_NO_ASSERTION_CHECKING) @@ -80,7 +85,8 @@ EI_ADD_TEST(nomalloc) EI_ADD_TEST(basicstuff) EI_ADD_TEST(linearstructure) EI_ADD_TEST(cwiseop) -EI_ADD_TEST(product) +EI_ADD_TEST(product_small) +EI_ADD_TEST(product_large) EI_ADD_TEST(adjoint) EI_ADD_TEST(submatrices) EI_ADD_TEST(miscmatrices) diff --git a/test/eigensolver.cpp b/test/eigensolver.cpp index 9837162f6..a1ab4a685 100644 --- a/test/eigensolver.cpp +++ b/test/eigensolver.cpp @@ -63,8 +63,8 @@ void test_eigensolver() // very important to test a 3x3 matrix since we provide a special path for it CALL_SUBTEST( eigensolver(Matrix3f()) ); CALL_SUBTEST( eigensolver(Matrix4d()) ); - CALL_SUBTEST( eigensolver(MatrixXd(7,7)) ); + CALL_SUBTEST( eigensolver(MatrixXf(7,7)) ); CALL_SUBTEST( eigensolver(MatrixXcd(6,6)) ); - CALL_SUBTEST( eigensolver(MatrixXcd(3,3)) ); + CALL_SUBTEST( eigensolver(MatrixXcf(3,3)) ); } } diff --git a/test/product.cpp b/test/product.h index 2f6677ff1..374994576 100644 --- a/test/product.cpp +++ b/test/product.h @@ -144,25 +144,3 @@ template<typename MatrixType> void product(const MatrixType& m) } } -void test_product() -{ - for(int i = 0; i < g_repeat; i++) { - CALL_SUBTEST( product(Matrix3i()) ); - CALL_SUBTEST( product(Matrix<float, 3, 2>()) ); - CALL_SUBTEST( product(Matrix4d()) ); - CALL_SUBTEST( product(Matrix4f()) ); - CALL_SUBTEST( product(MatrixXf(3,5)) ); - CALL_SUBTEST( product(MatrixXi(28,39)) ); - } - for(int i = 0; i < g_repeat; i++) { - CALL_SUBTEST( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) ); - CALL_SUBTEST( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) ); - CALL_SUBTEST( product(MatrixXi(ei_random<int>(1,256), ei_random<int>(1,256))) ); - CALL_SUBTEST( product(MatrixXcf(ei_random<int>(1,50), ei_random<int>(1,50))) ); - #ifndef EIGEN_DEFAULT_TO_ROW_MAJOR - CALL_SUBTEST( product(Matrix<float,Dynamic,Dynamic,Dynamic,Dynamic,RowMajorBit>(ei_random<int>(1,320), ei_random<int>(1,320))) ); - #else - CALL_SUBTEST( product(Matrix<float,Dynamic,Dynamic,Dynamic,Dynamic,0>(ei_random<int>(1,320), ei_random<int>(1,320))) ); - #endif - } -} diff --git a/test/product_large.cpp b/test/product_large.cpp new file mode 100644 index 000000000..904cf5a0b --- /dev/null +++ b/test/product_large.cpp @@ -0,0 +1,40 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. Eigen itself is part of the KDE project. +// +// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr> +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see <http://www.gnu.org/licenses/>. + +#include "product.h" + +void test_product_large() +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST( product(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) ); + CALL_SUBTEST( product(MatrixXd(ei_random<int>(1,320), ei_random<int>(1,320))) ); + CALL_SUBTEST( product(MatrixXi(ei_random<int>(1,320), ei_random<int>(1,320))) ); + CALL_SUBTEST( product(MatrixXcf(ei_random<int>(1,50), ei_random<int>(1,50))) ); + #ifndef EIGEN_DEFAULT_TO_ROW_MAJOR + CALL_SUBTEST( product(Matrix<float,Dynamic,Dynamic,Dynamic,Dynamic,RowMajorBit>(ei_random<int>(1,320), ei_random<int>(1,320))) ); + #else + CALL_SUBTEST( product(Matrix<float,Dynamic,Dynamic,Dynamic,Dynamic,0>(ei_random<int>(1,320), ei_random<int>(1,320))) ); + #endif + } +} diff --git a/test/product_small.cpp b/test/product_small.cpp new file mode 100644 index 000000000..ef44b0826 --- /dev/null +++ b/test/product_small.cpp @@ -0,0 +1,35 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. Eigen itself is part of the KDE project. +// +// Copyright (C) 2006-2008 Benoit Jacob <jacob@math.jussieu.fr> +// +// Eigen is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// Alternatively, you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License and a copy of the GNU General Public License along with +// Eigen. If not, see <http://www.gnu.org/licenses/>. + +#include "product.h" + +void test_product_small() +{ + for(int i = 0; i < g_repeat; i++) { + CALL_SUBTEST( product(Matrix<float, 3, 2>()) ); + CALL_SUBTEST( product(Matrix<int, 3, 5>()) ); + CALL_SUBTEST( product(Matrix4d()) ); + CALL_SUBTEST( product(Matrix4f()) ); + } +} |