diff --git a/Eigen/src/Core/ProductEvaluators.h b/Eigen/src/Core/ProductEvaluators.h index 60b79b855..d53dc30a3 100644 --- a/Eigen/src/Core/ProductEvaluators.h +++ b/Eigen/src/Core/ProductEvaluators.h @@ -430,28 +430,30 @@ struct generic_product_impl void eval_dynamic(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Func &func) { enum { - HasScalarFactor = blas_traits::HasScalarFactor || blas_traits::HasScalarFactor + HasScalarFactor = blas_traits::HasScalarFactor || blas_traits::HasScalarFactor, + ConjLhs = blas_traits::NeedToConjugate, + ConjRhs = blas_traits::NeedToConjugate }; // FIXME: in c++11 this should be auto, and extractScalarFactor should also return auto // this is important for real*complex_mat Scalar actualAlpha = blas_traits::extractScalarFactor(lhs) * blas_traits::extractScalarFactor(rhs); eval_dynamic_impl(dst, - blas_traits::extract(lhs), - blas_traits::extract(rhs), + blas_traits::extract(lhs).template conjugateIf(), + blas_traits::extract(rhs).template conjugateIf(), func, actualAlpha, typename conditional::type()); - - } protected: template static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE - void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs, const Func &func, const Scalar& /* s == 1 */, false_type) + void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs, const Func &func, const Scalar& s /* == 1 */, false_type) { + EIGEN_UNUSED_VARIABLE(s); + eigen_internal_assert(s==Scalar(1)); call_restricted_packet_assignment_no_alias(dst, lhs.lazyProduct(rhs), func); } diff --git a/test/product_notemporary.cpp b/test/product_notemporary.cpp index 8b6419d0c..20cb7c080 100644 --- a/test/product_notemporary.cpp +++ b/test/product_notemporary.cpp @@ -29,6 +29,7 @@ void check_scalar_multiple2(Dst &dst, const Lhs& A, const Rhs& B, S2 s2) CALL_SUBTEST( check_scalar_multiple3(dst, A, -B) ); CALL_SUBTEST( check_scalar_multiple3(dst, A, s2*B) ); CALL_SUBTEST( check_scalar_multiple3(dst, A, B*s2) ); + CALL_SUBTEST( check_scalar_multiple3(dst, A, (B*s2).conjugate()) ); } template @@ -38,6 +39,7 @@ void check_scalar_multiple1(Dst &dst, const Lhs& A, const Rhs& B, S1 s1, S2 s2) CALL_SUBTEST( check_scalar_multiple2(dst, -A, B, s2) ); CALL_SUBTEST( check_scalar_multiple2(dst, s1*A, B, s2) ); CALL_SUBTEST( check_scalar_multiple2(dst, A*s1, B, s2) ); + CALL_SUBTEST( check_scalar_multiple2(dst, (A*s1).conjugate(), B, s2) ); } template void product_notemporary(const MatrixType& m)