Fix scalar_inner_product_op when binary ops return a different type

This commit is contained in:
Jeremy Nimmer 2025-10-06 18:19:59 +00:00 committed by Rasmus Munk Larsen
parent c08497ae1c
commit b27f784ca5

View File

@ -211,8 +211,14 @@ struct scalar_inner_product_op {
static constexpr bool PacketAccess = false;
};
// Partial specialization for packet access if and only if
// LhsScalar == RhsScalar == ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType.
template <typename Scalar, bool Conj>
struct scalar_inner_product_op<Scalar, Scalar, Conj> {
struct scalar_inner_product_op<
Scalar,
typename std::enable_if<internal::is_same<typename ScalarBinaryOpTraits<Scalar, Scalar>::ReturnType, Scalar>::value,
Scalar>::type,
Conj> {
using result_type = Scalar;
using conj_helper = conditional_conj<Scalar, Conj>;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(const Scalar& a, const Scalar& b) const {