diff options
author | Ilya Tokar <tokarip@google.com> | 2019-12-16 16:00:35 -0500 |
---|---|---|
committer | Ilya Tokar <tokarip@google.com> | 2020-01-07 21:22:44 +0000 |
commit | 19876ced76bd1730008e02fc4c43c2228faed38a (patch) | |
tree | 22f999134e79f84f6f9dc0d19bdfa6740db416f0 /Eigen/src/Core/GenericPacketMath.h | |
parent | d0ae052da4ce25a5b4306bfbb5bf8edcd010b663 (diff) |
Bug #1785: Introduce numext::rint.
This provides a new op that matches std::rint and previous behavior of
pround. Also adds corresponding unsupported/../Tensor op.
Performance is the same as e. g. floor (tested SSE/AVX).
Diffstat (limited to 'Eigen/src/Core/GenericPacketMath.h')
-rw-r--r-- | Eigen/src/Core/GenericPacketMath.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Eigen/src/Core/GenericPacketMath.h b/Eigen/src/Core/GenericPacketMath.h index 2e9fd4d7a..146d34fb5 100644 --- a/Eigen/src/Core/GenericPacketMath.h +++ b/Eigen/src/Core/GenericPacketMath.h @@ -92,6 +92,7 @@ struct default_packet_traits HasBetaInc = 0, HasRound = 0, + HasRint = 0, HasFloor = 0, HasCeil = 0, @@ -575,6 +576,11 @@ Packet pround(const Packet& a) { using numext::round; return round(a); } template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pfloor(const Packet& a) { using numext::floor; return floor(a); } +/** \internal \returns the rounded value of \a a (coeff-wise) with current + * rounding mode */ +template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet print(const Packet& a) { using numext::rint; return rint(a); } + /** \internal \returns the ceil of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pceil(const Packet& a) { using numext::ceil; return ceil(a); } |