diff options
author | Joel Holdsworth <joel@airwebreathe.org.uk> | 2020-03-19 17:45:20 +0000 |
---|---|---|
committer | Rasmus Munk Larsen <rmlarsen@google.com> | 2020-03-19 17:45:20 +0000 |
commit | d5c665742beb8dc00ce0f6eab633f719a9218e03 (patch) | |
tree | 2cea4f868303064d37e9321c810cd07c0fcfceac /Eigen/src/Core/GenericPacketMath.h | |
parent | 6ff5a14091151ce0d722878de93b57025976facb (diff) |
Add absolute_difference coefficient-wise binary Array function
Diffstat (limited to 'Eigen/src/Core/GenericPacketMath.h')
-rw-r--r-- | Eigen/src/Core/GenericPacketMath.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index 13c639f7e..ddfdc39e6 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h @@ -52,6 +52,7 @@ struct default_packet_traits HasAbs = 1, HasArg = 0, HasAbs2 = 1, + HasAbsDiff = 0, HasMin = 1, HasMax = 1, HasConj = 1, @@ -322,6 +323,10 @@ pcmp_eq(const Packet& a, const Packet& b) { return a==b ? ptrue(a) : pzero(a); } template<typename Packet> EIGEN_DEVICE_FUNC inline Packet pcmp_lt_or_nan(const Packet& a, const Packet& b) { return pnot(pcmp_le(b,a)); } +/** \internal \returns the min of \a a and \a b (coeff-wise) */ +template<typename Packet> EIGEN_DEVICE_FUNC inline Packet +pabsdiff(const Packet& a, const Packet& b) { return pselect(pcmp_lt(a, b), psub(b, a), psub(a, b)); } + /** \internal \returns a packet version of \a *from, from must be 16 bytes aligned */ template<typename Packet> EIGEN_DEVICE_FUNC inline Packet pload(const typename unpacket_traits<Packet>::type* from) { return *from; } |