From 64909b82bd3801ec300bf7887a2f68e8f7256e4b Mon Sep 17 00:00:00 2001 From: Erik Schultheis Date: Mon, 4 Apr 2022 17:33:33 +0000 Subject: [PATCH] static const class members turned into constexpr --- Eigen/src/Core/PlainObjectBase.h | 2 +- Eigen/src/Core/util/Memory.h | 4 +- Eigen/src/LU/PartialPivLU.h | 10 ++--- unsupported/Eigen/CXX11/src/Tensor/Tensor.h | 4 +- .../Eigen/CXX11/src/Tensor/TensorArgMax.h | 12 +++--- .../Eigen/CXX11/src/Tensor/TensorAssign.h | 10 ++--- .../Eigen/CXX11/src/Tensor/TensorBase.h | 4 +- .../Eigen/CXX11/src/Tensor/TensorBlock.h | 14 +++---- .../CXX11/src/Tensor/TensorBroadcasting.h | 10 ++--- .../Eigen/CXX11/src/Tensor/TensorChipping.h | 16 ++++---- .../CXX11/src/Tensor/TensorConcatenation.h | 8 ++-- .../CXX11/src/Tensor/TensorContraction.h | 22 +++++----- .../CXX11/src/Tensor/TensorContractionGpu.h | 8 ++-- .../CXX11/src/Tensor/TensorContractionSycl.h | 8 ++-- .../src/Tensor/TensorContractionThreadPool.h | 10 ++--- .../Eigen/CXX11/src/Tensor/TensorConversion.h | 14 +++---- .../CXX11/src/Tensor/TensorConvolution.h | 18 ++++----- .../CXX11/src/Tensor/TensorConvolutionSycl.h | 6 +-- .../Eigen/CXX11/src/Tensor/TensorCustomOp.h | 16 ++++---- .../Eigen/CXX11/src/Tensor/TensorEvalTo.h | 10 ++--- .../Eigen/CXX11/src/Tensor/TensorEvaluator.h | 28 ++++++------- .../Eigen/CXX11/src/Tensor/TensorExecutor.h | 8 ++-- .../Eigen/CXX11/src/Tensor/TensorExpr.h | 20 +++++----- .../Eigen/CXX11/src/Tensor/TensorFFT.h | 8 ++-- .../Eigen/CXX11/src/Tensor/TensorFixedSize.h | 4 +- .../Eigen/CXX11/src/Tensor/TensorForcedEval.h | 8 ++-- .../src/Tensor/TensorForwardDeclarations.h | 2 +- .../Eigen/CXX11/src/Tensor/TensorFunctors.h | 2 +- .../Eigen/CXX11/src/Tensor/TensorGenerator.h | 6 +-- .../Eigen/CXX11/src/Tensor/TensorImagePatch.h | 10 ++--- .../Eigen/CXX11/src/Tensor/TensorInflation.h | 8 ++-- .../Eigen/CXX11/src/Tensor/TensorIntDiv.h | 2 +- .../Eigen/CXX11/src/Tensor/TensorLayoutSwap.h | 6 +-- .../Eigen/CXX11/src/Tensor/TensorMap.h | 4 +- .../Eigen/CXX11/src/Tensor/TensorMeta.h | 4 +- .../Eigen/CXX11/src/Tensor/TensorMorphing.h | 24 +++++------ .../Eigen/CXX11/src/Tensor/TensorPadding.h | 8 ++-- .../Eigen/CXX11/src/Tensor/TensorPatch.h | 8 ++-- .../Eigen/CXX11/src/Tensor/TensorRandom.h | 4 +- .../Eigen/CXX11/src/Tensor/TensorReduction.h | 40 +++++++++---------- .../CXX11/src/Tensor/TensorReductionGpu.h | 10 ++--- .../Eigen/CXX11/src/Tensor/TensorRef.h | 2 +- .../Eigen/CXX11/src/Tensor/TensorReverse.h | 12 +++--- .../Eigen/CXX11/src/Tensor/TensorScan.h | 6 +-- .../Eigen/CXX11/src/Tensor/TensorShuffling.h | 12 +++--- .../Eigen/CXX11/src/Tensor/TensorStorage.h | 4 +- .../Eigen/CXX11/src/Tensor/TensorStriding.h | 12 +++--- .../Eigen/CXX11/src/Tensor/TensorTrace.h | 12 +++--- .../Eigen/CXX11/src/Tensor/TensorTraits.h | 16 ++++---- .../CXX11/src/Tensor/TensorVolumePatch.h | 10 ++--- unsupported/Eigen/CXX11/src/util/CXX11Meta.h | 3 +- .../Eigen/src/EulerAngles/EulerSystem.h | 6 +-- .../Eigen/src/SparseExtra/RandomSetter.h | 2 +- 53 files changed, 259 insertions(+), 258 deletions(-) diff --git a/Eigen/src/Core/PlainObjectBase.h b/Eigen/src/Core/PlainObjectBase.h index 48e372f20..e0bde5478 100644 --- a/Eigen/src/Core/PlainObjectBase.h +++ b/Eigen/src/Core/PlainObjectBase.h @@ -982,7 +982,7 @@ namespace internal { template struct conservative_resize_like_impl { - static const bool IsRelocatable = std::is_trivially_copyable::value; + static constexpr bool IsRelocatable = std::is_trivially_copyable::value; static void run(DenseBase& _this, Index rows, Index cols) { if (_this.rows() == rows && _this.cols() == cols) return; diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index 871219ad9..7657ead80 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -634,7 +634,7 @@ template struct local_nested_eval_wrapper { - static const bool NeedExternalBuffer = false; + static constexpr bool NeedExternalBuffer = false; typedef typename Xpr::Scalar Scalar; typedef typename nested_eval::type ObjectType; ObjectType object; @@ -650,7 +650,7 @@ struct local_nested_eval_wrapper template struct local_nested_eval_wrapper { - static const bool NeedExternalBuffer = true; + static constexpr bool NeedExternalBuffer = true; typedef typename Xpr::Scalar Scalar; typedef typename plain_object_eval::type PlainObject; typedef Map ObjectType; diff --git a/Eigen/src/LU/PartialPivLU.h b/Eigen/src/LU/PartialPivLU.h index 3a32f19e5..137739892 100644 --- a/Eigen/src/LU/PartialPivLU.h +++ b/Eigen/src/LU/PartialPivLU.h @@ -333,12 +333,12 @@ namespace internal { template struct partial_lu_impl { - static const int UnBlockedBound = 16; - static const bool UnBlockedAtCompileTime = SizeAtCompileTime!=Dynamic && SizeAtCompileTime<=UnBlockedBound; - static const int ActualSizeAtCompileTime = UnBlockedAtCompileTime ? SizeAtCompileTime : Dynamic; + static constexpr int UnBlockedBound = 16; + static constexpr bool UnBlockedAtCompileTime = SizeAtCompileTime!=Dynamic && SizeAtCompileTime<=UnBlockedBound; + static constexpr int ActualSizeAtCompileTime = UnBlockedAtCompileTime ? SizeAtCompileTime : Dynamic; // Remaining rows and columns at compile-time: - static const int RRows = SizeAtCompileTime==2 ? 1 : Dynamic; - static const int RCols = SizeAtCompileTime==2 ? 1 : Dynamic; + static constexpr int RRows = SizeAtCompileTime==2 ? 1 : Dynamic; + static constexpr int RCols = SizeAtCompileTime==2 ? 1 : Dynamic; typedef Matrix MatrixType; typedef Ref MatrixTypeRef; typedef Ref > BlockType; diff --git a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h index b19a20e90..b830984f7 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h +++ b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h @@ -82,8 +82,8 @@ class Tensor : public TensorBase Dimensions; protected: diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h b/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h index 180d19635..0d6032710 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h @@ -32,8 +32,8 @@ struct traits > : public traits typedef Pair Scalar; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; }; template @@ -83,7 +83,7 @@ struct TensorEvaluator, Device> typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename TensorEvaluator::Dimensions Dimensions; - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; @@ -155,8 +155,8 @@ struct traits > : public traits Nested_; - static const int NumDimensions = XprTraits::NumDimensions - array_size::value; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions - array_size::value; + static constexpr int Layout = XprTraits::Layout; }; template @@ -222,7 +222,7 @@ struct TensorEvaluator, Devic typedef typename TensorIndexPairOp::CoeffReturnType PairType; typedef typename TensorEvaluator >, Device>::Dimensions Dimensions; typedef typename TensorEvaluator , Device>::Dimensions InputDimensions; - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; typedef array StrideDims; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h b/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h index fc5df834a..0bd3a001b 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h @@ -34,8 +34,8 @@ struct traits > typedef typename RhsXprType::Nested RhsNested; typedef std::remove_reference_t LhsNested_; typedef std::remove_reference_t RhsNested_; - static const std::size_t NumDimensions = internal::traits::NumDimensions; - static const int Layout = internal::traits::Layout; + static constexpr std::size_t NumDimensions = internal::traits::NumDimensions; + static constexpr int Layout = internal::traits::Layout; typedef typename traits::PointerType PointerType; enum { @@ -70,7 +70,7 @@ class TensorAssignOp : public TensorBase typedef typename Eigen::internal::traits::StorageKind StorageKind; typedef typename Eigen::internal::traits::Index Index; - static const int NumDims = Eigen::internal::traits::NumDimensions; + static constexpr int NumDims = Eigen::internal::traits::NumDimensions; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorAssignOp(LhsXprType& lhs, const RhsXprType& rhs) : m_lhs_xpr(lhs), m_rhs_xpr(rhs) {} @@ -102,8 +102,8 @@ struct TensorEvaluator, Device> typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; - static const int PacketSize = PacketType::size; - static const int NumDims = XprType::NumDims; + static constexpr int PacketSize = PacketType::size; + static constexpr int NumDims = XprType::NumDims; static constexpr int Layout = TensorEvaluator::Layout; enum { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h b/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h index 4c13401f6..8eaf96a7b 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h @@ -35,7 +35,7 @@ class TensorBase typedef typename DerivedTraits::Scalar Scalar; typedef typename DerivedTraits::Index Index; typedef std::remove_const_t CoeffReturnType; - static const int NumDimensions = DerivedTraits::NumDimensions; + static constexpr int NumDimensions = DerivedTraits::NumDimensions; // Generic nullary operation support. template EIGEN_DEVICE_FUNC @@ -988,7 +988,7 @@ class TensorBase : public TensorBase { typedef typename DerivedTraits::Scalar Scalar; typedef typename DerivedTraits::Index Index; typedef Scalar CoeffReturnType; - static const int NumDimensions = DerivedTraits::NumDimensions; + static constexpr int NumDimensions = DerivedTraits::NumDimensions; template friend class Tensor; template friend class TensorFixedSize; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h b/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h index 6f394a6dd..3a40cb857 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h @@ -835,7 +835,7 @@ class TensorMaterializedBlock { template class TensorCwiseUnaryBlock { - static const bool NoArgBlockAccess = + static constexpr bool NoArgBlockAccess = internal::is_void::value; public: @@ -866,7 +866,7 @@ class TensorCwiseUnaryBlock { template class TensorCwiseBinaryBlock { - static const bool NoArgBlockAccess = + static constexpr bool NoArgBlockAccess = internal::is_void::value || internal::is_void::value; @@ -913,7 +913,7 @@ class TensorCwiseBinaryBlock { template class TensorUnaryExprBlock { typedef typename ArgTensorBlock::XprType ArgXprType; - static const bool NoArgBlockAccess = internal::is_void::value; + static constexpr bool NoArgBlockAccess = internal::is_void::value; public: typedef std::conditional_t< @@ -947,9 +947,9 @@ class TensorTernaryExprBlock { typedef typename Arg2TensorBlock::XprType Arg2XprType; typedef typename Arg3TensorBlock::XprType Arg3XprType; - static const bool NoArgBlockAccess = internal::is_void::value || - internal::is_void::value || - internal::is_void::value; + static constexpr bool NoArgBlockAccess = internal::is_void::value || + internal::is_void::value || + internal::is_void::value; public: typedef std::conditional_t< @@ -1143,7 +1143,7 @@ class StridedLinearBufferCopy { template class TensorBlockIO { - static const bool IsColMajor = (Layout == ColMajor); + static constexpr bool IsColMajor = (Layout == ColMajor); typedef StridedLinearBufferCopy LinCopy; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h b/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h index 541468d82..64c39ca28 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h @@ -31,8 +31,8 @@ struct traits > : public traits Nested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -100,13 +100,13 @@ struct TensorEvaluator, Device> { typedef TensorBroadcastingOp XprType; typedef typename XprType::Index Index; - static const int NumDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = internal::array_size::Dimensions>::value; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename TensorEvaluator::Dimensions InputDimensions; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; protected: // all the non-static fields must have the same access control, otherwise the TensorEvaluator won't be standard layout; bool isCopy, nByOne, oneByN; public: @@ -695,7 +695,7 @@ struct TensorEvaluator, Device> } #endif private: - static const bool IsColMajor = + static constexpr bool IsColMajor = static_cast(Layout) == static_cast(ColMajor); // We will build a general case block broadcasting on top of broadcasting diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h b/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h index 8870344bc..c3b28eca5 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h @@ -32,8 +32,8 @@ struct traits > : public traits typedef typename XprTraits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions - 1; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions - 1; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -117,14 +117,14 @@ template struct TensorEvaluator, Device> { typedef TensorChippingOp XprType; - static const int NumInputDims = internal::array_size::Dimensions>::value; - static const int NumDims = NumInputDims-1; + static constexpr int NumInputDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = NumInputDims-1; typedef typename XprType::Index Index; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; static constexpr int Layout = TensorEvaluator::Layout; @@ -413,14 +413,14 @@ struct TensorEvaluator, Device> { typedef TensorEvaluator, Device> Base; typedef TensorChippingOp XprType; - static const int NumInputDims = internal::array_size::Dimensions>::value; - static const int NumDims = NumInputDims-1; + static constexpr int NumInputDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = NumInputDims-1; typedef typename XprType::Index Index; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; enum { IsAligned = false, diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h b/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h index 33674fee5..073be8146 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h @@ -36,8 +36,8 @@ struct traits > typedef typename RhsXprType::Nested RhsNested; typedef std::remove_reference_t LhsNested_; typedef std::remove_reference_t RhsNested_; - static const int NumDimensions = traits::NumDimensions; - static const int Layout = traits::Layout; + static constexpr int NumDimensions = traits::NumDimensions; + static constexpr int Layout = traits::Layout; enum { Flags = 0 }; typedef std::conditional_t::val, typename traits::PointerType, typename traits::PointerType> PointerType; @@ -98,8 +98,8 @@ struct TensorEvaluator XprType; typedef typename XprType::Index Index; - static const int NumDims = internal::array_size::Dimensions>::value; - static const int RightNumDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = internal::array_size::Dimensions>::value; + static constexpr int RightNumDims = internal::array_size::Dimensions>::value; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h b/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h index e0496ac66..c629e44cf 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h @@ -40,8 +40,8 @@ struct traits RhsNested_; // From NumDims below. - static const int NumDimensions = traits::NumDimensions + traits::NumDimensions - 2 * array_size::value; - static const int Layout = traits::Layout; + static constexpr int NumDimensions = traits::NumDimensions + traits::NumDimensions - 2 * array_size::value; + static constexpr int Layout = traits::Layout; typedef std::conditional_t::val, typename traits::PointerType, typename traits::PointerType> @@ -73,7 +73,7 @@ struct traits::NumDimensions + traits::NumDimensions - 2 * array_size::value; + static constexpr int NumDimensions = traits::NumDimensions + traits::NumDimensions - 2 * array_size::value; }; // Helper class to allocate and deallocate temporary memory for packed buffers. @@ -406,12 +406,12 @@ struct TensorContractionEvaluatorBase : internal::no_assignment_operator typedef TensorEvaluator LeftEvaluatorType; typedef TensorEvaluator RightEvaluatorType; - static const int LDims = + static constexpr int LDims = internal::array_size::Dimensions>::value; - static const int RDims = + static constexpr int RDims = internal::array_size::Dimensions>::value; - static const int ContractDims = internal::array_size::value; - static const int NumDims = LDims + RDims - 2 * ContractDims; + static constexpr int ContractDims = internal::array_size::value; + static constexpr int NumDims = LDims + RDims - 2 * ContractDims; typedef array contract_t; typedef array left_nocontract_t; @@ -992,17 +992,17 @@ struct TensorEvaluator(ColMajor), LeftArgType, RightArgType> EvalLeftArgType; typedef std::conditional_t(ColMajor), RightArgType, LeftArgType> EvalRightArgType; - static const int LDims = + static constexpr int LDims = internal::array_size::Dimensions>::value; - static const int RDims = + static constexpr int RDims = internal::array_size::Dimensions>::value; - static const int ContractDims = internal::array_size::value; + static constexpr int ContractDims = internal::array_size::value; typedef array contract_t; typedef array left_nocontract_t; typedef array right_nocontract_t; - static const int NumDims = LDims + RDims - 2 * ContractDims; + static constexpr int NumDims = LDims + RDims - 2 * ContractDims; // Could we use NumDimensions here? typedef DSizes Dimensions; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h index 794aa006e..4e01a7b76 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h @@ -1241,11 +1241,11 @@ struct TensorEvaluator(ColMajor), LeftArgType, RightArgType> EvalLeftArgType; typedef std::conditional_t(ColMajor), RightArgType, LeftArgType> EvalRightArgType; - static const int LDims = + static constexpr int LDims = internal::array_size::Dimensions>::value; - static const int RDims = + static constexpr int RDims = internal::array_size::Dimensions>::value; - static const int ContractDims = internal::array_size::value; + static constexpr int ContractDims = internal::array_size::value; typedef array left_dim_mapper_t; typedef array right_dim_mapper_t; @@ -1254,7 +1254,7 @@ struct TensorEvaluator left_nocontract_t; typedef array right_nocontract_t; - static const int NumDims = LDims + RDims - 2 * ContractDims; + static constexpr int NumDims = LDims + RDims - 2 * ContractDims; typedef DSizes Dimensions; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionSycl.h b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionSycl.h index a46e7e91d..c6c40776f 100755 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionSycl.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionSycl.h @@ -1311,9 +1311,9 @@ struct TensorEvaluator::Layout; - static EIGEN_CONSTEXPR int LDims = Base::LDims; - static EIGEN_CONSTEXPR int RDims = Base::RDims; - static EIGEN_CONSTEXPR int ContractDims = Base::ContractDims; + static constexpr int LDims = Base::LDims; + static constexpr int RDims = Base::RDims; + static constexpr int ContractDims = Base::ContractDims; typedef array left_dim_mapper_t; typedef array right_dim_mapper_t; @@ -1322,7 +1322,7 @@ struct TensorEvaluator left_nocontract_t; typedef array right_nocontract_t; - static const int NumDims = LDims + RDims - 2 * ContractDims; + static constexpr int NumDims = LDims + RDims - 2 * ContractDims; typedef DSizes Dimensions; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h index faf62019d..1f818ecec 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h @@ -43,11 +43,11 @@ struct TensorEvaluator(Layout) == static_cast(ColMajor), RightArgType, LeftArgType> EvalRightArgType; - static const int LDims = + static constexpr int LDims = internal::array_size::Dimensions>::value; - static const int RDims = + static constexpr int RDims = internal::array_size::Dimensions>::value; - static const int ContractDims = internal::array_size::value; + static constexpr int ContractDims = internal::array_size::value; typedef array left_dim_mapper_t; typedef array right_dim_mapper_t; @@ -56,7 +56,7 @@ struct TensorEvaluator left_nocontract_t; typedef array right_nocontract_t; - static const int NumDims = LDims + RDims - 2 * ContractDims; + static constexpr int NumDims = LDims + RDims - 2 * ContractDims; typedef DSizes Dimensions; @@ -599,7 +599,7 @@ struct TensorEvaluator > typedef typename traits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = traits::NumDimensions; - static const int Layout = traits::Layout; + static constexpr int NumDimensions = traits::NumDimensions; + static constexpr int Layout = traits::Layout; enum { Flags = 0 }; typedef typename TypeConversion::PointerType>::type PointerType; }; @@ -252,7 +252,7 @@ struct PacketConv { typedef typename internal::unpacket_traits::type SrcType; typedef typename internal::unpacket_traits::type TargetType; - static const int PacketSize = internal::unpacket_traits::size; + static constexpr int PacketSize = internal::unpacket_traits::size; template static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TargetPacket run(const TensorEvaluator& impl, Index index) { @@ -285,7 +285,7 @@ struct PacketConv { template struct PacketConv { typedef typename internal::unpacket_traits::type TargetType; - static const int PacketSize = internal::unpacket_traits::size; + static constexpr int PacketSize = internal::unpacket_traits::size; template static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TargetPacket run(const TensorEvaluator& impl, Index index) { @@ -317,8 +317,8 @@ struct TensorEvaluator, Device> typedef internal::remove_all_t::Scalar> SrcType; typedef typename PacketType::type PacketReturnType; typedef typename PacketType::type PacketSourceType; - static const int PacketSize = PacketType::size; - static const bool IsSameType = internal::is_same::value; + static constexpr int PacketSize = PacketType::size; + static constexpr bool IsSameType = internal::is_same::value; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; @@ -337,7 +337,7 @@ struct TensorEvaluator, Device> }; static constexpr int Layout = TensorEvaluator::Layout; - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// typedef internal::TensorBlockDescriptor TensorBlockDesc; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h b/unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h index cbe06b7cf..70d21292a 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h @@ -208,7 +208,7 @@ class IndexMapper { } private: - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; array m_inputStrides; array m_outputStrides; array m_gpuInputStrides; @@ -231,8 +231,8 @@ struct traits > typedef typename KernelXprType::Nested RhsNested; typedef std::remove_reference_t LhsNested_; typedef std::remove_reference_t RhsNested_; - static const int NumDimensions = traits::NumDimensions; - static const int Layout = traits::Layout; + static constexpr int NumDimensions = traits::NumDimensions; + static constexpr int Layout = traits::Layout; typedef std::conditional_t::val, typename traits::PointerType, typename traits::PointerType> PointerType; @@ -296,15 +296,15 @@ struct TensorEvaluator XprType; - static const int NumDims = internal::array_size::Dimensions>::value; - static const int NumKernelDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::Dimensions>::value; + static constexpr int NumKernelDims = internal::array_size::value; typedef typename XprType::Index Index; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; @@ -779,8 +779,8 @@ struct TensorEvaluator XprType; - static const int NumDims = internal::array_size::Dimensions>::value; - static const int NumKernelDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::Dimensions>::value; + static constexpr int NumKernelDims = internal::array_size::value; typedef typename XprType::Index Index; typedef DSizes Dimensions; typedef typename TensorEvaluator::Dimensions KernelDimensions; @@ -820,7 +820,7 @@ struct TensorEvaluator::type PacketReturnType; typedef typename InputArgType::Scalar Scalar; - static const int PacketSize = internal::unpacket_traits::size; + static constexpr int PacketSize = internal::unpacket_traits::size; EIGEN_DEVICE_FUNC const Dimensions& dimensions() const { return m_dimensions; } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorConvolutionSycl.h b/unsupported/Eigen/CXX11/src/Tensor/TensorConvolutionSycl.h index 7e7328283..8a9177982 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorConvolutionSycl.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorConvolutionSycl.h @@ -277,9 +277,9 @@ template struct TensorEvaluator, Eigen::SyclDevice> { typedef TensorConvolutionOp XprType; - static const int NumDims = + static constexpr int NumDims = internal::array_size::Dimensions>::value; - static const int NumKernelDims = internal::array_size::value; + static constexpr int NumKernelDims = internal::array_size::value; typedef typename XprType::Index Index; typedef DSizes Dimensions; typedef typename TensorEvaluator::Dimensions KernelDimensions; @@ -287,7 +287,7 @@ struct TensorEvaluator::type PacketReturnType; typedef typename InputArgType::Scalar Scalar; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; typedef StorageMemory KernelStorage; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h b/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h index 7f8c59601..0634be89b 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h @@ -30,8 +30,8 @@ struct traits > typedef typename XprType::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = traits::NumDimensions; - static const int Layout = traits::Layout; + static constexpr int NumDimensions = traits::NumDimensions; + static constexpr int Layout = traits::Layout; typedef typename traits::PointerType PointerType; }; @@ -84,12 +84,12 @@ struct TensorEvaluator, Devi { typedef TensorCustomUnaryOp ArgType; typedef typename internal::traits::Index Index; - static const int NumDims = internal::traits::NumDimensions; + static constexpr int NumDims = internal::traits::NumDimensions; typedef DSizes Dimensions; typedef std::remove_const_t Scalar; typedef std::remove_const_t CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef typename Eigen::internal::traits::PointerType TensorPointerType; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; @@ -195,8 +195,8 @@ struct traits > typedef typename RhsXprType::Nested RhsNested; typedef std::remove_reference_t LhsNested_; typedef std::remove_reference_t RhsNested_; - static const int NumDimensions = traits::NumDimensions; - static const int Layout = traits::Layout; + static constexpr int NumDimensions = traits::NumDimensions; + static constexpr int Layout = traits::Layout; typedef std::conditional_t::val, typename traits::PointerType, typename traits::PointerType> PointerType; }; @@ -256,12 +256,12 @@ struct TensorEvaluator XprType; typedef typename internal::traits::Index Index; - static const int NumDims = internal::traits::NumDimensions; + static constexpr int NumDims = internal::traits::NumDimensions; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef std::remove_const_t CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef typename Eigen::internal::traits::PointerType TensorPointerType; typedef StorageMemory Storage; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h b/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h index 9d8b01784..0e9cdfe41 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h @@ -32,8 +32,8 @@ struct traits > typedef typename XprTraits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename MakePointer_::Type PointerType; enum { @@ -78,7 +78,7 @@ class TensorEvalToOp : public TensorBase, typedef typename Eigen::internal::traits::StorageKind StorageKind; typedef typename Eigen::internal::traits::Index Index; - static const int NumDims = Eigen::internal::traits::NumDimensions; + static constexpr int NumDims = Eigen::internal::traits::NumDimensions; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorEvalToOp(PointerType buffer, const XprType& expr) : m_xpr(expr), m_buffer(buffer) {} @@ -105,7 +105,7 @@ struct TensorEvaluator, Device> typedef typename XprType::Index Index; typedef std::remove_const_t CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef typename Eigen::internal::traits::PointerType TensorPointerType; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; @@ -119,7 +119,7 @@ struct TensorEvaluator, Device> }; static constexpr int Layout = TensorEvaluator::Layout; - static const int NumDims = internal::traits::NumDimensions; + static constexpr int NumDims = internal::traits::NumDimensions; //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// typedef internal::TensorBlockDescriptor TensorBlockDesc; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h b/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h index 941666a73..e54c558ab 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h @@ -35,14 +35,14 @@ struct TensorEvaluator typedef typename PacketType::type PacketReturnType; typedef typename Derived::Dimensions Dimensions; typedef Derived XprType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef typename internal::traits::template MakePointer::Type TensorPointerType; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; // NumDimensions is -1 for variable dim tensors - static const int NumCoords = internal::traits::NumDimensions > 0 ? - internal::traits::NumDimensions : 0; + static constexpr int NumCoords = internal::traits::NumDimensions > 0 ? + internal::traits::NumDimensions : 0; static constexpr int Layout = Derived::Layout; enum { @@ -240,9 +240,9 @@ struct TensorEvaluator typedef std::remove_const_t ScalarNoConst; // NumDimensions is -1 for variable dim tensors - static const int NumCoords = internal::traits::NumDimensions > 0 ? - internal::traits::NumDimensions : 0; - static const int PacketSize = PacketType::size; + static constexpr int NumCoords = internal::traits::NumDimensions > 0 ? + internal::traits::NumDimensions : 0; + static constexpr int PacketSize = PacketType::size; static constexpr int Layout = Derived::Layout; enum { @@ -366,7 +366,7 @@ struct TensorEvaluator, Device> typedef typename XprType::Scalar Scalar; typedef typename internal::traits::Scalar CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef typename TensorEvaluator::Dimensions Dimensions; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; @@ -466,11 +466,11 @@ struct TensorEvaluator, Device> typedef std::remove_const_t ScalarNoConst; typedef typename internal::traits::Scalar CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef typename TensorEvaluator::Dimensions Dimensions; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// typedef internal::TensorBlockDescriptor TensorBlockDesc; @@ -585,12 +585,12 @@ struct TensorEvaluator::Scalar CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef typename TensorEvaluator::Dimensions Dimensions; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; - static const int NumDims = internal::array_size< + static constexpr int NumDims = internal::array_size< typename TensorEvaluator::Dimensions>::value; //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// @@ -737,7 +737,7 @@ struct TensorEvaluator::Scalar CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef typename TensorEvaluator::Dimensions Dimensions; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; @@ -843,12 +843,12 @@ struct TensorEvaluator typedef typename XprType::Index Index; typedef typename internal::traits::Scalar CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef typename TensorEvaluator::Dimensions Dimensions; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// typedef internal::TensorBlockDescriptor TensorBlockDesc; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h b/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h index 37244c4f0..de9bed4ed 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h @@ -172,7 +172,7 @@ class TensorExecutor Evaluator; typedef typename traits::Index StorageIndex; - static const int NumDims = traits::NumDimensions; + static constexpr int NumDims = traits::NumDimensions; EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(const Expression& expr, @@ -284,7 +284,7 @@ struct EvalRange { template struct EvalRange { - static const int PacketSize = + static constexpr int PacketSize = unpacket_traits::size; static void run(Evaluator* evaluator_in, const StorageIndex firstIdx, @@ -355,7 +355,7 @@ class TensorExecutor::Scalar Scalar; typedef std::remove_const_t ScalarNoConst; - static const int NumDims = traits::NumDimensions; + static constexpr int NumDims = traits::NumDimensions; typedef TensorEvaluator Evaluator; typedef TensorBlockMapper BlockMapper; @@ -463,7 +463,7 @@ class TensorAsyncExecutor::Scalar Scalar; typedef std::remove_const_t ScalarNoConst; - static const int NumDims = traits::NumDimensions; + static constexpr int NumDims = traits::NumDimensions; typedef TensorEvaluator Evaluator; typedef TensorBlockMapper BlockMapper; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h b/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h index aab9b51b1..9bed2a162 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h @@ -38,8 +38,8 @@ struct traits > typedef typename XprType::Scalar Scalar; typedef typename XprType::Nested XprTypeNested; typedef std::remove_reference_t XprTypeNested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; enum { Flags = 0 @@ -89,8 +89,8 @@ struct traits > typedef traits XprTraits; typedef typename XprType::Nested XprTypeNested; typedef std::remove_reference_t XprTypeNested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename TypeConversion::type @@ -165,8 +165,8 @@ struct traits > typedef typename RhsXprType::Nested RhsNested; typedef std::remove_reference_t LhsNested_; typedef std::remove_reference_t RhsNested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename TypeConversion::val, typename traits::PointerType, @@ -247,8 +247,8 @@ struct traits Arg1Nested_; typedef std::remove_reference_t Arg2Nested_; typedef std::remove_reference_t Arg3Nested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename TypeConversion::val, typename traits::PointerType, @@ -328,8 +328,8 @@ struct traits > typedef typename IfXprType::Nested IfNested; typedef typename ThenXprType::Nested ThenNested; typedef typename ElseXprType::Nested ElseNested; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef std::conditional_t::val, typename traits::PointerType, typename traits::PointerType> PointerType; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h b/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h index bd98da47c..c744d7955 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h @@ -67,8 +67,8 @@ struct traits > : public traits typedef typename XprTraits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename traits::PointerType PointerType; }; @@ -117,7 +117,7 @@ template , Device> { typedef TensorFFTOp XprType; typedef typename XprType::Index Index; - static const int NumDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = internal::array_size::Dimensions>::value; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename Eigen::NumTraits::Real RealScalar; @@ -128,7 +128,7 @@ struct TensorEvaluator, D typedef std::conditional_t OutputScalar; typedef OutputScalar CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = internal::unpacket_traits::size; + static constexpr int PacketSize = internal::unpacket_traits::size; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h b/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h index 9e782f012..051ff6ddf 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h @@ -38,7 +38,7 @@ class TensorFixedSize : public TensorBase::Real RealScalar; typedef typename Base::CoeffReturnType CoeffReturnType; - static const int Options = Options_; + static constexpr int Options = Options_; static constexpr int Layout = Options_ & RowMajor ? RowMajor : ColMajor; enum { @@ -55,7 +55,7 @@ class TensorFixedSize : public TensorBase m_storage; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h b/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h index f16833063..a17637490 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h @@ -32,8 +32,8 @@ struct traits > typedef typename traits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; enum { @@ -112,7 +112,7 @@ struct TensorEvaluator, Device> typedef typename XprType::Index Index; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef typename Eigen::internal::traits::PointerType TensorPointerType; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; @@ -126,7 +126,7 @@ struct TensorEvaluator, Device> }; static constexpr int Layout = TensorEvaluator::Layout; - static const int NumDims = internal::traits::NumDimensions; + static constexpr int NumDims = internal::traits::NumDimensions; //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// typedef internal::TensorBlockDescriptor TensorBlockDesc; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h b/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h index 9fce0f045..b52833cea 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h @@ -167,7 +167,7 @@ struct IsTileable { // Check that block evaluation is supported and it's a preferred option (at // least one sub-expression has much faster block evaluation, e.g. // broadcasting). - static const bool BlockAccess = + static constexpr bool BlockAccess = TensorEvaluator::BlockAccess && TensorEvaluator::PreferBlockAccess; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h b/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h index ddd2c87fb..780451f1d 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h @@ -428,7 +428,7 @@ struct reducer_traits, Device> { template class GaussianGenerator { public: - static const bool PacketAccess = false; + static constexpr bool PacketAccess = false; EIGEN_DEVICE_FUNC GaussianGenerator(const array& means, const array& std_devs) diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h b/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h index 5a173909b..9b8469b98 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h @@ -31,8 +31,8 @@ struct traits > : public traits typedef typename XprTraits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -86,7 +86,7 @@ struct TensorEvaluator, Device> typedef TensorGeneratorOp XprType; typedef typename XprType::Index Index; typedef typename TensorEvaluator::Dimensions Dimensions; - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h b/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h index 4987e7ab1..a9b281fef 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h @@ -39,8 +39,8 @@ struct traits > : public traits typedef typename XprTraits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions + 1; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions + 1; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -217,8 +217,8 @@ struct TensorEvaluator, Device> { typedef TensorImagePatchOp XprType; typedef typename XprType::Index Index; - static const int NumInputDims = internal::array_size::Dimensions>::value; - static const int NumDims = NumInputDims + 1; + static constexpr int NumInputDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = NumInputDims + 1; typedef DSizes Dimensions; typedef std::remove_const_t Scalar; typedef TensorEvaluator, @@ -226,7 +226,7 @@ struct TensorEvaluator, Device> typedef TensorEvaluator Impl; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h b/unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h index 53592895c..818819408 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h @@ -31,8 +31,8 @@ struct traits > : public traits typedef typename XprTraits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -82,12 +82,12 @@ struct TensorEvaluator, Device> { typedef TensorInflationOp XprType; typedef typename XprType::Index Index; - static const int NumDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = internal::array_size::Dimensions>::value; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h b/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h index 7afb775f2..a921fea14 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h @@ -85,7 +85,7 @@ namespace internal { template struct DividerTraits { typedef typename UnsignedTraits::type type; - static const int N = sizeof(T) * 8; + static constexpr int N = sizeof(T) * 8; }; template diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h b/unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h index 0e6ee93e6..d12bd6dd5 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h @@ -46,8 +46,8 @@ struct traits > : public traits typedef typename XprTraits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = traits::NumDimensions; - static const int Layout = (traits::Layout == ColMajor) ? RowMajor : ColMajor; + static constexpr int NumDimensions = traits::NumDimensions; + static constexpr int Layout = (traits::Layout == ColMajor) ? RowMajor : ColMajor; typedef typename XprTraits::PointerType PointerType; }; @@ -98,7 +98,7 @@ struct TensorEvaluator, Device> { typedef TensorLayoutSwapOp XprType; typedef typename XprType::Index Index; - static const int NumDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = internal::array_size::Dimensions>::value; typedef DSizes Dimensions; static constexpr int Layout = (TensorEvaluator::Layout == static_cast(ColMajor)) ? RowMajor : ColMajor; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h index bc842669b..7a601ca1f 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h @@ -66,9 +66,9 @@ template class MakePoin const Scalar& > 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; static constexpr int Layout = PlainObjectType::Layout; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h index 8b107ebcb..3c9a80862 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h @@ -122,13 +122,13 @@ struct static_for { template struct Vectorise { - static const int PacketSize = 1; + static constexpr int PacketSize = 1; typedef OutScalar PacketReturnType; }; template struct Vectorise { - static const int PacketSize = Eigen::PacketType::size; + static constexpr int PacketSize = Eigen::PacketType::size; typedef typename Eigen::PacketType::type PacketReturnType; }; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h index c1546b628..ea622a555 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h @@ -31,8 +31,8 @@ struct traits > : public traits Nested_; - static const int NumDimensions = array_size::value; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = array_size::value; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -96,8 +96,8 @@ struct TensorEvaluator, Device> typedef typename Storage::Type EvaluatorPointerType; typedef StorageMemory, Device> ConstCastStorage; - static const int NumOutputDims = internal::array_size::value; - static const int NumInputDims = internal::array_size::Dimensions>::value; + static constexpr int NumOutputDims = internal::array_size::value; + static constexpr int NumInputDims = internal::array_size::Dimensions>::value; enum ReshapingKind { // We do not use layout information to determine reshaping kind. @@ -314,8 +314,8 @@ struct traits > : public traits Nested_; - static const int NumDimensions = array_size::value; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = array_size::value; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -406,7 +406,7 @@ template, Device> { typedef TensorSlicingOp XprType; - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; typedef typename XprType::Index Index; typedef typename XprType::Scalar Scalar; @@ -704,7 +704,7 @@ struct TensorEvaluator, Device> { typedef TensorEvaluator, Device> Base; typedef TensorSlicingOp XprType; - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; typedef typename XprType::Index Index; typedef typename XprType::Scalar Scalar; @@ -811,8 +811,8 @@ struct traits Nested_; - static const int NumDimensions = array_size::value; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = array_size::value; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -873,7 +873,7 @@ template, Device> { typedef TensorStridingSlicingOp XprType; - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; typedef typename XprType::Index Index; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; @@ -1059,7 +1059,7 @@ struct TensorEvaluator, Device> Base; typedef TensorStridingSlicingOp XprType; - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; static constexpr int Layout = TensorEvaluator::Layout; enum { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h b/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h index de615132b..cf348c3c5 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h @@ -31,8 +31,8 @@ struct traits > : public traits Nested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -88,12 +88,12 @@ struct TensorEvaluator, Device { typedef TensorPaddingOp XprType; typedef typename XprType::Index Index; - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h b/unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h index 4e86d119d..413c5c48e 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h @@ -31,8 +31,8 @@ struct traits > : public traits typedef typename XprTraits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions + 1; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions + 1; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -85,12 +85,12 @@ struct TensorEvaluator, Device> { typedef TensorPatchOp XprType; typedef typename XprType::Index Index; - static const int NumDims = internal::array_size::Dimensions>::value + 1; + static constexpr int NumDims = internal::array_size::Dimensions>::value + 1; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h b/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h index 65c0c17cf..0de404704 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h @@ -120,7 +120,7 @@ std::complex RandomToTypeUniform >(uint64_t* state, template class UniformRandomGenerator { public: - static const bool PacketAccess = true; + static constexpr bool PacketAccess = true; // Uses the given "seed" if non-zero, otherwise uses a random seed. EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE UniformRandomGenerator( @@ -234,7 +234,7 @@ std::complex RandomToTypeNormal >(uint64_t* state, template class NormalRandomGenerator { public: - static const bool PacketAccess = true; + static constexpr bool PacketAccess = true; // Uses the given "seed" if non-zero, otherwise uses a random seed. EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE NormalRandomGenerator(uint64_t seed = 0) { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h b/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h index 39b33df4d..e62397a62 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h @@ -43,8 +43,8 @@ namespace internal { typedef typename XprTraits::StorageKind StorageKind; typedef typename XprTraits::Index Index; typedef typename XprType::Nested Nested; - static const int NumDimensions = XprTraits::NumDimensions - array_size::value; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions - array_size::value; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; template struct MakePointer { @@ -351,7 +351,7 @@ struct InnerMostDimPreserver<-1, Self, Op, true> { // Default full reducer template 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) { const typename Self::Index num_coeffs = array_prod(self.m_impl.dimensions()); @@ -376,8 +376,8 @@ struct FullReducerShard { // Multithreaded full reducer template struct FullReducer { - static const bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful; - static const Index PacketSize = + static constexpr bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful; + static constexpr Index PacketSize = unpacket_traits::size; // launch one reducer per thread and accumulate the result. @@ -434,7 +434,7 @@ struct FullReducer { // Default inner reducer template 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_assert(false && "Not implemented"); @@ -445,7 +445,7 @@ struct InnerReducer { // Default outer reducer template 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_assert(false && "Not implemented"); @@ -457,7 +457,7 @@ struct OuterReducer { // Default Generic reducer template 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_assert(false && "Not implemented"); @@ -551,32 +551,32 @@ struct TensorReductionEvaluatorBase::Dimensions InputDimensions; - static const int NumInputDims = internal::array_size::value; - static const int NumReducedDims = internal::array_size::value; - static const int NumOutputDims = NumInputDims - NumReducedDims; + static constexpr int NumInputDims = internal::array_size::value; + static constexpr int NumReducedDims = internal::array_size::value; + static constexpr int NumOutputDims = NumInputDims - NumReducedDims; typedef std::conditional_t, DSizes > Dimensions; typedef typename XprType::Scalar Scalar; typedef TensorReductionEvaluatorBase, Device> Self; - static const bool InputPacketAccess = TensorEvaluator::PacketAccess; + static constexpr bool InputPacketAccess = TensorEvaluator::PacketAccess; typedef typename internal::ReductionReturnType::type CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const Index PacketSize = PacketType::size; + static constexpr Index PacketSize = PacketType::size; typedef typename Eigen::internal::traits::PointerType TensorPointerType; typedef StorageMemory Storage; 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. - static const int NumPreservedStrides = max_n_1::size; + static constexpr int NumPreservedStrides = max_n_1::size; // For full reductions #if defined(EIGEN_USE_GPU) && (defined(EIGEN_GPUCC)) static constexpr bool RunningOnGPU = internal::is_same::value; static constexpr bool RunningOnSycl = false; #elif defined(EIGEN_USE_SYCL) -static const bool RunningOnSycl = internal::is_same, Eigen::SyclDevice>::value; -static const bool RunningOnGPU = false; +static constexpr bool RunningOnSycl = internal::is_same, Eigen::SyclDevice>::value; +static constexpr bool RunningOnGPU = false; #else static constexpr bool RunningOnGPU = false; static constexpr bool RunningOnSycl = false; @@ -598,9 +598,9 @@ static const bool RunningOnGPU = false; typedef internal::TensorBlockNotImplemented TensorBlock; //===--------------------------------------------------------------------===// - static const bool ReducingInnerMostDims = internal::are_inner_most_dims::value; - static const bool PreservingInnerMostDims = internal::preserve_inner_most_dims::value; - static const bool RunningFullReduction = (NumOutputDims==0); + static constexpr bool ReducingInnerMostDims = internal::are_inner_most_dims::value; + static constexpr bool PreservingInnerMostDims = internal::preserve_inner_most_dims::value; + static constexpr bool RunningFullReduction = (NumOutputDims==0); 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) diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h b/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h index a4bef4733..51cdf443f 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h @@ -458,12 +458,12 @@ struct FullReducer { // so reduce the scope of the optimized version of the code to the simple cases // of doubles, floats and half floats #ifdef EIGEN_HAS_GPU_FP16 - static const bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && + static constexpr bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && (internal::is_same::value || internal::is_same::value || (internal::is_same::value && reducer_traits::PacketAccess)); #else // EIGEN_HAS_GPU_FP16 - static const bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && + static constexpr bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && (internal::is_same::value || internal::is_same::value); #endif // EIGEN_HAS_GPU_FP16 @@ -847,12 +847,12 @@ struct InnerReducer { // so reduce the scope of the optimized version of the code to the simple case // of floats and half floats. #ifdef EIGEN_HAS_GPU_FP16 - static const bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && + static constexpr bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && (internal::is_same::value || internal::is_same::value || (internal::is_same::value && reducer_traits::PacketAccess)); #else // EIGEN_HAS_GPU_FP16 - static const bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && + static constexpr bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && (internal::is_same::value || internal::is_same::value); #endif // EIGEN_HAS_GPU_FP16 @@ -909,7 +909,7 @@ struct OuterReducer { // 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 // of floats. - static const bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && + static constexpr bool HasOptimizedImplementation = !Self::ReducerTraits::IsStateful && (internal::is_same::value || internal::is_same::value); template diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h b/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h index 3813d93d9..843cb9d67 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h @@ -137,7 +137,7 @@ template class TensorRef : public TensorBase Nested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -90,12 +90,12 @@ struct TensorEvaluator, Device { typedef TensorReverseOp XprType; typedef typename XprType::Index Index; - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; @@ -414,7 +414,7 @@ struct TensorEvaluator, Device> Device> Base; typedef TensorReverseOp XprType; typedef typename XprType::Index Index; - static const int NumDims = internal::array_size::value; + static constexpr int NumDims = internal::array_size::value; typedef DSizes Dimensions; static constexpr int Layout = TensorEvaluator::Layout; @@ -432,7 +432,7 @@ struct TensorEvaluator, Device> typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; //===- Tensor block evaluation strategy (see TensorBlock.h) -------------===// typedef internal::TensorBlockNotImplemented TensorBlock; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h b/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h index 3b49aaea7..ed0a731aa 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h @@ -24,8 +24,8 @@ struct traits > typedef typename XprTraits::StorageKind StorageKind; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -381,7 +381,7 @@ struct TensorEvaluator, Device> { typedef typename XprType::Index Index; typedef const ArgType ChildTypeNoConst; typedef const ArgType ChildType; - static const int NumDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = internal::array_size::Dimensions>::value; typedef DSizes Dimensions; typedef std::remove_const_t Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h b/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h index 6c7f0a41e..e50a57022 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h @@ -31,8 +31,8 @@ struct traits > : public traits typedef typename XprTraits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -90,12 +90,12 @@ struct TensorEvaluator, Device> typedef TensorEvaluator, Device> Self; typedef TensorShufflingOp XprType; typedef typename XprType::Index Index; - static const int NumDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = internal::array_size::Dimensions>::value; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; @@ -364,12 +364,12 @@ struct TensorEvaluator, Device> typedef TensorShufflingOp XprType; typedef typename XprType::Index Index; - static const int NumDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = internal::array_size::Dimensions>::value; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; static constexpr int Layout = TensorEvaluator::Layout; enum { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h b/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h index e79cddf3c..2d63a1c9f 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h @@ -41,10 +41,10 @@ template class TensorStorage { 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. - static const std::size_t MinSize = max_n_1::size; + static constexpr std::size_t MinSize = max_n_1::size; EIGEN_ALIGN_MAX T m_data[MinSize]; public: diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h b/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h index f836659a9..609afe3b9 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h @@ -31,8 +31,8 @@ struct traits > : public traits typedef typename XprTraits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -88,12 +88,12 @@ struct TensorEvaluator, Device> { typedef TensorStridingOp XprType; typedef typename XprType::Index Index; - static const int NumDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = internal::array_size::Dimensions>::value; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; @@ -267,7 +267,7 @@ struct TensorEvaluator, Device> typedef TensorStridingOp XprType; typedef TensorEvaluator Base; // typedef typename XprType::Index Index; - static const int NumDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = internal::array_size::Dimensions>::value; // typedef DSizes Dimensions; static constexpr int Layout = TensorEvaluator::Layout; @@ -286,7 +286,7 @@ struct TensorEvaluator, Device> typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) { diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h b/unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h index 25f8ff003..d68220266 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h @@ -33,8 +33,8 @@ struct traits > : public traits typedef typename XprTraits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions - array_size::value; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions - array_size::value; + static constexpr int Layout = XprTraits::Layout; }; template @@ -84,15 +84,15 @@ template struct TensorEvaluator, Device> { typedef TensorTraceOp XprType; - static const int NumInputDims = internal::array_size::Dimensions>::value; - static const int NumReducedDims = internal::array_size::value; - static const int NumOutputDims = NumInputDims - NumReducedDims; + static constexpr int NumInputDims = internal::array_size::Dimensions>::value; + static constexpr int NumReducedDims = internal::array_size::value; + static constexpr int NumOutputDims = NumInputDims - NumReducedDims; typedef typename XprType::Index Index; typedef DSizes Dimensions; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = internal::unpacket_traits::size; + static constexpr int PacketSize = internal::unpacket_traits::size; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h b/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h index 1a4f4e8a7..295f6e5bb 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h @@ -52,8 +52,8 @@ struct traits > typedef Scalar_ Scalar; typedef Dense StorageKind; typedef IndexType_ Index; - static const int NumDimensions = NumIndices_; - static const int Layout = Options_ & RowMajor ? RowMajor : ColMajor; + static constexpr int NumDimensions = NumIndices_; + static constexpr int Layout = Options_ & RowMajor ? RowMajor : ColMajor; enum { Options = Options_, Flags = compute_tensor_flags::ret | (is_const::value ? 0 : LvalueBit) @@ -71,8 +71,8 @@ struct traits > typedef Scalar_ Scalar; typedef Dense StorageKind; typedef IndexType_ Index; - static const int NumDimensions = array_size::value; - static const int Layout = Options_ & RowMajor ? RowMajor : ColMajor; + static constexpr int NumDimensions = array_size::value; + static constexpr int Layout = Options_ & RowMajor ? RowMajor : ColMajor; enum { Options = Options_, Flags = compute_tensor_flags::ret | (is_const::value ? 0: LvalueBit) @@ -92,8 +92,8 @@ struct traits > typedef typename BaseTraits::Scalar Scalar; typedef typename BaseTraits::StorageKind StorageKind; typedef typename BaseTraits::Index Index; - static const int NumDimensions = BaseTraits::NumDimensions; - static const int Layout = BaseTraits::Layout; + static constexpr int NumDimensions = BaseTraits::NumDimensions; + static constexpr int Layout = BaseTraits::Layout; enum { Options = Options_, Flags = BaseTraits::Flags @@ -114,8 +114,8 @@ struct traits > typedef typename BaseTraits::Scalar Scalar; typedef typename BaseTraits::StorageKind StorageKind; typedef typename BaseTraits::Index Index; - static const int NumDimensions = BaseTraits::NumDimensions; - static const int Layout = BaseTraits::Layout; + static constexpr int NumDimensions = BaseTraits::NumDimensions; + static constexpr int Layout = BaseTraits::Layout; enum { Options = BaseTraits::Options, Flags = BaseTraits::Flags diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h b/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h index a6fddba30..3523a9431 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h @@ -34,8 +34,8 @@ struct traits > : public traits typedef typename XprTraits::Index Index; typedef typename XprType::Nested Nested; typedef std::remove_reference_t Nested_; - static const int NumDimensions = XprTraits::NumDimensions + 1; - static const int Layout = XprTraits::Layout; + static constexpr int NumDimensions = XprTraits::NumDimensions + 1; + static constexpr int Layout = XprTraits::Layout; typedef typename XprTraits::PointerType PointerType; }; @@ -172,13 +172,13 @@ struct TensorEvaluator, D { typedef TensorVolumePatchOp XprType; typedef typename XprType::Index Index; - static const int NumInputDims = internal::array_size::Dimensions>::value; - static const int NumDims = NumInputDims + 1; + static constexpr int NumInputDims = internal::array_size::Dimensions>::value; + static constexpr int NumDims = NumInputDims + 1; typedef DSizes Dimensions; typedef std::remove_const_t Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; typedef typename PacketType::type PacketReturnType; - static const int PacketSize = PacketType::size; + static constexpr int PacketSize = PacketType::size; typedef StorageMemory Storage; typedef typename Storage::Type EvaluatorPointerType; diff --git a/unsupported/Eigen/CXX11/src/util/CXX11Meta.h b/unsupported/Eigen/CXX11/src/util/CXX11Meta.h index f662dee5b..bcf847e76 100644 --- a/unsupported/Eigen/CXX11/src/util/CXX11Meta.h +++ b/unsupported/Eigen/CXX11/src/util/CXX11Meta.h @@ -35,7 +35,8 @@ template struct numeric_list { constexpr static std::size_t count = sizeof...(nn); }; template -struct numeric_list { static const std::size_t count = sizeof...(nn) + 1; const static T first_value = n; }; +struct numeric_list { static constexpr std::size_t count = sizeof...(nn) + 1; + static constexpr T first_value = n; }; #ifndef EIGEN_PARSED_BY_DOXYGEN /* numeric list constructors diff --git a/unsupported/Eigen/src/EulerAngles/EulerSystem.h b/unsupported/Eigen/src/EulerAngles/EulerSystem.h index bf5804de9..278f9bf22 100644 --- a/unsupported/Eigen/src/EulerAngles/EulerSystem.h +++ b/unsupported/Eigen/src/EulerAngles/EulerSystem.h @@ -132,13 +132,13 @@ namespace Eigen // that enum is not guerantee to support negative numbers /** The first rotation axis */ - static const int AlphaAxis = _AlphaAxis; + static constexpr int AlphaAxis = _AlphaAxis; /** The second rotation axis */ - static const int BetaAxis = _BetaAxis; + static constexpr int BetaAxis = _BetaAxis; /** The third rotation axis */ - static const int GammaAxis = _GammaAxis; + static constexpr int GammaAxis = _GammaAxis; enum { diff --git a/unsupported/Eigen/src/SparseExtra/RandomSetter.h b/unsupported/Eigen/src/SparseExtra/RandomSetter.h index 656ea0555..9476ee3fb 100644 --- a/unsupported/Eigen/src/SparseExtra/RandomSetter.h +++ b/unsupported/Eigen/src/SparseExtra/RandomSetter.h @@ -171,7 +171,7 @@ class RandomSetter }; typedef typename MapTraits::KeyType KeyType; typedef typename MapTraits::Type HashMapType; - static const int OuterPacketMask = (1 << OuterPacketBits) - 1; + static constexpr int OuterPacketMask = (1 << OuterPacketBits) - 1; enum { SwapStorage = 1 - MapTraits::IsSorted, TargetRowMajor = (SparseMatrixType::Flags & RowMajorBit) ? 1 : 0,