From 779774f98cea76a0f44b4b53b89e5195582363bd Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 26 Sep 2016 23:53:40 +0200 Subject: bug #1311: fix alignment logic in some cases of (scalar*small).lazyProduct(small) --- test/product_small.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'test/product_small.cpp') 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 // regression test for bug 447 +template void product1x1() { Matrix matAstatic; @@ -209,6 +210,24 @@ void test_linear_but_not_vectorizable() } } +template +void bug_1311() +{ + Matrix< double, Rows, 2 > A; A.setRandom(); + Vector2d b = Vector2d::Random() ; + Matrix 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() ); CALL_SUBTEST_12( test_lazy_l2() ); @@ -239,6 +258,9 @@ void test_product_small() CALL_SUBTEST_7(( test_linear_but_not_vectorizable() )); CALL_SUBTEST_7(( test_linear_but_not_vectorizable() )); CALL_SUBTEST_7(( test_linear_but_not_vectorizable() )); + + CALL_SUBTEST_6( bug_1311<3>() ); + CALL_SUBTEST_6( bug_1311<5>() ); } #ifdef EIGEN_TEST_PART_6 -- cgit v1.2.3