diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2008-05-28 04:38:16 +0000 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2008-05-28 04:38:16 +0000 |
commit | aebecae510dd29f5573d3f86dfed526e6d8be9a8 (patch) | |
tree | b9bb9d2d15011409fe5f66e1fbb56f1998f5cc91 /test | |
parent | 559233c73e86474d67f5730f9b20e46ccea93b7f (diff) |
* find the proper way of nesting the expression in Flagged:
finally that's more subtle than just using ei_nested, because when
flagging with NestByValueBit we want to store the expression by value
already, regardless of whether it already had the NestByValueBit set.
* rename temporary() ----> nestByValue()
* move the old Product.h to disabled/, replace by what was ProductWIP.h
* tweak -O and -g flags for tests and examples
* reorder the tests -- basic things go first
* simplifications, e.g. in many methoeds return derived() and count on
implicit casting to the actual return type.
* strip some not-really-useful stuff from the heaviest tests
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 14 | ||||
-rw-r--r-- | test/adjoint.cpp | 14 | ||||
-rw-r--r-- | test/linearstructure.cpp | 4 | ||||
-rw-r--r-- | test/product.cpp | 20 |
4 files changed, 19 insertions, 33 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6cd98800a..238006bdf 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,11 @@ IF(BUILD_TESTS) +IF(CMAKE_COMPILER_IS_GNUCXX) + IF(CMAKE_SYSTEM_NAME MATCHES Linux) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1 -g2") + ENDIF(CMAKE_SYSTEM_NAME MATCHES Linux) +ENDIF(CMAKE_COMPILER_IS_GNUCXX) + OPTION(EIGEN_NO_ASSERTION_CHECKING "Disable checking of assertions" OFF) # similar to SET_TARGET_PROPERTIES but append the property instead of overwritting it @@ -64,14 +70,14 @@ FIND_PACKAGE(Qt4 REQUIRED) INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ) EI_ADD_TEST(basicstuff) -EI_ADD_TEST(miscmatrices) +EI_ADD_TEST(linearstructure) +EI_ADD_TEST(cwiseop) +EI_ADD_TEST(product) EI_ADD_TEST(adjoint) EI_ADD_TEST(submatrices) +EI_ADD_TEST(miscmatrices) EI_ADD_TEST(smallvectors) -EI_ADD_TEST(cwiseop) EI_ADD_TEST(map) -EI_ADD_TEST(linearstructure) -EI_ADD_TEST(product) EI_ADD_TEST(triangular) EI_ADD_TEST(cholesky) # EI_ADD_TEST(determinant) diff --git a/test/adjoint.cpp b/test/adjoint.cpp index ae1b002e5..9a15c4986 100644 --- a/test/adjoint.cpp +++ b/test/adjoint.cpp @@ -51,23 +51,15 @@ template<typename MatrixType> void adjoint(const MatrixType& m) Scalar s1 = ei_random<Scalar>(), s2 = ei_random<Scalar>(); - // check involutivity of adjoint, transpose, conjugate - VERIFY_IS_APPROX(m1.transpose().transpose(), m1); - VERIFY_IS_APPROX(m1.conjugate().conjugate(), m1); - VERIFY_IS_APPROX(m1.adjoint().adjoint(), m1); - // check basic compatibility of adjoint, transpose, conjugate VERIFY_IS_APPROX(m1.transpose().conjugate().adjoint(), m1); VERIFY_IS_APPROX(m1.adjoint().conjugate().transpose(), m1); - if(!NumTraits<Scalar>::IsComplex) - VERIFY_IS_APPROX(m1.adjoint().transpose(), m1); // check multiplicative behavior - VERIFY_IS_APPROX((m1.transpose() * m2).transpose(), m2.transpose() * m1); + std::cout << (m1.adjoint() * m2).adjoint() << std::endl; + std::cout << "------------------------------" << std::endl; + std::cout << m2.adjoint() * m1 << std::endl; VERIFY_IS_APPROX((m1.adjoint() * m2).adjoint(), m2.adjoint() * m1); - VERIFY_IS_APPROX((m1.transpose() * m2).conjugate(), m1.adjoint() * m2.conjugate()); - VERIFY_IS_APPROX((s1 * m1).transpose(), s1 * m1.transpose()); - VERIFY_IS_APPROX((s1 * m1).conjugate(), ei_conj(s1) * m1.conjugate()); VERIFY_IS_APPROX((s1 * m1).adjoint(), ei_conj(s1) * m1.adjoint()); // check basic properties of dot, norm, norm2 diff --git a/test/linearstructure.cpp b/test/linearstructure.cpp index a7b058d69..8beb33925 100644 --- a/test/linearstructure.cpp +++ b/test/linearstructure.cpp @@ -62,11 +62,7 @@ template<typename MatrixType> void linearStructure(const MatrixType& m) VERIFY_IS_APPROX(-m2+m1+m2, m1); VERIFY_IS_APPROX(m1*s1, s1*m1); VERIFY_IS_APPROX((m1+m2)*s1, s1*m1+s1*m2); - VERIFY_IS_APPROX((s1+s2)*m1, m1*s1+m1*s2); - VERIFY_IS_APPROX((m1-m2)*s1, s1*m1-s1*m2); - VERIFY_IS_APPROX((s1-s2)*m1, m1*s1-m1*s2); VERIFY_IS_APPROX((-m1+m2)*s1, -s1*m1+s1*m2); - VERIFY_IS_APPROX((-s1+s2)*m1, -m1*s1+m1*s2); m3 = m2; m3 += m1; VERIFY_IS_APPROX(m3, m1+m2); m3 = m2; m3 -= m1; diff --git a/test/product.cpp b/test/product.cpp index 70b41212a..a89497763 100644 --- a/test/product.cpp +++ b/test/product.cpp @@ -73,14 +73,10 @@ template<typename MatrixType> void product(const MatrixType& m) VERIFY_IS_APPROX(s1*(square*m1), (s1*square)*m1); VERIFY_IS_APPROX(s1*(square*m1), square*(m1*s1)); - // continue testing Product.h: lazy product - VERIFY_IS_APPROX(square.lazy() * m1, square*m1); - VERIFY_IS_APPROX(square * m1.lazy(), square*m1); // again, test operator() to check const-qualification s1 += (square.lazy() * m1)(r,c); // test Product.h together with Identity.h - VERIFY_IS_APPROX(m1, identity*m1); VERIFY_IS_APPROX(v1, identity*v1); // again, test operator() to check const-qualification VERIFY_IS_APPROX(MatrixType::identity(rows, cols)(r,c), static_cast<Scalar>(r==c)); @@ -92,18 +88,14 @@ template<typename MatrixType> void product(const MatrixType& m) void test_product() { for(int i = 0; i < g_repeat; i++) { - CALL_SUBTEST( product(Matrix<float, 1, 1>()) ); - CALL_SUBTEST( product(Matrix<float, 3, 3>()) ); - CALL_SUBTEST( product(Matrix<float, 4, 2>()) ); + CALL_SUBTEST( product(Matrix3i()) ); + CALL_SUBTEST( product(Matrix<float, 3, 2>()) ); CALL_SUBTEST( product(Matrix4d()) ); } for(int i = 0; i < g_repeat; i++) { - int rows = ei_random<int>(1,320); - int cols = ei_random<int>(1,320); - CALL_SUBTEST( product(MatrixXf(rows, cols)) ); - CALL_SUBTEST( product(MatrixXd(rows, cols)) ); - CALL_SUBTEST( product(MatrixXi(rows, cols)) ); - CALL_SUBTEST( product(MatrixXcf(rows, cols)) ); - CALL_SUBTEST( product(MatrixXcd(rows, cols)) ); + 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))) ); } } |