diff options
author | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2011-09-19 15:07:19 +0100 |
---|---|---|
committer | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2011-09-19 15:07:19 +0100 |
commit | 2092b45d0d27cf4f4c7f58e28628bd61464a8a2c (patch) | |
tree | f2972f444645785b4b21ef69e1cb7ea3e272130d /test/product_extra.cpp | |
parent | 16b13596a60c8c384a80ccd71b1c63275dc0d92f (diff) |
Bug fix for matrix1 * matrix2 * scalar1 * scalar2.
See report on http://forum.kde.org/viewtopic.php?f=74&t=96947 .
Diffstat (limited to 'test/product_extra.cpp')
-rw-r--r-- | test/product_extra.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/product_extra.cpp b/test/product_extra.cpp index 25a9974b9..ca302b469 100644 --- a/test/product_extra.cpp +++ b/test/product_extra.cpp @@ -116,6 +116,16 @@ template<typename MatrixType> void product_extra(const MatrixType& m) VERIFY_IS_APPROX(tmp, m1 * m1.adjoint() * s1); } +// Regression test for bug reported at http://forum.kde.org/viewtopic.php?f=74&t=96947 +void mat_mat_scalar_scalar_product() +{ + Eigen::Matrix2Xd dNdxy(2, 3); + dNdxy << -0.5, 0.5, 0, + -0.3, 0, 0.3; + double det = 6.0, wt = 0.5; + VERIFY_IS_APPROX(dNdxy.transpose()*dNdxy*det*wt, det*wt*dNdxy.transpose()*dNdxy); +} + void zero_sized_objects() { // Bug 127 @@ -145,6 +155,7 @@ void test_product_extra() for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1( product_extra(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) ); CALL_SUBTEST_2( product_extra(MatrixXd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) ); + CALL_SUBTEST_2( mat_mat_scalar_scalar_product() ); CALL_SUBTEST_3( product_extra(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2), internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))) ); CALL_SUBTEST_4( product_extra(MatrixXcd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2), internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))) ); CALL_SUBTEST_5( zero_sized_objects() ); |