From b27f784ca582127fda13321496e33d016a2806ba Mon Sep 17 00:00:00 2001 From: Jeremy Nimmer Date: Mon, 6 Oct 2025 18:19:59 +0000 Subject: [PATCH] Fix scalar_inner_product_op when binary ops return a different type --- Eigen/src/Core/InnerProduct.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Eigen/src/Core/InnerProduct.h b/Eigen/src/Core/InnerProduct.h index 9849d9b1f..686ad1379 100644 --- a/Eigen/src/Core/InnerProduct.h +++ b/Eigen/src/Core/InnerProduct.h @@ -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::ReturnType. template -struct scalar_inner_product_op { +struct scalar_inner_product_op< + Scalar, + typename std::enable_if::ReturnType, Scalar>::value, + Scalar>::type, + Conj> { using result_type = Scalar; using conj_helper = conditional_conj; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(const Scalar& a, const Scalar& b) const {