aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2014-06-09 10:06:57 -0700
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2014-06-09 10:06:57 -0700
commita77458a8ff2a83e716add62253eb50ef64980b21 (patch)
tree858d2f54bbec575c231f12662b8f4f3c7b6e74d5 /unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h
parenta669052f12d6d71ba815764d6419726d64fef675 (diff)
Fixes compilation errors triggered when compiling the tensor contraction code with cxx11 enabled.
Diffstat (limited to 'unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h')
-rw-r--r--unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h17
1 files changed, 13 insertions, 4 deletions
diff --git a/unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h b/unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h
index 636063f9e..1d3164d6a 100644
--- a/unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h
+++ b/unsupported/Eigen/CXX11/src/Core/util/EmulateCXX11Meta.h
@@ -182,23 +182,32 @@ array<t, n> repeat(t v) {
}
template<std::size_t n, typename t>
-t array_prod(const array<t, n>& a) {
+EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE t array_prod(const array<t, n>& a) {
t prod = 1;
for (size_t i = 0; i < n; ++i) { prod *= a[i]; }
return prod;
}
template<typename t>
-t array_prod(const array<t, 0>& /*a*/) {
+EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE t array_prod(const array<t, 0>& /*a*/) {
return 0;
}
-template<std::size_t I, class T, std::size_t N> inline T& array_get(array<T,N>& a) {
+template<std::size_t I, class T, std::size_t N>
+EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T& array_get(array<T,N>& a) {
return a[I];
}
-template<std::size_t I, class T, std::size_t N> inline const T& array_get(const array<T,N>& a) {
+template<std::size_t I, class T, std::size_t N> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
+const T& array_get(const array<T,N>& a) {
return a[I];
}
+
+template <typename T> struct array_size;
+template<class T, std::size_t N> struct array_size<const array<T,N> > {
+ static const size_t value = N;
+};
+
+
struct sum_op {
template<typename A, typename B> static inline bool run(A a, B b) { return a + b; }
};