diff --git a/Eigen/src/Core/Dot.h b/Eigen/src/Core/Dot.h index 8eaa62185..9fc2fb60e 100644 --- a/Eigen/src/Core/Dot.h +++ b/Eigen/src/Core/Dot.h @@ -41,7 +41,7 @@ struct ei_dot_nocheck { static inline typename ei_traits::Scalar run(const MatrixBase& a, const MatrixBase& b) { - return a.conjugate().cwiseProduct(b).sum(); + return a.template binaryExpr::Scalar> >(b).sum(); } }; @@ -50,7 +50,7 @@ struct ei_dot_nocheck { static inline typename ei_traits::Scalar run(const MatrixBase& a, const MatrixBase& b) { - return a.adjoint().cwiseProduct(b).sum(); + return a.transpose().template binaryExpr::Scalar> >(b).sum(); } }; diff --git a/Eigen/src/Core/Functors.h b/Eigen/src/Core/Functors.h index 103833447..ac5aa67c4 100644 --- a/Eigen/src/Core/Functors.h +++ b/Eigen/src/Core/Functors.h @@ -73,6 +73,28 @@ struct ei_functor_traits > { }; }; +/** \internal + * \brief Template functor to compute the conjugate product of two scalars + * + * This is a short cut for ei_conj(x) * y which is needed for optimization purpose + */ +template struct ei_scalar_conj_product_op { + enum { Conj = NumTraits::IsComplex }; + EIGEN_EMPTY_STRUCT_CTOR(ei_scalar_conj_product_op) + EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const + { return ei_conj_helper().pmul(a,b); } + template + EIGEN_STRONG_INLINE const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const + { return ei_conj_helper().pmul(a,b); } +}; +template +struct ei_functor_traits > { + enum { + Cost = NumTraits::MulCost, + PacketAccess = ei_packet_traits::HasMul + }; +}; + /** \internal * \brief Template functor to compute the min of two scalars * diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h index a757bef76..310ffa4b3 100644 --- a/Eigen/src/Core/util/ForwardDeclarations.h +++ b/Eigen/src/Core/util/ForwardDeclarations.h @@ -113,6 +113,7 @@ template str template struct ei_scalar_sum_op; template struct ei_scalar_difference_op; template struct ei_scalar_product_op; +template struct ei_scalar_conj_product_op; template struct ei_scalar_quotient_op; template struct ei_scalar_opposite_op; template struct ei_scalar_conjugate_op;