From 30c42222a683e8b844c557bb297a6d13105792ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20S=C3=A1nchez?= Date: Tue, 30 Aug 2022 17:24:14 +0000 Subject: [PATCH] Fix some test build errors in new unary pow. --- Eigen/src/Core/functors/UnaryFunctors.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Eigen/src/Core/functors/UnaryFunctors.h b/Eigen/src/Core/functors/UnaryFunctors.h index 6b1bcc757..4ba75647a 100644 --- a/Eigen/src/Core/functors/UnaryFunctors.h +++ b/Eigen/src/Core/functors/UnaryFunctors.h @@ -1076,10 +1076,14 @@ template ::IsComplex, bool ExponentIsComplex = NumTraits::IsComplex> struct scalar_unary_pow_op { + typedef typename internal::promote_scalar_arg< + Scalar, ScalarExponent, + internal::has_ReturnType >::value>::type PromotedExponent; + typedef typename ScalarBinaryOpTraits::ReturnType result_type; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE scalar_unary_pow_op(const ScalarExponent& exponent) : m_exponent(exponent) { EIGEN_STATIC_ASSERT((is_arithmetic::Real>::value), EXPONENT_MUST_BE_ARITHMETIC_OR_COMPLEX); } - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& a) const { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator()(const Scalar& a) const { EIGEN_USING_STD(pow); return pow(a, m_exponent); } @@ -1095,12 +1099,12 @@ struct scalar_unary_pow_op { EIGEN_STATIC_ASSERT((is_same::value), NON_INTEGER_EXPONENT_MUST_BE_SAME_TYPE_AS_BASE); EIGEN_STATIC_ASSERT((is_arithmetic::value), EXPONENT_MUST_BE_ARITHMETIC); } - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& a) const { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const Scalar& a) const { EIGEN_USING_STD(pow); return pow(a, m_exponent); } template - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& a) const { return unary_pow_impl::run(a, m_exponent); } @@ -1115,11 +1119,11 @@ struct scalar_unary_pow_op::value), EXPONENT_MUST_BE_ARITHMETIC); } // TODO: error handling logic for complex^real_integer - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar operator()(const Scalar& a) const { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const Scalar& a) const { return unary_pow_impl::run(a, m_exponent); } template - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& a) const { return unary_pow_impl::run(a, m_exponent); }