aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/product_small.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2016-09-26 23:53:40 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2016-09-26 23:53:40 +0200
commit779774f98cea76a0f44b4b53b89e5195582363bd (patch)
tree714140ef1c04ef03877bcdd658d1cf5bc329249b /test/product_small.cpp
parent6565f8d60fc0cadd1935ab2dee522ec52829e615 (diff)
bug #1311: fix alignment logic in some cases of (scalar*small).lazyProduct(small)
Diffstat (limited to 'test/product_small.cpp')
-rw-r--r--test/product_small.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/product_small.cpp b/test/product_small.cpp
index 0db50b949..fdfdd9f6c 100644
--- a/test/product_small.cpp
+++ b/test/product_small.cpp
@@ -12,6 +12,7 @@
#include <Eigen/LU>
// regression test for bug 447
+template<int>
void product1x1()
{
Matrix<float,1,3> matAstatic;
@@ -209,6 +210,24 @@ void test_linear_but_not_vectorizable()
}
}
+template<int Rows>
+void bug_1311()
+{
+ Matrix< double, Rows, 2 > A; A.setRandom();
+ Vector2d b = Vector2d::Random() ;
+ Matrix<double,Rows,1> res;
+ res.noalias() = 1. * (A * b);
+ VERIFY_IS_APPROX(res, A*b);
+ res.noalias() = 1.*A * b;
+ VERIFY_IS_APPROX(res, A*b);
+ res.noalias() = (1.*A).lazyProduct(b);
+ VERIFY_IS_APPROX(res, A*b);
+ res.noalias() = (1.*A).lazyProduct(1.*b);
+ VERIFY_IS_APPROX(res, A*b);
+ res.noalias() = (A).lazyProduct(1.*b);
+ VERIFY_IS_APPROX(res, A*b);
+}
+
void test_product_small()
{
for(int i = 0; i < g_repeat; i++) {
@@ -218,7 +237,7 @@ void test_product_small()
CALL_SUBTEST_3( product(Matrix3d()) );
CALL_SUBTEST_4( product(Matrix4d()) );
CALL_SUBTEST_5( product(Matrix4f()) );
- CALL_SUBTEST_6( product1x1() );
+ CALL_SUBTEST_6( product1x1<0>() );
CALL_SUBTEST_11( test_lazy_l1<float>() );
CALL_SUBTEST_12( test_lazy_l2<float>() );
@@ -239,6 +258,9 @@ void test_product_small()
CALL_SUBTEST_7(( test_linear_but_not_vectorizable<float,2,1,Dynamic>() ));
CALL_SUBTEST_7(( test_linear_but_not_vectorizable<float,3,1,Dynamic>() ));
CALL_SUBTEST_7(( test_linear_but_not_vectorizable<float,2,1,16>() ));
+
+ CALL_SUBTEST_6( bug_1311<3>() );
+ CALL_SUBTEST_6( bug_1311<5>() );
}
#ifdef EIGEN_TEST_PART_6