diff --git a/.clang-format b/.clang-format index 28251c665..f3870b820 100644 --- a/.clang-format +++ b/.clang-format @@ -2,6 +2,8 @@ Language: Cpp BasedOnStyle: Google ColumnLimit: 120 +StatementMacros: + - EIGEN_STATIC_ASSERT SortIncludes: false AttributeMacros: - EIGEN_STRONG_INLINE diff --git a/Eigen/src/Core/CoreEvaluators.h b/Eigen/src/Core/CoreEvaluators.h index 5e1cbf6ec..5da9c5798 100644 --- a/Eigen/src/Core/CoreEvaluators.h +++ b/Eigen/src/Core/CoreEvaluators.h @@ -167,7 +167,7 @@ class plainobjectbase_evaluator_data { }; template -struct evaluator > : evaluator_base { +struct evaluator> : evaluator_base { typedef PlainObjectBase PlainObjectType; typedef typename PlainObjectType::Scalar Scalar; typedef typename PlainObjectType::CoeffReturnType CoeffReturnType; @@ -247,31 +247,29 @@ struct evaluator > : evaluator_base { }; template -struct evaluator > - : evaluator > > { +struct evaluator> + : evaluator>> { typedef Matrix XprType; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator() {} - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& m) - : evaluator >(m) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& m) : evaluator>(m) {} }; template -struct evaluator > - : evaluator > > { +struct evaluator> + : evaluator>> { typedef Array XprType; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator() {} - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& m) - : evaluator >(m) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& m) : evaluator>(m) {} }; // -------------------- Transpose -------------------- template -struct unary_evaluator, IndexBased> : evaluator_base > { +struct unary_evaluator, IndexBased> : evaluator_base> { typedef Transpose XprType; enum { @@ -460,8 +458,8 @@ struct nullary_wrapper #endif // MSVC workaround template -struct evaluator > - : evaluator_base > { +struct evaluator> + : evaluator_base> { typedef CwiseNullaryOp XprType; typedef internal::remove_all_t PlainObjectTypeCleaned; @@ -509,7 +507,7 @@ struct evaluator > // -------------------- CwiseUnaryOp -------------------- template -struct unary_evaluator, IndexBased> : evaluator_base > { +struct unary_evaluator, IndexBased> : evaluator_base> { typedef CwiseUnaryOp XprType; enum { @@ -762,17 +760,17 @@ struct unary_evaluator, ArgType>, In // this is a ternary expression template -struct evaluator > - : public ternary_evaluator > { +struct evaluator> + : public ternary_evaluator> { typedef CwiseTernaryOp XprType; - typedef ternary_evaluator > Base; + typedef ternary_evaluator> Base; EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {} }; template struct ternary_evaluator, IndexBased, IndexBased> - : evaluator_base > { + : evaluator_base> { typedef CwiseTernaryOp XprType; enum { @@ -865,16 +863,16 @@ struct evaluator, // this is a binary expression template -struct evaluator > : public binary_evaluator > { +struct evaluator> : public binary_evaluator> { typedef CwiseBinaryOp XprType; - typedef binary_evaluator > Base; + typedef binary_evaluator> Base; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) : Base(xpr) {} }; template struct binary_evaluator, IndexBased, IndexBased> - : evaluator_base > { + : evaluator_base> { typedef CwiseBinaryOp XprType; enum { @@ -939,7 +937,7 @@ struct binary_evaluator, IndexBased, IndexBase template struct unary_evaluator, IndexBased> - : evaluator_base > { + : evaluator_base> { typedef CwiseUnaryView XprType; enum { @@ -1067,7 +1065,7 @@ struct mapbase_evaluator : evaluator_base { }; template -struct evaluator > +struct evaluator> : public mapbase_evaluator, PlainObjectType> { typedef Map XprType; typedef typename XprType::Scalar Scalar; @@ -1100,13 +1098,13 @@ struct evaluator > // -------------------- Ref -------------------- template -struct evaluator > +struct evaluator> : public mapbase_evaluator, PlainObjectType> { typedef Ref XprType; enum { - Flags = evaluator >::Flags, - Alignment = evaluator >::Alignment + Flags = evaluator>::Flags, + Alignment = evaluator>::Alignment }; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& ref) @@ -1120,7 +1118,7 @@ template -struct evaluator > +struct evaluator> : block_evaluator { typedef Block XprType; typedef typename XprType::Scalar Scalar; @@ -1171,7 +1169,7 @@ struct evaluator > // no direct-access => dispatch to a unary evaluator template struct block_evaluator - : unary_evaluator > { + : unary_evaluator> { typedef Block XprType; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit block_evaluator(const XprType& block) @@ -1180,7 +1178,7 @@ struct block_evaluator struct unary_evaluator, IndexBased> - : evaluator_base > { + : evaluator_base> { typedef Block XprType; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& block) @@ -1293,8 +1291,8 @@ struct block_evaluator -struct evaluator > - : evaluator_base > { +struct evaluator> + : evaluator_base> { typedef Select XprType; enum { CoeffReadCost = evaluator::CoeffReadCost + @@ -1335,8 +1333,8 @@ struct evaluator > // -------------------- Replicate -------------------- template -struct unary_evaluator > - : evaluator_base > { +struct unary_evaluator> + : evaluator_base> { typedef Replicate XprType; typedef typename XprType::CoeffReturnType CoeffReturnType; enum { Factor = (RowFactor == Dynamic || ColFactor == Dynamic) ? Dynamic : RowFactor * ColFactor }; @@ -1461,19 +1459,19 @@ struct evaluator_wrapper_base : evaluator_base { }; template -struct unary_evaluator > : evaluator_wrapper_base > { +struct unary_evaluator> : evaluator_wrapper_base> { typedef MatrixWrapper XprType; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& wrapper) - : evaluator_wrapper_base >(wrapper.nestedExpression()) {} + : evaluator_wrapper_base>(wrapper.nestedExpression()) {} }; template -struct unary_evaluator > : evaluator_wrapper_base > { +struct unary_evaluator> : evaluator_wrapper_base> { typedef ArrayWrapper XprType; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit unary_evaluator(const XprType& wrapper) - : evaluator_wrapper_base >(wrapper.nestedExpression()) {} + : evaluator_wrapper_base>(wrapper.nestedExpression()) {} }; // -------------------- Reverse -------------------- @@ -1483,7 +1481,7 @@ template struct reverse_packet_cond; template -struct unary_evaluator > : evaluator_base > { +struct unary_evaluator> : evaluator_base> { typedef Reverse XprType; typedef typename XprType::Scalar Scalar; typedef typename XprType::CoeffReturnType CoeffReturnType; @@ -1584,7 +1582,7 @@ struct unary_evaluator > : evaluator_base -struct evaluator > : evaluator_base > { +struct evaluator> : evaluator_base> { typedef Diagonal XprType; enum { @@ -1643,10 +1641,10 @@ template class EvalToTemp; template -struct traits > : public traits {}; +struct traits> : public traits {}; template -class EvalToTemp : public dense_xpr_base >::type { +class EvalToTemp : public dense_xpr_base>::type { public: typedef typename dense_xpr_base::type Base; EIGEN_GENERIC_PUBLIC_INTERFACE(EvalToTemp) @@ -1664,7 +1662,7 @@ class EvalToTemp : public dense_xpr_base >::type { }; template -struct evaluator > : public evaluator { +struct evaluator> : public evaluator { typedef EvalToTemp XprType; typedef typename ArgType::PlainObject PlainObject; typedef evaluator Base; diff --git a/Eigen/src/Core/GeneralProduct.h b/Eigen/src/Core/GeneralProduct.h index 1220073a8..b7ae44fda 100644 --- a/Eigen/src/Core/GeneralProduct.h +++ b/Eigen/src/Core/GeneralProduct.h @@ -243,17 +243,15 @@ struct gemv_static_vector_if { template struct gemv_static_vector_if { #if EIGEN_MAX_STATIC_ALIGN_BYTES != 0 - internal::plain_array - m_data; + internal::plain_array m_data; EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; } #else // Some architectures cannot align on the stack, // => let's manually enforce alignment by allocating more data and return the address of the first aligned element. - internal::plain_array< - Scalar, internal::min_size_prefer_fixed(Size, MaxSize) + EIGEN_MAX_ALIGN_BYTES, 0> - m_data; + internal::plain_array m_data; EIGEN_STRONG_INLINE Scalar* data() { - return reinterpret_cast((std::uintptr_t(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES - 1))) + EIGEN_MAX_ALIGN_BYTES); + return reinterpret_cast((std::uintptr_t(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES - 1))) + + EIGEN_MAX_ALIGN_BYTES); } #endif }; diff --git a/Eigen/src/Core/Replicate.h b/Eigen/src/Core/Replicate.h index c01c62737..11d7ad19e 100644 --- a/Eigen/src/Core/Replicate.h +++ b/Eigen/src/Core/Replicate.h @@ -80,15 +80,12 @@ class Replicate : public internal::dense_xpr_base EIGEN_DEVICE_FUNC inline Replicate(const OriginalMatrixType& matrix, Index rowFactor, Index colFactor) - : m_matrix(matrix), - m_rowFactor(rowFactor), - m_colFactor(colFactor){ - EIGEN_STATIC_ASSERT((internal::is_same, OriginalMatrixType>::value), - THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE)} - - EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const { - return m_matrix.rows() * m_rowFactor.value(); + : m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor) { + EIGEN_STATIC_ASSERT((internal::is_same, OriginalMatrixType>::value), + THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const { return m_matrix.rows() * m_rowFactor.value(); } EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const { return m_matrix.cols() * m_colFactor.value(); } EIGEN_DEVICE_FUNC const MatrixTypeNested_& nestedExpression() const { return m_matrix; } diff --git a/Eigen/src/Core/products/TriangularSolverMatrix.h b/Eigen/src/Core/products/TriangularSolverMatrix.h index 2122af956..8244758bd 100644 --- a/Eigen/src/Core/products/TriangularSolverMatrix.h +++ b/Eigen/src/Core/products/TriangularSolverMatrix.h @@ -57,7 +57,7 @@ EIGEN_STRONG_INLINE void trsmKernelL>(derived(), -a); } constexpr ProductExpr> operator*(Index a) const { - return ProductExpr >(derived(), a); + return ProductExpr>(derived(), a); } constexpr QuotientExpr> operator/(Index a) const { - return QuotientExpr >(derived(), a); + return QuotientExpr>(derived(), a); } friend constexpr AddExpr> operator+(Index a, const BaseExpr& b) { - return AddExpr >(b.derived(), a); + return AddExpr>(b.derived(), a); } friend constexpr AddExpr, ValueExpr<>> operator-(Index a, const BaseExpr& b) { - return AddExpr, ValueExpr<> >(-b.derived(), a); + return AddExpr, ValueExpr<>>(-b.derived(), a); } friend constexpr ProductExpr, Derived> operator*(Index a, const BaseExpr& b) { return ProductExpr, Derived>(a, b.derived()); @@ -117,41 +117,41 @@ class BaseExpr { template constexpr AddExpr>> operator+(internal::FixedInt) const { - return AddExpr > >(derived(), ValueExpr >()); + return AddExpr>>(derived(), ValueExpr>()); } template constexpr AddExpr>> operator-(internal::FixedInt) const { - return AddExpr > >(derived(), ValueExpr >()); + return AddExpr>>(derived(), ValueExpr>()); } template constexpr ProductExpr>> operator*(internal::FixedInt) const { - return ProductExpr > >(derived(), ValueExpr >()); + return ProductExpr>>(derived(), ValueExpr>()); } template constexpr QuotientExpr>> operator/(internal::FixedInt) const { - return QuotientExpr > >(derived(), ValueExpr >()); + return QuotientExpr>>(derived(), ValueExpr>()); } template friend constexpr AddExpr>> operator+(internal::FixedInt, const BaseExpr& b) { - return AddExpr > >(b.derived(), ValueExpr >()); + return AddExpr>>(b.derived(), ValueExpr>()); } template friend constexpr AddExpr, ValueExpr>> operator-(internal::FixedInt, const BaseExpr& b) { - return AddExpr, ValueExpr > >(-b.derived(), - ValueExpr >()); + return AddExpr, ValueExpr>>(-b.derived(), + ValueExpr>()); } template friend constexpr ProductExpr>, Derived> operator*(internal::FixedInt, const BaseExpr& b) { - return ProductExpr >, Derived>(ValueExpr >(), b.derived()); + return ProductExpr>, Derived>(ValueExpr>(), b.derived()); } template friend constexpr QuotientExpr>, Derived> operator/(internal::FixedInt, const BaseExpr& b) { - return QuotientExpr >, Derived>(ValueExpr >(), b.derived()); + return QuotientExpr>, Derived>(ValueExpr>(), b.derived()); } template @@ -161,7 +161,7 @@ class BaseExpr { template constexpr AddExpr> operator-(const BaseExpr& b) const { - return AddExpr >(derived(), -b.derived()); + return AddExpr>(derived(), -b.derived()); } template @@ -179,7 +179,7 @@ template struct is_symbolic { // BaseExpr has no conversion ctor, so we only have to check whether T can be statically cast to its base class // BaseExpr. - enum { value = internal::is_convertible >::value }; + enum { value = internal::is_convertible>::value }; }; // A simple wrapper around an integral value to provide the eval method. @@ -317,7 +317,7 @@ struct EvalSymbolValueHelper { /** Expression of a symbol uniquely identified by the template parameter type \c tag */ template -class SymbolExpr : public BaseExpr > { +class SymbolExpr : public BaseExpr> { public: /** Alias to the template parameter \c tag */ typedef tag Tag; @@ -349,7 +349,7 @@ class SymbolExpr : public BaseExpr > { }; template -class NegateExpr : public BaseExpr > { +class NegateExpr : public BaseExpr> { public: constexpr NegateExpr() = default; constexpr NegateExpr(const Arg0& arg0) : m_arg0(arg0) {} @@ -370,7 +370,7 @@ class NegateExpr : public BaseExpr > { }; template -class AddExpr : public BaseExpr > { +class AddExpr : public BaseExpr> { public: constexpr AddExpr() = default; constexpr AddExpr(const Arg0& arg0, const Arg1& arg1) : m_arg0(arg0), m_arg1(arg1) {} @@ -393,7 +393,7 @@ class AddExpr : public BaseExpr > { }; template -class ProductExpr : public BaseExpr > { +class ProductExpr : public BaseExpr> { public: constexpr ProductExpr() = default; constexpr ProductExpr(const Arg0& arg0, const Arg1& arg1) : m_arg0(arg0), m_arg1(arg1) {} @@ -416,7 +416,7 @@ class ProductExpr : public BaseExpr > { }; template -class QuotientExpr : public BaseExpr > { +class QuotientExpr : public BaseExpr> { public: constexpr QuotientExpr() = default; constexpr QuotientExpr(const Arg0& arg0, const Arg1& arg1) : m_arg0(arg0), m_arg1(arg1) {} diff --git a/Eigen/src/SVD/BDCSVD.h b/Eigen/src/SVD/BDCSVD.h index f80ddc0e2..52f3564c0 100644 --- a/Eigen/src/SVD/BDCSVD.h +++ b/Eigen/src/SVD/BDCSVD.h @@ -1233,7 +1233,7 @@ void BDCSVD::deflation44(Index firstColu, Index firstColm, using std::conj; using std::pow; using std::sqrt; - + RealScalar s = m_computed(firstColm + i, firstColm); RealScalar c = m_computed(firstColm + j, firstColm); RealScalar r = numext::hypot(c, s); @@ -1424,8 +1424,7 @@ void BDCSVD::deflation(Index firstCol, Index lastCol, Index if ((diag(i) - diag(i - 1)) < epsilon_strict) { #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE std::cout << "deflation 4.4 with i = " << i << " because " << diag(i) << " - " << diag(i - 1) - << " == " << (diag(i) - diag(i - 1)) << " < " - << epsilon_strict << "\n"; + << " == " << (diag(i) - diag(i - 1)) << " < " << epsilon_strict << "\n"; #endif eigen_internal_assert(abs(diag(i) - diag(i - 1)) < epsilon_coarse && " diagonal entries are not properly sorted"); diff --git a/scripts/format.sh b/scripts/format.sh new file mode 100755 index 000000000..f1c38b2b1 --- /dev/null +++ b/scripts/format.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Format files with extensions, excluding plugins because they're partial files that don't contain valid syntax +find . -type f \( -name '*.c' -o -name '*.cc' -o -name '*.cpp' -o -name '*.cu' -o -name '*.cxx' -o -name '*.h' -o -name '*.inc' -not -path '*/plugins/*' \) | xargs -n 1 -P 0 clang-format-17 -i + +# Format main headers without extensions +find Eigen -maxdepth 1 -type f | xargs -n 1 -P 0 clang-format-17 -i +find unsupported/Eigen -maxdepth 2 -type f -not -name '*.txt' | xargs -n 1 -P 0 clang-format-17 -i + +# Format examples +find doc/examples -type f -name '*.cpp.*' | xargs -n 1 -P 0 clang-format-17 -i diff --git a/test/array_cwise.cpp b/test/array_cwise.cpp index 155f77a2d..fdc5b481c 100644 --- a/test/array_cwise.cpp +++ b/test/array_cwise.cpp @@ -960,9 +960,9 @@ void array_complex(const ArrayType& m) { // Check for larger magnitude complex numbers that expm1 matches exp - 1. VERIFY_IS_APPROX(expm1(10. * m1), exp(10. * m1) - 1.); - VERIFY_IS_APPROX(sinh(m1), 0.5*(exp(m1)-exp(-m1))); - VERIFY_IS_APPROX(cosh(m1), 0.5*(exp(m1)+exp(-m1))); - VERIFY_IS_APPROX(tanh(m1), (0.5*(exp(m1)-exp(-m1)))/(0.5*(exp(m1)+exp(-m1)))); + VERIFY_IS_APPROX(sinh(m1), 0.5 * (exp(m1) - exp(-m1))); + VERIFY_IS_APPROX(cosh(m1), 0.5 * (exp(m1) + exp(-m1))); + VERIFY_IS_APPROX(tanh(m1), (0.5 * (exp(m1) - exp(-m1))) / (0.5 * (exp(m1) + exp(-m1)))); VERIFY_IS_APPROX(logistic(m1), (1.0 / (1.0 + exp(-m1)))); if (m1.size() > 0) { // Complex exponential overflow edge-case. diff --git a/test/array_for_matrix.cpp b/test/array_for_matrix.cpp index 10bfe68f0..e94398a65 100644 --- a/test/array_for_matrix.cpp +++ b/test/array_for_matrix.cpp @@ -140,7 +140,8 @@ void comparisons(const MatrixType& m) { // and/or VERIFY(((m1.array() < RealScalar(0)).matrix() && (m1.array() > RealScalar(0)).matrix()).count() == 0); VERIFY(((m1.array() < RealScalar(0)).matrix() || (m1.array() >= RealScalar(0)).matrix()).count() == rows * cols); - VERIFY(((m1.array() < -mid).matrix() || (m1.array() > mid).matrix()).count() == (m1.cwiseAbs().array() > mid).count()); + VERIFY(((m1.array() < -mid).matrix() || (m1.array() > mid).matrix()).count() == + (m1.cwiseAbs().array() > mid).count()); typedef Matrix VectorOfIndices; diff --git a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h index 9417469d2..9dc95916c 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/Tensor.h +++ b/unsupported/Eigen/CXX11/src/Tensor/Tensor.h @@ -239,18 +239,16 @@ class Tensor : public TensorBase - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor(Index firstDimension, IndexTypes... otherDimensions) - : m_storage(firstDimension, otherDimensions...) - { - // The number of dimensions used to construct a tensor must be equal to the rank of the tensor. - EIGEN_STATIC_ASSERT(sizeof...(otherDimensions) + 1 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE) - } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Tensor(Index firstDimension, IndexTypes... otherDimensions) + : m_storage(firstDimension, otherDimensions...) { + // The number of dimensions used to construct a tensor must be equal to the rank of the tensor. + EIGEN_STATIC_ASSERT(sizeof...(otherDimensions) + 1 == NumIndices, YOU_MADE_A_PROGRAMMING_MISTAKE) + } - /** Normal Dimension */ - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit Tensor(const array& dimensions) - : m_storage(internal::array_prod(dimensions), dimensions) - { + /** Normal Dimension */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit Tensor(const array& dimensions) + : m_storage(internal::array_prod(dimensions), dimensions) { EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h index ae8f25f87..06d4dfd30 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h @@ -215,14 +215,13 @@ struct DSizes : array { } template - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit DSizes(DenseIndex firstDimension, DenseIndex secondDimension, - IndexTypes... otherDimensions) - : Base({{firstDimension, secondDimension, otherDimensions...}}){EIGEN_STATIC_ASSERT( - sizeof...(otherDimensions) + 2 == NumDims, YOU_MADE_A_PROGRAMMING_MISTAKE)} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit DSizes(DenseIndex firstDimension, DenseIndex secondDimension, + IndexTypes... otherDimensions) + : Base({{firstDimension, secondDimension, otherDimensions...}}) { + EIGEN_STATIC_ASSERT(sizeof...(otherDimensions) + 2 == NumDims, YOU_MADE_A_PROGRAMMING_MISTAKE) + } - EIGEN_DEVICE_FUNC DSizes - & - operator=(const array& other) { + EIGEN_DEVICE_FUNC DSizes& operator=(const array& other) { *static_cast(this) = other; return *this; } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h b/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h index 2605219d0..0bdb1ab79 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h @@ -367,7 +367,8 @@ struct TensorPrinter 0) { const IndexType first_dim = Eigen::internal::array_get<0>(tensor.dimensions()); - Map> matrix(tensor.data(), first_dim, total_size / first_dim); + Map> matrix(tensor.data(), first_dim, + total_size / first_dim); s << matrix; return; } diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h b/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h index c201707fe..191413b7d 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h @@ -79,14 +79,14 @@ class TensorMap : public TensorBase EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr, Index firstDimension, IndexTypes... otherDimensions) - : m_data(dataPtr), - m_dimensions(firstDimension, otherDimensions...){ - // The number of dimensions used to construct a tensor must be equal to the rank of the tensor. - EIGEN_STATIC_ASSERT((sizeof...(otherDimensions) + 1 == NumIndices || NumIndices == Dynamic), - YOU_MADE_A_PROGRAMMING_MISTAKE)} + : m_data(dataPtr), m_dimensions(firstDimension, otherDimensions...) { + // The number of dimensions used to construct a tensor must be equal to the rank of the tensor. + EIGEN_STATIC_ASSERT((sizeof...(otherDimensions) + 1 == NumIndices || NumIndices == Dynamic), + YOU_MADE_A_PROGRAMMING_MISTAKE) + } - EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr, - const array& dimensions) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE TensorMap(StoragePointerType dataPtr, + const array& dimensions) : m_data(dataPtr), m_dimensions(dimensions) {} template diff --git a/unsupported/Eigen/FFT b/unsupported/Eigen/FFT index 557fdf6c6..f32ad36aa 100644 --- a/unsupported/Eigen/FFT +++ b/unsupported/Eigen/FFT @@ -231,7 +231,7 @@ class FFT { THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_WITH_DIRECT_MEMORY_ACCESS_SUCH_AS_MAP_OR_PLAIN_MATRICES) if (nfft < 1) nfft = src.size(); - + Index dst_size = nfft; if (NumTraits::IsComplex == 0 && HasFlag(HalfSpectrum)) { dst_size = (nfft >> 1) + 1;