From 462758e8a3da38f8c90e9ca2cb859ea1117e03df Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Wed, 12 Oct 2022 16:03:29 +0000 Subject: [PATCH] Don't use generic sign function for sign(complex) unless it is vectorizable --- Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h | 3 ++- Eigen/src/Core/functors/UnaryFunctors.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index a0e5f9fef..30602143e 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -1146,7 +1146,8 @@ struct psign_impl -struct psign_impl::type>::IsComplex>> { +struct psign_impl::type>::IsComplex && + unpacket_traits::vectorizable>> { static EIGEN_DEVICE_FUNC inline Packet run(const Packet& a) { typedef typename unpacket_traits::type Scalar; typedef typename Scalar::value_type RealScalar; diff --git a/Eigen/src/Core/functors/UnaryFunctors.h b/Eigen/src/Core/functors/UnaryFunctors.h index 942c8e817..348536968 100644 --- a/Eigen/src/Core/functors/UnaryFunctors.h +++ b/Eigen/src/Core/functors/UnaryFunctors.h @@ -930,7 +930,7 @@ struct functor_traits > NumTraits::IsComplex ? ( 8*NumTraits::MulCost ) // roughly : ( 3*NumTraits::AddCost), - PacketAccess = packet_traits::HasSign + PacketAccess = packet_traits::HasSign && packet_traits::Vectorizable }; };