From 468863f3a0e9725335e73f239f02bb30a56ee2a7 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 9 Jul 2010 20:27:05 +0200 Subject: [PATCH] fix bad Map in row-vector by matrix products --- Eigen/src/Core/Product.h | 6 +++--- test/product_large.cpp | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index 1e516d005..bfe78caa8 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -614,7 +614,7 @@ struct ei_cache_friendly_product_selector >(_res, res.size()) = res; + Map >(_res, res.size()) = res; } ei_cache_friendly_product_colmajor_times_vector(res.size(), &product.rhs().const_cast_derived().coeffRef(0,0), product.rhs().stride(), @@ -622,7 +622,7 @@ struct ei_cache_friendly_product_selector >(_res, res.size()); + res = Map >(_res, res.size()); ei_aligned_stack_delete(Scalar, _res, res.size()); } } @@ -677,7 +677,7 @@ struct ei_cache_friendly_product_selector >(_lhs, product.lhs().size()) = product.lhs(); + Map >(_lhs, product.lhs().size()) = product.lhs(); } ei_cache_friendly_product_rowmajor_times_vector(&product.rhs().const_cast_derived().coeffRef(0,0), product.rhs().stride(), _lhs, product.lhs().size(), res); diff --git a/test/product_large.cpp b/test/product_large.cpp index 637e02b2a..966d8ed76 100644 --- a/test/product_large.cpp +++ b/test/product_large.cpp @@ -48,4 +48,11 @@ void test_product_large() MatrixXf a = MatrixXf::Random(10,4), b = MatrixXf::Random(4,10), c = a; VERIFY_IS_APPROX((a = a * b), (c * b).eval()); } + + { + MatrixXf mat1(10,10); mat1.setRandom(); + MatrixXf mat2(32,10); mat2.setRandom(); + MatrixXf result = mat1.row(2)*mat2.transpose(); + VERIFY_IS_APPROX(result, (mat1.row(2)*mat2.transpose()).eval()); + } }