diff --git a/Eigen/src/Cholesky/LDLT.h b/Eigen/src/Cholesky/LDLT.h index 350cdea92..267440596 100644 --- a/Eigen/src/Cholesky/LDLT.h +++ b/Eigen/src/Cholesky/LDLT.h @@ -272,10 +272,7 @@ template class LDLT protected: - static void check_template_parameters() - { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); - } + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) /** \internal * Used to compute and store the Cholesky decomposition A = L D L^* = U^* D U. @@ -500,8 +497,6 @@ template template LDLT& LDLT::compute(const EigenBase& a) { - check_template_parameters(); - eigen_assert(a.rows()==a.cols()); const Index size = a.rows(); diff --git a/Eigen/src/Cholesky/LLT.h b/Eigen/src/Cholesky/LLT.h index 8ce93b216..f22d2a751 100644 --- a/Eigen/src/Cholesky/LLT.h +++ b/Eigen/src/Cholesky/LLT.h @@ -219,10 +219,7 @@ template class LLT protected: - static void check_template_parameters() - { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); - } + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) /** \internal * Used to compute and store L @@ -433,8 +430,6 @@ template template LLT& LLT::compute(const EigenBase& a) { - check_template_parameters(); - eigen_assert(a.rows()==a.cols()); const Index size = a.rows(); m_matrix.resize(size, size); diff --git a/Eigen/src/Core/Array.h b/Eigen/src/Core/Array.h index 2e2c3a4fd..c39aa15bd 100644 --- a/Eigen/src/Core/Array.h +++ b/Eigen/src/Core/Array.h @@ -133,7 +133,6 @@ class Array EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array() : Base() { - Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } @@ -144,7 +143,6 @@ class Array Array(internal::constructor_without_unaligned_array_assert) : Base(internal::constructor_without_unaligned_array_assert()) { - Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #endif @@ -154,7 +152,6 @@ class Array Array(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible::value) : Base(std::move(other)) { - Base::_check_template_params(); } EIGEN_DEVICE_FUNC Array& operator=(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable::value) @@ -208,7 +205,6 @@ class Array EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit Array(const T& x) { - Base::_check_template_params(); Base::template _init1(x); } @@ -216,7 +212,6 @@ class Array EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array(const T0& val0, const T1& val1) { - Base::_check_template_params(); this->template _init2(val0, val1); } @@ -251,7 +246,6 @@ class Array EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2) { - Base::_check_template_params(); EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 3) m_storage.data()[0] = val0; m_storage.data()[1] = val1; @@ -263,7 +257,6 @@ class Array EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2, const Scalar& val3) { - Base::_check_template_params(); EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 4) m_storage.data()[0] = val0; m_storage.data()[1] = val1; diff --git a/Eigen/src/Core/AssignEvaluator.h b/Eigen/src/Core/AssignEvaluator.h index 91c1d9ce3..5056328a0 100644 --- a/Eigen/src/Core/AssignEvaluator.h +++ b/Eigen/src/Core/AssignEvaluator.h @@ -329,8 +329,7 @@ struct dense_assignment_loop { EIGEN_DEVICE_FUNC static void EIGEN_STRONG_INLINE run(Kernel& /*kernel*/) { - typedef typename Kernel::DstEvaluatorType::XprType DstXprType; - EIGEN_STATIC_ASSERT(int(DstXprType::SizeAtCompileTime) == 0, + EIGEN_STATIC_ASSERT(int(Kernel::DstEvaluatorType::XprType::SizeAtCompileTime) == 0, EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT) } }; diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index a02995230..98fdabb6f 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -97,6 +97,9 @@ class CwiseBinaryOp : BinaryOp>::ret>::Base Base; EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseBinaryOp) + EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename Rhs::Scalar) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs) + typedef typename internal::ref_selector::type LhsNested; typedef typename internal::ref_selector::type RhsNested; typedef typename internal::remove_reference::type _LhsNested; @@ -112,9 +115,6 @@ class CwiseBinaryOp : CwiseBinaryOp(const Lhs& aLhs, const Rhs& aRhs, const BinaryOp& func = BinaryOp()) : m_lhs(aLhs), m_rhs(aRhs), m_functor(func) { - EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename Rhs::Scalar); - // require the sizes to match - EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs) eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols()); } diff --git a/Eigen/src/Core/CwiseTernaryOp.h b/Eigen/src/Core/CwiseTernaryOp.h index 897c6d435..52a0ae7ae 100644 --- a/Eigen/src/Core/CwiseTernaryOp.h +++ b/Eigen/src/Core/CwiseTernaryOp.h @@ -93,6 +93,20 @@ class CwiseTernaryOp : public CwiseTernaryOpImpl< typedef typename internal::remove_all::type Arg2; typedef typename internal::remove_all::type Arg3; + // require the sizes to match + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg2) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg3) + + // The index types should match + EIGEN_STATIC_ASSERT((internal::is_same< + typename internal::traits::StorageKind, + typename internal::traits::StorageKind>::value), + STORAGE_KIND_MUST_MATCH) + EIGEN_STATIC_ASSERT((internal::is_same< + typename internal::traits::StorageKind, + typename internal::traits::StorageKind>::value), + STORAGE_KIND_MUST_MATCH) + typedef typename CwiseTernaryOpImpl< TernaryOp, Arg1Type, Arg2Type, Arg3Type, typename internal::traits::StorageKind>::Base Base; @@ -110,20 +124,6 @@ class CwiseTernaryOp : public CwiseTernaryOpImpl< const Arg3& a3, const TernaryOp& func = TernaryOp()) : m_arg1(a1), m_arg2(a2), m_arg3(a3), m_functor(func) { - // require the sizes to match - EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg2) - EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg3) - - // The index types should match - EIGEN_STATIC_ASSERT((internal::is_same< - typename internal::traits::StorageKind, - typename internal::traits::StorageKind>::value), - STORAGE_KIND_MUST_MATCH) - EIGEN_STATIC_ASSERT((internal::is_same< - typename internal::traits::StorageKind, - typename internal::traits::StorageKind>::value), - STORAGE_KIND_MUST_MATCH) - eigen_assert(a1.rows() == a2.rows() && a1.cols() == a2.cols() && a1.rows() == a3.rows() && a1.cols() == a3.cols()); } diff --git a/Eigen/src/Core/DenseBase.h b/Eigen/src/Core/DenseBase.h index 687a32e54..940eabd92 100644 --- a/Eigen/src/Core/DenseBase.h +++ b/Eigen/src/Core/DenseBase.h @@ -15,15 +15,8 @@ namespace Eigen { -namespace internal { - // The index type defined by EIGEN_DEFAULT_DENSE_INDEX_TYPE must be a signed type. -// This dummy function simply aims at checking that at compile time. -static inline void check_DenseIndex_is_signed() { - EIGEN_STATIC_ASSERT(NumTraits::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE) -} - -} // end namespace internal +EIGEN_STATIC_ASSERT(NumTraits::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE) /** \class DenseBase * \ingroup Core_Module diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h index 2f4b5e7e0..56d1ff86f 100644 --- a/Eigen/src/Core/Map.h +++ b/Eigen/src/Core/Map.h @@ -131,7 +131,6 @@ template class Ma explicit inline Map(PointerArgType dataPtr, const StrideType& stride = StrideType()) : Base(cast_to_pointer_type(dataPtr)), m_stride(stride) { - PlainObjectType::Base::_check_template_params(); } /** Constructor in the dynamic-size vector case. @@ -144,7 +143,6 @@ template class Ma inline Map(PointerArgType dataPtr, Index size, const StrideType& stride = StrideType()) : Base(cast_to_pointer_type(dataPtr), size), m_stride(stride) { - PlainObjectType::Base::_check_template_params(); } /** Constructor in the dynamic-size matrix case. @@ -158,7 +156,6 @@ template class Ma inline Map(PointerArgType dataPtr, Index rows, Index cols, const StrideType& stride = StrideType()) : Base(cast_to_pointer_type(dataPtr), rows, cols), m_stride(stride) { - PlainObjectType::Base::_check_template_params(); } EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map) diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h index 6e5c77b2d..957cca779 100644 --- a/Eigen/src/Core/MathFunctions.h +++ b/Eigen/src/Core/MathFunctions.h @@ -471,10 +471,11 @@ inline NewType cast(const OldType& x) template struct round_impl { + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) { - EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) #if EIGEN_HAS_CXX11_MATH EIGEN_USING_STD(round); #endif @@ -497,10 +498,11 @@ struct round_impl { template struct round_using_floor_ceil_impl { + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) { - EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) // Without C99 round/roundf, resort to floor/ceil. EIGEN_USING_STD(floor); EIGEN_USING_STD(ceil); @@ -534,10 +536,11 @@ struct round_retval template struct rint_impl { + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) { - EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) #if EIGEN_HAS_CXX11_MATH EIGEN_USING_STD(rint); #endif @@ -738,9 +741,10 @@ namespace std_fallback { template struct log1p_impl { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) #if EIGEN_HAS_CXX11_MATH using std::log1p; #else @@ -753,9 +757,10 @@ struct log1p_impl { // Specialization for complex types that are not supported by std::log1p. template struct log1p_impl > { + EIGEN_STATIC_ASSERT_NON_INTEGER(RealScalar) + EIGEN_DEVICE_FUNC static inline std::complex run( const std::complex& x) { - EIGEN_STATIC_ASSERT_NON_INTEGER(RealScalar) return std_fallback::log1p(x); } }; @@ -2008,9 +2013,10 @@ namespace internal { // Specialization for complex types that are not supported by std::expm1. template struct expm1_impl > { + EIGEN_STATIC_ASSERT_NON_INTEGER(RealScalar) + EIGEN_DEVICE_FUNC static inline std::complex run( const std::complex& x) { - EIGEN_STATIC_ASSERT_NON_INTEGER(RealScalar) RealScalar xr = x.real(); RealScalar xi = x.imag(); // expm1(z) = exp(z) - 1 diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index c77187f1d..bc75a28ef 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -260,7 +260,6 @@ class Matrix EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix() : Base() { - Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } @@ -268,15 +267,12 @@ class Matrix EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit Matrix(internal::constructor_without_unaligned_array_assert) : Base(internal::constructor_without_unaligned_array_assert()) - { Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } + { EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #if EIGEN_HAS_RVALUE_REFERENCES EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible::value) - : Base(std::move(other)) - { - Base::_check_template_params(); - } + : Base(std::move(other)) {} EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix& operator=(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable::value) { @@ -330,7 +326,6 @@ class Matrix EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit Matrix(const T& x) { - Base::_check_template_params(); Base::template _init1(x); } @@ -338,7 +333,6 @@ class Matrix EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const T0& x, const T1& y) { - Base::_check_template_params(); Base::template _init2(x, y); } @@ -390,7 +384,6 @@ class Matrix EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z) { - Base::_check_template_params(); EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 3) m_storage.data()[0] = x; m_storage.data()[1] = y; @@ -402,7 +395,6 @@ class Matrix EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) { - Base::_check_template_params(); EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 4) m_storage.data()[0] = x; m_storage.data()[1] = y; diff --git a/Eigen/src/Core/PlainObjectBase.h b/Eigen/src/Core/PlainObjectBase.h index 30b7a1048..607e1c8b3 100644 --- a/Eigen/src/Core/PlainObjectBase.h +++ b/Eigen/src/Core/PlainObjectBase.h @@ -136,6 +136,16 @@ class PlainObjectBase : public internal::dense_xpr_base::type enum { NeedsToAlign = (SizeAtCompileTime != Dynamic) && (internal::traits::Alignment>0) }; EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) + EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (int(Options)&RowMajor)==RowMajor), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (int(Options)&RowMajor)==0), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT((MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime==Dynamic), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT((MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime==Dynamic), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_STATIC_ASSERT(((Options & (DontAlign|RowMajor)) == Options), INVALID_MATRIX_TEMPLATE_PARAMETERS) + EIGEN_DEVICE_FUNC Base& base() { return *static_cast(this); } EIGEN_DEVICE_FUNC @@ -272,7 +282,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index rows, Index cols) { - eigen_assert( EIGEN_IMPLIES(RowsAtCompileTime!=Dynamic,rows==RowsAtCompileTime) + eigen_assert(EIGEN_IMPLIES(RowsAtCompileTime!=Dynamic,rows==RowsAtCompileTime) && EIGEN_IMPLIES(ColsAtCompileTime!=Dynamic,cols==ColsAtCompileTime) && EIGEN_IMPLIES(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic,rows<=MaxRowsAtCompileTime) && EIGEN_IMPLIES(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic,cols<=MaxColsAtCompileTime) @@ -477,7 +487,6 @@ class PlainObjectBase : public internal::dense_xpr_base::type EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase() : m_storage() { -// _check_template_params(); // EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } @@ -488,7 +497,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type explicit PlainObjectBase(internal::constructor_without_unaligned_array_assert) : m_storage(internal::constructor_without_unaligned_array_assert()) { -// _check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + // EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #endif @@ -502,7 +511,6 @@ class PlainObjectBase : public internal::dense_xpr_base::type EIGEN_DEVICE_FUNC PlainObjectBase& operator=(PlainObjectBase&& other) EIGEN_NOEXCEPT { - _check_template_params(); m_storage = std::move(other.m_storage); return *this; } @@ -516,7 +524,6 @@ class PlainObjectBase : public internal::dense_xpr_base::type EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols) : m_storage(size, rows, cols) { -// _check_template_params(); // EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } @@ -536,7 +543,6 @@ class PlainObjectBase : public internal::dense_xpr_base::type PlainObjectBase(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) : m_storage() { - _check_template_params(); EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, sizeof...(args) + 4); m_storage.data()[0] = a0; m_storage.data()[1] = a1; @@ -554,8 +560,6 @@ class PlainObjectBase : public internal::dense_xpr_base::type explicit EIGEN_STRONG_INLINE PlainObjectBase(const std::initializer_list>& list) : m_storage() { - _check_template_params(); - size_t list_size = 0; if (list.begin() != list.end()) { list_size = list.begin()->size(); @@ -591,7 +595,6 @@ class PlainObjectBase : public internal::dense_xpr_base::type EIGEN_STRONG_INLINE PlainObjectBase(const DenseBase &other) : m_storage() { - _check_template_params(); resizeLike(other); _set_noalias(other); } @@ -602,7 +605,6 @@ class PlainObjectBase : public internal::dense_xpr_base::type EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase &other) : m_storage() { - _check_template_params(); resizeLike(other); *this = other.derived(); } @@ -611,7 +613,6 @@ class PlainObjectBase : public internal::dense_xpr_base::type EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const ReturnByValue& other) { - _check_template_params(); // FIXME this does not automatically transpose vectors if necessary resize(other.rows(), other.cols()); other.evalTo(this->derived()); @@ -966,21 +967,6 @@ class PlainObjectBase : public internal::dense_xpr_base::type void swap(DenseBase const & other) { Base::swap(other.derived()); } - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE void _check_template_params() - { - EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (int(Options)&RowMajor)==RowMajor) - && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (int(Options)&RowMajor)==0) - && ((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0)) - && ((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0)) - && ((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0)) - && ((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0)) - && (MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime==Dynamic) - && (MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime==Dynamic) - && (Options & (DontAlign|RowMajor)) == Options), - INVALID_MATRIX_TEMPLATE_PARAMETERS) - } - enum { IsPlainObjectBase = 1 }; #endif public: diff --git a/Eigen/src/Core/SelfAdjointView.h b/Eigen/src/Core/SelfAdjointView.h index 077a17a2b..97c2a1939 100644 --- a/Eigen/src/Core/SelfAdjointView.h +++ b/Eigen/src/Core/SelfAdjointView.h @@ -52,6 +52,7 @@ template class SelfAdjointView : public TriangularBase > { public: + EIGEN_STATIC_ASSERT(UpLo==Lower || UpLo==Upper,SELFADJOINTVIEW_ACCEPTS_UPPER_AND_LOWER_MODE_ONLY) typedef MatrixType_ MatrixType; typedef TriangularBase Base; @@ -73,10 +74,7 @@ template class SelfAdjointView typedef typename MatrixType::PlainObject PlainObject; EIGEN_DEVICE_FUNC - explicit inline SelfAdjointView(MatrixType& matrix) : m_matrix(matrix) - { - EIGEN_STATIC_ASSERT(UpLo==Lower || UpLo==Upper,SELFADJOINTVIEW_ACCEPTS_UPPER_AND_LOWER_MODE_ONLY); - } + explicit inline SelfAdjointView(MatrixType& matrix) : m_matrix(matrix) { } EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } diff --git a/Eigen/src/Core/VectorBlock.h b/Eigen/src/Core/VectorBlock.h index 9aa193ef9..ee28da1fc 100644 --- a/Eigen/src/Core/VectorBlock.h +++ b/Eigen/src/Core/VectorBlock.h @@ -68,6 +68,7 @@ template class VectorBlock }; public: EIGEN_DENSE_PUBLIC_INTERFACE(VectorBlock) + EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorBlock) using Base::operator=; @@ -78,18 +79,14 @@ template class VectorBlock : Base(vector, IsColVector ? start : 0, IsColVector ? 0 : start, IsColVector ? size : 1, IsColVector ? 1 : size) - { - EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorBlock); - } + { } /** Fixed-size constructor */ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE VectorBlock(VectorType& vector, Index start) : Base(vector, IsColVector ? start : 0, IsColVector ? 0 : start) - { - EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorBlock); - } + { } }; diff --git a/Eigen/src/Core/util/StaticAssert.h b/Eigen/src/Core/util/StaticAssert.h index c45de5901..c938eb800 100644 --- a/Eigen/src/Core/util/StaticAssert.h +++ b/Eigen/src/Core/util/StaticAssert.h @@ -16,10 +16,6 @@ * - in EIGEN_STATIC_ASSERT(CONDITION,MSG) the parameter CONDITION must be a compile time boolean * expression, and MSG an enum listed in struct internal::static_assertion * - * - define EIGEN_NO_STATIC_ASSERT to disable them (and save compilation time) - * in that case, the static assertion is converted to the following runtime assert: - * eigen_assert(CONDITION && "MSG") - * * - currently EIGEN_STATIC_ASSERT can only be used in function scope * */ @@ -27,113 +23,11 @@ #ifndef EIGEN_STATIC_ASSERT #ifndef EIGEN_NO_STATIC_ASSERT - #if EIGEN_MAX_CPP_VER>=11 && (__has_feature(cxx_static_assert) || (EIGEN_COMP_CXXVER >= 11) || (EIGEN_COMP_MSVC >= 1600)) - - // if native static_assert is enabled, let's use it - #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG); - - #else // not CXX0X - - namespace Eigen { - - namespace internal { - - template - struct static_assertion {}; - - template<> - struct static_assertion - { - enum { - YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX=1, - YOU_MIXED_VECTORS_OF_DIFFERENT_SIZES=1, - YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES=1, - THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE=1, - THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE=1, - THIS_METHOD_IS_ONLY_FOR_OBJECTS_OF_A_SPECIFIC_SIZE=1, - OUT_OF_RANGE_ACCESS=1, - YOU_MADE_A_PROGRAMMING_MISTAKE=1, - EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT=1, - EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE=1, - YOU_CALLED_A_FIXED_SIZE_METHOD_ON_A_DYNAMIC_SIZE_MATRIX_OR_VECTOR=1, - YOU_CALLED_A_DYNAMIC_SIZE_METHOD_ON_A_FIXED_SIZE_MATRIX_OR_VECTOR=1, - UNALIGNED_LOAD_AND_STORE_OPERATIONS_UNIMPLEMENTED_ON_ALTIVEC=1, - THIS_FUNCTION_IS_NOT_FOR_INTEGER_NUMERIC_TYPES=1, - FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED=1, - NUMERIC_TYPE_MUST_BE_REAL=1, - COEFFICIENT_WRITE_ACCESS_TO_SELFADJOINT_NOT_SUPPORTED=1, - WRITING_TO_TRIANGULAR_PART_WITH_UNIT_DIAGONAL_IS_NOT_SUPPORTED=1, - THIS_METHOD_IS_ONLY_FOR_FIXED_SIZE=1, - INVALID_MATRIX_PRODUCT=1, - INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS=1, - INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION=1, - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY=1, - THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES=1, - THIS_METHOD_IS_ONLY_FOR_ROW_MAJOR_MATRICES=1, - INVALID_MATRIX_TEMPLATE_PARAMETERS=1, - INVALID_MATRIXBASE_TEMPLATE_PARAMETERS=1, - BOTH_MATRICES_MUST_HAVE_THE_SAME_STORAGE_ORDER=1, - THIS_METHOD_IS_ONLY_FOR_DIAGONAL_MATRIX=1, - THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE=1, - THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_WITH_DIRECT_MEMORY_ACCESS_SUCH_AS_MAP_OR_PLAIN_MATRICES=1, - YOU_ALREADY_SPECIFIED_THIS_STRIDE=1, - INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION=1, - THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD=1, - PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1=1, - THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS=1, - YOU_CANNOT_MIX_ARRAYS_AND_MATRICES=1, - YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION=1, - THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY=1, - YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT=1, - THIS_METHOD_IS_ONLY_FOR_1x1_EXPRESSIONS=1, - THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS=1, - THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL=1, - THIS_METHOD_IS_ONLY_FOR_ARRAYS_NOT_MATRICES=1, - YOU_PASSED_A_ROW_VECTOR_BUT_A_COLUMN_VECTOR_WAS_EXPECTED=1, - YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED=1, - THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE=1, - THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH=1, - OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG=1, - IMPLICIT_CONVERSION_TO_SCALAR_IS_FOR_INNER_PRODUCT_ONLY=1, - STORAGE_LAYOUT_DOES_NOT_MATCH=1, - EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT__INVALID_COST_VALUE=1, - THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS=1, - MATRIX_FREE_CONJUGATE_GRADIENT_IS_COMPATIBLE_WITH_UPPER_UNION_LOWER_MODE_ONLY=1, - THIS_TYPE_IS_NOT_SUPPORTED=1, - STORAGE_KIND_MUST_MATCH=1, - STORAGE_INDEX_MUST_MATCH=1, - CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY=1, - SELFADJOINTVIEW_ACCEPTS_UPPER_AND_LOWER_MODE_ONLY=1, - INVALID_TEMPLATE_PARAMETER=1, - GPU_TENSOR_CONTRACTION_DOES_NOT_SUPPORT_OUTPUT_KERNELS=1, - THE_ARRAY_SIZE_SHOULD_EQUAL_WITH_PACKET_SIZE=1 - }; - }; - - } // end namespace internal - - } // end namespace Eigen - - // Specialized implementation for MSVC to avoid "conditional - // expression is constant" warnings. This implementation doesn't - // appear to work under GCC, hence the multiple implementations. - #if EIGEN_COMP_MSVC - - #define EIGEN_STATIC_ASSERT(CONDITION,MSG) \ - {Eigen::internal::static_assertion::MSG;} - - #else - // In some cases clang interprets bool(CONDITION) as function declaration - #define EIGEN_STATIC_ASSERT(CONDITION,MSG) \ - if (Eigen::internal::static_assertion(CONDITION)>::MSG) {} - - #endif - - #endif // not CXX0X +#define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG); #else // EIGEN_NO_STATIC_ASSERT - #define EIGEN_STATIC_ASSERT(CONDITION,MSG) eigen_assert((CONDITION) && #MSG); +#define EIGEN_STATIC_ASSERT(CONDITION,MSG) #endif // EIGEN_NO_STATIC_ASSERT #endif // EIGEN_STATIC_ASSERT diff --git a/Eigen/src/Eigenvalues/ComplexEigenSolver.h b/Eigen/src/Eigenvalues/ComplexEigenSolver.h index 2853394e6..1cfc0ca86 100644 --- a/Eigen/src/Eigenvalues/ComplexEigenSolver.h +++ b/Eigen/src/Eigenvalues/ComplexEigenSolver.h @@ -238,12 +238,9 @@ template class ComplexEigenSolver } protected: - - static void check_template_parameters() - { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); - } - + + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + EigenvectorType m_eivec; EigenvalueType m_eivalues; ComplexSchur m_schur; @@ -262,8 +259,6 @@ template ComplexEigenSolver& ComplexEigenSolver::compute(const EigenBase& matrix, bool computeEigenvectors) { - check_template_parameters(); - // this code is inspired from Jampack eigen_assert(matrix.cols() == matrix.rows()); diff --git a/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h b/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h index f8e6e3623..3df3092bf 100644 --- a/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +++ b/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h @@ -269,13 +269,10 @@ template class GeneralizedEigenSolver } protected: - - static void check_template_parameters() - { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); - EIGEN_STATIC_ASSERT(!NumTraits::IsComplex, NUMERIC_TYPE_MUST_BE_REAL); - } - + + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + EIGEN_STATIC_ASSERT(!NumTraits::IsComplex, NUMERIC_TYPE_MUST_BE_REAL) + EigenvectorsType m_eivec; ComplexVectorType m_alphas; VectorType m_betas; @@ -288,8 +285,6 @@ template GeneralizedEigenSolver& GeneralizedEigenSolver::compute(const MatrixType& A, const MatrixType& B, bool computeEigenvectors) { - check_template_parameters(); - using std::sqrt; using std::abs; eigen_assert(A.cols() == A.rows() && B.cols() == A.rows() && B.cols() == B.rows()); diff --git a/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h b/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h index 32c77eb87..70d370c1b 100644 --- a/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +++ b/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h @@ -374,12 +374,8 @@ template class SelfAdjointEigenSolver static const int m_maxIterations = 30; protected: - static EIGEN_DEVICE_FUNC - void check_template_parameters() - { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); - } - + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + EigenvectorsType m_eivec; RealVectorType m_eivalues; typename TridiagonalizationType::SubDiagonalType m_subdiag; @@ -421,10 +417,8 @@ EIGEN_DEVICE_FUNC SelfAdjointEigenSolver& SelfAdjointEigenSolver ::compute(const EigenBase& a_matrix, int options) { - check_template_parameters(); - const InputType &matrix(a_matrix.derived()); - + EIGEN_USING_STD(abs); eigen_assert(matrix.cols() == matrix.rows()); eigen_assert((options&~(EigVecMask|GenEigMask))==0 diff --git a/Eigen/src/Geometry/Quaternion.h b/Eigen/src/Geometry/Quaternion.h index 3b4f5ee25..3a27505a8 100644 --- a/Eigen/src/Geometry/Quaternion.h +++ b/Eigen/src/Geometry/Quaternion.h @@ -343,20 +343,17 @@ public: EIGEN_DEVICE_FUNC inline const Coefficients& coeffs() const { return m_coeffs;} EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(bool(NeedsAlignment)) - + #ifdef EIGEN_QUATERNION_PLUGIN # include EIGEN_QUATERNION_PLUGIN #endif protected: Coefficients m_coeffs; - + #ifndef EIGEN_PARSED_BY_DOXYGEN - static EIGEN_STRONG_INLINE void _check_template_params() - { - EIGEN_STATIC_ASSERT( (Options_ & DontAlign) == Options_, - INVALID_MATRIX_TEMPLATE_PARAMETERS) - } + EIGEN_STATIC_ASSERT( (Options_ & DontAlign) == Options_, + INVALID_MATRIX_TEMPLATE_PARAMETERS) #endif }; diff --git a/Eigen/src/LU/FullPivLU.h b/Eigen/src/LU/FullPivLU.h index c41e2e077..1dd0a4ed0 100644 --- a/Eigen/src/LU/FullPivLU.h +++ b/Eigen/src/LU/FullPivLU.h @@ -421,10 +421,7 @@ template class FullPivLU protected: - static void check_template_parameters() - { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); - } + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) void computeInPlace(); @@ -489,8 +486,6 @@ FullPivLU::FullPivLU(EigenBase& matrix) template void FullPivLU::computeInPlace() { - check_template_parameters(); - // the permutations are stored as int indices, so just to be sure: eigen_assert(m_lu.rows()<=NumTraits::highest() && m_lu.cols()<=NumTraits::highest()); diff --git a/Eigen/src/LU/PartialPivLU.h b/Eigen/src/LU/PartialPivLU.h index 935b6b5a1..4034745b8 100644 --- a/Eigen/src/LU/PartialPivLU.h +++ b/Eigen/src/LU/PartialPivLU.h @@ -267,10 +267,7 @@ template class PartialPivLU protected: - static void check_template_parameters() - { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); - } + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) void compute(); @@ -526,8 +523,6 @@ void partial_lu_inplace(MatrixType& lu, TranspositionType& row_transpositions, t template void PartialPivLU::compute() { - check_template_parameters(); - // the row permutation is stored as int indices, so just to be sure: eigen_assert(m_lu.rows()::highest()); diff --git a/Eigen/src/QR/ColPivHouseholderQR.h b/Eigen/src/QR/ColPivHouseholderQR.h index d6f18ec3e..b9500c865 100644 --- a/Eigen/src/QR/ColPivHouseholderQR.h +++ b/Eigen/src/QR/ColPivHouseholderQR.h @@ -428,10 +428,7 @@ template class ColPivHouseholderQR friend class CompleteOrthogonalDecomposition; - static void check_template_parameters() - { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); - } + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) void computeInPlace(); @@ -483,8 +480,6 @@ ColPivHouseholderQR& ColPivHouseholderQR::compute(const template void ColPivHouseholderQR::computeInPlace() { - check_template_parameters(); - // the column permutation is stored as int indices, so just to be sure: eigen_assert(m_qr.cols()<=NumTraits::highest()); diff --git a/Eigen/src/QR/CompleteOrthogonalDecomposition.h b/Eigen/src/QR/CompleteOrthogonalDecomposition.h index 3fea2b1be..111d58358 100644 --- a/Eigen/src/QR/CompleteOrthogonalDecomposition.h +++ b/Eigen/src/QR/CompleteOrthogonalDecomposition.h @@ -379,9 +379,7 @@ template class CompleteOrthogonalDecomposition #endif protected: - static void check_template_parameters() { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); - } + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) template void _check_solve_assertion(const Rhs& b) const { @@ -431,8 +429,6 @@ CompleteOrthogonalDecomposition::logAbsDeterminant() const { template void CompleteOrthogonalDecomposition::computeInPlace() { - check_template_parameters(); - // the column permutation is stored as int indices, so just to be sure: eigen_assert(m_cpqr.cols() <= NumTraits::highest()); diff --git a/Eigen/src/QR/FullPivHouseholderQR.h b/Eigen/src/QR/FullPivHouseholderQR.h index 5a4ad0007..0a61f2222 100644 --- a/Eigen/src/QR/FullPivHouseholderQR.h +++ b/Eigen/src/QR/FullPivHouseholderQR.h @@ -405,10 +405,7 @@ template class FullPivHouseholderQR protected: - static void check_template_parameters() - { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); - } + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) void computeInPlace(); @@ -460,8 +457,6 @@ FullPivHouseholderQR& FullPivHouseholderQR::compute(cons template void FullPivHouseholderQR::computeInPlace() { - check_template_parameters(); - using std::abs; Index rows = m_qr.rows(); Index cols = m_qr.cols(); diff --git a/Eigen/src/QR/HouseholderQR.h b/Eigen/src/QR/HouseholderQR.h index b61f29fff..c55cac3d8 100644 --- a/Eigen/src/QR/HouseholderQR.h +++ b/Eigen/src/QR/HouseholderQR.h @@ -232,10 +232,7 @@ template class HouseholderQR protected: - static void check_template_parameters() - { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); - } + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) void computeInPlace(); @@ -405,8 +402,6 @@ void HouseholderQR::_solve_impl_transposed(const RhsType &rhs, DstT template void HouseholderQR::computeInPlace() { - check_template_parameters(); - Index rows = m_qr.rows(); Index cols = m_qr.cols(); Index size = (std::min)(rows,cols); diff --git a/Eigen/src/SVD/SVDBase.h b/Eigen/src/SVD/SVDBase.h index ac02ac857..bbb667640 100644 --- a/Eigen/src/SVD/SVDBase.h +++ b/Eigen/src/SVD/SVDBase.h @@ -251,10 +251,7 @@ public: protected: - static void check_template_parameters() - { - EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); - } + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) void _check_compute_assertions() const { eigen_assert(m_isInitialized && "SVD is not initialized."); @@ -297,9 +294,7 @@ protected: m_computeThinV(false), m_computationOptions(0), m_rows(-1), m_cols(-1), m_diagSize(0) - { - check_template_parameters(); - } + { } }; diff --git a/Eigen/src/SparseCore/SparseCwiseBinaryOp.h b/Eigen/src/SparseCore/SparseCwiseBinaryOp.h index 1b102f335..17cdb8e5b 100644 --- a/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +++ b/Eigen/src/SparseCore/SparseCwiseBinaryOp.h @@ -42,14 +42,11 @@ class CwiseBinaryOpImpl typedef CwiseBinaryOp Derived; typedef SparseMatrixBase Base; EIGEN_SPARSE_PUBLIC_INTERFACE(Derived) - CwiseBinaryOpImpl() - { - EIGEN_STATIC_ASSERT(( - (!internal::is_same::StorageKind, - typename internal::traits::StorageKind>::value) - || ((internal::evaluator::Flags&RowMajorBit) == (internal::evaluator::Flags&RowMajorBit))), - THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH); - } + EIGEN_STATIC_ASSERT(( + (!internal::is_same::StorageKind, + typename internal::traits::StorageKind>::value) + || ((internal::evaluator::Flags&RowMajorBit) == (internal::evaluator::Flags&RowMajorBit))), + THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH) }; namespace internal { diff --git a/Eigen/src/SparseCore/SparseMatrix.h b/Eigen/src/SparseCore/SparseMatrix.h index 776eaf9f4..4bf47bb91 100644 --- a/Eigen/src/SparseCore/SparseMatrix.h +++ b/Eigen/src/SparseCore/SparseMatrix.h @@ -667,7 +667,6 @@ class SparseMatrix inline SparseMatrix() : m_outerSize(-1), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { - check_template_parameters(); resize(0, 0); } @@ -675,7 +674,6 @@ class SparseMatrix inline SparseMatrix(Index rows, Index cols) : m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { - check_template_parameters(); resize(rows, cols); } @@ -686,7 +684,6 @@ class SparseMatrix { EIGEN_STATIC_ASSERT((internal::is_same::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - check_template_parameters(); const bool needToTranspose = (Flags & RowMajorBit) != (internal::evaluator::Flags & RowMajorBit); if (needToTranspose) *this = other.derived(); @@ -698,13 +695,12 @@ class SparseMatrix internal::call_assignment_no_alias(*this, other.derived()); } } - + /** Constructs a sparse matrix from the sparse selfadjoint view \a other */ template inline SparseMatrix(const SparseSelfAdjointView& other) : m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { - check_template_parameters(); Base::operator=(other); } @@ -712,7 +708,6 @@ class SparseMatrix inline SparseMatrix(const SparseMatrix& other) : Base(), m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { - check_template_parameters(); *this = other.derived(); } @@ -721,17 +716,15 @@ class SparseMatrix SparseMatrix(const ReturnByValue& other) : Base(), m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { - check_template_parameters(); initAssignment(other); other.evalTo(*this); } - + /** \brief Copy constructor with in-place evaluation */ template explicit SparseMatrix(const DiagonalBase& other) : Base(), m_outerSize(0), m_innerSize(0), m_outerIndex(0), m_innerNonZeros(0) { - check_template_parameters(); *this = other.derived(); } @@ -1015,11 +1008,8 @@ protected: } private: - static void check_template_parameters() - { - EIGEN_STATIC_ASSERT(NumTraits::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE); - EIGEN_STATIC_ASSERT((Options&(ColMajor|RowMajor))==Options,INVALID_MATRIX_TEMPLATE_PARAMETERS); - } + EIGEN_STATIC_ASSERT(NumTraits::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE) + EIGEN_STATIC_ASSERT((Options&(ColMajor|RowMajor))==Options,INVALID_MATRIX_TEMPLATE_PARAMETERS) struct default_prunning_func { default_prunning_func(const Scalar& ref, const RealScalar& eps) : reference(ref), epsilon(eps) {} diff --git a/Eigen/src/SparseCore/SparseVector.h b/Eigen/src/SparseCore/SparseVector.h index 3a17fbd79..570694831 100644 --- a/Eigen/src/SparseCore/SparseVector.h +++ b/Eigen/src/SparseCore/SparseVector.h @@ -258,11 +258,11 @@ class SparseVector void resizeNonZeros(Index size) { m_data.resize(size); } - inline SparseVector() : m_size(0) { check_template_parameters(); resize(0); } + inline SparseVector() : m_size(0) { resize(0); } - explicit inline SparseVector(Index size) : m_size(0) { check_template_parameters(); resize(size); } + explicit inline SparseVector(Index size) : m_size(0) { resize(size); } - inline SparseVector(Index rows, Index cols) : m_size(0) { check_template_parameters(); resize(rows,cols); } + inline SparseVector(Index rows, Index cols) : m_size(0) { resize(rows,cols); } template inline SparseVector(const SparseMatrixBase& other) @@ -271,14 +271,12 @@ class SparseVector #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN #endif - check_template_parameters(); *this = other.derived(); } inline SparseVector(const SparseVector& other) : Base(other), m_size(0) { - check_template_parameters(); *this = other.derived(); } @@ -395,13 +393,9 @@ class SparseVector # endif protected: - - static void check_template_parameters() - { - EIGEN_STATIC_ASSERT(NumTraits::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE); - EIGEN_STATIC_ASSERT((Options_&(ColMajor|RowMajor))==Options,INVALID_MATRIX_TEMPLATE_PARAMETERS); - } - + EIGEN_STATIC_ASSERT(NumTraits::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE) + EIGEN_STATIC_ASSERT((Options_&(ColMajor|RowMajor))==Options,INVALID_MATRIX_TEMPLATE_PARAMETERS) + Storage m_data; Index m_size; }; diff --git a/test/adjoint.cpp b/test/adjoint.cpp index 4c4f98bb9..84f430cc5 100644 --- a/test/adjoint.cpp +++ b/test/adjoint.cpp @@ -7,8 +7,6 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -#define EIGEN_NO_STATIC_ASSERT - #include "main.h" template struct adjoint_specific; diff --git a/test/basicstuff.cpp b/test/basicstuff.cpp index 4ca607c82..00ef96ac1 100644 --- a/test/basicstuff.cpp +++ b/test/basicstuff.cpp @@ -7,11 +7,20 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -#define EIGEN_NO_STATIC_ASSERT - #include "main.h" #include "random_without_cast_overflow.h" +template +typename internal::enable_if<(MatrixType::RowsAtCompileTime==1 || MatrixType::ColsAtCompileTime==1),void>::type +check_index(const MatrixType& m) { + VERIFY_RAISES_ASSERT(m[0]); + VERIFY_RAISES_ASSERT((m+m)[0]); +} + +template +typename internal::enable_if::type +check_index(const MatrixType& /*unused*/) {} + template void basicStuff(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; @@ -101,8 +110,7 @@ template void basicStuff(const MatrixType& m) if(cols!=1 && rows!=1) { - VERIFY_RAISES_ASSERT(m1[0]); - VERIFY_RAISES_ASSERT((m1+m1)[0]); + check_index(m1); } VERIFY_IS_APPROX(m3 = m1,m1); diff --git a/test/block.cpp b/test/block.cpp index 84124aba6..43849adb6 100644 --- a/test/block.cpp +++ b/test/block.cpp @@ -7,7 +7,6 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -#define EIGEN_NO_STATIC_ASSERT // otherwise we fail at compile time on unused paths #include "main.h" template @@ -37,6 +36,20 @@ is_same_block(const T1& a, const T2& b) return a.isApprox(b); } +template +typename internal::enable_if<((MatrixType::Flags&RowMajorBit)==0),void>::type +check_left_top(const MatrixType& m, Index r, Index c, + Index rows, Index /*unused*/) { + VERIFY_IS_EQUAL(m.leftCols(c).coeff(r+c*rows), m(r,c)); +} + +template +typename internal::enable_if<((MatrixType::Flags&RowMajorBit)!=0),void>::type +check_left_top(const MatrixType& m, Index r, Index c, + Index /*unused*/, Index cols) { + VERIFY_IS_EQUAL(m.topRows(r).coeff(c+r*cols), m(r,c)); +} + template void block(const MatrixType& m) { typedef typename MatrixType::Scalar Scalar; @@ -79,7 +92,8 @@ template void block(const MatrixType& m) VERIFY_IS_APPROX(m1.col(c1), m1_copy.col(c1) + s1 * m1_copy.col(c2)); m1.col(c1).col(0) += s1 * m1_copy.col(c2); VERIFY_IS_APPROX(m1.col(c1), m1_copy.col(c1) + Scalar(2) * s1 * m1_copy.col(c2)); - + + check_left_top(m1,r1,c1,rows,cols); //check block() Matrix b1(1,1); b1(0,0) = m1(r1,c1); @@ -143,11 +157,6 @@ template void block(const MatrixType& m) // check that linear acccessors works on blocks m1 = m1_copy; - if((MatrixType::Flags&RowMajorBit)==0) - VERIFY_IS_EQUAL(m1.leftCols(c1).coeff(r1+c1*rows), m1(r1,c1)); - else - VERIFY_IS_EQUAL(m1.topRows(r1).coeff(c1+r1*cols), m1(r1,c1)); - // now test some block-inside-of-block. @@ -213,14 +222,6 @@ template void block(const MatrixType& m) VERIFY_IS_EQUAL( ((m1*1).template block(1,0,0,1)), m1.block(1,0,0,1)); VERIFY_IS_EQUAL( ((m1*1).template block<1,Dynamic>(0,1,1,0)), m1.block(0,1,1,0)); - if (rows>=2 && cols>=2) - { - VERIFY_RAISES_ASSERT( m1 += m1.col(0) ); - VERIFY_RAISES_ASSERT( m1 -= m1.col(0) ); - VERIFY_RAISES_ASSERT( m1.array() *= m1.col(0).array() ); - VERIFY_RAISES_ASSERT( m1.array() /= m1.col(0).array() ); - } - VERIFY_IS_EQUAL( m1.template subVector(r1), m1.row(r1) ); VERIFY_IS_APPROX( (m1+m1).template subVector(r1), (m1+m1).row(r1) ); VERIFY_IS_EQUAL( m1.template subVector(c1), m1.col(c1) ); @@ -240,13 +241,35 @@ template void block(const MatrixType& m) } + template -void compare_using_data_and_stride(const MatrixType& m) +typename internal::enable_if::type +compare_using_data_and_stride(const MatrixType& m) { Index rows = m.rows(); Index cols = m.cols(); Index size = m.size(); Index innerStride = m.innerStride(); + Index rowStride = m.rowStride(); + Index colStride = m.colStride(); + const typename MatrixType::Scalar* data = m.data(); + + for(int j=0;j +typename internal::enable_if::type +compare_using_data_and_stride(const MatrixType& m) +{ + Index rows = m.rows(); + Index cols = m.cols(); + Index innerStride = m.innerStride(); Index outerStride = m.outerStride(); Index rowStride = m.rowStride(); Index colStride = m.colStride(); @@ -256,21 +279,11 @@ void compare_using_data_and_stride(const MatrixType& m) for(int i=0;i diff --git a/test/diagonal_matrix_variadic_ctor.cpp b/test/diagonal_matrix_variadic_ctor.cpp index fbc8f8470..db5653969 100644 --- a/test/diagonal_matrix_variadic_ctor.cpp +++ b/test/diagonal_matrix_variadic_ctor.cpp @@ -7,32 +7,8 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -#define EIGEN_NO_STATIC_ASSERT - #include "main.h" -template -void assertionTest() -{ - typedef DiagonalMatrix DiagMatrix5; - typedef DiagonalMatrix DiagMatrix7; - typedef DiagonalMatrix DiagMatrixX; - - Scalar raw[6]; - for (int i = 0; i < 6; ++i) { - raw[i] = internal::random(); - } - - VERIFY_RAISES_ASSERT((DiagMatrix5{raw[0], raw[1], raw[2], raw[3]})); - VERIFY_RAISES_ASSERT((DiagMatrix5{raw[0], raw[1], raw[3]})); - VERIFY_RAISES_ASSERT((DiagMatrix7{raw[0], raw[1], raw[2], raw[3]})); - - VERIFY_RAISES_ASSERT((DiagMatrixX { - {raw[0], raw[1], raw[2]}, - {raw[3], raw[4], raw[5]} - })); -} - #define VERIFY_IMPLICIT_CONVERSION_3(DIAGTYPE, V0, V1, V2) \ DIAGTYPE d(V0, V1, V2); \ DIAGTYPE::DenseMatrixType Dense = d.toDenseMatrix(); \ @@ -167,14 +143,6 @@ void constructorTest() EIGEN_DECLARE_TEST(diagonal_matrix_variadic_ctor) { - CALL_SUBTEST_1(assertionTest()); - CALL_SUBTEST_1(assertionTest()); - CALL_SUBTEST_1(assertionTest()); - CALL_SUBTEST_1(assertionTest()); - CALL_SUBTEST_1(assertionTest()); - CALL_SUBTEST_1(assertionTest()); - CALL_SUBTEST_1(assertionTest>()); - CALL_SUBTEST_2(constructorTest()); CALL_SUBTEST_2(constructorTest()); CALL_SUBTEST_2(constructorTest()); diff --git a/test/initializer_list_construction.cpp b/test/initializer_list_construction.cpp index 7a9c49e8d..71a6597b7 100644 --- a/test/initializer_list_construction.cpp +++ b/test/initializer_list_construction.cpp @@ -7,8 +7,6 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -#define EIGEN_NO_STATIC_ASSERT - #include "main.h" template::IsInteger> @@ -320,16 +318,6 @@ template void dynamicVectorConstruction() VERIFY(v.cols() == 1); VERIFY_IS_EQUAL(v, (VectorX {{raw[0], raw[1], raw[2], raw[3]}})); } - - { - VERIFY_RAISES_ASSERT((VectorX {raw[0], raw[1], raw[2], raw[3]})); - } - { - VERIFY_RAISES_ASSERT((VectorX { - {raw[0], raw[1], raw[2], raw[3]}, - {raw[0], raw[1], raw[2], raw[3]}, - })); - } } EIGEN_DECLARE_TEST(initializer_list_construction) diff --git a/test/integer_types.cpp b/test/integer_types.cpp index 31f4100c5..ce64e1870 100644 --- a/test/integer_types.cpp +++ b/test/integer_types.cpp @@ -7,8 +7,6 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -#define EIGEN_NO_STATIC_ASSERT - #include "main.h" #undef VERIFY_IS_APPROX diff --git a/test/main.h b/test/main.h index 73e972eea..4ab5a6677 100644 --- a/test/main.h +++ b/test/main.h @@ -321,36 +321,10 @@ namespace Eigen #endif // EIGEN_EXCEPTIONS #endif // EIGEN_DEBUG_ASSERTS - #if defined(TEST_CHECK_STATIC_ASSERTIONS) && defined(EIGEN_EXCEPTIONS) - #define EIGEN_STATIC_ASSERT(a,MSG) \ - if( (!Eigen::internal::copy_bool(a)) && (!no_more_assert) )\ - { \ - Eigen::no_more_assert = true; \ - if(report_on_cerr_on_assert_failure) \ - eigen_plain_assert((a) && #MSG); \ - else \ - EIGEN_THROW_X(Eigen::eigen_static_assert_exception()); \ - } - #define VERIFY_RAISES_STATIC_ASSERT(a) { \ - Eigen::no_more_assert = false; \ - Eigen::report_on_cerr_on_assert_failure = false; \ - try { \ - a; \ - VERIFY(Eigen::should_raise_an_assert && # a); \ - } \ - catch (Eigen::eigen_static_assert_exception&) { VERIFY(true); } \ - Eigen::report_on_cerr_on_assert_failure = true; \ - } - #endif // TEST_CHECK_STATIC_ASSERTIONS - #ifndef VERIFY_RAISES_ASSERT #define VERIFY_RAISES_ASSERT(a) \ std::cout << "Can't VERIFY_RAISES_ASSERT( " #a " ) with exceptions disabled\n"; #endif -#ifndef VERIFY_RAISES_STATIC_ASSERT - #define VERIFY_RAISES_STATIC_ASSERT(a) \ - std::cout << "Can't VERIFY_RAISES_STATIC_ASSERT( " #a " ) with exceptions disabled\n"; -#endif #if !defined(__CUDACC__) && !defined(__HIPCC__) && !defined(SYCL_DEVICE_ONLY) #define EIGEN_USE_CUSTOM_ASSERT @@ -359,7 +333,6 @@ namespace Eigen #else // EIGEN_NO_ASSERTION_CHECKING #define VERIFY_RAISES_ASSERT(a) {} - #define VERIFY_RAISES_STATIC_ASSERT(a) {} #endif // EIGEN_NO_ASSERTION_CHECKING diff --git a/test/mapped_matrix.cpp b/test/mapped_matrix.cpp index 0ea136ae6..1b576b0e4 100644 --- a/test/mapped_matrix.cpp +++ b/test/mapped_matrix.cpp @@ -7,10 +7,6 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -#ifndef EIGEN_NO_STATIC_ASSERT -#define EIGEN_NO_STATIC_ASSERT // turn static asserts into runtime asserts in order to check them -#endif - #include "main.h" #define EIGEN_TESTMAP_MAX_SIZE 256 diff --git a/test/mixingtypes.cpp b/test/mixingtypes.cpp index d450dbff8..f836722b3 100644 --- a/test/mixingtypes.cpp +++ b/test/mixingtypes.cpp @@ -10,10 +10,6 @@ #if defined(EIGEN_TEST_PART_7) -#ifndef EIGEN_NO_STATIC_ASSERT -#define EIGEN_NO_STATIC_ASSERT // turn static asserts into runtime asserts in order to check them -#endif - // ignore double-promotion diagnostic for clang and gcc, if we check for static assertion anyway: // TODO do the same for MSVC? #if defined(__clang__) @@ -49,28 +45,6 @@ using namespace std; VERIFY_IS_APPROX(XPR,REF); \ VERIFY( g_called && #XPR" not properly optimized"); -template -void raise_assertion(Index size = SizeAtCompileType) -{ - // VERIFY_RAISES_ASSERT(mf+md); // does not even compile - Matrix vf; vf.setRandom(size); - Matrix vd; vd.setRandom(size); - VERIFY_RAISES_ASSERT(vf=vd); - VERIFY_RAISES_ASSERT(vf+=vd); - VERIFY_RAISES_ASSERT(vf-=vd); - VERIFY_RAISES_ASSERT(vd=vf); - VERIFY_RAISES_ASSERT(vd+=vf); - VERIFY_RAISES_ASSERT(vd-=vf); - - // vd.asDiagonal() * mf; // does not even compile - // vcd.asDiagonal() * mf; // does not even compile - -#if 0 // we get other compilation errors here than just static asserts - VERIFY_RAISES_ASSERT(vd.dot(vf)); -#endif -} - - template void mixingtypes(int size = SizeAtCompileType) { typedef std::complex CF; @@ -320,10 +294,5 @@ EIGEN_DECLARE_TEST(mixingtypes) CALL_SUBTEST_4(mixingtypes<3>()); CALL_SUBTEST_5(mixingtypes<4>()); CALL_SUBTEST_6(mixingtypes(internal::random(1,EIGEN_TEST_MAX_SIZE))); - CALL_SUBTEST_7(raise_assertion(internal::random(1,EIGEN_TEST_MAX_SIZE))); } - CALL_SUBTEST_7(raise_assertion<0>()); - CALL_SUBTEST_7(raise_assertion<3>()); - CALL_SUBTEST_7(raise_assertion<4>()); - CALL_SUBTEST_7(raise_assertion(0)); } diff --git a/test/product.h b/test/product.h index c6c78fbd8..0477d776e 100644 --- a/test/product.h +++ b/test/product.h @@ -17,6 +17,17 @@ bool areNotApprox(const MatrixBase& m1, const MatrixBase& m2 * (std::max)(m1.cwiseAbs2().maxCoeff(), m2.cwiseAbs2().maxCoeff())); } +template +typename internal::enable_if::type +check_mismatched_product(LhsType& lhs, const RhsType& rhs) { + VERIFY_RAISES_ASSERT(lhs = rhs*rhs); +} + +template +typename internal::enable_if::type +check_mismatched_product(LhsType& /*unused*/, const RhsType& /*unused*/) { +} + template void product(const MatrixType& m) { /* this test covers the following files: @@ -77,8 +88,9 @@ template void product(const MatrixType& m) // again, test operator() to check const-qualification VERIFY_IS_APPROX(MatrixType::Identity(rows, cols)(r,c), static_cast(r==c)); - if (rows!=cols) - VERIFY_RAISES_ASSERT(m3 = m1*m1); + if (rows!=cols) { + check_mismatched_product(m3, m1); + } // test the previous tests were not screwed up because operator* returns 0 // (we use the more accurate default epsilon) diff --git a/test/product_small.cpp b/test/product_small.cpp index 1d6df6e58..8c56ea5d3 100644 --- a/test/product_small.cpp +++ b/test/product_small.cpp @@ -7,7 +7,6 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -#define EIGEN_NO_STATIC_ASSERT #include "product.h" #include diff --git a/test/ref.cpp b/test/ref.cpp index 63eb65e27..5e7a3b35d 100644 --- a/test/ref.cpp +++ b/test/ref.cpp @@ -106,9 +106,6 @@ template void ref_vector(const VectorType& m) { RefMat rm0 = v1.block(0,0,size,1); VERIFY_IS_EQUAL(rm0, v1); } { RefDynMat rv1 = v1; VERIFY_IS_EQUAL(rv1, v1); } { RefDynMat rv1 = v1.block(0,0,size,1); VERIFY_IS_EQUAL(rv1, v1); } - { VERIFY_RAISES_ASSERT( RefMat rm0 = v1.block(0, 0, size, 0); EIGEN_UNUSED_VARIABLE(rm0); ); } - if(VectorType::SizeAtCompileTime!=1) - { VERIFY_RAISES_ASSERT( RefDynMat rv1 = v1.block(0, 0, size, 0); EIGEN_UNUSED_VARIABLE(rv1); ); } RefDynMat rv2 = v1.segment(i,bsize); VERIFY_IS_EQUAL(rv2, v1.segment(i,bsize)); @@ -320,17 +317,6 @@ void test_ref_overloads() test_ref_ambiguous(A, B); } -void test_ref_fixed_size_assert() -{ - Vector4f v4 = Vector4f::Random(); - VectorXf vx = VectorXf::Random(10); - VERIFY_RAISES_STATIC_ASSERT( Ref y = v4; (void)y; ); - VERIFY_RAISES_STATIC_ASSERT( Ref y = vx.head<4>(); (void)y; ); - VERIFY_RAISES_STATIC_ASSERT( Ref y = v4; (void)y; ); - VERIFY_RAISES_STATIC_ASSERT( Ref y = vx.head<4>(); (void)y; ); - VERIFY_RAISES_STATIC_ASSERT( Ref y = 2*v4; (void)y; ); -} - EIGEN_DECLARE_TEST(ref) { for(int i = 0; i < g_repeat; i++) { @@ -356,5 +342,4 @@ EIGEN_DECLARE_TEST(ref) } CALL_SUBTEST_7( test_ref_overloads() ); - CALL_SUBTEST_7( test_ref_fixed_size_assert() ); } diff --git a/test/selfadjoint.cpp b/test/selfadjoint.cpp index 9ca9cef9e..74495fbf4 100644 --- a/test/selfadjoint.cpp +++ b/test/selfadjoint.cpp @@ -45,9 +45,6 @@ template void selfadjoint(const MatrixType& m) m4 = m2; m4 -= m1.template selfadjointView(); VERIFY_IS_APPROX(m4, m2-m3); - - VERIFY_RAISES_STATIC_ASSERT(m2.template selfadjointView()); - VERIFY_RAISES_STATIC_ASSERT(m2.template selfadjointView()); } void bug_159() diff --git a/test/smallvectors.cpp b/test/smallvectors.cpp index f9803acbb..d58038ffd 100644 --- a/test/smallvectors.cpp +++ b/test/smallvectors.cpp @@ -7,7 +7,6 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -#define EIGEN_NO_STATIC_ASSERT #include "main.h" template void smallVectors() @@ -33,28 +32,11 @@ template void smallVectors() VERIFY_IS_APPROX(x3, v4.z()); VERIFY_IS_APPROX(x4, v4.w()); - if (!NumTraits::IsInteger) - { - VERIFY_RAISES_ASSERT(V3(2, 1)) - VERIFY_RAISES_ASSERT(V3(3, 2)) - VERIFY_RAISES_ASSERT(V3(Scalar(3), 1)) - VERIFY_RAISES_ASSERT(V3(3, Scalar(1))) - VERIFY_RAISES_ASSERT(V3(Scalar(3), Scalar(1))) - VERIFY_RAISES_ASSERT(V3(Scalar(123), Scalar(123))) - - VERIFY_RAISES_ASSERT(V4(1, 3)) - VERIFY_RAISES_ASSERT(V4(2, 4)) - VERIFY_RAISES_ASSERT(V4(1, Scalar(4))) - VERIFY_RAISES_ASSERT(V4(Scalar(1), 4)) - VERIFY_RAISES_ASSERT(V4(Scalar(1), Scalar(4))) - VERIFY_RAISES_ASSERT(V4(Scalar(123), Scalar(123))) - - VERIFY_RAISES_ASSERT(VX(3, 2)) - VERIFY_RAISES_ASSERT(VX(Scalar(3), 1)) - VERIFY_RAISES_ASSERT(VX(3, Scalar(1))) - VERIFY_RAISES_ASSERT(VX(Scalar(3), Scalar(1))) - VERIFY_RAISES_ASSERT(VX(Scalar(123), Scalar(123))) - } + VERIFY_RAISES_ASSERT(V3(2, 1)) + VERIFY_RAISES_ASSERT(V3(3, 2)) + VERIFY_RAISES_ASSERT(V4(1, 3)) + VERIFY_RAISES_ASSERT(V4(2, 4)) + VERIFY_RAISES_ASSERT(VX(3, 2)) } EIGEN_DECLARE_TEST(smallvectors) diff --git a/test/swap.cpp b/test/swap.cpp index 813c61325..6189f1372 100644 --- a/test/swap.cpp +++ b/test/swap.cpp @@ -7,7 +7,6 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -#define EIGEN_NO_STATIC_ASSERT #include "main.h" template @@ -22,6 +21,20 @@ struct other_matrix_type type; }; +template +typename internal::enable_if<(MatrixType::RowsAtCompileTime==1 || MatrixType::RowsAtCompileTime==Dynamic), void>::type +check_row_swap(MatrixType& m1) { + // test assertion on mismatching size -- matrix case + VERIFY_RAISES_ASSERT(m1.swap(m1.row(0))); + // test assertion on mismatching size -- xpr case + VERIFY_RAISES_ASSERT(m1.row(0).swap(m1)); +} + +template +typename internal::enable_if::type +check_row_swap(MatrixType& /* unused */) { +} + template void swap(const MatrixType& m) { typedef typename other_matrix_type::type OtherMatrixType; @@ -73,14 +86,8 @@ template void swap(const MatrixType& m) VERIFY_IS_APPROX(m3,m1_copy); m1 = m1_copy; m3 = m3_copy; - - if(m1.rows()>1) - { - // test assertion on mismatching size -- matrix case - VERIFY_RAISES_ASSERT(m1.swap(m1.row(0))); - // test assertion on mismatching size -- xpr case - VERIFY_RAISES_ASSERT(m1.row(0).swap(m1)); - } + + check_row_swap(m1); } EIGEN_DECLARE_TEST(swap) diff --git a/test/triangular.cpp b/test/triangular.cpp index 981a0d071..eae0ea0b0 100644 --- a/test/triangular.cpp +++ b/test/triangular.cpp @@ -139,7 +139,6 @@ template void triangular_square(const MatrixType& m) m3.setZero(); m3.template triangularView().setOnes(); VERIFY_IS_APPROX(m2,m3); - VERIFY_RAISES_STATIC_ASSERT(m1.template triangularView().swap(m2.template triangularView())); m1.setRandom(); m3 = m1.template triangularView(); diff --git a/test/vectorwiseop.cpp b/test/vectorwiseop.cpp index 8ee58841a..261e80c06 100644 --- a/test/vectorwiseop.cpp +++ b/test/vectorwiseop.cpp @@ -9,7 +9,6 @@ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #define TEST_ENABLE_TEMPORARY_TRACKING -#define EIGEN_NO_STATIC_ASSERT #include "main.h" @@ -32,77 +31,49 @@ template void vectorwiseop_array(const ArrayType& m) RowVectorType rowvec = RowVectorType::Random(cols); // test addition - m2 = m1; m2.colwise() += colvec; VERIFY_IS_APPROX(m2, m1.colwise() + colvec); VERIFY_IS_APPROX(m2.col(c), m1.col(c) + colvec); - VERIFY_RAISES_ASSERT(m2.colwise() += colvec.transpose()); - VERIFY_RAISES_ASSERT(m1.colwise() + colvec.transpose()); - m2 = m1; m2.rowwise() += rowvec; VERIFY_IS_APPROX(m2, m1.rowwise() + rowvec); VERIFY_IS_APPROX(m2.row(r), m1.row(r) + rowvec); - VERIFY_RAISES_ASSERT(m2.rowwise() += rowvec.transpose()); - VERIFY_RAISES_ASSERT(m1.rowwise() + rowvec.transpose()); - // test substraction - m2 = m1; m2.colwise() -= colvec; VERIFY_IS_APPROX(m2, m1.colwise() - colvec); VERIFY_IS_APPROX(m2.col(c), m1.col(c) - colvec); - VERIFY_RAISES_ASSERT(m2.colwise() -= colvec.transpose()); - VERIFY_RAISES_ASSERT(m1.colwise() - colvec.transpose()); - m2 = m1; m2.rowwise() -= rowvec; VERIFY_IS_APPROX(m2, m1.rowwise() - rowvec); VERIFY_IS_APPROX(m2.row(r), m1.row(r) - rowvec); - VERIFY_RAISES_ASSERT(m2.rowwise() -= rowvec.transpose()); - VERIFY_RAISES_ASSERT(m1.rowwise() - rowvec.transpose()); - // test multiplication - m2 = m1; m2.colwise() *= colvec; VERIFY_IS_APPROX(m2, m1.colwise() * colvec); VERIFY_IS_APPROX(m2.col(c), m1.col(c) * colvec); - VERIFY_RAISES_ASSERT(m2.colwise() *= colvec.transpose()); - VERIFY_RAISES_ASSERT(m1.colwise() * colvec.transpose()); - m2 = m1; m2.rowwise() *= rowvec; VERIFY_IS_APPROX(m2, m1.rowwise() * rowvec); VERIFY_IS_APPROX(m2.row(r), m1.row(r) * rowvec); - VERIFY_RAISES_ASSERT(m2.rowwise() *= rowvec.transpose()); - VERIFY_RAISES_ASSERT(m1.rowwise() * rowvec.transpose()); - // test quotient - m2 = m1; m2.colwise() /= colvec; VERIFY_IS_APPROX(m2, m1.colwise() / colvec); VERIFY_IS_APPROX(m2.col(c), m1.col(c) / colvec); - VERIFY_RAISES_ASSERT(m2.colwise() /= colvec.transpose()); - VERIFY_RAISES_ASSERT(m1.colwise() / colvec.transpose()); - m2 = m1; m2.rowwise() /= rowvec; VERIFY_IS_APPROX(m2, m1.rowwise() / rowvec); VERIFY_IS_APPROX(m2.row(r), m1.row(r) / rowvec); - VERIFY_RAISES_ASSERT(m2.rowwise() /= rowvec.transpose()); - VERIFY_RAISES_ASSERT(m1.rowwise() / rowvec.transpose()); - m2 = m1; // yes, there might be an aliasing issue there but ".rowwise() /=" // is supposed to evaluate " m2.colwise().sum()" into a temporary to avoid @@ -158,58 +129,30 @@ template void vectorwiseop_matrix(const MatrixType& m) m2.rowwise() = rowvec; for(Index i=0; i1) - VERIFY_RAISES_ASSERT(m2.colwise() = colvec.transpose()); - if(cols>1) - VERIFY_RAISES_ASSERT(m2.rowwise() = rowvec.transpose()); // test addition - m2 = m1; m2.colwise() += colvec; VERIFY_IS_APPROX(m2, m1.colwise() + colvec); VERIFY_IS_APPROX(m2.col(c), m1.col(c) + colvec); - if(rows>1) - { - VERIFY_RAISES_ASSERT(m2.colwise() += colvec.transpose()); - VERIFY_RAISES_ASSERT(m1.colwise() + colvec.transpose()); - } - m2 = m1; m2.rowwise() += rowvec; VERIFY_IS_APPROX(m2, m1.rowwise() + rowvec); VERIFY_IS_APPROX(m2.row(r), m1.row(r) + rowvec); - if(cols>1) - { - VERIFY_RAISES_ASSERT(m2.rowwise() += rowvec.transpose()); - VERIFY_RAISES_ASSERT(m1.rowwise() + rowvec.transpose()); - } // test substraction - m2 = m1; m2.colwise() -= colvec; VERIFY_IS_APPROX(m2, m1.colwise() - colvec); VERIFY_IS_APPROX(m2.col(c), m1.col(c) - colvec); - if(rows>1) - { - VERIFY_RAISES_ASSERT(m2.colwise() -= colvec.transpose()); - VERIFY_RAISES_ASSERT(m1.colwise() - colvec.transpose()); - } - m2 = m1; m2.rowwise() -= rowvec; VERIFY_IS_APPROX(m2, m1.rowwise() - rowvec); VERIFY_IS_APPROX(m2.row(r), m1.row(r) - rowvec); - if(cols>1) - { - VERIFY_RAISES_ASSERT(m2.rowwise() -= rowvec.transpose()); - VERIFY_RAISES_ASSERT(m1.rowwise() - rowvec.transpose()); - } // ------ partial reductions ------ @@ -272,11 +215,8 @@ template void vectorwiseop_matrix(const MatrixType& m) VERIFY_IS_APPROX(m1.matrix().middleRows(0,0).colwise().prod().eval(), MatrixX::Ones(1,cols)); VERIFY_IS_APPROX(m1.matrix().middleCols(0,fix<0>).rowwise().prod().eval(), MatrixX::Ones(rows,1)); VERIFY_IS_APPROX(m1.matrix().middleRows(0,fix<0>).colwise().prod().eval(), MatrixX::Ones(1,cols)); - VERIFY_IS_APPROX(m1.matrix().middleCols(0,0).rowwise().squaredNorm().eval(), MatrixX::Zero(rows,1)); - VERIFY_RAISES_ASSERT(m1.real().middleCols(0,0).rowwise().minCoeff().eval()); - VERIFY_RAISES_ASSERT(m1.real().middleRows(0,0).colwise().maxCoeff().eval()); VERIFY_IS_EQUAL(m1.real().middleRows(0,0).rowwise().maxCoeff().eval().rows(),0); VERIFY_IS_EQUAL(m1.real().middleCols(0,0).colwise().maxCoeff().eval().cols(),0); VERIFY_IS_EQUAL(m1.real().middleRows(0,fix<0>).rowwise().maxCoeff().eval().rows(),0); diff --git a/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h b/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h index 707b561f2..b600079e0 100644 --- a/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h +++ b/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h @@ -50,10 +50,10 @@ struct bessel_i0e_retval { template ::type> struct generic_i0e { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE T run(const T&) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -241,10 +241,10 @@ struct bessel_i1e_retval { template ::type > struct generic_i1e { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE T run(const T&) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -436,10 +436,10 @@ struct bessel_k0e_retval { template ::type> struct generic_k0e { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE T run(const T&) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -599,10 +599,10 @@ struct bessel_k0_retval { template ::type> struct generic_k0 { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE T run(const T&) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -771,10 +771,10 @@ struct bessel_k1e_retval { template ::type> struct generic_k1e { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE T run(const T&) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -927,10 +927,10 @@ struct bessel_k1_retval { template ::type> struct generic_k1 { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE T run(const T&) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -1093,10 +1093,10 @@ struct bessel_j0_retval { template ::type> struct generic_j0 { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE T run(const T&) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -1293,10 +1293,10 @@ struct bessel_y0_retval { template ::type> struct generic_y0 { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE T run(const T&) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -1491,10 +1491,10 @@ struct bessel_j1_retval { template ::type> struct generic_j1 { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE T run(const T&) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; @@ -1682,10 +1682,10 @@ struct bessel_y1_retval { template ::type> struct generic_y1 { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE T run(const T&) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T run(const T&) { return ScalarType(0); } }; diff --git a/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h b/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h index 7f49ca7b2..2a012eb8f 100644 --- a/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h +++ b/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h @@ -45,10 +45,10 @@ namespace internal { template struct lgamma_impl { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar run(const Scalar) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Scalar) { return Scalar(0); } }; @@ -128,10 +128,10 @@ struct digamma_retval { */ template struct digamma_impl_maybe_poly { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar run(const Scalar) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Scalar) { return Scalar(0); } }; @@ -392,10 +392,10 @@ struct erf_impl { template struct erfc_impl { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar run(const Scalar) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Scalar) { return Scalar(0); } }; @@ -652,10 +652,10 @@ struct ndtri_retval { template struct ndtri_impl { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar run(const Scalar) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Scalar) { return Scalar(0); } }; @@ -954,10 +954,10 @@ struct igamma_series_impl { template struct igammac_impl { - EIGEN_DEVICE_FUNC - static Scalar run(Scalar a, Scalar x) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static Scalar run(Scalar a, Scalar x) { return Scalar(0); } }; @@ -1053,10 +1053,10 @@ struct igammac_impl { template struct igamma_generic_impl { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar run(Scalar a, Scalar x) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(Scalar a, Scalar x) { return Scalar(0); } }; @@ -1257,10 +1257,10 @@ struct zeta_retval { template struct zeta_impl_series { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar run(const Scalar) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Scalar) { return Scalar(0); } }; @@ -1468,10 +1468,10 @@ struct polygamma_retval { template struct polygamma_impl { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar run(Scalar n, Scalar x) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(Scalar n, Scalar x) { return Scalar(0); } }; @@ -1517,10 +1517,10 @@ struct betainc_retval { template struct betainc_impl { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar run(Scalar a, Scalar b, Scalar x) { - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(Scalar a, Scalar b, Scalar x) { return Scalar(0); } }; @@ -1529,8 +1529,10 @@ struct betainc_impl { template struct betainc_impl { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar run(Scalar, Scalar, Scalar) { + EIGEN_STATIC_ASSERT((internal::is_same::value == false), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(Scalar, Scalar, Scalar) { /* betaincf.c * * Incomplete beta integral @@ -1599,9 +1601,6 @@ struct betainc_impl { * incbet domain x<0, x>1 nan * incbet underflow nan */ - - EIGEN_STATIC_ASSERT((internal::is_same::value == false), - THIS_TYPE_IS_NOT_SUPPORTED); return Scalar(0); } }; @@ -1611,11 +1610,11 @@ struct betainc_impl { */ template struct incbeta_cfe { - EIGEN_DEVICE_FUNC - static EIGEN_STRONG_INLINE Scalar run(Scalar a, Scalar b, Scalar x, bool small_branch) { - EIGEN_STATIC_ASSERT((internal::is_same::value || - internal::is_same::value), - THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT((internal::is_same::value || + internal::is_same::value), + THIS_TYPE_IS_NOT_SUPPORTED) + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(Scalar a, Scalar b, Scalar x, bool small_branch) { const Scalar big = cephes_helper::big(); const Scalar machep = cephes_helper::machep(); const Scalar biginv = cephes_helper::biginv(); diff --git a/unsupported/test/alignedvector3.cpp b/unsupported/test/alignedvector3.cpp index f442e416a..1fc6d62ca 100644 --- a/unsupported/test/alignedvector3.cpp +++ b/unsupported/test/alignedvector3.cpp @@ -7,6 +7,8 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +#define EIGEN_NO_STATIC_ASSERT + #include "main.h" #include