static const class members turned into constexpr

This commit is contained in:
Erik Schultheis 2022-04-04 17:33:33 +00:00 committed by Rasmus Munk Larsen
parent 2c0ef43b48
commit 64909b82bd
53 changed files with 259 additions and 258 deletions

View File

@ -982,7 +982,7 @@ namespace internal {
template <typename Derived, typename OtherDerived, bool IsVector> template <typename Derived, typename OtherDerived, bool IsVector>
struct conservative_resize_like_impl struct conservative_resize_like_impl
{ {
static const bool IsRelocatable = std::is_trivially_copyable<typename Derived::Scalar>::value; static constexpr bool IsRelocatable = std::is_trivially_copyable<typename Derived::Scalar>::value;
static void run(DenseBase<Derived>& _this, Index rows, Index cols) static void run(DenseBase<Derived>& _this, Index rows, Index cols)
{ {
if (_this.rows() == rows && _this.cols() == cols) return; if (_this.rows() == rows && _this.cols() == cols) return;

View File

@ -634,7 +634,7 @@ template<typename Xpr, int NbEvaluations,
> >
struct local_nested_eval_wrapper struct local_nested_eval_wrapper
{ {
static const bool NeedExternalBuffer = false; static constexpr bool NeedExternalBuffer = false;
typedef typename Xpr::Scalar Scalar; typedef typename Xpr::Scalar Scalar;
typedef typename nested_eval<Xpr,NbEvaluations>::type ObjectType; typedef typename nested_eval<Xpr,NbEvaluations>::type ObjectType;
ObjectType object; ObjectType object;
@ -650,7 +650,7 @@ struct local_nested_eval_wrapper
template<typename Xpr, int NbEvaluations> template<typename Xpr, int NbEvaluations>
struct local_nested_eval_wrapper<Xpr,NbEvaluations,true> struct local_nested_eval_wrapper<Xpr,NbEvaluations,true>
{ {
static const bool NeedExternalBuffer = true; static constexpr bool NeedExternalBuffer = true;
typedef typename Xpr::Scalar Scalar; typedef typename Xpr::Scalar Scalar;
typedef typename plain_object_eval<Xpr>::type PlainObject; typedef typename plain_object_eval<Xpr>::type PlainObject;
typedef Map<PlainObject,EIGEN_DEFAULT_ALIGN_BYTES> ObjectType; typedef Map<PlainObject,EIGEN_DEFAULT_ALIGN_BYTES> ObjectType;

View File

@ -333,12 +333,12 @@ namespace internal {
template<typename Scalar, int StorageOrder, typename PivIndex, int SizeAtCompileTime=Dynamic> template<typename Scalar, int StorageOrder, typename PivIndex, int SizeAtCompileTime=Dynamic>
struct partial_lu_impl struct partial_lu_impl
{ {
static const int UnBlockedBound = 16; static constexpr int UnBlockedBound = 16;
static const bool UnBlockedAtCompileTime = SizeAtCompileTime!=Dynamic && SizeAtCompileTime<=UnBlockedBound; static constexpr bool UnBlockedAtCompileTime = SizeAtCompileTime!=Dynamic && SizeAtCompileTime<=UnBlockedBound;
static const int ActualSizeAtCompileTime = UnBlockedAtCompileTime ? SizeAtCompileTime : Dynamic; static constexpr int ActualSizeAtCompileTime = UnBlockedAtCompileTime ? SizeAtCompileTime : Dynamic;
// Remaining rows and columns at compile-time: // Remaining rows and columns at compile-time:
static const int RRows = SizeAtCompileTime==2 ? 1 : Dynamic; static constexpr int RRows = SizeAtCompileTime==2 ? 1 : Dynamic;
static const int RCols = SizeAtCompileTime==2 ? 1 : Dynamic; static constexpr int RCols = SizeAtCompileTime==2 ? 1 : Dynamic;
typedef Matrix<Scalar, ActualSizeAtCompileTime, ActualSizeAtCompileTime, StorageOrder> MatrixType; typedef Matrix<Scalar, ActualSizeAtCompileTime, ActualSizeAtCompileTime, StorageOrder> MatrixType;
typedef Ref<MatrixType> MatrixTypeRef; typedef Ref<MatrixType> MatrixTypeRef;
typedef Ref<Matrix<Scalar, Dynamic, Dynamic, StorageOrder> > BlockType; typedef Ref<Matrix<Scalar, Dynamic, Dynamic, StorageOrder> > BlockType;

View File

@ -82,8 +82,8 @@ class Tensor : public TensorBase<Tensor<Scalar_, NumIndices_, Options_, IndexTyp
}; };
static constexpr int Layout = Options_ & RowMajor ? RowMajor : ColMajor; static constexpr int Layout = Options_ & RowMajor ? RowMajor : ColMajor;
static const int Options = Options_; static constexpr int Options = Options_;
static const int NumIndices = NumIndices_; static constexpr int NumIndices = NumIndices_;
typedef DSizes<Index, NumIndices_> Dimensions; typedef DSizes<Index, NumIndices_> Dimensions;
protected: protected:

View File

@ -32,8 +32,8 @@ struct traits<TensorIndexPairOp<XprType> > : public traits<XprType>
typedef Pair<Index, typename XprTraits::Scalar> Scalar; typedef Pair<Index, typename XprTraits::Scalar> Scalar;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
}; };
template<typename XprType> template<typename XprType>
@ -83,7 +83,7 @@ struct TensorEvaluator<const TensorIndexPairOp<ArgType>, Device>
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename TensorEvaluator<ArgType, Device>::Dimensions Dimensions; typedef typename TensorEvaluator<ArgType, Device>::Dimensions Dimensions;
static const int NumDims = internal::array_size<Dimensions>::value; static constexpr int NumDims = internal::array_size<Dimensions>::value;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
@ -155,8 +155,8 @@ struct traits<TensorPairReducerOp<ReduceOp, Dims, XprType> > : public traits<Xpr
typedef Index Scalar; typedef Index Scalar;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions - array_size<Dims>::value; static constexpr int NumDimensions = XprTraits::NumDimensions - array_size<Dims>::value;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
}; };
template<typename ReduceOp, typename Dims, typename XprType> template<typename ReduceOp, typename Dims, typename XprType>
@ -222,7 +222,7 @@ struct TensorEvaluator<const TensorPairReducerOp<ReduceOp, Dims, ArgType>, Devic
typedef typename TensorIndexPairOp<ArgType>::CoeffReturnType PairType; typedef typename TensorIndexPairOp<ArgType>::CoeffReturnType PairType;
typedef typename TensorEvaluator<const TensorReductionOp<ReduceOp, Dims, const TensorIndexPairOp<ArgType> >, Device>::Dimensions Dimensions; typedef typename TensorEvaluator<const TensorReductionOp<ReduceOp, Dims, const TensorIndexPairOp<ArgType> >, Device>::Dimensions Dimensions;
typedef typename TensorEvaluator<const TensorIndexPairOp<ArgType> , Device>::Dimensions InputDimensions; typedef typename TensorEvaluator<const TensorIndexPairOp<ArgType> , Device>::Dimensions InputDimensions;
static const int NumDims = internal::array_size<InputDimensions>::value; static constexpr int NumDims = internal::array_size<InputDimensions>::value;
typedef array<Index, NumDims> StrideDims; typedef array<Index, NumDims> StrideDims;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;

View File

@ -34,8 +34,8 @@ struct traits<TensorAssignOp<LhsXprType, RhsXprType> >
typedef typename RhsXprType::Nested RhsNested; typedef typename RhsXprType::Nested RhsNested;
typedef std::remove_reference_t<LhsNested> LhsNested_; typedef std::remove_reference_t<LhsNested> LhsNested_;
typedef std::remove_reference_t<RhsNested> RhsNested_; typedef std::remove_reference_t<RhsNested> RhsNested_;
static const std::size_t NumDimensions = internal::traits<LhsXprType>::NumDimensions; static constexpr std::size_t NumDimensions = internal::traits<LhsXprType>::NumDimensions;
static const int Layout = internal::traits<LhsXprType>::Layout; static constexpr int Layout = internal::traits<LhsXprType>::Layout;
typedef typename traits<LhsXprType>::PointerType PointerType; typedef typename traits<LhsXprType>::PointerType PointerType;
enum { enum {
@ -70,7 +70,7 @@ class TensorAssignOp : public TensorBase<TensorAssignOp<LhsXprType, RhsXprType>
typedef typename Eigen::internal::traits<TensorAssignOp>::StorageKind StorageKind; typedef typename Eigen::internal::traits<TensorAssignOp>::StorageKind StorageKind;
typedef typename Eigen::internal::traits<TensorAssignOp>::Index Index; typedef typename Eigen::internal::traits<TensorAssignOp>::Index Index;
static const int NumDims = Eigen::internal::traits<TensorAssignOp>::NumDimensions; static constexpr int NumDims = Eigen::internal::traits<TensorAssignOp>::NumDimensions;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorAssignOp(LhsXprType& lhs, const RhsXprType& rhs) EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorAssignOp(LhsXprType& lhs, const RhsXprType& rhs)
: m_lhs_xpr(lhs), m_rhs_xpr(rhs) {} : m_lhs_xpr(lhs), m_rhs_xpr(rhs) {}
@ -102,8 +102,8 @@ struct TensorEvaluator<const TensorAssignOp<LeftArgType, RightArgType>, Device>
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
static const int NumDims = XprType::NumDims; static constexpr int NumDims = XprType::NumDims;
static constexpr int Layout = TensorEvaluator<LeftArgType, Device>::Layout; static constexpr int Layout = TensorEvaluator<LeftArgType, Device>::Layout;
enum { enum {

View File

@ -35,7 +35,7 @@ class TensorBase<Derived, ReadOnlyAccessors>
typedef typename DerivedTraits::Scalar Scalar; typedef typename DerivedTraits::Scalar Scalar;
typedef typename DerivedTraits::Index Index; typedef typename DerivedTraits::Index Index;
typedef std::remove_const_t<Scalar> CoeffReturnType; typedef std::remove_const_t<Scalar> CoeffReturnType;
static const int NumDimensions = DerivedTraits::NumDimensions; static constexpr int NumDimensions = DerivedTraits::NumDimensions;
// Generic nullary operation support. // Generic nullary operation support.
template <typename CustomNullaryOp> EIGEN_DEVICE_FUNC template <typename CustomNullaryOp> EIGEN_DEVICE_FUNC
@ -988,7 +988,7 @@ class TensorBase : public TensorBase<Derived, ReadOnlyAccessors> {
typedef typename DerivedTraits::Scalar Scalar; typedef typename DerivedTraits::Scalar Scalar;
typedef typename DerivedTraits::Index Index; typedef typename DerivedTraits::Index Index;
typedef Scalar CoeffReturnType; typedef Scalar CoeffReturnType;
static const int NumDimensions = DerivedTraits::NumDimensions; static constexpr int NumDimensions = DerivedTraits::NumDimensions;
template <typename Scalar, int NumIndices, int Options, typename IndexType> friend class Tensor; template <typename Scalar, int NumIndices, int Options, typename IndexType> friend class Tensor;
template <typename Scalar, typename Dimensions, int Option, typename IndexTypes> friend class TensorFixedSize; template <typename Scalar, typename Dimensions, int Option, typename IndexTypes> friend class TensorFixedSize;

View File

@ -835,7 +835,7 @@ class TensorMaterializedBlock {
template <typename UnaryOp, typename ArgTensorBlock> template <typename UnaryOp, typename ArgTensorBlock>
class TensorCwiseUnaryBlock { class TensorCwiseUnaryBlock {
static const bool NoArgBlockAccess = static constexpr bool NoArgBlockAccess =
internal::is_void<typename ArgTensorBlock::XprType>::value; internal::is_void<typename ArgTensorBlock::XprType>::value;
public: public:
@ -866,7 +866,7 @@ class TensorCwiseUnaryBlock {
template <typename BinaryOp, typename LhsTensorBlock, typename RhsTensorBlock> template <typename BinaryOp, typename LhsTensorBlock, typename RhsTensorBlock>
class TensorCwiseBinaryBlock { class TensorCwiseBinaryBlock {
static const bool NoArgBlockAccess = static constexpr bool NoArgBlockAccess =
internal::is_void<typename LhsTensorBlock::XprType>::value || internal::is_void<typename LhsTensorBlock::XprType>::value ||
internal::is_void<typename RhsTensorBlock::XprType>::value; internal::is_void<typename RhsTensorBlock::XprType>::value;
@ -913,7 +913,7 @@ class TensorCwiseBinaryBlock {
template <typename BlockFactory, typename ArgTensorBlock> template <typename BlockFactory, typename ArgTensorBlock>
class TensorUnaryExprBlock { class TensorUnaryExprBlock {
typedef typename ArgTensorBlock::XprType ArgXprType; typedef typename ArgTensorBlock::XprType ArgXprType;
static const bool NoArgBlockAccess = internal::is_void<ArgXprType>::value; static constexpr bool NoArgBlockAccess = internal::is_void<ArgXprType>::value;
public: public:
typedef std::conditional_t< typedef std::conditional_t<
@ -947,9 +947,9 @@ class TensorTernaryExprBlock {
typedef typename Arg2TensorBlock::XprType Arg2XprType; typedef typename Arg2TensorBlock::XprType Arg2XprType;
typedef typename Arg3TensorBlock::XprType Arg3XprType; typedef typename Arg3TensorBlock::XprType Arg3XprType;
static const bool NoArgBlockAccess = internal::is_void<Arg1XprType>::value || static constexpr bool NoArgBlockAccess = internal::is_void<Arg1XprType>::value ||
internal::is_void<Arg2XprType>::value || internal::is_void<Arg2XprType>::value ||
internal::is_void<Arg3XprType>::value; internal::is_void<Arg3XprType>::value;
public: public:
typedef std::conditional_t< typedef std::conditional_t<
@ -1143,7 +1143,7 @@ class StridedLinearBufferCopy {
template <typename Scalar, typename IndexType, int NumDims, int Layout> template <typename Scalar, typename IndexType, int NumDims, int Layout>
class TensorBlockIO { class TensorBlockIO {
static const bool IsColMajor = (Layout == ColMajor); static constexpr bool IsColMajor = (Layout == ColMajor);
typedef StridedLinearBufferCopy<Scalar, IndexType> LinCopy; typedef StridedLinearBufferCopy<Scalar, IndexType> LinCopy;

View File

@ -31,8 +31,8 @@ struct traits<TensorBroadcastingOp<Broadcast, XprType> > : public traits<XprType
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -100,13 +100,13 @@ struct TensorEvaluator<const TensorBroadcastingOp<Broadcast, ArgType>, Device>
{ {
typedef TensorBroadcastingOp<Broadcast, ArgType> XprType; typedef TensorBroadcastingOp<Broadcast, ArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename TensorEvaluator<ArgType, Device>::Dimensions InputDimensions; typedef typename TensorEvaluator<ArgType, Device>::Dimensions InputDimensions;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
protected: // all the non-static fields must have the same access control, otherwise the TensorEvaluator won't be standard layout; protected: // all the non-static fields must have the same access control, otherwise the TensorEvaluator won't be standard layout;
bool isCopy, nByOne, oneByN; bool isCopy, nByOne, oneByN;
public: public:
@ -695,7 +695,7 @@ struct TensorEvaluator<const TensorBroadcastingOp<Broadcast, ArgType>, Device>
} }
#endif #endif
private: private:
static const bool IsColMajor = static constexpr bool IsColMajor =
static_cast<int>(Layout) == static_cast<int>(ColMajor); static_cast<int>(Layout) == static_cast<int>(ColMajor);
// We will build a general case block broadcasting on top of broadcasting // We will build a general case block broadcasting on top of broadcasting

View File

@ -32,8 +32,8 @@ struct traits<TensorChippingOp<DimId, XprType> > : public traits<XprType>
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions - 1; static constexpr int NumDimensions = XprTraits::NumDimensions - 1;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -117,14 +117,14 @@ template<DenseIndex DimId, typename ArgType, typename Device>
struct TensorEvaluator<const TensorChippingOp<DimId, ArgType>, Device> struct TensorEvaluator<const TensorChippingOp<DimId, ArgType>, Device>
{ {
typedef TensorChippingOp<DimId, ArgType> XprType; typedef TensorChippingOp<DimId, ArgType> XprType;
static const int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
static const int NumDims = NumInputDims-1; static constexpr int NumDims = NumInputDims-1;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout; static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout;
@ -413,14 +413,14 @@ struct TensorEvaluator<TensorChippingOp<DimId, ArgType>, Device>
{ {
typedef TensorEvaluator<const TensorChippingOp<DimId, ArgType>, Device> Base; typedef TensorEvaluator<const TensorChippingOp<DimId, ArgType>, Device> Base;
typedef TensorChippingOp<DimId, ArgType> XprType; typedef TensorChippingOp<DimId, ArgType> XprType;
static const int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
static const int NumDims = NumInputDims-1; static constexpr int NumDims = NumInputDims-1;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
enum { enum {
IsAligned = false, IsAligned = false,

View File

@ -36,8 +36,8 @@ struct traits<TensorConcatenationOp<Axis, LhsXprType, RhsXprType> >
typedef typename RhsXprType::Nested RhsNested; typedef typename RhsXprType::Nested RhsNested;
typedef std::remove_reference_t<LhsNested> LhsNested_; typedef std::remove_reference_t<LhsNested> LhsNested_;
typedef std::remove_reference_t<RhsNested> RhsNested_; typedef std::remove_reference_t<RhsNested> RhsNested_;
static const int NumDimensions = traits<LhsXprType>::NumDimensions; static constexpr int NumDimensions = traits<LhsXprType>::NumDimensions;
static const int Layout = traits<LhsXprType>::Layout; static constexpr int Layout = traits<LhsXprType>::Layout;
enum { Flags = 0 }; enum { Flags = 0 };
typedef std::conditional_t<Pointer_type_promotion<typename LhsXprType::Scalar, Scalar>::val, typedef std::conditional_t<Pointer_type_promotion<typename LhsXprType::Scalar, Scalar>::val,
typename traits<LhsXprType>::PointerType, typename traits<RhsXprType>::PointerType> PointerType; typename traits<LhsXprType>::PointerType, typename traits<RhsXprType>::PointerType> PointerType;
@ -98,8 +98,8 @@ struct TensorEvaluator<const TensorConcatenationOp<Axis, LeftArgType, RightArgTy
{ {
typedef TensorConcatenationOp<Axis, LeftArgType, RightArgType> XprType; typedef TensorConcatenationOp<Axis, LeftArgType, RightArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumDims = internal::array_size<typename TensorEvaluator<LeftArgType, Device>::Dimensions>::value; static constexpr int NumDims = internal::array_size<typename TensorEvaluator<LeftArgType, Device>::Dimensions>::value;
static const int RightNumDims = internal::array_size<typename TensorEvaluator<RightArgType, Device>::Dimensions>::value; static constexpr int RightNumDims = internal::array_size<typename TensorEvaluator<RightArgType, Device>::Dimensions>::value;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;

View File

@ -40,8 +40,8 @@ struct traits<TensorContractionOp<Dimensions, LhsXprType, RhsXprType, OutputKern
typedef std::remove_reference_t<RhsNested> RhsNested_; typedef std::remove_reference_t<RhsNested> RhsNested_;
// From NumDims below. // From NumDims below.
static const int NumDimensions = traits<LhsXprType>::NumDimensions + traits<RhsXprType>::NumDimensions - 2 * array_size<Dimensions>::value; static constexpr int NumDimensions = traits<LhsXprType>::NumDimensions + traits<RhsXprType>::NumDimensions - 2 * array_size<Dimensions>::value;
static const int Layout = traits<LhsXprType>::Layout; static constexpr int Layout = traits<LhsXprType>::Layout;
typedef std::conditional_t<Pointer_type_promotion<typename LhsXprType::Scalar, Scalar>::val, typedef std::conditional_t<Pointer_type_promotion<typename LhsXprType::Scalar, Scalar>::val,
typename traits<LhsXprType>::PointerType, typename traits<LhsXprType>::PointerType,
typename traits<RhsXprType>::PointerType> typename traits<RhsXprType>::PointerType>
@ -73,7 +73,7 @@ struct traits<TensorEvaluator<const TensorContractionOp<Indices_, LeftArgType_,
typedef Device_ Device; typedef Device_ Device;
// From NumDims below. // From NumDims below.
static const int NumDimensions = traits<LeftArgType_>::NumDimensions + traits<RightArgType_>::NumDimensions - 2 * array_size<Indices_>::value; static constexpr int NumDimensions = traits<LeftArgType_>::NumDimensions + traits<RightArgType_>::NumDimensions - 2 * array_size<Indices_>::value;
}; };
// Helper class to allocate and deallocate temporary memory for packed buffers. // Helper class to allocate and deallocate temporary memory for packed buffers.
@ -406,12 +406,12 @@ struct TensorContractionEvaluatorBase : internal::no_assignment_operator
typedef TensorEvaluator<EvalLeftArgType, Device> LeftEvaluatorType; typedef TensorEvaluator<EvalLeftArgType, Device> LeftEvaluatorType;
typedef TensorEvaluator<EvalRightArgType, Device> RightEvaluatorType; typedef TensorEvaluator<EvalRightArgType, Device> RightEvaluatorType;
static const int LDims = static constexpr int LDims =
internal::array_size<typename TensorEvaluator<EvalLeftArgType, Device>::Dimensions>::value; internal::array_size<typename TensorEvaluator<EvalLeftArgType, Device>::Dimensions>::value;
static const int RDims = static constexpr int RDims =
internal::array_size<typename TensorEvaluator<EvalRightArgType, Device>::Dimensions>::value; internal::array_size<typename TensorEvaluator<EvalRightArgType, Device>::Dimensions>::value;
static const int ContractDims = internal::array_size<Indices>::value; static constexpr int ContractDims = internal::array_size<Indices>::value;
static const int NumDims = LDims + RDims - 2 * ContractDims; static constexpr int NumDims = LDims + RDims - 2 * ContractDims;
typedef array<Index, ContractDims> contract_t; typedef array<Index, ContractDims> contract_t;
typedef array<Index, LDims - ContractDims> left_nocontract_t; typedef array<Index, LDims - ContractDims> left_nocontract_t;
@ -992,17 +992,17 @@ struct TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgT
typedef std::conditional_t<Layout == static_cast<int>(ColMajor), LeftArgType, RightArgType> EvalLeftArgType; typedef std::conditional_t<Layout == static_cast<int>(ColMajor), LeftArgType, RightArgType> EvalLeftArgType;
typedef std::conditional_t<Layout == static_cast<int>(ColMajor), RightArgType, LeftArgType> EvalRightArgType; typedef std::conditional_t<Layout == static_cast<int>(ColMajor), RightArgType, LeftArgType> EvalRightArgType;
static const int LDims = static constexpr int LDims =
internal::array_size<typename TensorEvaluator<EvalLeftArgType, Device>::Dimensions>::value; internal::array_size<typename TensorEvaluator<EvalLeftArgType, Device>::Dimensions>::value;
static const int RDims = static constexpr int RDims =
internal::array_size<typename TensorEvaluator<EvalRightArgType, Device>::Dimensions>::value; internal::array_size<typename TensorEvaluator<EvalRightArgType, Device>::Dimensions>::value;
static const int ContractDims = internal::array_size<Indices>::value; static constexpr int ContractDims = internal::array_size<Indices>::value;
typedef array<Index, ContractDims> contract_t; typedef array<Index, ContractDims> contract_t;
typedef array<Index, LDims - ContractDims> left_nocontract_t; typedef array<Index, LDims - ContractDims> left_nocontract_t;
typedef array<Index, RDims - ContractDims> right_nocontract_t; typedef array<Index, RDims - ContractDims> right_nocontract_t;
static const int NumDims = LDims + RDims - 2 * ContractDims; static constexpr int NumDims = LDims + RDims - 2 * ContractDims;
// Could we use NumDimensions here? // Could we use NumDimensions here?
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;

View File

@ -1241,11 +1241,11 @@ struct TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgT
typedef std::conditional_t<Layout == static_cast<int>(ColMajor), LeftArgType, RightArgType> EvalLeftArgType; typedef std::conditional_t<Layout == static_cast<int>(ColMajor), LeftArgType, RightArgType> EvalLeftArgType;
typedef std::conditional_t<Layout == static_cast<int>(ColMajor), RightArgType, LeftArgType> EvalRightArgType; typedef std::conditional_t<Layout == static_cast<int>(ColMajor), RightArgType, LeftArgType> EvalRightArgType;
static const int LDims = static constexpr int LDims =
internal::array_size<typename TensorEvaluator<EvalLeftArgType, Device>::Dimensions>::value; internal::array_size<typename TensorEvaluator<EvalLeftArgType, Device>::Dimensions>::value;
static const int RDims = static constexpr int RDims =
internal::array_size<typename TensorEvaluator<EvalRightArgType, Device>::Dimensions>::value; internal::array_size<typename TensorEvaluator<EvalRightArgType, Device>::Dimensions>::value;
static const int ContractDims = internal::array_size<Indices>::value; static constexpr int ContractDims = internal::array_size<Indices>::value;
typedef array<Index, LDims> left_dim_mapper_t; typedef array<Index, LDims> left_dim_mapper_t;
typedef array<Index, RDims> right_dim_mapper_t; typedef array<Index, RDims> right_dim_mapper_t;
@ -1254,7 +1254,7 @@ struct TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgT
typedef array<Index, LDims - ContractDims> left_nocontract_t; typedef array<Index, LDims - ContractDims> left_nocontract_t;
typedef array<Index, RDims - ContractDims> right_nocontract_t; typedef array<Index, RDims - ContractDims> right_nocontract_t;
static const int NumDims = LDims + RDims - 2 * ContractDims; static constexpr int NumDims = LDims + RDims - 2 * ContractDims;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;

View File

@ -1311,9 +1311,9 @@ struct TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgT
}; };
static constexpr int Layout = TensorEvaluator<LeftArgType, Device>::Layout; static constexpr int Layout = TensorEvaluator<LeftArgType, Device>::Layout;
static EIGEN_CONSTEXPR int LDims = Base::LDims; static constexpr int LDims = Base::LDims;
static EIGEN_CONSTEXPR int RDims = Base::RDims; static constexpr int RDims = Base::RDims;
static EIGEN_CONSTEXPR int ContractDims = Base::ContractDims; static constexpr int ContractDims = Base::ContractDims;
typedef array<StorageIndex, LDims> left_dim_mapper_t; typedef array<StorageIndex, LDims> left_dim_mapper_t;
typedef array<StorageIndex, RDims> right_dim_mapper_t; typedef array<StorageIndex, RDims> right_dim_mapper_t;
@ -1322,7 +1322,7 @@ struct TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgT
typedef array<StorageIndex, LDims - ContractDims> left_nocontract_t; typedef array<StorageIndex, LDims - ContractDims> left_nocontract_t;
typedef array<StorageIndex, RDims - ContractDims> right_nocontract_t; typedef array<StorageIndex, RDims - ContractDims> right_nocontract_t;
static const int NumDims = LDims + RDims - 2 * ContractDims; static constexpr int NumDims = LDims + RDims - 2 * ContractDims;
typedef DSizes<StorageIndex, NumDims> Dimensions; typedef DSizes<StorageIndex, NumDims> Dimensions;

View File

@ -43,11 +43,11 @@ struct TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgT
typedef std::conditional_t< typedef std::conditional_t<
static_cast<int>(Layout) == static_cast<int>(ColMajor), RightArgType, LeftArgType> EvalRightArgType; static_cast<int>(Layout) == static_cast<int>(ColMajor), RightArgType, LeftArgType> EvalRightArgType;
static const int LDims = static constexpr int LDims =
internal::array_size<typename TensorEvaluator<EvalLeftArgType, Device>::Dimensions>::value; internal::array_size<typename TensorEvaluator<EvalLeftArgType, Device>::Dimensions>::value;
static const int RDims = static constexpr int RDims =
internal::array_size<typename TensorEvaluator<EvalRightArgType, Device>::Dimensions>::value; internal::array_size<typename TensorEvaluator<EvalRightArgType, Device>::Dimensions>::value;
static const int ContractDims = internal::array_size<Indices>::value; static constexpr int ContractDims = internal::array_size<Indices>::value;
typedef array<Index, LDims> left_dim_mapper_t; typedef array<Index, LDims> left_dim_mapper_t;
typedef array<Index, RDims> right_dim_mapper_t; typedef array<Index, RDims> right_dim_mapper_t;
@ -56,7 +56,7 @@ struct TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgT
typedef array<Index, LDims - ContractDims> left_nocontract_t; typedef array<Index, LDims - ContractDims> left_nocontract_t;
typedef array<Index, RDims - ContractDims> right_nocontract_t; typedef array<Index, RDims - ContractDims> right_nocontract_t;
static const int NumDims = LDims + RDims - 2 * ContractDims; static constexpr int NumDims = LDims + RDims - 2 * ContractDims;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
@ -599,7 +599,7 @@ struct TensorEvaluator<const TensorContractionOp<Indices, LeftArgType, RightArgT
// These variable are rolling over 3 consecutive k slices: first two we are // These variable are rolling over 3 consecutive k slices: first two we are
// actively executing + one to track completion of kernels in the second // actively executing + one to track completion of kernels in the second
// slice. // slice.
static const Index P = 3; static constexpr Index P = 3;
// Handle to the allocated temporary storage for Lhs/Rhs blocks. // Handle to the allocated temporary storage for Lhs/Rhs blocks.
BlockMemHandle packed_mem_; BlockMemHandle packed_mem_;

View File

@ -31,8 +31,8 @@ struct traits<TensorConversionOp<TargetType, XprType> >
typedef typename traits<XprType>::Index Index; typedef typename traits<XprType>::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = traits<XprType>::NumDimensions; static constexpr int NumDimensions = traits<XprType>::NumDimensions;
static const int Layout = traits<XprType>::Layout; static constexpr int Layout = traits<XprType>::Layout;
enum { Flags = 0 }; enum { Flags = 0 };
typedef typename TypeConversion<Scalar, typename traits<XprType>::PointerType>::type PointerType; typedef typename TypeConversion<Scalar, typename traits<XprType>::PointerType>::type PointerType;
}; };
@ -252,7 +252,7 @@ struct PacketConv {
typedef typename internal::unpacket_traits<SrcPacket>::type SrcType; typedef typename internal::unpacket_traits<SrcPacket>::type SrcType;
typedef typename internal::unpacket_traits<TargetPacket>::type TargetType; typedef typename internal::unpacket_traits<TargetPacket>::type TargetType;
static const int PacketSize = internal::unpacket_traits<TargetPacket>::size; static constexpr int PacketSize = internal::unpacket_traits<TargetPacket>::size;
template <typename ArgType, typename Device> template <typename ArgType, typename Device>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TargetPacket run(const TensorEvaluator<ArgType, Device>& impl, Index index) { static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TargetPacket run(const TensorEvaluator<ArgType, Device>& impl, Index index) {
@ -285,7 +285,7 @@ struct PacketConv<SrcPacket, TargetPacket, LoadMode, true, IsSameT> {
template <typename SrcPacket, typename TargetPacket, int LoadMode> template <typename SrcPacket, typename TargetPacket, int LoadMode>
struct PacketConv<SrcPacket, TargetPacket, LoadMode, /*ActuallyVectorize=*/false, /*IsSameT=*/true> { struct PacketConv<SrcPacket, TargetPacket, LoadMode, /*ActuallyVectorize=*/false, /*IsSameT=*/true> {
typedef typename internal::unpacket_traits<TargetPacket>::type TargetType; typedef typename internal::unpacket_traits<TargetPacket>::type TargetType;
static const int PacketSize = internal::unpacket_traits<TargetPacket>::size; static constexpr int PacketSize = internal::unpacket_traits<TargetPacket>::size;
template <typename ArgType, typename Device> template <typename ArgType, typename Device>
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TargetPacket run(const TensorEvaluator<ArgType, Device>& impl, Index index) { static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TargetPacket run(const TensorEvaluator<ArgType, Device>& impl, Index index) {
@ -317,8 +317,8 @@ struct TensorEvaluator<const TensorConversionOp<TargetType, ArgType>, Device>
typedef internal::remove_all_t<typename internal::traits<ArgType>::Scalar> SrcType; typedef internal::remove_all_t<typename internal::traits<ArgType>::Scalar> SrcType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
typedef typename PacketType<SrcType, Device>::type PacketSourceType; typedef typename PacketType<SrcType, Device>::type PacketSourceType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
static const bool IsSameType = internal::is_same<TargetType, SrcType>::value; static constexpr bool IsSameType = internal::is_same<TargetType, SrcType>::value;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
@ -337,7 +337,7 @@ struct TensorEvaluator<const TensorConversionOp<TargetType, ArgType>, Device>
}; };
static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout; static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout;
static const int NumDims = internal::array_size<Dimensions>::value; static constexpr int NumDims = internal::array_size<Dimensions>::value;
//===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
typedef internal::TensorBlockDescriptor<NumDims, Index> TensorBlockDesc; typedef internal::TensorBlockDescriptor<NumDims, Index> TensorBlockDesc;

View File

@ -208,7 +208,7 @@ class IndexMapper {
} }
private: private:
static const int NumDims = internal::array_size<InputDims>::value; static constexpr int NumDims = internal::array_size<InputDims>::value;
array<Index, NumDims> m_inputStrides; array<Index, NumDims> m_inputStrides;
array<Index, NumDims> m_outputStrides; array<Index, NumDims> m_outputStrides;
array<Index, NumDims> m_gpuInputStrides; array<Index, NumDims> m_gpuInputStrides;
@ -231,8 +231,8 @@ struct traits<TensorConvolutionOp<Dimensions, InputXprType, KernelXprType> >
typedef typename KernelXprType::Nested RhsNested; typedef typename KernelXprType::Nested RhsNested;
typedef std::remove_reference_t<LhsNested> LhsNested_; typedef std::remove_reference_t<LhsNested> LhsNested_;
typedef std::remove_reference_t<RhsNested> RhsNested_; typedef std::remove_reference_t<RhsNested> RhsNested_;
static const int NumDimensions = traits<InputXprType>::NumDimensions; static constexpr int NumDimensions = traits<InputXprType>::NumDimensions;
static const int Layout = traits<InputXprType>::Layout; static constexpr int Layout = traits<InputXprType>::Layout;
typedef std::conditional_t<Pointer_type_promotion<typename InputXprType::Scalar, Scalar>::val, typedef std::conditional_t<Pointer_type_promotion<typename InputXprType::Scalar, Scalar>::val,
typename traits<InputXprType>::PointerType, typename traits<KernelXprType>::PointerType> PointerType; typename traits<InputXprType>::PointerType, typename traits<KernelXprType>::PointerType> PointerType;
@ -296,15 +296,15 @@ struct TensorEvaluator<const TensorConvolutionOp<Indices, InputArgType, KernelAr
{ {
typedef TensorConvolutionOp<Indices, InputArgType, KernelArgType> XprType; typedef TensorConvolutionOp<Indices, InputArgType, KernelArgType> XprType;
static const int NumDims = internal::array_size<typename TensorEvaluator<InputArgType, Device>::Dimensions>::value; static constexpr int NumDims = internal::array_size<typename TensorEvaluator<InputArgType, Device>::Dimensions>::value;
static const int NumKernelDims = internal::array_size<Indices>::value; static constexpr int NumKernelDims = internal::array_size<Indices>::value;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef StorageMemory<Scalar, Device> Storage; typedef StorageMemory<Scalar, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
@ -779,8 +779,8 @@ struct TensorEvaluator<const TensorConvolutionOp<Indices, InputArgType, KernelAr
{ {
typedef TensorConvolutionOp<Indices, InputArgType, KernelArgType> XprType; typedef TensorConvolutionOp<Indices, InputArgType, KernelArgType> XprType;
static const int NumDims = internal::array_size<typename TensorEvaluator<InputArgType, GpuDevice>::Dimensions>::value; static constexpr int NumDims = internal::array_size<typename TensorEvaluator<InputArgType, GpuDevice>::Dimensions>::value;
static const int NumKernelDims = internal::array_size<Indices>::value; static constexpr int NumKernelDims = internal::array_size<Indices>::value;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename TensorEvaluator<KernelArgType, GpuDevice>::Dimensions KernelDimensions; typedef typename TensorEvaluator<KernelArgType, GpuDevice>::Dimensions KernelDimensions;
@ -820,7 +820,7 @@ struct TensorEvaluator<const TensorConvolutionOp<Indices, InputArgType, KernelAr
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, GpuDevice>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, GpuDevice>::type PacketReturnType;
typedef typename InputArgType::Scalar Scalar; typedef typename InputArgType::Scalar Scalar;
static const int PacketSize = internal::unpacket_traits<PacketReturnType>::size; static constexpr int PacketSize = internal::unpacket_traits<PacketReturnType>::size;
EIGEN_DEVICE_FUNC const Dimensions& dimensions() const { return m_dimensions; } EIGEN_DEVICE_FUNC const Dimensions& dimensions() const { return m_dimensions; }

View File

@ -277,9 +277,9 @@ template <typename Indices, typename InputArgType, typename KernelArgType>
struct TensorEvaluator<const TensorConvolutionOp<Indices, InputArgType, KernelArgType>, Eigen::SyclDevice> { struct TensorEvaluator<const TensorConvolutionOp<Indices, InputArgType, KernelArgType>, Eigen::SyclDevice> {
typedef TensorConvolutionOp<Indices, InputArgType, KernelArgType> XprType; typedef TensorConvolutionOp<Indices, InputArgType, KernelArgType> XprType;
static const int NumDims = static constexpr int NumDims =
internal::array_size<typename TensorEvaluator<InputArgType, Eigen::SyclDevice>::Dimensions>::value; internal::array_size<typename TensorEvaluator<InputArgType, Eigen::SyclDevice>::Dimensions>::value;
static const int NumKernelDims = internal::array_size<Indices>::value; static constexpr int NumKernelDims = internal::array_size<Indices>::value;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename TensorEvaluator<KernelArgType, Eigen::SyclDevice>::Dimensions KernelDimensions; typedef typename TensorEvaluator<KernelArgType, Eigen::SyclDevice>::Dimensions KernelDimensions;
@ -287,7 +287,7 @@ struct TensorEvaluator<const TensorConvolutionOp<Indices, InputArgType, KernelAr
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Eigen::SyclDevice>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Eigen::SyclDevice>::type PacketReturnType;
typedef typename InputArgType::Scalar Scalar; typedef typename InputArgType::Scalar Scalar;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef StorageMemory<CoeffReturnType, Eigen::SyclDevice> Storage; typedef StorageMemory<CoeffReturnType, Eigen::SyclDevice> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
typedef StorageMemory<const CoeffReturnType, Eigen::SyclDevice> KernelStorage; typedef StorageMemory<const CoeffReturnType, Eigen::SyclDevice> KernelStorage;

View File

@ -30,8 +30,8 @@ struct traits<TensorCustomUnaryOp<CustomUnaryFunc, XprType> >
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = traits<XprType>::NumDimensions; static constexpr int NumDimensions = traits<XprType>::NumDimensions;
static const int Layout = traits<XprType>::Layout; static constexpr int Layout = traits<XprType>::Layout;
typedef typename traits<XprType>::PointerType PointerType; typedef typename traits<XprType>::PointerType PointerType;
}; };
@ -84,12 +84,12 @@ struct TensorEvaluator<const TensorCustomUnaryOp<CustomUnaryFunc, XprType>, Devi
{ {
typedef TensorCustomUnaryOp<CustomUnaryFunc, XprType> ArgType; typedef TensorCustomUnaryOp<CustomUnaryFunc, XprType> ArgType;
typedef typename internal::traits<ArgType>::Index Index; typedef typename internal::traits<ArgType>::Index Index;
static const int NumDims = internal::traits<ArgType>::NumDimensions; static constexpr int NumDims = internal::traits<ArgType>::NumDimensions;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef std::remove_const_t<typename ArgType::Scalar> Scalar; typedef std::remove_const_t<typename ArgType::Scalar> Scalar;
typedef std::remove_const_t<typename XprType::CoeffReturnType> CoeffReturnType; typedef std::remove_const_t<typename XprType::CoeffReturnType> CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef typename Eigen::internal::traits<XprType>::PointerType TensorPointerType; typedef typename Eigen::internal::traits<XprType>::PointerType TensorPointerType;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
@ -195,8 +195,8 @@ struct traits<TensorCustomBinaryOp<CustomBinaryFunc, LhsXprType, RhsXprType> >
typedef typename RhsXprType::Nested RhsNested; typedef typename RhsXprType::Nested RhsNested;
typedef std::remove_reference_t<LhsNested> LhsNested_; typedef std::remove_reference_t<LhsNested> LhsNested_;
typedef std::remove_reference_t<RhsNested> RhsNested_; typedef std::remove_reference_t<RhsNested> RhsNested_;
static const int NumDimensions = traits<LhsXprType>::NumDimensions; static constexpr int NumDimensions = traits<LhsXprType>::NumDimensions;
static const int Layout = traits<LhsXprType>::Layout; static constexpr int Layout = traits<LhsXprType>::Layout;
typedef std::conditional_t<Pointer_type_promotion<typename LhsXprType::Scalar, Scalar>::val, typedef std::conditional_t<Pointer_type_promotion<typename LhsXprType::Scalar, Scalar>::val,
typename traits<LhsXprType>::PointerType, typename traits<RhsXprType>::PointerType> PointerType; typename traits<LhsXprType>::PointerType, typename traits<RhsXprType>::PointerType> PointerType;
}; };
@ -256,12 +256,12 @@ struct TensorEvaluator<const TensorCustomBinaryOp<CustomBinaryFunc, LhsXprType,
{ {
typedef TensorCustomBinaryOp<CustomBinaryFunc, LhsXprType, RhsXprType> XprType; typedef TensorCustomBinaryOp<CustomBinaryFunc, LhsXprType, RhsXprType> XprType;
typedef typename internal::traits<XprType>::Index Index; typedef typename internal::traits<XprType>::Index Index;
static const int NumDims = internal::traits<XprType>::NumDimensions; static constexpr int NumDims = internal::traits<XprType>::NumDimensions;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef std::remove_const_t<typename XprType::CoeffReturnType> CoeffReturnType; typedef std::remove_const_t<typename XprType::CoeffReturnType> CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef typename Eigen::internal::traits<XprType>::PointerType TensorPointerType; typedef typename Eigen::internal::traits<XprType>::PointerType TensorPointerType;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;

View File

@ -32,8 +32,8 @@ struct traits<TensorEvalToOp<XprType, MakePointer_> >
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename MakePointer_<Scalar>::Type PointerType; typedef typename MakePointer_<Scalar>::Type PointerType;
enum { enum {
@ -78,7 +78,7 @@ class TensorEvalToOp : public TensorBase<TensorEvalToOp<XprType, MakePointer_>,
typedef typename Eigen::internal::traits<TensorEvalToOp>::StorageKind StorageKind; typedef typename Eigen::internal::traits<TensorEvalToOp>::StorageKind StorageKind;
typedef typename Eigen::internal::traits<TensorEvalToOp>::Index Index; typedef typename Eigen::internal::traits<TensorEvalToOp>::Index Index;
static const int NumDims = Eigen::internal::traits<TensorEvalToOp>::NumDimensions; static constexpr int NumDims = Eigen::internal::traits<TensorEvalToOp>::NumDimensions;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvalToOp(PointerType buffer, const XprType& expr) EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvalToOp(PointerType buffer, const XprType& expr)
: m_xpr(expr), m_buffer(buffer) {} : m_xpr(expr), m_buffer(buffer) {}
@ -105,7 +105,7 @@ struct TensorEvaluator<const TensorEvalToOp<ArgType, MakePointer_>, Device>
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef std::remove_const_t<typename XprType::CoeffReturnType> CoeffReturnType; typedef std::remove_const_t<typename XprType::CoeffReturnType> CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef typename Eigen::internal::traits<XprType>::PointerType TensorPointerType; typedef typename Eigen::internal::traits<XprType>::PointerType TensorPointerType;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
@ -119,7 +119,7 @@ struct TensorEvaluator<const TensorEvalToOp<ArgType, MakePointer_>, Device>
}; };
static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout; static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout;
static const int NumDims = internal::traits<ArgType>::NumDimensions; static constexpr int NumDims = internal::traits<ArgType>::NumDimensions;
//===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
typedef internal::TensorBlockDescriptor<NumDims, Index> TensorBlockDesc; typedef internal::TensorBlockDescriptor<NumDims, Index> TensorBlockDesc;

View File

@ -35,14 +35,14 @@ struct TensorEvaluator
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
typedef typename Derived::Dimensions Dimensions; typedef typename Derived::Dimensions Dimensions;
typedef Derived XprType; typedef Derived XprType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef typename internal::traits<Derived>::template MakePointer<Scalar>::Type TensorPointerType; typedef typename internal::traits<Derived>::template MakePointer<Scalar>::Type TensorPointerType;
typedef StorageMemory<Scalar, Device> Storage; typedef StorageMemory<Scalar, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
// NumDimensions is -1 for variable dim tensors // NumDimensions is -1 for variable dim tensors
static const int NumCoords = internal::traits<Derived>::NumDimensions > 0 ? static constexpr int NumCoords = internal::traits<Derived>::NumDimensions > 0 ?
internal::traits<Derived>::NumDimensions : 0; internal::traits<Derived>::NumDimensions : 0;
static constexpr int Layout = Derived::Layout; static constexpr int Layout = Derived::Layout;
enum { enum {
@ -240,9 +240,9 @@ struct TensorEvaluator<const Derived, Device>
typedef std::remove_const_t<Scalar> ScalarNoConst; typedef std::remove_const_t<Scalar> ScalarNoConst;
// NumDimensions is -1 for variable dim tensors // NumDimensions is -1 for variable dim tensors
static const int NumCoords = internal::traits<Derived>::NumDimensions > 0 ? static constexpr int NumCoords = internal::traits<Derived>::NumDimensions > 0 ?
internal::traits<Derived>::NumDimensions : 0; internal::traits<Derived>::NumDimensions : 0;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
static constexpr int Layout = Derived::Layout; static constexpr int Layout = Derived::Layout;
enum { enum {
@ -366,7 +366,7 @@ struct TensorEvaluator<const TensorCwiseNullaryOp<NullaryOp, ArgType>, Device>
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename internal::traits<XprType>::Scalar CoeffReturnType; typedef typename internal::traits<XprType>::Scalar CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef typename TensorEvaluator<ArgType, Device>::Dimensions Dimensions; typedef typename TensorEvaluator<ArgType, Device>::Dimensions Dimensions;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
@ -466,11 +466,11 @@ struct TensorEvaluator<const TensorCwiseUnaryOp<UnaryOp, ArgType>, Device>
typedef std::remove_const_t<Scalar> ScalarNoConst; typedef std::remove_const_t<Scalar> ScalarNoConst;
typedef typename internal::traits<XprType>::Scalar CoeffReturnType; typedef typename internal::traits<XprType>::Scalar CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef typename TensorEvaluator<ArgType, Device>::Dimensions Dimensions; typedef typename TensorEvaluator<ArgType, Device>::Dimensions Dimensions;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
static const int NumDims = internal::array_size<Dimensions>::value; static constexpr int NumDims = internal::array_size<Dimensions>::value;
//===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
typedef internal::TensorBlockDescriptor<NumDims, Index> TensorBlockDesc; typedef internal::TensorBlockDescriptor<NumDims, Index> TensorBlockDesc;
@ -585,12 +585,12 @@ struct TensorEvaluator<const TensorCwiseBinaryOp<BinaryOp, LeftArgType, RightArg
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename internal::traits<XprType>::Scalar CoeffReturnType; typedef typename internal::traits<XprType>::Scalar CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef typename TensorEvaluator<LeftArgType, Device>::Dimensions Dimensions; typedef typename TensorEvaluator<LeftArgType, Device>::Dimensions Dimensions;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
static const int NumDims = internal::array_size< static constexpr int NumDims = internal::array_size<
typename TensorEvaluator<LeftArgType, Device>::Dimensions>::value; typename TensorEvaluator<LeftArgType, Device>::Dimensions>::value;
//===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
@ -737,7 +737,7 @@ struct TensorEvaluator<const TensorCwiseTernaryOp<TernaryOp, Arg1Type, Arg2Type,
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename internal::traits<XprType>::Scalar CoeffReturnType; typedef typename internal::traits<XprType>::Scalar CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef typename TensorEvaluator<Arg1Type, Device>::Dimensions Dimensions; typedef typename TensorEvaluator<Arg1Type, Device>::Dimensions Dimensions;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
@ -843,12 +843,12 @@ struct TensorEvaluator<const TensorSelectOp<IfArgType, ThenArgType, ElseArgType>
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef typename internal::traits<XprType>::Scalar CoeffReturnType; typedef typename internal::traits<XprType>::Scalar CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef typename TensorEvaluator<IfArgType, Device>::Dimensions Dimensions; typedef typename TensorEvaluator<IfArgType, Device>::Dimensions Dimensions;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
static const int NumDims = internal::array_size<Dimensions>::value; static constexpr int NumDims = internal::array_size<Dimensions>::value;
//===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
typedef internal::TensorBlockDescriptor<NumDims, Index> TensorBlockDesc; typedef internal::TensorBlockDescriptor<NumDims, Index> TensorBlockDesc;

View File

@ -172,7 +172,7 @@ class TensorExecutor<Expression, DefaultDevice, Vectorizable,
typedef TensorEvaluator<Expression, DefaultDevice> Evaluator; typedef TensorEvaluator<Expression, DefaultDevice> Evaluator;
typedef typename traits<Expression>::Index StorageIndex; typedef typename traits<Expression>::Index StorageIndex;
static const int NumDims = traits<Expression>::NumDimensions; static constexpr int NumDims = traits<Expression>::NumDimensions;
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE void run(const Expression& expr, static EIGEN_STRONG_INLINE void run(const Expression& expr,
@ -284,7 +284,7 @@ struct EvalRange {
template <typename Evaluator, typename StorageIndex> template <typename Evaluator, typename StorageIndex>
struct EvalRange<Evaluator, StorageIndex, /*Vectorizable*/ true> { struct EvalRange<Evaluator, StorageIndex, /*Vectorizable*/ true> {
static const int PacketSize = static constexpr int PacketSize =
unpacket_traits<typename Evaluator::PacketReturnType>::size; unpacket_traits<typename Evaluator::PacketReturnType>::size;
static void run(Evaluator* evaluator_in, const StorageIndex firstIdx, static void run(Evaluator* evaluator_in, const StorageIndex firstIdx,
@ -355,7 +355,7 @@ class TensorExecutor<Expression, ThreadPoolDevice, Vectorizable,
typedef typename traits<Expression>::Scalar Scalar; typedef typename traits<Expression>::Scalar Scalar;
typedef std::remove_const_t<Scalar> ScalarNoConst; typedef std::remove_const_t<Scalar> ScalarNoConst;
static const int NumDims = traits<Expression>::NumDimensions; static constexpr int NumDims = traits<Expression>::NumDimensions;
typedef TensorEvaluator<Expression, ThreadPoolDevice> Evaluator; typedef TensorEvaluator<Expression, ThreadPoolDevice> Evaluator;
typedef TensorBlockMapper<NumDims, Evaluator::Layout, IndexType> BlockMapper; typedef TensorBlockMapper<NumDims, Evaluator::Layout, IndexType> BlockMapper;
@ -463,7 +463,7 @@ class TensorAsyncExecutor<Expression, ThreadPoolDevice, DoneCallback,
typedef typename traits<Expression>::Scalar Scalar; typedef typename traits<Expression>::Scalar Scalar;
typedef std::remove_const_t<Scalar> ScalarNoConst; typedef std::remove_const_t<Scalar> ScalarNoConst;
static const int NumDims = traits<Expression>::NumDimensions; static constexpr int NumDims = traits<Expression>::NumDimensions;
typedef TensorEvaluator<Expression, ThreadPoolDevice> Evaluator; typedef TensorEvaluator<Expression, ThreadPoolDevice> Evaluator;
typedef TensorBlockMapper<NumDims, Evaluator::Layout, IndexType> BlockMapper; typedef TensorBlockMapper<NumDims, Evaluator::Layout, IndexType> BlockMapper;

View File

@ -38,8 +38,8 @@ struct traits<TensorCwiseNullaryOp<NullaryOp, XprType> >
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::Nested XprTypeNested; typedef typename XprType::Nested XprTypeNested;
typedef std::remove_reference_t<XprTypeNested> XprTypeNested_; typedef std::remove_reference_t<XprTypeNested> XprTypeNested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
enum { enum {
Flags = 0 Flags = 0
@ -89,8 +89,8 @@ struct traits<TensorCwiseUnaryOp<UnaryOp, XprType> >
typedef traits<XprType> XprTraits; typedef traits<XprType> XprTraits;
typedef typename XprType::Nested XprTypeNested; typedef typename XprType::Nested XprTypeNested;
typedef std::remove_reference_t<XprTypeNested> XprTypeNested_; typedef std::remove_reference_t<XprTypeNested> XprTypeNested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename TypeConversion<Scalar, typedef typename TypeConversion<Scalar,
typename XprTraits::PointerType typename XprTraits::PointerType
>::type >::type
@ -165,8 +165,8 @@ struct traits<TensorCwiseBinaryOp<BinaryOp, LhsXprType, RhsXprType> >
typedef typename RhsXprType::Nested RhsNested; typedef typename RhsXprType::Nested RhsNested;
typedef std::remove_reference_t<LhsNested> LhsNested_; typedef std::remove_reference_t<LhsNested> LhsNested_;
typedef std::remove_reference_t<RhsNested> RhsNested_; typedef std::remove_reference_t<RhsNested> RhsNested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename TypeConversion<Scalar, typedef typename TypeConversion<Scalar,
std::conditional_t<Pointer_type_promotion<typename LhsXprType::Scalar, Scalar>::val, std::conditional_t<Pointer_type_promotion<typename LhsXprType::Scalar, Scalar>::val,
typename traits<LhsXprType>::PointerType, typename traits<LhsXprType>::PointerType,
@ -247,8 +247,8 @@ struct traits<TensorCwiseTernaryOp<TernaryOp, Arg1XprType, Arg2XprType, Arg3XprT
typedef std::remove_reference_t<Arg1Nested> Arg1Nested_; typedef std::remove_reference_t<Arg1Nested> Arg1Nested_;
typedef std::remove_reference_t<Arg2Nested> Arg2Nested_; typedef std::remove_reference_t<Arg2Nested> Arg2Nested_;
typedef std::remove_reference_t<Arg3Nested> Arg3Nested_; typedef std::remove_reference_t<Arg3Nested> Arg3Nested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename TypeConversion<Scalar, typedef typename TypeConversion<Scalar,
std::conditional_t<Pointer_type_promotion<typename Arg2XprType::Scalar, Scalar>::val, std::conditional_t<Pointer_type_promotion<typename Arg2XprType::Scalar, Scalar>::val,
typename traits<Arg2XprType>::PointerType, typename traits<Arg2XprType>::PointerType,
@ -328,8 +328,8 @@ struct traits<TensorSelectOp<IfXprType, ThenXprType, ElseXprType> >
typedef typename IfXprType::Nested IfNested; typedef typename IfXprType::Nested IfNested;
typedef typename ThenXprType::Nested ThenNested; typedef typename ThenXprType::Nested ThenNested;
typedef typename ElseXprType::Nested ElseNested; typedef typename ElseXprType::Nested ElseNested;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef std::conditional_t<Pointer_type_promotion<typename ThenXprType::Scalar, Scalar>::val, typedef std::conditional_t<Pointer_type_promotion<typename ThenXprType::Scalar, Scalar>::val,
typename traits<ThenXprType>::PointerType, typename traits<ThenXprType>::PointerType,
typename traits<ElseXprType>::PointerType> PointerType; typename traits<ElseXprType>::PointerType> PointerType;

View File

@ -67,8 +67,8 @@ struct traits<TensorFFTOp<FFT, XprType, FFTResultType, FFTDir> > : public traits
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename traits<XprType>::PointerType PointerType; typedef typename traits<XprType>::PointerType PointerType;
}; };
@ -117,7 +117,7 @@ template <typename FFT, typename ArgType, typename Device, int FFTResultType, in
struct TensorEvaluator<const TensorFFTOp<FFT, ArgType, FFTResultType, FFTDir>, Device> { struct TensorEvaluator<const TensorFFTOp<FFT, ArgType, FFTResultType, FFTDir>, Device> {
typedef TensorFFTOp<FFT, ArgType, FFTResultType, FFTDir> XprType; typedef TensorFFTOp<FFT, ArgType, FFTResultType, FFTDir> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; typedef typename Eigen::NumTraits<Scalar>::Real RealScalar;
@ -128,7 +128,7 @@ struct TensorEvaluator<const TensorFFTOp<FFT, ArgType, FFTResultType, FFTDir>, D
typedef std::conditional_t<FFTResultType == RealPart || FFTResultType == ImagPart, RealScalar, ComplexScalar> OutputScalar; typedef std::conditional_t<FFTResultType == RealPart || FFTResultType == ImagPart, RealScalar, ComplexScalar> OutputScalar;
typedef OutputScalar CoeffReturnType; typedef OutputScalar CoeffReturnType;
typedef typename PacketType<OutputScalar, Device>::type PacketReturnType; typedef typename PacketType<OutputScalar, Device>::type PacketReturnType;
static const int PacketSize = internal::unpacket_traits<PacketReturnType>::size; static constexpr int PacketSize = internal::unpacket_traits<PacketReturnType>::size;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;

View File

@ -38,7 +38,7 @@ class TensorFixedSize : public TensorBase<TensorFixedSize<Scalar_, Dimensions_,
typedef typename NumTraits<Scalar>::Real RealScalar; typedef typename NumTraits<Scalar>::Real RealScalar;
typedef typename Base::CoeffReturnType CoeffReturnType; typedef typename Base::CoeffReturnType CoeffReturnType;
static const int Options = Options_; static constexpr int Options = Options_;
static constexpr int Layout = Options_ & RowMajor ? RowMajor : ColMajor; static constexpr int Layout = Options_ & RowMajor ? RowMajor : ColMajor;
enum { enum {
@ -55,7 +55,7 @@ class TensorFixedSize : public TensorBase<TensorFixedSize<Scalar_, Dimensions_,
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
typedef Dimensions_ Dimensions; typedef Dimensions_ Dimensions;
static const std::size_t NumIndices = Dimensions::count; static constexpr std::size_t NumIndices = Dimensions::count;
protected: protected:
TensorStorage<Scalar, Dimensions, Options> m_storage; TensorStorage<Scalar, Dimensions, Options> m_storage;

View File

@ -32,8 +32,8 @@ struct traits<TensorForcedEvalOp<XprType> >
typedef typename traits<XprType>::Index Index; typedef typename traits<XprType>::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
enum { enum {
@ -112,7 +112,7 @@ struct TensorEvaluator<const TensorForcedEvalOp<ArgType_>, Device>
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef typename Eigen::internal::traits<XprType>::PointerType TensorPointerType; typedef typename Eigen::internal::traits<XprType>::PointerType TensorPointerType;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
@ -126,7 +126,7 @@ struct TensorEvaluator<const TensorForcedEvalOp<ArgType_>, Device>
}; };
static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout; static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout;
static const int NumDims = internal::traits<ArgType>::NumDimensions; static constexpr int NumDims = internal::traits<ArgType>::NumDimensions;
//===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
typedef internal::TensorBlockDescriptor<NumDims, Index> TensorBlockDesc; typedef internal::TensorBlockDescriptor<NumDims, Index> TensorBlockDesc;

View File

@ -167,7 +167,7 @@ struct IsTileable {
// Check that block evaluation is supported and it's a preferred option (at // Check that block evaluation is supported and it's a preferred option (at
// least one sub-expression has much faster block evaluation, e.g. // least one sub-expression has much faster block evaluation, e.g.
// broadcasting). // broadcasting).
static const bool BlockAccess = static constexpr bool BlockAccess =
TensorEvaluator<Expression, Device>::BlockAccess && TensorEvaluator<Expression, Device>::BlockAccess &&
TensorEvaluator<Expression, Device>::PreferBlockAccess; TensorEvaluator<Expression, Device>::PreferBlockAccess;

View File

@ -428,7 +428,7 @@ struct reducer_traits<ArgMinPairReducer<T>, Device> {
template <typename T, typename Index, size_t NumDims> template <typename T, typename Index, size_t NumDims>
class GaussianGenerator { class GaussianGenerator {
public: public:
static const bool PacketAccess = false; static constexpr bool PacketAccess = false;
EIGEN_DEVICE_FUNC GaussianGenerator(const array<T, NumDims>& means, EIGEN_DEVICE_FUNC GaussianGenerator(const array<T, NumDims>& means,
const array<T, NumDims>& std_devs) const array<T, NumDims>& std_devs)

View File

@ -31,8 +31,8 @@ struct traits<TensorGeneratorOp<Generator, XprType> > : public traits<XprType>
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -86,7 +86,7 @@ struct TensorEvaluator<const TensorGeneratorOp<Generator, ArgType>, Device>
typedef TensorGeneratorOp<Generator, ArgType> XprType; typedef TensorGeneratorOp<Generator, ArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef typename TensorEvaluator<ArgType, Device>::Dimensions Dimensions; typedef typename TensorEvaluator<ArgType, Device>::Dimensions Dimensions;
static const int NumDims = internal::array_size<Dimensions>::value; static constexpr int NumDims = internal::array_size<Dimensions>::value;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;

View File

@ -39,8 +39,8 @@ struct traits<TensorImagePatchOp<Rows, Cols, XprType> > : public traits<XprType>
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions + 1; static constexpr int NumDimensions = XprTraits::NumDimensions + 1;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -217,8 +217,8 @@ struct TensorEvaluator<const TensorImagePatchOp<Rows, Cols, ArgType>, Device>
{ {
typedef TensorImagePatchOp<Rows, Cols, ArgType> XprType; typedef TensorImagePatchOp<Rows, Cols, ArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
static const int NumDims = NumInputDims + 1; static constexpr int NumDims = NumInputDims + 1;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef std::remove_const_t<typename XprType::Scalar> Scalar; typedef std::remove_const_t<typename XprType::Scalar> Scalar;
typedef TensorEvaluator<const TensorImagePatchOp<Rows, Cols, ArgType>, typedef TensorEvaluator<const TensorImagePatchOp<Rows, Cols, ArgType>,
@ -226,7 +226,7 @@ struct TensorEvaluator<const TensorImagePatchOp<Rows, Cols, ArgType>, Device>
typedef TensorEvaluator<ArgType, Device> Impl; typedef TensorEvaluator<ArgType, Device> Impl;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;

View File

@ -31,8 +31,8 @@ struct traits<TensorInflationOp<Strides, XprType> > : public traits<XprType>
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -82,12 +82,12 @@ struct TensorEvaluator<const TensorInflationOp<Strides, ArgType>, Device>
{ {
typedef TensorInflationOp<Strides, ArgType> XprType; typedef TensorInflationOp<Strides, ArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;

View File

@ -85,7 +85,7 @@ namespace internal {
template <typename T> template <typename T>
struct DividerTraits { struct DividerTraits {
typedef typename UnsignedTraits<T>::type type; typedef typename UnsignedTraits<T>::type type;
static const int N = sizeof(T) * 8; static constexpr int N = sizeof(T) * 8;
}; };
template <typename T> template <typename T>

View File

@ -46,8 +46,8 @@ struct traits<TensorLayoutSwapOp<XprType> > : public traits<XprType>
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = traits<XprType>::NumDimensions; static constexpr int NumDimensions = traits<XprType>::NumDimensions;
static const int Layout = (traits<XprType>::Layout == ColMajor) ? RowMajor : ColMajor; static constexpr int Layout = (traits<XprType>::Layout == ColMajor) ? RowMajor : ColMajor;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -98,7 +98,7 @@ struct TensorEvaluator<const TensorLayoutSwapOp<ArgType>, Device>
{ {
typedef TensorLayoutSwapOp<ArgType> XprType; typedef TensorLayoutSwapOp<ArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
static constexpr int Layout = (TensorEvaluator<ArgType, Device>::Layout == static_cast<int>(ColMajor)) ? RowMajor : ColMajor; static constexpr int Layout = (TensorEvaluator<ArgType, Device>::Layout == static_cast<int>(ColMajor)) ? RowMajor : ColMajor;

View File

@ -66,9 +66,9 @@ template<typename PlainObjectType, int Options_, template <class> class MakePoin
const Scalar& const Scalar&
> StorageRefType; > StorageRefType;
static const int Options = Options_; static constexpr int Options = Options_;
static const Index NumIndices = PlainObjectType::NumIndices; static constexpr Index NumIndices = PlainObjectType::NumIndices;
typedef typename PlainObjectType::Dimensions Dimensions; typedef typename PlainObjectType::Dimensions Dimensions;
static constexpr int Layout = PlainObjectType::Layout; static constexpr int Layout = PlainObjectType::Layout;

View File

@ -122,13 +122,13 @@ struct static_for<Index, end, end, step, StepOp> {
template <typename OutScalar, typename Device, bool Vectorizable> template <typename OutScalar, typename Device, bool Vectorizable>
struct Vectorise { struct Vectorise {
static const int PacketSize = 1; static constexpr int PacketSize = 1;
typedef OutScalar PacketReturnType; typedef OutScalar PacketReturnType;
}; };
template <typename OutScalar, typename Device> template <typename OutScalar, typename Device>
struct Vectorise<OutScalar, Device, true> { struct Vectorise<OutScalar, Device, true> {
static const int PacketSize = Eigen::PacketType<OutScalar, Device>::size; static constexpr int PacketSize = Eigen::PacketType<OutScalar, Device>::size;
typedef typename Eigen::PacketType<OutScalar, Device>::type PacketReturnType; typedef typename Eigen::PacketType<OutScalar, Device>::type PacketReturnType;
}; };

View File

@ -31,8 +31,8 @@ struct traits<TensorReshapingOp<NewDimensions, XprType> > : public traits<XprTyp
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = array_size<NewDimensions>::value; static constexpr int NumDimensions = array_size<NewDimensions>::value;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -96,8 +96,8 @@ struct TensorEvaluator<const TensorReshapingOp<NewDimensions, ArgType>, Device>
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
typedef StorageMemory<std::remove_const_t<CoeffReturnType>, Device> ConstCastStorage; typedef StorageMemory<std::remove_const_t<CoeffReturnType>, Device> ConstCastStorage;
static const int NumOutputDims = internal::array_size<Dimensions>::value; static constexpr int NumOutputDims = internal::array_size<Dimensions>::value;
static const int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
enum ReshapingKind { enum ReshapingKind {
// We do not use layout information to determine reshaping kind. // We do not use layout information to determine reshaping kind.
@ -314,8 +314,8 @@ struct traits<TensorSlicingOp<StartIndices, Sizes, XprType> > : public traits<Xp
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = array_size<StartIndices>::value; static constexpr int NumDimensions = array_size<StartIndices>::value;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -406,7 +406,7 @@ template<typename StartIndices, typename Sizes, typename ArgType, typename Devic
struct TensorEvaluator<const TensorSlicingOp<StartIndices, Sizes, ArgType>, Device> struct TensorEvaluator<const TensorSlicingOp<StartIndices, Sizes, ArgType>, Device>
{ {
typedef TensorSlicingOp<StartIndices, Sizes, ArgType> XprType; typedef TensorSlicingOp<StartIndices, Sizes, ArgType> XprType;
static const int NumDims = internal::array_size<Sizes>::value; static constexpr int NumDims = internal::array_size<Sizes>::value;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
@ -704,7 +704,7 @@ struct TensorEvaluator<TensorSlicingOp<StartIndices, Sizes, ArgType>, Device>
{ {
typedef TensorEvaluator<const TensorSlicingOp<StartIndices, Sizes, ArgType>, Device> Base; typedef TensorEvaluator<const TensorSlicingOp<StartIndices, Sizes, ArgType>, Device> Base;
typedef TensorSlicingOp<StartIndices, Sizes, ArgType> XprType; typedef TensorSlicingOp<StartIndices, Sizes, ArgType> XprType;
static const int NumDims = internal::array_size<Sizes>::value; static constexpr int NumDims = internal::array_size<Sizes>::value;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
@ -811,8 +811,8 @@ struct traits<TensorStridingSlicingOp<StartIndices, StopIndices, Strides, XprTyp
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = array_size<StartIndices>::value; static constexpr int NumDimensions = array_size<StartIndices>::value;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -873,7 +873,7 @@ template<typename StartIndices, typename StopIndices, typename Strides, typename
struct TensorEvaluator<const TensorStridingSlicingOp<StartIndices, StopIndices, Strides, ArgType>, Device> struct TensorEvaluator<const TensorStridingSlicingOp<StartIndices, StopIndices, Strides, ArgType>, Device>
{ {
typedef TensorStridingSlicingOp<StartIndices, StopIndices, Strides, ArgType> XprType; typedef TensorStridingSlicingOp<StartIndices, StopIndices, Strides, ArgType> XprType;
static const int NumDims = internal::array_size<Strides>::value; static constexpr int NumDims = internal::array_size<Strides>::value;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
@ -1059,7 +1059,7 @@ struct TensorEvaluator<TensorStridingSlicingOp<StartIndices, StopIndices, Stride
{ {
typedef TensorEvaluator<const TensorStridingSlicingOp<StartIndices, StopIndices, Strides, ArgType>, Device> Base; typedef TensorEvaluator<const TensorStridingSlicingOp<StartIndices, StopIndices, Strides, ArgType>, Device> Base;
typedef TensorStridingSlicingOp<StartIndices, StopIndices, Strides, ArgType> XprType; typedef TensorStridingSlicingOp<StartIndices, StopIndices, Strides, ArgType> XprType;
static const int NumDims = internal::array_size<Strides>::value; static constexpr int NumDims = internal::array_size<Strides>::value;
static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout; static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout;
enum { enum {

View File

@ -31,8 +31,8 @@ struct traits<TensorPaddingOp<PaddingDimensions, XprType> > : public traits<XprT
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -88,12 +88,12 @@ struct TensorEvaluator<const TensorPaddingOp<PaddingDimensions, ArgType>, Device
{ {
typedef TensorPaddingOp<PaddingDimensions, ArgType> XprType; typedef TensorPaddingOp<PaddingDimensions, ArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumDims = internal::array_size<PaddingDimensions>::value; static constexpr int NumDims = internal::array_size<PaddingDimensions>::value;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;

View File

@ -31,8 +31,8 @@ struct traits<TensorPatchOp<PatchDim, XprType> > : public traits<XprType>
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions + 1; static constexpr int NumDimensions = XprTraits::NumDimensions + 1;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -85,12 +85,12 @@ struct TensorEvaluator<const TensorPatchOp<PatchDim, ArgType>, Device>
{ {
typedef TensorPatchOp<PatchDim, ArgType> XprType; typedef TensorPatchOp<PatchDim, ArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value + 1; static constexpr int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value + 1;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;

View File

@ -120,7 +120,7 @@ std::complex<double> RandomToTypeUniform<std::complex<double> >(uint64_t* state,
template <typename T> class UniformRandomGenerator { template <typename T> class UniformRandomGenerator {
public: public:
static const bool PacketAccess = true; static constexpr bool PacketAccess = true;
// Uses the given "seed" if non-zero, otherwise uses a random seed. // Uses the given "seed" if non-zero, otherwise uses a random seed.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE UniformRandomGenerator( EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE UniformRandomGenerator(
@ -234,7 +234,7 @@ std::complex<double> RandomToTypeNormal<std::complex<double> >(uint64_t* state,
template <typename T> class NormalRandomGenerator { template <typename T> class NormalRandomGenerator {
public: public:
static const bool PacketAccess = true; static constexpr bool PacketAccess = true;
// Uses the given "seed" if non-zero, otherwise uses a random seed. // Uses the given "seed" if non-zero, otherwise uses a random seed.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE NormalRandomGenerator(uint64_t seed = 0) { EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE NormalRandomGenerator(uint64_t seed = 0) {

View File

@ -43,8 +43,8 @@ namespace internal {
typedef typename XprTraits::StorageKind StorageKind; typedef typename XprTraits::StorageKind StorageKind;
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
static const int NumDimensions = XprTraits::NumDimensions - array_size<Dims>::value; static constexpr int NumDimensions = XprTraits::NumDimensions - array_size<Dims>::value;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
template <class T> struct MakePointer { template <class T> struct MakePointer {
@ -351,7 +351,7 @@ struct InnerMostDimPreserver<-1, Self, Op, true> {
// Default full reducer // Default full reducer
template <typename Self, typename Op, typename Device, bool Vectorizable = (Self::InputPacketAccess && Self::ReducerTraits::PacketAccess)> template <typename Self, typename Op, typename Device, bool Vectorizable = (Self::InputPacketAccess && Self::ReducerTraits::PacketAccess)>
struct FullReducer { struct FullReducer {
static const bool HasOptimizedImplementation = false; static constexpr bool HasOptimizedImplementation = false;
static EIGEN_DEVICE_FUNC void run(const Self& self, Op& reducer, const Device&, typename Self::EvaluatorPointerType output) { static EIGEN_DEVICE_FUNC void run(const Self& self, Op& reducer, const Device&, typename Self::EvaluatorPointerType output) {
const typename Self::Index num_coeffs = array_prod(self.m_impl.dimensions()); const typename Self::Index num_coeffs = array_prod(self.m_impl.dimensions());
@ -376,8 +376,8 @@ struct FullReducerShard {
// Multithreaded full reducer // Multithreaded full reducer
template <typename Self, typename Op, bool Vectorizable> template <typename Self, typename Op, bool Vectorizable>
struct FullReducer<Self, Op, ThreadPoolDevice, Vectorizable> { struct FullReducer<Self, Op, ThreadPoolDevice, Vectorizable> {
static const bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful; static constexpr bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful;
static const Index PacketSize = static constexpr Index PacketSize =
unpacket_traits<typename Self::PacketReturnType>::size; unpacket_traits<typename Self::PacketReturnType>::size;
// launch one reducer per thread and accumulate the result. // launch one reducer per thread and accumulate the result.
@ -434,7 +434,7 @@ struct FullReducer<Self, Op, ThreadPoolDevice, Vectorizable> {
// Default inner reducer // Default inner reducer
template <typename Self, typename Op, typename Device> template <typename Self, typename Op, typename Device>
struct InnerReducer { struct InnerReducer {
static const bool HasOptimizedImplementation = false; static constexpr bool HasOptimizedImplementation = false;
EIGEN_DEVICE_FUNC static bool run(const Self&, Op&, const Device&, typename Self::CoeffReturnType*, typename Self::Index, typename Self::Index) { EIGEN_DEVICE_FUNC static bool run(const Self&, Op&, const Device&, typename Self::CoeffReturnType*, typename Self::Index, typename Self::Index) {
eigen_assert(false && "Not implemented"); eigen_assert(false && "Not implemented");
@ -445,7 +445,7 @@ struct InnerReducer {
// Default outer reducer // Default outer reducer
template <typename Self, typename Op, typename Device> template <typename Self, typename Op, typename Device>
struct OuterReducer { struct OuterReducer {
static const bool HasOptimizedImplementation = false; static constexpr bool HasOptimizedImplementation = false;
EIGEN_DEVICE_FUNC static bool run(const Self&, Op&, const Device&, typename Self::CoeffReturnType*, typename Self::Index, typename Self::Index) { EIGEN_DEVICE_FUNC static bool run(const Self&, Op&, const Device&, typename Self::CoeffReturnType*, typename Self::Index, typename Self::Index) {
eigen_assert(false && "Not implemented"); eigen_assert(false && "Not implemented");
@ -457,7 +457,7 @@ struct OuterReducer {
// Default Generic reducer // Default Generic reducer
template <typename Self, typename Op, typename Device> template <typename Self, typename Op, typename Device>
struct GenericReducer { struct GenericReducer {
static const bool HasOptimizedImplementation = false; static constexpr bool HasOptimizedImplementation = false;
EIGEN_DEVICE_FUNC static bool run(const Self&, Op&, const Device&, typename Self::CoeffReturnType*, typename Self::Index, typename Self::Index) { EIGEN_DEVICE_FUNC static bool run(const Self&, Op&, const Device&, typename Self::CoeffReturnType*, typename Self::Index, typename Self::Index) {
eigen_assert(false && "Not implemented"); eigen_assert(false && "Not implemented");
@ -551,32 +551,32 @@ struct TensorReductionEvaluatorBase<const TensorReductionOp<Op, Dims, ArgType, M
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef ArgType ChildType; typedef ArgType ChildType;
typedef typename TensorEvaluator<ArgType, Device>::Dimensions InputDimensions; typedef typename TensorEvaluator<ArgType, Device>::Dimensions InputDimensions;
static const int NumInputDims = internal::array_size<InputDimensions>::value; static constexpr int NumInputDims = internal::array_size<InputDimensions>::value;
static const int NumReducedDims = internal::array_size<Dims>::value; static constexpr int NumReducedDims = internal::array_size<Dims>::value;
static const int NumOutputDims = NumInputDims - NumReducedDims; static constexpr int NumOutputDims = NumInputDims - NumReducedDims;
typedef std::conditional_t<NumOutputDims==0, Sizes<>, DSizes<Index, NumOutputDims> > Dimensions; typedef std::conditional_t<NumOutputDims==0, Sizes<>, DSizes<Index, NumOutputDims> > Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef TensorReductionEvaluatorBase<const TensorReductionOp<Op, Dims, ArgType, MakePointer_>, Device> Self; typedef TensorReductionEvaluatorBase<const TensorReductionOp<Op, Dims, ArgType, MakePointer_>, Device> Self;
static const bool InputPacketAccess = TensorEvaluator<ArgType, Device>::PacketAccess; static constexpr bool InputPacketAccess = TensorEvaluator<ArgType, Device>::PacketAccess;
typedef typename internal::ReductionReturnType<Op, typename XprType::CoeffReturnType>::type CoeffReturnType; typedef typename internal::ReductionReturnType<Op, typename XprType::CoeffReturnType>::type CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const Index PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr Index PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef typename Eigen::internal::traits<XprType>::PointerType TensorPointerType; typedef typename Eigen::internal::traits<XprType>::PointerType TensorPointerType;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
// Subset of strides of the input tensor for the non-reduced dimensions. // Subset of strides of the input tensor for the non-reduced dimensions.
// Indexed by output dimensions. // Indexed by output dimensions.
static const int NumPreservedStrides = max_n_1<NumOutputDims>::size; static constexpr int NumPreservedStrides = max_n_1<NumOutputDims>::size;
// For full reductions // For full reductions
#if defined(EIGEN_USE_GPU) && (defined(EIGEN_GPUCC)) #if defined(EIGEN_USE_GPU) && (defined(EIGEN_GPUCC))
static constexpr bool RunningOnGPU = internal::is_same<Device, Eigen::GpuDevice>::value; static constexpr bool RunningOnGPU = internal::is_same<Device, Eigen::GpuDevice>::value;
static constexpr bool RunningOnSycl = false; static constexpr bool RunningOnSycl = false;
#elif defined(EIGEN_USE_SYCL) #elif defined(EIGEN_USE_SYCL)
static const bool RunningOnSycl = internal::is_same<internal::remove_all_t<Device>, Eigen::SyclDevice>::value; static constexpr bool RunningOnSycl = internal::is_same<internal::remove_all_t<Device>, Eigen::SyclDevice>::value;
static const bool RunningOnGPU = false; static constexpr bool RunningOnGPU = false;
#else #else
static constexpr bool RunningOnGPU = false; static constexpr bool RunningOnGPU = false;
static constexpr bool RunningOnSycl = false; static constexpr bool RunningOnSycl = false;
@ -598,9 +598,9 @@ static const bool RunningOnGPU = false;
typedef internal::TensorBlockNotImplemented TensorBlock; typedef internal::TensorBlockNotImplemented TensorBlock;
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
static const bool ReducingInnerMostDims = internal::are_inner_most_dims<Dims, NumInputDims, Layout>::value; static constexpr bool ReducingInnerMostDims = internal::are_inner_most_dims<Dims, NumInputDims, Layout>::value;
static const bool PreservingInnerMostDims = internal::preserve_inner_most_dims<Dims, NumInputDims, Layout>::value; static constexpr bool PreservingInnerMostDims = internal::preserve_inner_most_dims<Dims, NumInputDims, Layout>::value;
static const bool RunningFullReduction = (NumOutputDims==0); static constexpr bool RunningFullReduction = (NumOutputDims==0);
EIGEN_STRONG_INLINE TensorReductionEvaluatorBase(const XprType& op, const Device& device) EIGEN_STRONG_INLINE TensorReductionEvaluatorBase(const XprType& op, const Device& device)
: m_impl(op.expression(), device), m_reducer(op.reducer()), m_result(NULL), m_device(device) : m_impl(op.expression(), device), m_reducer(op.reducer()), m_result(NULL), m_device(device)

View File

@ -458,12 +458,12 @@ struct FullReducer<Self, Op, GpuDevice, Vectorizable> {
// so reduce the scope of the optimized version of the code to the simple cases // so reduce the scope of the optimized version of the code to the simple cases
// of doubles, floats and half floats // of doubles, floats and half floats
#ifdef EIGEN_HAS_GPU_FP16 #ifdef EIGEN_HAS_GPU_FP16
static const bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && static constexpr bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful &&
(internal::is_same<typename Self::CoeffReturnType, float>::value || (internal::is_same<typename Self::CoeffReturnType, float>::value ||
internal::is_same<typename Self::CoeffReturnType, double>::value || internal::is_same<typename Self::CoeffReturnType, double>::value ||
(internal::is_same<typename Self::CoeffReturnType, Eigen::half>::value && reducer_traits<Op, GpuDevice>::PacketAccess)); (internal::is_same<typename Self::CoeffReturnType, Eigen::half>::value && reducer_traits<Op, GpuDevice>::PacketAccess));
#else // EIGEN_HAS_GPU_FP16 #else // EIGEN_HAS_GPU_FP16
static const bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && static constexpr bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful &&
(internal::is_same<typename Self::CoeffReturnType, float>::value || (internal::is_same<typename Self::CoeffReturnType, float>::value ||
internal::is_same<typename Self::CoeffReturnType, double>::value); internal::is_same<typename Self::CoeffReturnType, double>::value);
#endif // EIGEN_HAS_GPU_FP16 #endif // EIGEN_HAS_GPU_FP16
@ -847,12 +847,12 @@ struct InnerReducer<Self, Op, GpuDevice> {
// so reduce the scope of the optimized version of the code to the simple case // so reduce the scope of the optimized version of the code to the simple case
// of floats and half floats. // of floats and half floats.
#ifdef EIGEN_HAS_GPU_FP16 #ifdef EIGEN_HAS_GPU_FP16
static const bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && static constexpr bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful &&
(internal::is_same<typename Self::CoeffReturnType, float>::value || (internal::is_same<typename Self::CoeffReturnType, float>::value ||
internal::is_same<typename Self::CoeffReturnType, double>::value || internal::is_same<typename Self::CoeffReturnType, double>::value ||
(internal::is_same<typename Self::CoeffReturnType, Eigen::half>::value && reducer_traits<Op, GpuDevice>::PacketAccess)); (internal::is_same<typename Self::CoeffReturnType, Eigen::half>::value && reducer_traits<Op, GpuDevice>::PacketAccess));
#else // EIGEN_HAS_GPU_FP16 #else // EIGEN_HAS_GPU_FP16
static const bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && static constexpr bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful &&
(internal::is_same<typename Self::CoeffReturnType, float>::value || (internal::is_same<typename Self::CoeffReturnType, float>::value ||
internal::is_same<typename Self::CoeffReturnType, double>::value); internal::is_same<typename Self::CoeffReturnType, double>::value);
#endif // EIGEN_HAS_GPU_FP16 #endif // EIGEN_HAS_GPU_FP16
@ -909,7 +909,7 @@ struct OuterReducer<Self, Op, GpuDevice> {
// Unfortunately nvidia doesn't support well exotic types such as complex, // Unfortunately nvidia doesn't support well exotic types such as complex,
// so reduce the scope of the optimized version of the code to the simple case // so reduce the scope of the optimized version of the code to the simple case
// of floats. // of floats.
static const bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && static constexpr bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful &&
(internal::is_same<typename Self::CoeffReturnType, float>::value || (internal::is_same<typename Self::CoeffReturnType, float>::value ||
internal::is_same<typename Self::CoeffReturnType, double>::value); internal::is_same<typename Self::CoeffReturnType, double>::value);
template <typename Device, typename OutputType> template <typename Device, typename OutputType>

View File

@ -137,7 +137,7 @@ template<typename PlainObjectType> class TensorRef : public TensorBase<TensorRef
typedef Scalar* PointerType; typedef Scalar* PointerType;
typedef PointerType PointerArgType; typedef PointerType PointerArgType;
static const Index NumIndices = PlainObjectType::NumIndices; static constexpr Index NumIndices = PlainObjectType::NumIndices;
typedef typename PlainObjectType::Dimensions Dimensions; typedef typename PlainObjectType::Dimensions Dimensions;
static constexpr int Layout = PlainObjectType::Layout; static constexpr int Layout = PlainObjectType::Layout;

View File

@ -31,8 +31,8 @@ struct traits<TensorReverseOp<ReverseDimensions,
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -90,12 +90,12 @@ struct TensorEvaluator<const TensorReverseOp<ReverseDimensions, ArgType>, Device
{ {
typedef TensorReverseOp<ReverseDimensions, ArgType> XprType; typedef TensorReverseOp<ReverseDimensions, ArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumDims = internal::array_size<ReverseDimensions>::value; static constexpr int NumDims = internal::array_size<ReverseDimensions>::value;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
@ -414,7 +414,7 @@ struct TensorEvaluator<TensorReverseOp<ReverseDimensions, ArgType>, Device>
Device> Base; Device> Base;
typedef TensorReverseOp<ReverseDimensions, ArgType> XprType; typedef TensorReverseOp<ReverseDimensions, ArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumDims = internal::array_size<ReverseDimensions>::value; static constexpr int NumDims = internal::array_size<ReverseDimensions>::value;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout; static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout;
@ -432,7 +432,7 @@ struct TensorEvaluator<TensorReverseOp<ReverseDimensions, ArgType>, Device>
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
//===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===//
typedef internal::TensorBlockNotImplemented TensorBlock; typedef internal::TensorBlockNotImplemented TensorBlock;

View File

@ -24,8 +24,8 @@ struct traits<TensorScanOp<Op, XprType> >
typedef typename XprTraits::StorageKind StorageKind; typedef typename XprTraits::StorageKind StorageKind;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -381,7 +381,7 @@ struct TensorEvaluator<const TensorScanOp<Op, ArgType>, Device> {
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef const ArgType ChildTypeNoConst; typedef const ArgType ChildTypeNoConst;
typedef const ArgType ChildType; typedef const ArgType ChildType;
static const int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef std::remove_const_t<typename XprType::Scalar> Scalar; typedef std::remove_const_t<typename XprType::Scalar> Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;

View File

@ -31,8 +31,8 @@ struct traits<TensorShufflingOp<Shuffle, XprType> > : public traits<XprType>
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -90,12 +90,12 @@ struct TensorEvaluator<const TensorShufflingOp<Shuffle, ArgType>, Device>
typedef TensorEvaluator<const TensorShufflingOp<Shuffle, ArgType>, Device> Self; typedef TensorEvaluator<const TensorShufflingOp<Shuffle, ArgType>, Device> Self;
typedef TensorShufflingOp<Shuffle, ArgType> XprType; typedef TensorShufflingOp<Shuffle, ArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
@ -364,12 +364,12 @@ struct TensorEvaluator<TensorShufflingOp<Shuffle, ArgType>, Device>
typedef TensorShufflingOp<Shuffle, ArgType> XprType; typedef TensorShufflingOp<Shuffle, ArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout; static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout;
enum { enum {

View File

@ -41,10 +41,10 @@ template<typename T, typename FixedDimensions, int Options_>
class TensorStorage class TensorStorage
{ {
private: private:
static const std::size_t Size = FixedDimensions::total_size; static constexpr std::size_t Size = FixedDimensions::total_size;
// Allocate an array of size at least one to prevent compiler warnings. // Allocate an array of size at least one to prevent compiler warnings.
static const std::size_t MinSize = max_n_1<Size>::size; static constexpr std::size_t MinSize = max_n_1<Size>::size;
EIGEN_ALIGN_MAX T m_data[MinSize]; EIGEN_ALIGN_MAX T m_data[MinSize];
public: public:

View File

@ -31,8 +31,8 @@ struct traits<TensorStridingOp<Strides, XprType> > : public traits<XprType>
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions; static constexpr int NumDimensions = XprTraits::NumDimensions;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -88,12 +88,12 @@ struct TensorEvaluator<const TensorStridingOp<Strides, ArgType>, Device>
{ {
typedef TensorStridingOp<Strides, ArgType> XprType; typedef TensorStridingOp<Strides, ArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;
@ -267,7 +267,7 @@ struct TensorEvaluator<TensorStridingOp<Strides, ArgType>, Device>
typedef TensorStridingOp<Strides, ArgType> XprType; typedef TensorStridingOp<Strides, ArgType> XprType;
typedef TensorEvaluator<const XprType, Device> Base; typedef TensorEvaluator<const XprType, Device> Base;
// typedef typename XprType::Index Index; // typedef typename XprType::Index Index;
static const int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
// typedef DSizes<Index, NumDims> Dimensions; // typedef DSizes<Index, NumDims> Dimensions;
static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout; static constexpr int Layout = TensorEvaluator<ArgType, Device>::Layout;
@ -286,7 +286,7 @@ struct TensorEvaluator<TensorStridingOp<Strides, ArgType>, Device>
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index)
{ {

View File

@ -33,8 +33,8 @@ struct traits<TensorTraceOp<Dims, XprType> > : public traits<XprType>
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions - array_size<Dims>::value; static constexpr int NumDimensions = XprTraits::NumDimensions - array_size<Dims>::value;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
}; };
template<typename Dims, typename XprType> template<typename Dims, typename XprType>
@ -84,15 +84,15 @@ template<typename Dims, typename ArgType, typename Device>
struct TensorEvaluator<const TensorTraceOp<Dims, ArgType>, Device> struct TensorEvaluator<const TensorTraceOp<Dims, ArgType>, Device>
{ {
typedef TensorTraceOp<Dims, ArgType> XprType; typedef TensorTraceOp<Dims, ArgType> XprType;
static const int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
static const int NumReducedDims = internal::array_size<Dims>::value; static constexpr int NumReducedDims = internal::array_size<Dims>::value;
static const int NumOutputDims = NumInputDims - NumReducedDims; static constexpr int NumOutputDims = NumInputDims - NumReducedDims;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
typedef DSizes<Index, NumOutputDims> Dimensions; typedef DSizes<Index, NumOutputDims> Dimensions;
typedef typename XprType::Scalar Scalar; typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = internal::unpacket_traits<PacketReturnType>::size; static constexpr int PacketSize = internal::unpacket_traits<PacketReturnType>::size;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;

View File

@ -52,8 +52,8 @@ struct traits<Tensor<Scalar_, NumIndices_, Options_, IndexType_> >
typedef Scalar_ Scalar; typedef Scalar_ Scalar;
typedef Dense StorageKind; typedef Dense StorageKind;
typedef IndexType_ Index; typedef IndexType_ Index;
static const int NumDimensions = NumIndices_; static constexpr int NumDimensions = NumIndices_;
static const int Layout = Options_ & RowMajor ? RowMajor : ColMajor; static constexpr int Layout = Options_ & RowMajor ? RowMajor : ColMajor;
enum { enum {
Options = Options_, Options = Options_,
Flags = compute_tensor_flags<Scalar_, Options_>::ret | (is_const<Scalar_>::value ? 0 : LvalueBit) Flags = compute_tensor_flags<Scalar_, Options_>::ret | (is_const<Scalar_>::value ? 0 : LvalueBit)
@ -71,8 +71,8 @@ struct traits<TensorFixedSize<Scalar_, Dimensions, Options_, IndexType_> >
typedef Scalar_ Scalar; typedef Scalar_ Scalar;
typedef Dense StorageKind; typedef Dense StorageKind;
typedef IndexType_ Index; typedef IndexType_ Index;
static const int NumDimensions = array_size<Dimensions>::value; static constexpr int NumDimensions = array_size<Dimensions>::value;
static const int Layout = Options_ & RowMajor ? RowMajor : ColMajor; static constexpr int Layout = Options_ & RowMajor ? RowMajor : ColMajor;
enum { enum {
Options = Options_, Options = Options_,
Flags = compute_tensor_flags<Scalar_, Options_>::ret | (is_const<Scalar_>::value ? 0: LvalueBit) Flags = compute_tensor_flags<Scalar_, Options_>::ret | (is_const<Scalar_>::value ? 0: LvalueBit)
@ -92,8 +92,8 @@ struct traits<TensorMap<PlainObjectType, Options_, MakePointer_> >
typedef typename BaseTraits::Scalar Scalar; typedef typename BaseTraits::Scalar Scalar;
typedef typename BaseTraits::StorageKind StorageKind; typedef typename BaseTraits::StorageKind StorageKind;
typedef typename BaseTraits::Index Index; typedef typename BaseTraits::Index Index;
static const int NumDimensions = BaseTraits::NumDimensions; static constexpr int NumDimensions = BaseTraits::NumDimensions;
static const int Layout = BaseTraits::Layout; static constexpr int Layout = BaseTraits::Layout;
enum { enum {
Options = Options_, Options = Options_,
Flags = BaseTraits::Flags Flags = BaseTraits::Flags
@ -114,8 +114,8 @@ struct traits<TensorRef<PlainObjectType> >
typedef typename BaseTraits::Scalar Scalar; typedef typename BaseTraits::Scalar Scalar;
typedef typename BaseTraits::StorageKind StorageKind; typedef typename BaseTraits::StorageKind StorageKind;
typedef typename BaseTraits::Index Index; typedef typename BaseTraits::Index Index;
static const int NumDimensions = BaseTraits::NumDimensions; static constexpr int NumDimensions = BaseTraits::NumDimensions;
static const int Layout = BaseTraits::Layout; static constexpr int Layout = BaseTraits::Layout;
enum { enum {
Options = BaseTraits::Options, Options = BaseTraits::Options,
Flags = BaseTraits::Flags Flags = BaseTraits::Flags

View File

@ -34,8 +34,8 @@ struct traits<TensorVolumePatchOp<Planes, Rows, Cols, XprType> > : public traits
typedef typename XprTraits::Index Index; typedef typename XprTraits::Index Index;
typedef typename XprType::Nested Nested; typedef typename XprType::Nested Nested;
typedef std::remove_reference_t<Nested> Nested_; typedef std::remove_reference_t<Nested> Nested_;
static const int NumDimensions = XprTraits::NumDimensions + 1; static constexpr int NumDimensions = XprTraits::NumDimensions + 1;
static const int Layout = XprTraits::Layout; static constexpr int Layout = XprTraits::Layout;
typedef typename XprTraits::PointerType PointerType; typedef typename XprTraits::PointerType PointerType;
}; };
@ -172,13 +172,13 @@ struct TensorEvaluator<const TensorVolumePatchOp<Planes, Rows, Cols, ArgType>, D
{ {
typedef TensorVolumePatchOp<Planes, Rows, Cols, ArgType> XprType; typedef TensorVolumePatchOp<Planes, Rows, Cols, ArgType> XprType;
typedef typename XprType::Index Index; typedef typename XprType::Index Index;
static const int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value; static constexpr int NumInputDims = internal::array_size<typename TensorEvaluator<ArgType, Device>::Dimensions>::value;
static const int NumDims = NumInputDims + 1; static constexpr int NumDims = NumInputDims + 1;
typedef DSizes<Index, NumDims> Dimensions; typedef DSizes<Index, NumDims> Dimensions;
typedef std::remove_const_t<typename XprType::Scalar> Scalar; typedef std::remove_const_t<typename XprType::Scalar> Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename XprType::CoeffReturnType CoeffReturnType;
typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType; typedef typename PacketType<CoeffReturnType, Device>::type PacketReturnType;
static const int PacketSize = PacketType<CoeffReturnType, Device>::size; static constexpr int PacketSize = PacketType<CoeffReturnType, Device>::size;
typedef StorageMemory<CoeffReturnType, Device> Storage; typedef StorageMemory<CoeffReturnType, Device> Storage;
typedef typename Storage::Type EvaluatorPointerType; typedef typename Storage::Type EvaluatorPointerType;

View File

@ -35,7 +35,8 @@ template<typename T, T... nn>
struct numeric_list { constexpr static std::size_t count = sizeof...(nn); }; struct numeric_list { constexpr static std::size_t count = sizeof...(nn); };
template<typename T, T n, T... nn> template<typename T, T n, T... nn>
struct numeric_list<T, n, nn...> { static const std::size_t count = sizeof...(nn) + 1; const static T first_value = n; }; struct numeric_list<T, n, nn...> { static constexpr std::size_t count = sizeof...(nn) + 1;
static constexpr T first_value = n; };
#ifndef EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN
/* numeric list constructors /* numeric list constructors

View File

@ -132,13 +132,13 @@ namespace Eigen
// that enum is not guerantee to support negative numbers // that enum is not guerantee to support negative numbers
/** The first rotation axis */ /** The first rotation axis */
static const int AlphaAxis = _AlphaAxis; static constexpr int AlphaAxis = _AlphaAxis;
/** The second rotation axis */ /** The second rotation axis */
static const int BetaAxis = _BetaAxis; static constexpr int BetaAxis = _BetaAxis;
/** The third rotation axis */ /** The third rotation axis */
static const int GammaAxis = _GammaAxis; static constexpr int GammaAxis = _GammaAxis;
enum enum
{ {

View File

@ -171,7 +171,7 @@ class RandomSetter
}; };
typedef typename MapTraits<ScalarWrapper>::KeyType KeyType; typedef typename MapTraits<ScalarWrapper>::KeyType KeyType;
typedef typename MapTraits<ScalarWrapper>::Type HashMapType; typedef typename MapTraits<ScalarWrapper>::Type HashMapType;
static const int OuterPacketMask = (1 << OuterPacketBits) - 1; static constexpr int OuterPacketMask = (1 << OuterPacketBits) - 1;
enum { enum {
SwapStorage = 1 - MapTraits<ScalarWrapper>::IsSorted, SwapStorage = 1 - MapTraits<ScalarWrapper>::IsSorted,
TargetRowMajor = (SparseMatrixType::Flags & RowMajorBit) ? 1 : 0, TargetRowMajor = (SparseMatrixType::Flags & RowMajorBit) ? 1 : 0,