diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-01-28 10:02:47 -0800 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2015-01-28 10:02:47 -0800 |
commit | 5a6ea4edf61b5626a781070c6342fc16606b490a (patch) | |
tree | 2e94aad11b5ca76e48e17bce25979694441879bc /unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h | |
parent | 9dfdbd7e568bd3aa9a4610986dcfc679b9ea425d (diff) |
Added more tests to cover tensor reductions
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h b/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h index 209749042..7ff47673d 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h @@ -181,7 +181,7 @@ template<typename FirstType, typename... OtherTypes> size_t array_prod(const Ind result *= sizes[i]; } return result; -} +}; template<typename FirstType, typename... OtherTypes> struct array_size<IndexList<FirstType, OtherTypes...> > { static const size_t value = std::tuple_size<std::tuple<FirstType, OtherTypes...> >::value; @@ -307,6 +307,52 @@ struct index_statically_ne<const IndexList<FirstType, OtherTypes...> > { }; +template <typename T> +struct index_statically_gt { + constexpr bool operator() (DenseIndex, DenseIndex) const { + return false; + } +}; + +template <typename FirstType, typename... OtherTypes> +struct index_statically_gt<IndexList<FirstType, OtherTypes...> > { + constexpr bool operator() (const DenseIndex i, const DenseIndex value) const { + return IndexList<FirstType, OtherTypes...>().value_known_statically(i) & + IndexList<FirstType, OtherTypes...>()[i] > value; + } +}; + +template <typename FirstType, typename... OtherTypes> +struct index_statically_gt<const IndexList<FirstType, OtherTypes...> > { + constexpr bool operator() (const DenseIndex i, const DenseIndex value) const { + return IndexList<FirstType, OtherTypes...>().value_known_statically(i) & + IndexList<FirstType, OtherTypes...>()[i] > value; + } +}; + +template <typename T> +struct index_statically_lt { + constexpr bool operator() (DenseIndex, DenseIndex) const { + return false; + } +}; + +template <typename FirstType, typename... OtherTypes> +struct index_statically_lt<IndexList<FirstType, OtherTypes...> > { + constexpr bool operator() (const DenseIndex i, const DenseIndex value) const { + return IndexList<FirstType, OtherTypes...>().value_known_statically(i) & + IndexList<FirstType, OtherTypes...>()[i] < value; + } +}; + +template <typename FirstType, typename... OtherTypes> +struct index_statically_lt<const IndexList<FirstType, OtherTypes...> > { + constexpr bool operator() (const DenseIndex i, const DenseIndex value) const { + return IndexList<FirstType, OtherTypes...>().value_known_statically(i) & + IndexList<FirstType, OtherTypes...>()[i] < value; + } +}; + } // end namespace internal } // end namespace Eigen @@ -351,6 +397,20 @@ struct index_statically_ne { } }; +template <typename T> +struct index_statically_gt { + EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool operator() (DenseIndex, DenseIndex) const{ + return false; + } +}; + +template <typename T> +struct index_statically_lt { + EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool operator() (DenseIndex, DenseIndex) const{ + return false; + } +}; + } // end namespace internal } // end namespace Eigen |