Fix scalar_inner_product_op when binary ops return a different type

This commit is contained in:
Jeremy Nimmer 2025-10-05 22:51:50 +00:00 committed by Rasmus Munk Larsen
parent 7eaf9ae68d
commit eea6587b0e

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 {