11 #ifndef EIGEN_STATIC_ASSERT_H 12 #define EIGEN_STATIC_ASSERT_H 27 #ifndef EIGEN_STATIC_ASSERT 28 #ifndef EIGEN_NO_STATIC_ASSERT 30 #if EIGEN_MAX_CPP_VER>=11 && (__has_feature(cxx_static_assert) || (defined(__cplusplus) && __cplusplus >= 201103L) || (EIGEN_COMP_MSVC >= 1600)) 33 #define EIGEN_STATIC_ASSERT(X,MSG) static_assert(X,#MSG); 41 template<
bool condition>
48 YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX=1,
49 YOU_MIXED_VECTORS_OF_DIFFERENT_SIZES=1,
50 YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES=1,
51 THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE=1,
52 THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE=1,
53 THIS_METHOD_IS_ONLY_FOR_OBJECTS_OF_A_SPECIFIC_SIZE=1,
54 OUT_OF_RANGE_ACCESS=1,
55 YOU_MADE_A_PROGRAMMING_MISTAKE=1,
56 EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT=1,
57 EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE=1,
58 YOU_CALLED_A_FIXED_SIZE_METHOD_ON_A_DYNAMIC_SIZE_MATRIX_OR_VECTOR=1,
59 YOU_CALLED_A_DYNAMIC_SIZE_METHOD_ON_A_FIXED_SIZE_MATRIX_OR_VECTOR=1,
60 UNALIGNED_LOAD_AND_STORE_OPERATIONS_UNIMPLEMENTED_ON_ALTIVEC=1,
61 THIS_FUNCTION_IS_NOT_FOR_INTEGER_NUMERIC_TYPES=1,
62 FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED=1,
63 NUMERIC_TYPE_MUST_BE_REAL=1,
64 COEFFICIENT_WRITE_ACCESS_TO_SELFADJOINT_NOT_SUPPORTED=1,
65 WRITING_TO_TRIANGULAR_PART_WITH_UNIT_DIAGONAL_IS_NOT_SUPPORTED=1,
66 THIS_METHOD_IS_ONLY_FOR_FIXED_SIZE=1,
67 INVALID_MATRIX_PRODUCT=1,
68 INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS=1,
69 INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION=1,
70 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY=1,
71 THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES=1,
72 THIS_METHOD_IS_ONLY_FOR_ROW_MAJOR_MATRICES=1,
73 INVALID_MATRIX_TEMPLATE_PARAMETERS=1,
74 INVALID_MATRIXBASE_TEMPLATE_PARAMETERS=1,
75 BOTH_MATRICES_MUST_HAVE_THE_SAME_STORAGE_ORDER=1,
76 THIS_METHOD_IS_ONLY_FOR_DIAGONAL_MATRIX=1,
77 THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE=1,
78 THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_WITH_DIRECT_MEMORY_ACCESS_SUCH_AS_MAP_OR_PLAIN_MATRICES=1,
79 YOU_ALREADY_SPECIFIED_THIS_STRIDE=1,
80 INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION=1,
81 THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD=1,
82 PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1=1,
83 THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS=1,
84 YOU_CANNOT_MIX_ARRAYS_AND_MATRICES=1,
85 YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION=1,
86 THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY=1,
87 YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT=1,
88 THIS_METHOD_IS_ONLY_FOR_1x1_EXPRESSIONS=1,
89 THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS=1,
90 THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_OF_BOOL=1,
91 THIS_METHOD_IS_ONLY_FOR_ARRAYS_NOT_MATRICES=1,
92 YOU_PASSED_A_ROW_VECTOR_BUT_A_COLUMN_VECTOR_WAS_EXPECTED=1,
93 YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED=1,
94 THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE=1,
95 THE_STORAGE_ORDER_OF_BOTH_SIDES_MUST_MATCH=1,
96 OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG=1,
97 IMPLICIT_CONVERSION_TO_SCALAR_IS_FOR_INNER_PRODUCT_ONLY=1,
98 STORAGE_LAYOUT_DOES_NOT_MATCH=1,
99 EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT__INVALID_COST_VALUE=1,
100 THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS=1,
101 MATRIX_FREE_CONJUGATE_GRADIENT_IS_COMPATIBLE_WITH_UPPER_UNION_LOWER_MODE_ONLY=1,
102 THIS_TYPE_IS_NOT_SUPPORTED=1,
103 STORAGE_KIND_MUST_MATCH=1,
104 STORAGE_INDEX_MUST_MATCH=1,
105 CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY=1,
106 SELFADJOINTVIEW_ACCEPTS_UPPER_AND_LOWER_MODE_ONLY=1
119 #define EIGEN_STATIC_ASSERT(CONDITION,MSG) \ 120 {Eigen::internal::static_assertion<bool(CONDITION)>::MSG;} 124 #define EIGEN_STATIC_ASSERT(CONDITION,MSG) \ 125 if (Eigen::internal::static_assertion<static_cast<bool>(CONDITION)>::MSG) {} 131 #else // EIGEN_NO_STATIC_ASSERT 133 #define EIGEN_STATIC_ASSERT(CONDITION,MSG) eigen_assert((CONDITION) && #MSG); 135 #endif // EIGEN_NO_STATIC_ASSERT 136 #endif // EIGEN_STATIC_ASSERT 139 #define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE) \ 140 EIGEN_STATIC_ASSERT(TYPE::IsVectorAtCompileTime, \ 141 YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX) 144 #define EIGEN_STATIC_ASSERT_FIXED_SIZE(TYPE) \ 145 EIGEN_STATIC_ASSERT(TYPE::SizeAtCompileTime!=Eigen::Dynamic, \ 146 YOU_CALLED_A_FIXED_SIZE_METHOD_ON_A_DYNAMIC_SIZE_MATRIX_OR_VECTOR) 149 #define EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(TYPE) \ 150 EIGEN_STATIC_ASSERT(TYPE::SizeAtCompileTime==Eigen::Dynamic, \ 151 YOU_CALLED_A_DYNAMIC_SIZE_METHOD_ON_A_FIXED_SIZE_MATRIX_OR_VECTOR) 154 #define EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(TYPE, SIZE) \ 155 EIGEN_STATIC_ASSERT(TYPE::IsVectorAtCompileTime && TYPE::SizeAtCompileTime==SIZE, \ 156 THIS_METHOD_IS_ONLY_FOR_VECTORS_OF_A_SPECIFIC_SIZE) 159 #define EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(TYPE, ROWS, COLS) \ 160 EIGEN_STATIC_ASSERT(TYPE::RowsAtCompileTime==ROWS && TYPE::ColsAtCompileTime==COLS, \ 161 THIS_METHOD_IS_ONLY_FOR_MATRICES_OF_A_SPECIFIC_SIZE) 164 #define EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(TYPE0,TYPE1) \ 165 EIGEN_STATIC_ASSERT( \ 166 (int(TYPE0::SizeAtCompileTime)==Eigen::Dynamic \ 167 || int(TYPE1::SizeAtCompileTime)==Eigen::Dynamic \ 168 || int(TYPE0::SizeAtCompileTime)==int(TYPE1::SizeAtCompileTime)),\ 169 YOU_MIXED_VECTORS_OF_DIFFERENT_SIZES) 171 #define EIGEN_PREDICATE_SAME_MATRIX_SIZE(TYPE0,TYPE1) \ 173 (int(Eigen::internal::size_of_xpr_at_compile_time<TYPE0>::ret)==0 && int(Eigen::internal::size_of_xpr_at_compile_time<TYPE1>::ret)==0) \ 175 (int(TYPE0::RowsAtCompileTime)==Eigen::Dynamic \ 176 || int(TYPE1::RowsAtCompileTime)==Eigen::Dynamic \ 177 || int(TYPE0::RowsAtCompileTime)==int(TYPE1::RowsAtCompileTime)) \ 178 && (int(TYPE0::ColsAtCompileTime)==Eigen::Dynamic \ 179 || int(TYPE1::ColsAtCompileTime)==Eigen::Dynamic \ 180 || int(TYPE0::ColsAtCompileTime)==int(TYPE1::ColsAtCompileTime))\ 184 #define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE) \ 185 EIGEN_STATIC_ASSERT(!NumTraits<TYPE>::IsInteger, THIS_FUNCTION_IS_NOT_FOR_INTEGER_NUMERIC_TYPES) 189 #define EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(TYPE0,TYPE1) \ 190 EIGEN_STATIC_ASSERT( \ 191 EIGEN_PREDICATE_SAME_MATRIX_SIZE(TYPE0,TYPE1),\ 192 YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES) 194 #define EIGEN_STATIC_ASSERT_SIZE_1x1(TYPE) \ 195 EIGEN_STATIC_ASSERT((TYPE::RowsAtCompileTime == 1 || TYPE::RowsAtCompileTime == Dynamic) && \ 196 (TYPE::ColsAtCompileTime == 1 || TYPE::ColsAtCompileTime == Dynamic), \ 197 THIS_METHOD_IS_ONLY_FOR_1x1_EXPRESSIONS) 199 #define EIGEN_STATIC_ASSERT_LVALUE(Derived) \ 200 EIGEN_STATIC_ASSERT(Eigen::internal::is_lvalue<Derived>::value, \ 201 THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY) 203 #define EIGEN_STATIC_ASSERT_ARRAYXPR(Derived) \ 204 EIGEN_STATIC_ASSERT((Eigen::internal::is_same<typename Eigen::internal::traits<Derived>::XprKind, ArrayXpr>::value), \ 205 THIS_METHOD_IS_ONLY_FOR_ARRAYS_NOT_MATRICES) 207 #define EIGEN_STATIC_ASSERT_SAME_XPR_KIND(Derived1, Derived2) \ 208 EIGEN_STATIC_ASSERT((Eigen::internal::is_same<typename Eigen::internal::traits<Derived1>::XprKind, \ 209 typename Eigen::internal::traits<Derived2>::XprKind \ 211 YOU_CANNOT_MIX_ARRAYS_AND_MATRICES) 215 #define EIGEN_INTERNAL_CHECK_COST_VALUE(C) \ 216 EIGEN_STATIC_ASSERT((C)>=0 && (C)<=HugeCost*HugeCost, EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT__INVALID_COST_VALUE); 218 #endif // EIGEN_STATIC_ASSERT_H
Namespace containing all symbols from the Eigen library.