From 94f2cfc9c7646e2f6b946db3c3b6078a2635f025 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 18 Nov 2016 10:09:33 +0100 Subject: [PATCH] bug #1343: fix compilation regression in array = matrix_product (grafted from cebff7e3a22d3fde9f83f11fc44a4e8166e6cc2d ) --- Eigen/src/Core/GeneralProduct.h | 2 +- test/product_extra.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index a8c83f168..0cc2d08e2 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -264,7 +264,7 @@ template<> struct gemv_dense_selector if (!evalToDest) { if(!alphaIsCompatible) - dest += actualAlpha * MappedDest(actualDestPtr, dest.size()); + dest.matrix() += actualAlpha * MappedDest(actualDestPtr, dest.size()); else dest = MappedDest(actualDestPtr, dest.size()); } diff --git a/test/product_extra.cpp b/test/product_extra.cpp index 03d5c3657..e2b855bff 100644 --- a/test/product_extra.cpp +++ b/test/product_extra.cpp @@ -98,6 +98,16 @@ template void product_extra(const MatrixType& m) // regression test MatrixType tmp = m1 * m1.adjoint() * s1; VERIFY_IS_APPROX(tmp, m1 * m1.adjoint() * s1); + + // regression test for bug 1343, assignment to arrays + Array a1 = m1 * vc2; + VERIFY_IS_APPROX(a1.matrix(),m1*vc2); + Array a2 = s1 * (m1 * vc2); + VERIFY_IS_APPROX(a2.matrix(),s1*m1*vc2); + Array a3 = v1 * m1; + VERIFY_IS_APPROX(a3.matrix(),v1*m1); + Array a4 = m1 * m2.adjoint(); + VERIFY_IS_APPROX(a4.matrix(),m1*m2.adjoint()); } // Regression test for bug reported at http://forum.kde.org/viewtopic.php?f=74&t=96947