From fbf415c547bc9ee328f2afa58b0ebcee31b8f57c Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 20 Mar 2009 10:03:24 +0000 Subject: add vectorization of unary operator-() (the AltiVec version is probably broken) --- Eigen/src/Core/Functors.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Eigen/src/Core/Functors.h') diff --git a/Eigen/src/Core/Functors.h b/Eigen/src/Core/Functors.h index 7940baa0b..f411a254b 100644 --- a/Eigen/src/Core/Functors.h +++ b/Eigen/src/Core/Functors.h @@ -190,10 +190,16 @@ struct ei_functor_traits > { */ template struct ei_scalar_opposite_op EIGEN_EMPTY_STRUCT { EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return -a; } + template + EIGEN_STRONG_INLINE const PacketScalar packetOp(const PacketScalar& a) const + { return ei_pnegate(a); } }; template struct ei_functor_traits > -{ enum { Cost = NumTraits::AddCost, PacketAccess = false }; }; +{ enum { + Cost = NumTraits::AddCost, + PacketAccess = int(ei_packet_traits::size)>1 }; +}; /** \internal * \brief Template functor to compute the absolute value of a scalar -- cgit v1.2.3