diff --git a/Eigen/src/Core/VectorwiseOp.h b/Eigen/src/Core/VectorwiseOp.h index ac52dc5a7..9ccbf7d76 100644 --- a/Eigen/src/Core/VectorwiseOp.h +++ b/Eigen/src/Core/VectorwiseOp.h @@ -603,10 +603,9 @@ class VectorwiseOp { /** Returns the expression where each subvector is the product of the vector \a other * by the corresponding subvector of \c *this */ template - EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC - CwiseBinaryOp, const ExpressionTypeNestedCleaned, - const typename ExtendedType::Type> EIGEN_DEVICE_FUNC - operator*(const DenseBase& other) const { + EIGEN_DEVICE_FUNC CwiseBinaryOp, + const ExpressionTypeNestedCleaned, const typename ExtendedType::Type> + operator*(const DenseBase& other) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType) EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived) @@ -616,8 +615,8 @@ class VectorwiseOp { /** Returns the expression where each subvector is the quotient of the corresponding * subvector of \c *this by the vector \a other */ template - EIGEN_DEVICE_FUNC CwiseBinaryOp, const ExpressionTypeNestedCleaned, - const typename ExtendedType::Type> + EIGEN_DEVICE_FUNC CwiseBinaryOp, + const ExpressionTypeNestedCleaned, const typename ExtendedType::Type> operator/(const DenseBase& other) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType) diff --git a/test/vectorwiseop.cpp b/test/vectorwiseop.cpp index 0d1896bfb..6d0e5cbf8 100644 --- a/test/vectorwiseop.cpp +++ b/test/vectorwiseop.cpp @@ -214,6 +214,17 @@ void vectorwiseop_matrix(const MatrixType& m) { VERIFY_IS_EQUAL(m1.real().middleCols(0, fix<0>).colwise().maxCoeff().eval().cols(), 0); } +void vectorwiseop_mixedscalar() { + Matrix4cd a = Matrix4cd::Random(); + Vector4cd b = Vector4cd::Random(); + b.imag().setZero(); + Vector4d b_real = b.real(); + + Matrix4cd c = a.array().rowwise() * b.array().transpose(); + Matrix4cd d = a.array().rowwise() * b_real.array().transpose(); + VERIFY_IS_CWISE_EQUAL(c, d); +} + EIGEN_DECLARE_TEST(vectorwiseop) { CALL_SUBTEST_1(vectorwiseop_array(Array22cd())); CALL_SUBTEST_2(vectorwiseop_array(Array())); @@ -226,4 +237,5 @@ EIGEN_DECLARE_TEST(vectorwiseop) { MatrixXd(internal::random(1, EIGEN_TEST_MAX_SIZE), internal::random(1, EIGEN_TEST_MAX_SIZE)))); CALL_SUBTEST_7(vectorwiseop_matrix(VectorXd(internal::random(1, EIGEN_TEST_MAX_SIZE)))); CALL_SUBTEST_7(vectorwiseop_matrix(RowVectorXd(internal::random(1, EIGEN_TEST_MAX_SIZE)))); + CALL_SUBTEST_8(vectorwiseop_mixedscalar()); }