mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Cleanup
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
81c928ba55
commit
970640519b
@@ -388,7 +388,6 @@ class Tensor : public TensorBase<Tensor<Scalar_, NumIndices_, Options_, IndexTyp
|
||||
// Nothing to do: rank 0 tensors have fixed size
|
||||
}
|
||||
|
||||
#ifdef EIGEN_HAS_INDEX_LIST
|
||||
template <typename FirstType, typename... OtherTypes>
|
||||
EIGEN_DEVICE_FUNC
|
||||
void resize(const Eigen::IndexList<FirstType, OtherTypes...>& dimensions) {
|
||||
@@ -398,7 +397,6 @@ class Tensor : public TensorBase<Tensor<Scalar_, NumIndices_, Options_, IndexTyp
|
||||
}
|
||||
resize(dims);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Custom Dimension */
|
||||
template<typename CustomDimension,
|
||||
|
||||
@@ -45,8 +45,6 @@ template<DenseIndex n, typename Index, std::size_t Rank> const Index array_get(c
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
#if EIGEN_HAS_CONSTEXPR
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_known_statically_impl<DimensionList<Index, Rank> > {
|
||||
EIGEN_DEVICE_FUNC static constexpr bool run(const DenseIndex) {
|
||||
@@ -138,99 +136,6 @@ struct index_statically_lt_impl<const DimensionList<Index, Rank> > {
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_known_statically_impl<DimensionList<Index, Rank> > {
|
||||
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE bool run(const DenseIndex) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_known_statically_impl<const DimensionList<Index, Rank> > {
|
||||
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE bool run(const DenseIndex) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct all_indices_known_statically_impl<DimensionList<Index, Rank> > {
|
||||
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE bool run() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct all_indices_known_statically_impl<const DimensionList<Index, Rank> > {
|
||||
EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE bool run() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct indices_statically_known_to_increase_impl<DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct indices_statically_known_to_increase_impl<const DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_eq_impl<DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_eq_impl<const DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_ne_impl<DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex){
|
||||
return false;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_ne_impl<const DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_gt_impl<DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_gt_impl<const DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_lt_impl<DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
template <typename Index, std::size_t Rank>
|
||||
struct index_statically_lt_impl<const DimensionList<Index, Rank> > {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const DenseIndex, const DenseIndex) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
} // end namespace internal
|
||||
} // end namespace Eigen
|
||||
|
||||
|
||||
@@ -297,7 +297,6 @@ struct DSizes : array<DenseIndex, NumDims> {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef EIGEN_HAS_INDEX_LIST
|
||||
template <typename FirstType, typename... OtherTypes>
|
||||
EIGEN_DEVICE_FUNC
|
||||
explicit DSizes(const Eigen::IndexList<FirstType, OtherTypes...>& dimensions) {
|
||||
@@ -305,7 +304,6 @@ struct DSizes : array<DenseIndex, NumDims> {
|
||||
(*this)[i] = dimensions[i];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef EIGEN_EMULATE_CXX11_META_H
|
||||
template <typename std::ptrdiff_t... Indices>
|
||||
|
||||
@@ -12,10 +12,6 @@
|
||||
|
||||
#include "./InternalHeaderCheck.h"
|
||||
|
||||
#if EIGEN_HAS_CONSTEXPR
|
||||
|
||||
#define EIGEN_HAS_INDEX_LIST
|
||||
|
||||
namespace Eigen {
|
||||
|
||||
/** \internal
|
||||
@@ -609,81 +605,6 @@ struct index_pair_second_statically_eq_impl<const IndexPairList<FirstType, Other
|
||||
} // end namespace internal
|
||||
} // end namespace Eigen
|
||||
|
||||
#else
|
||||
|
||||
namespace Eigen {
|
||||
namespace internal {
|
||||
|
||||
template <typename T>
|
||||
struct index_known_statically_impl {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(const Index) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct all_indices_known_statically_impl {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct indices_statically_known_to_increase_impl {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct index_statically_eq_impl {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(Index, Index) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct index_statically_ne_impl {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(Index, Index) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct index_statically_gt_impl {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(Index, Index) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct index_statically_lt_impl {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(Index, Index) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Tx>
|
||||
struct index_pair_first_statically_eq_impl {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(Index, Index) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Tx>
|
||||
struct index_pair_second_statically_eq_impl {
|
||||
static EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool run(Index, Index) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // end namespace internal
|
||||
} // end namespace Eigen
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
namespace Eigen {
|
||||
namespace internal {
|
||||
|
||||
@@ -109,13 +109,9 @@ struct TensorEvaluator<const TensorReshapingOp<NewDimensions, ArgType>, Device>
|
||||
|
||||
// clang-format off
|
||||
static const ReshapingKind kind =
|
||||
#if defined(EIGEN_HAS_INDEX_LIST)
|
||||
(NumOutputDims == 2 && internal::index_statically_eq<NewDimensions>(/*index=*/0, /*value=*/1)) ? OneByN
|
||||
: (NumOutputDims == 2 && internal::index_statically_eq<NewDimensions>(/*index=*/1, /*value=*/1)) ? NByOne
|
||||
: Runtime;
|
||||
#else
|
||||
Runtime;
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
enum {
|
||||
|
||||
@@ -512,35 +512,20 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool isPaddingAtIndexForDim(
|
||||
Index index, int dim_index) const {
|
||||
#if defined(EIGEN_HAS_INDEX_LIST)
|
||||
return (!internal::index_pair_first_statically_eq<PaddingDimensions>(dim_index, 0) &&
|
||||
index < m_padding[dim_index].first) ||
|
||||
(!internal::index_pair_second_statically_eq<PaddingDimensions>(dim_index, 0) &&
|
||||
index >= m_dimensions[dim_index] - m_padding[dim_index].second);
|
||||
#else
|
||||
return (index < m_padding[dim_index].first) ||
|
||||
(index >= m_dimensions[dim_index] - m_padding[dim_index].second);
|
||||
#endif
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool isLeftPaddingCompileTimeZero(
|
||||
int dim_index) const {
|
||||
#if defined(EIGEN_HAS_INDEX_LIST)
|
||||
return internal::index_pair_first_statically_eq<PaddingDimensions>(dim_index, 0);
|
||||
#else
|
||||
EIGEN_UNUSED_VARIABLE(dim_index);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool isRightPaddingCompileTimeZero(
|
||||
int dim_index) const {
|
||||
#if defined(EIGEN_HAS_INDEX_LIST)
|
||||
return internal::index_pair_second_statically_eq<PaddingDimensions>(dim_index, 0);
|
||||
#else
|
||||
EIGEN_UNUSED_VARIABLE(dim_index);
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -108,7 +108,6 @@ struct preserve_inner_most_dims {
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
#if EIGEN_HAS_CONSTEXPR
|
||||
template <typename ReducedDims, int NumTensorDims>
|
||||
struct are_inner_most_dims<ReducedDims, NumTensorDims, ColMajor>{
|
||||
static const bool tmp1 = indices_statically_known_to_increase<ReducedDims>();
|
||||
@@ -137,7 +136,6 @@ struct preserve_inner_most_dims<ReducedDims, NumTensorDims, RowMajor>{
|
||||
static const bool tmp2 = index_statically_lt<ReducedDims>(array_size<ReducedDims>::value - 1, NumTensorDims - 1);
|
||||
static const bool value = tmp1 & tmp2;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
template <int DimIndex, typename Self, typename Op>
|
||||
|
||||
Reference in New Issue
Block a user