mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
Simplified more of the IndexList code.
This commit is contained in:
parent
e9ecfad796
commit
8037826367
@ -353,9 +353,10 @@
|
||||
|
||||
// Does the compiler support const expressions?
|
||||
#ifdef __CUDACC__
|
||||
#define EIGEN_HAS_CONSTEXPR 1
|
||||
// Const expressions are not supported regardless of what host compiler is used
|
||||
#elif (defined(__cplusplus) && __cplusplus >= 201402L) || \
|
||||
EIGEN_GNUC_AT_LEAST(4,9)
|
||||
EIGEN_GNUC_AT_LEAST(4,8)
|
||||
#define EIGEN_HAS_CONSTEXPR 1
|
||||
#endif
|
||||
|
||||
|
@ -156,11 +156,11 @@ struct TensorEvaluator<const TensorBroadcastingOp<Broadcast, ArgType>, Device>
|
||||
Index inputIndex = 0;
|
||||
for (int i = NumDims - 1; i > 0; --i) {
|
||||
const Index idx = index / m_outputStrides[i];
|
||||
if (internal::index_statically_eq<Broadcast>()(i, 1)) {
|
||||
if (internal::index_statically_eq<Broadcast>(i, 1)) {
|
||||
eigen_assert(idx < m_impl.dimensions()[i]);
|
||||
inputIndex += idx * m_inputStrides[i];
|
||||
} else {
|
||||
if (internal::index_statically_eq<InputDimensions>()(i, 1)) {
|
||||
if (internal::index_statically_eq<InputDimensions>(i, 1)) {
|
||||
eigen_assert(idx % m_impl.dimensions()[i] == 0);
|
||||
} else {
|
||||
inputIndex += (idx % m_impl.dimensions()[i]) * m_inputStrides[i];
|
||||
@ -168,11 +168,11 @@ struct TensorEvaluator<const TensorBroadcastingOp<Broadcast, ArgType>, Device>
|
||||
}
|
||||
index -= idx * m_outputStrides[i];
|
||||
}
|
||||
if (internal::index_statically_eq<Broadcast>()(0, 1)) {
|
||||
if (internal::index_statically_eq<Broadcast>(0, 1)) {
|
||||
eigen_assert(index < m_impl.dimensions()[0]);
|
||||
inputIndex += index;
|
||||
} else {
|
||||
if (internal::index_statically_eq<InputDimensions>()(0, 1)) {
|
||||
if (internal::index_statically_eq<InputDimensions>(0, 1)) {
|
||||
eigen_assert(index % m_impl.dimensions()[0] == 0);
|
||||
} else {
|
||||
inputIndex += (index % m_impl.dimensions()[0]);
|
||||
@ -186,11 +186,11 @@ struct TensorEvaluator<const TensorBroadcastingOp<Broadcast, ArgType>, Device>
|
||||
Index inputIndex = 0;
|
||||
for (int i = 0; i < NumDims - 1; ++i) {
|
||||
const Index idx = index / m_outputStrides[i];
|
||||
if (internal::index_statically_eq<Broadcast>()(i, 1)) {
|
||||
if (internal::index_statically_eq<Broadcast>(i, 1)) {
|
||||
eigen_assert(idx < m_impl.dimensions()[i]);
|
||||
inputIndex += idx * m_inputStrides[i];
|
||||
} else {
|
||||
if (internal::index_statically_eq<InputDimensions>()(i, 1)) {
|
||||
if (internal::index_statically_eq<InputDimensions>(i, 1)) {
|
||||
eigen_assert(idx % m_impl.dimensions()[i] == 0);
|
||||
} else {
|
||||
inputIndex += (idx % m_impl.dimensions()[i]) * m_inputStrides[i];
|
||||
@ -198,11 +198,11 @@ struct TensorEvaluator<const TensorBroadcastingOp<Broadcast, ArgType>, Device>
|
||||
}
|
||||
index -= idx * m_outputStrides[i];
|
||||
}
|
||||
if (internal::index_statically_eq<Broadcast>()(NumDims-1, 1)) {
|
||||
if (internal::index_statically_eq<Broadcast>(NumDims-1, 1)) {
|
||||
eigen_assert(index < m_impl.dimensions()[NumDims-1]);
|
||||
inputIndex += index;
|
||||
} else {
|
||||
if (internal::index_statically_eq<InputDimensions>()(NumDims-1, 1)) {
|
||||
if (internal::index_statically_eq<InputDimensions>(NumDims-1, 1)) {
|
||||
eigen_assert(index % m_impl.dimensions()[NumDims-1] == 0);
|
||||
} else {
|
||||
inputIndex += (index % m_impl.dimensions()[NumDims-1]);
|
||||
@ -235,11 +235,11 @@ struct TensorEvaluator<const TensorBroadcastingOp<Broadcast, ArgType>, Device>
|
||||
Index inputIndex = 0;
|
||||
for (int i = NumDims - 1; i > 0; --i) {
|
||||
const Index idx = index / m_outputStrides[i];
|
||||
if (internal::index_statically_eq<Broadcast>()(i, 1)) {
|
||||
if (internal::index_statically_eq<Broadcast>(i, 1)) {
|
||||
eigen_assert(idx < m_impl.dimensions()[i]);
|
||||
inputIndex += idx * m_inputStrides[i];
|
||||
} else {
|
||||
if (internal::index_statically_eq<InputDimensions>()(i, 1)) {
|
||||
if (internal::index_statically_eq<InputDimensions>(i, 1)) {
|
||||
eigen_assert(idx % m_impl.dimensions()[i] == 0);
|
||||
} else {
|
||||
inputIndex += (idx % m_impl.dimensions()[i]) * m_inputStrides[i];
|
||||
@ -248,11 +248,11 @@ struct TensorEvaluator<const TensorBroadcastingOp<Broadcast, ArgType>, Device>
|
||||
index -= idx * m_outputStrides[i];
|
||||
}
|
||||
Index innermostLoc;
|
||||
if (internal::index_statically_eq<Broadcast>()(0, 1)) {
|
||||
if (internal::index_statically_eq<Broadcast>(0, 1)) {
|
||||
eigen_assert(index < m_impl.dimensions()[0]);
|
||||
innermostLoc = index;
|
||||
} else {
|
||||
if (internal::index_statically_eq<InputDimensions>()(0, 1)) {
|
||||
if (internal::index_statically_eq<InputDimensions>(0, 1)) {
|
||||
eigen_assert(index % m_impl.dimensions()[0] == 0);
|
||||
innermostLoc = 0;
|
||||
} else {
|
||||
@ -288,11 +288,11 @@ struct TensorEvaluator<const TensorBroadcastingOp<Broadcast, ArgType>, Device>
|
||||
Index inputIndex = 0;
|
||||
for (int i = 0; i < NumDims - 1; ++i) {
|
||||
const Index idx = index / m_outputStrides[i];
|
||||
if (internal::index_statically_eq<Broadcast>()(i, 1)) {
|
||||
if (internal::index_statically_eq<Broadcast>(i, 1)) {
|
||||
eigen_assert(idx < m_impl.dimensions()[i]);
|
||||
inputIndex += idx * m_inputStrides[i];
|
||||
} else {
|
||||
if (internal::index_statically_eq<InputDimensions>()(i, 1)) {
|
||||
if (internal::index_statically_eq<InputDimensions>(i, 1)) {
|
||||
eigen_assert(idx % m_impl.dimensions()[i] == 0);
|
||||
} else {
|
||||
inputIndex += (idx % m_impl.dimensions()[i]) * m_inputStrides[i];
|
||||
@ -301,11 +301,11 @@ struct TensorEvaluator<const TensorBroadcastingOp<Broadcast, ArgType>, Device>
|
||||
index -= idx * m_outputStrides[i];
|
||||
}
|
||||
Index innermostLoc;
|
||||
if (internal::index_statically_eq<Broadcast>()(NumDims-1, 1)) {
|
||||
if (internal::index_statically_eq<Broadcast>(NumDims-1, 1)) {
|
||||
eigen_assert(index < m_impl.dimensions()[NumDims-1]);
|
||||
innermostLoc = index;
|
||||
} else {
|
||||
if (internal::index_statically_eq<InputDimensions>()(NumDims-1, 1)) {
|
||||
if (internal::index_statically_eq<InputDimensions>(NumDims-1, 1)) {
|
||||
eigen_assert(index % m_impl.dimensions()[NumDims-1] == 0);
|
||||
innermostLoc = 0;
|
||||
} else {
|
||||
|
@ -85,53 +85,53 @@ struct indices_statically_known_to_increase_impl<const DimensionList<Index, Rank
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_eq<DimensionList<Index, Rank> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_eq_impl<DimensionList<Index, Rank> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return i == value;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_eq<const DimensionList<Index, Rank> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_eq_impl<const DimensionList<Index, Rank> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return i == value;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_ne<DimensionList<Index, Rank> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_ne_impl<DimensionList<Index, Rank> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return i != value;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_ne<const DimensionList<Index, Rank> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_ne_impl<const DimensionList<Index, Rank> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return i != value;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_gt<DimensionList<Index, Rank> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_gt_impl<DimensionList<Index, Rank> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return i > value;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_gt<const DimensionList<Index, Rank> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_gt_impl<const DimensionList<Index, Rank> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return i > value;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_lt<DimensionList<Index, Rank> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_lt_impl<DimensionList<Index, Rank> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return i < value;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_lt<const DimensionList<Index, Rank> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_lt_impl<const DimensionList<Index, Rank> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return i < value;
|
||||
}
|
||||
};
|
||||
@ -177,53 +177,53 @@ struct indices_statically_known_to_increase_impl<const DimensionList<Index, Rank
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_eq<DimensionList<Index, Rank> > {
|
||||
EIGEN_ALWAYS_INLINE bool operator() (const DenseIndex, const DenseIndex) const {
|
||||
struct index_statically_eq_impl<DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) const {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_eq<const DimensionList<Index, Rank> > {
|
||||
EIGEN_ALWAYS_INLINE bool operator() (const DenseIndex, const DenseIndex) const {
|
||||
struct index_statically_eq_impl<const DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) const {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_ne<DimensionList<Index, Rank> > {
|
||||
EIGEN_ALWAYS_INLINE bool operator() (const DenseIndex, const DenseIndex) const {
|
||||
struct index_statically_ne_impl<DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run() (const DenseIndex, const DenseIndex) const {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_ne<const DimensionList<Index, Rank> > {
|
||||
EIGEN_ALWAYS_INLINE bool operator() (const DenseIndex, const DenseIndex) const {
|
||||
struct index_statically_ne_impl<const DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) const {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_gt<DimensionList<Index, Rank> > {
|
||||
EIGEN_ALWAYS_INLINE bool operator() (const DenseIndex, const DenseIndex) const {
|
||||
struct index_statically_gt_impl<DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run() (const DenseIndex, const DenseIndex) const {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_gt<const DimensionList<Index, Rank> > {
|
||||
EIGEN_ALWAYS_INLINE bool operator() (const DenseIndex, const DenseIndex) const {
|
||||
struct index_statically_gt_impl<const DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) const {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_lt<DimensionList<Index, Rank> > {
|
||||
EIGEN_ALWAYS_INLINE bool operator() (const DenseIndex, const DenseIndex) const {
|
||||
struct index_statically_lt_impl<DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run() (const DenseIndex, const DenseIndex) const {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_lt<const DimensionList<Index, Rank> > {
|
||||
EIGEN_ALWAYS_INLINE bool operator() (const DenseIndex, const DenseIndex) const {
|
||||
struct index_statically_lt_impl<const DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) const {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
@ -363,98 +363,124 @@ static constexpr bool indices_statically_known_to_increase() {
|
||||
|
||||
|
||||
template <typename Tx>
|
||||
struct index_statically_eq {
|
||||
constexpr bool operator() (DenseIndex, DenseIndex) const {
|
||||
struct index_statically_eq_impl {
|
||||
static constexpr bool run(DenseIndex, DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FirstType, typename... OtherTypes>
|
||||
struct index_statically_eq<IndexList<FirstType, OtherTypes...> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_eq_impl<IndexList<FirstType, OtherTypes...> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return IndexList<FirstType, OtherTypes...>().value_known_statically(i) &
|
||||
(IndexList<FirstType, OtherTypes...>().get(i) == value);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FirstType, typename... OtherTypes>
|
||||
struct index_statically_eq<const IndexList<FirstType, OtherTypes...> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_eq_impl<const IndexList<FirstType, OtherTypes...> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return IndexList<FirstType, OtherTypes...>().value_known_statically(i) &
|
||||
(IndexList<FirstType, OtherTypes...>().get(i) == value);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct index_statically_ne {
|
||||
constexpr bool operator() (DenseIndex, DenseIndex) const {
|
||||
return false;
|
||||
static constexpr bool index_statically_eq(DenseIndex i, DenseIndex value) {
|
||||
return index_statically_eq_impl<T>::run(i, value);
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct index_statically_ne_impl {
|
||||
static constexpr bool run(DenseIndex, DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FirstType, typename... OtherTypes>
|
||||
struct index_statically_ne<IndexList<FirstType, OtherTypes...> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_ne_impl<IndexList<FirstType, OtherTypes...> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return IndexList<FirstType, OtherTypes...>().value_known_statically(i) &
|
||||
(IndexList<FirstType, OtherTypes...>().get(i) != value);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FirstType, typename... OtherTypes>
|
||||
struct index_statically_ne<const IndexList<FirstType, OtherTypes...> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_ne_impl<const IndexList<FirstType, OtherTypes...> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return IndexList<FirstType, OtherTypes...>().value_known_statically(i) &
|
||||
(IndexList<FirstType, OtherTypes...>().get(i) != value);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
static constexpr bool index_statically_ne(DenseIndex i, DenseIndex value) {
|
||||
return index_statically_ne_impl<T>::run(i, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct index_statically_gt {
|
||||
constexpr bool operator() (DenseIndex, DenseIndex) const {
|
||||
return false;
|
||||
struct index_statically_gt_impl {
|
||||
static constexpr bool run(DenseIndex, DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FirstType, typename... OtherTypes>
|
||||
struct index_statically_gt<IndexList<FirstType, OtherTypes...> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_gt_impl<IndexList<FirstType, OtherTypes...> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return IndexList<FirstType, OtherTypes...>().value_known_statically(i) &
|
||||
(IndexList<FirstType, OtherTypes...>().get(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 {
|
||||
struct index_statically_gt_impl<const IndexList<FirstType, OtherTypes...> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return IndexList<FirstType, OtherTypes...>().value_known_statically(i) &
|
||||
(IndexList<FirstType, OtherTypes...>().get(i) > value);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct index_statically_lt {
|
||||
constexpr bool operator() (DenseIndex, DenseIndex) const {
|
||||
return false;
|
||||
static constexpr bool index_statically_gt(DenseIndex i, DenseIndex value) {
|
||||
return index_statically_gt_impl<T>::run(i, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct index_statically_lt_impl {
|
||||
static constexpr bool run(DenseIndex, DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename FirstType, typename... OtherTypes>
|
||||
struct index_statically_lt<IndexList<FirstType, OtherTypes...> > {
|
||||
constexpr bool operator() (const DenseIndex i, const DenseIndex value) const {
|
||||
struct index_statically_lt_impl<IndexList<FirstType, OtherTypes...> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return IndexList<FirstType, OtherTypes...>().value_known_statically(i) &
|
||||
(IndexList<FirstType, OtherTypes...>().get(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 {
|
||||
struct index_statically_lt_impl<const IndexList<FirstType, OtherTypes...> > {
|
||||
static constexpr bool run(const DenseIndex i, const DenseIndex value) {
|
||||
return IndexList<FirstType, OtherTypes...>().value_known_statically(i) &
|
||||
(IndexList<FirstType, OtherTypes...>().get(i) < value);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
static constexpr bool index_statically_lt(DenseIndex i, DenseIndex value) {
|
||||
return index_statically_lt_impl<T>::run(i, value);
|
||||
}
|
||||
|
||||
|
||||
} // end namespace internal
|
||||
} // end namespace Eigen
|
||||
|
||||
@ -484,32 +510,24 @@ static EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool indices_statically_known_to_in
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct index_statically_eq {
|
||||
EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool operator() (DenseIndex, DenseIndex) const{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
static EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool indices_statically_eq(DenseIndex, DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct index_statically_ne {
|
||||
EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool operator() (DenseIndex, DenseIndex) const{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
static EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool indices_statically_ne(DenseIndex, DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct index_statically_gt {
|
||||
EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool operator() (DenseIndex, DenseIndex) const{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
static EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool indices_statically_gt(DenseIndex, DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct index_statically_lt {
|
||||
EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool operator() (DenseIndex, DenseIndex) const{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
static EIGEN_ALWAYS_INLINE EIGEN_DEVICE_FUNC bool indices_statically_lt(DenseIndex, DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // end namespace internal
|
||||
} // end namespace Eigen
|
||||
|
@ -89,29 +89,29 @@ struct preserve_inner_most_dims {
|
||||
template <typename ReducedDims, int NumTensorDims>
|
||||
struct are_inner_most_dims<ReducedDims, NumTensorDims, ColMajor>{
|
||||
static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>();
|
||||
static const bool tmp2 = index_statically_eq<ReducedDims>()(0, 0);
|
||||
static const bool tmp3 = index_statically_eq<ReducedDims>()(array_size<ReducedDims>::value-1, array_size<ReducedDims>::value-1);
|
||||
static const bool tmp2 = index_statically_eq<ReducedDims>(0, 0);
|
||||
static const bool tmp3 = index_statically_eq<ReducedDims>(array_size<ReducedDims>::value-1, array_size<ReducedDims>::value-1);
|
||||
static const bool value = tmp1 & tmp2 & tmp3;
|
||||
};
|
||||
template <typename ReducedDims, int NumTensorDims>
|
||||
struct are_inner_most_dims<ReducedDims, NumTensorDims, RowMajor>{
|
||||
static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>();
|
||||
static const bool tmp2 = index_statically_eq<ReducedDims>()(0, NumTensorDims - array_size<ReducedDims>::value);
|
||||
static const bool tmp3 = index_statically_eq<ReducedDims>()(array_size<ReducedDims>::value - 1, NumTensorDims - 1);
|
||||
static const bool tmp2 = index_statically_eq<ReducedDims>(0, NumTensorDims - array_size<ReducedDims>::value);
|
||||
static const bool tmp3 = index_statically_eq<ReducedDims>(array_size<ReducedDims>::value - 1, NumTensorDims - 1);
|
||||
static const bool value = tmp1 & tmp2 & tmp3;
|
||||
|
||||
};
|
||||
template <typename ReducedDims, int NumTensorDims>
|
||||
struct preserve_inner_most_dims<ReducedDims, NumTensorDims, ColMajor>{
|
||||
static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>();
|
||||
static const bool tmp2 = index_statically_gt<ReducedDims>()(0, 0);
|
||||
static const bool tmp2 = index_statically_gt<ReducedDims>(0, 0);
|
||||
static const bool value = tmp1 & tmp2;
|
||||
|
||||
};
|
||||
template <typename ReducedDims, int NumTensorDims>
|
||||
struct preserve_inner_most_dims<ReducedDims, NumTensorDims, RowMajor>{
|
||||
static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>();
|
||||
static const bool tmp2 = index_statically_lt<ReducedDims>()(array_size<ReducedDims>::value - 1, NumTensorDims - 1);
|
||||
static const bool tmp2 = index_statically_lt<ReducedDims>(array_size<ReducedDims>::value - 1, NumTensorDims - 1);
|
||||
static const bool value = tmp1 & tmp2;
|
||||
};
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user