mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fixes compilation errors triggered when compiling the tensor contraction code with cxx11 enabled.
This commit is contained in:
@@ -66,6 +66,12 @@ template<std::size_t I, class T, std::size_t N> constexpr inline T const& array_
|
||||
|
||||
#undef STD_GET_ARR_HACK
|
||||
|
||||
template <typename T> struct array_size;
|
||||
template<class T, std::size_t N> struct array_size<const std::array<T,N> > {
|
||||
static const size_t value = N;
|
||||
};
|
||||
|
||||
|
||||
/* Suppose you have a template of the form
|
||||
* template<typename T> struct X;
|
||||
* And you want to specialize it in such a way:
|
||||
|
||||
@@ -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; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user