diff options
author | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-05-25 11:04:14 -0700 |
---|---|---|
committer | Benoit Steiner <benoit.steiner.goog@gmail.com> | 2016-05-25 11:04:14 -0700 |
commit | 58026905ae4a608abac33f59a782beae590a8371 (patch) | |
tree | d85fcd6bc009a0be687b35106fdc0b9ea9d27ae5 /unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h | |
parent | ed783872ab9040bab52f7b142458f168f662e3f0 (diff) |
Added support for statically known lists of pairs of indices
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h')
-rw-r--r-- | unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h index cd04716bd..9ae97ba42 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h @@ -112,6 +112,20 @@ bool operator!=(const Tuple<U, V>& x, const Tuple<U, V>& y) { } +// Can't use std::pairs on cuda devices +template <typename Idx> struct IndexPair { + constexpr EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE IndexPair() : first(0), second(0) {} + constexpr EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE IndexPair(Idx f, Idx s) : first(f), second(s) {} + + EIGEN_DEVICE_FUNC void set(IndexPair<Idx> val) { + first = val.first; + second = val.second; + } + + Idx first; + Idx second; +}; + #ifdef EIGEN_HAS_SFINAE namespace internal { |