diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-11-06 09:18:43 -0800 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-11-06 09:18:43 -0800 |
commit | ed1962b464119395d23fa7deeb9b7e77b0c05d18 (patch) | |
tree | 0158f732757345bff34044647592c4aae4383a72 /Eigen | |
parent | bfd6ee64f39340b42a1ee21e4b04ff15433e829d (diff) |
Reimplement the tensor comparison operators by using the scalar_cmp_op functors. This makes them more cuda friendly.
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/functors/BinaryFunctors.h | 8 | ||||
-rw-r--r-- | Eigen/src/Core/util/Constants.h | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/Eigen/src/Core/functors/BinaryFunctors.h b/Eigen/src/Core/functors/BinaryFunctors.h index cc0e80a33..f77066910 100644 --- a/Eigen/src/Core/functors/BinaryFunctors.h +++ b/Eigen/src/Core/functors/BinaryFunctors.h @@ -186,6 +186,14 @@ template<typename Scalar> struct scalar_cmp_op<Scalar, cmp_LE> { EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op) EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return a<=b;} }; +template<typename Scalar> struct scalar_cmp_op<Scalar, cmp_GT> { + EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return a>b;} +}; +template<typename Scalar> struct scalar_cmp_op<Scalar, cmp_GE> { + EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return a>=b;} +}; template<typename Scalar> struct scalar_cmp_op<Scalar, cmp_UNORD> { EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op) EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return !(a<=b || b<=a);} diff --git a/Eigen/src/Core/util/Constants.h b/Eigen/src/Core/util/Constants.h index c35077af6..28852c8c3 100644 --- a/Eigen/src/Core/util/Constants.h +++ b/Eigen/src/Core/util/Constants.h @@ -531,7 +531,9 @@ enum ComparisonName { cmp_LT = 1, cmp_LE = 2, cmp_UNORD = 3, - cmp_NEQ = 4 + cmp_NEQ = 4, + cmp_GT = 5, + cmp_GE = 6 }; } // end namespace internal |