Lines 29-48
Link Here
|
29 |
#define EIGEN_WORLD_VERSION 2 |
29 |
#define EIGEN_WORLD_VERSION 2 |
30 |
#define EIGEN_MAJOR_VERSION 93 |
30 |
#define EIGEN_MAJOR_VERSION 93 |
31 |
#define EIGEN_MINOR_VERSION 0 |
31 |
#define EIGEN_MINOR_VERSION 0 |
32 |
|
32 |
|
33 |
#define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \ |
33 |
#define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \ |
34 |
(EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \ |
34 |
(EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \ |
35 |
EIGEN_MINOR_VERSION>=z)))) |
35 |
EIGEN_MINOR_VERSION>=z)))) |
36 |
#ifdef __GNUC__ |
36 |
#ifdef __GNUC__ |
37 |
#define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__>=x && __GNUC_MINOR__>=y) || __GNUC__>x) |
37 |
#define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__==x && __GNUC_MINOR__>=y) || __GNUC__>x) |
38 |
#else |
38 |
#else |
39 |
#define EIGEN_GNUC_AT_LEAST(x,y) 0 |
39 |
#define EIGEN_GNUC_AT_LEAST(x,y) 0 |
40 |
#endif |
40 |
#endif |
|
|
41 |
|
42 |
#ifdef __GNUC__ |
43 |
#define EIGEN_GNUC_AT_MOST(x,y) ((__GNUC__==x && __GNUC_MINOR__<=y) || __GNUC__<x) |
44 |
#else |
45 |
#define EIGEN_GNUC_AT_MOST(x,y) 0 |
46 |
#endif |
47 |
|
48 |
#if EIGEN_GNUC_AT_MOST(4,3) |
49 |
// see bug 89 |
50 |
#define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 0 |
51 |
#else |
52 |
#define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 1 |
53 |
#endif |
41 |
|
54 |
|
42 |
#if defined(__GNUC__) && (__GNUC__ <= 3) |
55 |
#if defined(__GNUC__) && (__GNUC__ <= 3) |
43 |
#define EIGEN_GCC3_OR_OLDER 1 |
56 |
#define EIGEN_GCC3_OR_OLDER 1 |
44 |
#else |
57 |
#else |
45 |
#define EIGEN_GCC3_OR_OLDER 0 |
58 |
#define EIGEN_GCC3_OR_OLDER 0 |
46 |
#endif |
59 |
#endif |
47 |
|
60 |
|
48 |
// 16 byte alignment is only useful for vectorization. Since it affects the ABI, we need to enable |
61 |
// 16 byte alignment is only useful for vectorization. Since it affects the ABI, we need to enable |
Lines 104-144
Link Here
|
104 |
* - single precision Cwise::sin() and Cwise::cos() when SSE vectorization is enabled. |
117 |
* - single precision Cwise::sin() and Cwise::cos() when SSE vectorization is enabled. |
105 |
*/ |
118 |
*/ |
106 |
#ifndef EIGEN_FAST_MATH |
119 |
#ifndef EIGEN_FAST_MATH |
107 |
#define EIGEN_FAST_MATH 1 |
120 |
#define EIGEN_FAST_MATH 1 |
108 |
#endif |
121 |
#endif |
109 |
|
122 |
|
110 |
#define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl; |
123 |
#define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl; |
111 |
|
124 |
|
112 |
#ifdef NDEBUG |
125 |
// concatenate two tokens |
113 |
# ifndef EIGEN_NO_DEBUG |
126 |
#define EIGEN_CAT2(a,b) a ## b |
114 |
# define EIGEN_NO_DEBUG |
127 |
#define EIGEN_CAT(a,b) EIGEN_CAT2(a,b) |
115 |
# endif |
|
|
116 |
#endif |
117 |
|
128 |
|
118 |
#ifndef eigen_assert |
129 |
// convert a token to a string |
119 |
#ifdef EIGEN_NO_DEBUG |
130 |
#define EIGEN_MAKESTRING2(a) #a |
120 |
#define eigen_assert(x) |
131 |
#define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a) |
121 |
#else |
|
|
122 |
#define eigen_assert(x) assert(x) |
123 |
#endif |
124 |
#endif |
125 |
|
126 |
#ifdef EIGEN_INTERNAL_DEBUGGING |
127 |
#define eigen_internal_assert(x) eigen_assert(x) |
128 |
#else |
129 |
#define eigen_internal_assert(x) |
130 |
#endif |
131 |
|
132 |
#ifdef EIGEN_NO_DEBUG |
133 |
#define EIGEN_ONLY_USED_FOR_DEBUG(x) (void)x |
134 |
#else |
135 |
#define EIGEN_ONLY_USED_FOR_DEBUG(x) |
136 |
#endif |
137 |
|
132 |
|
138 |
// EIGEN_ALWAYS_INLINE_ATTRIB should be use in the declaration of function |
133 |
// EIGEN_ALWAYS_INLINE_ATTRIB should be use in the declaration of function |
139 |
// which should be inlined even in debug mode. |
134 |
// which should be inlined even in debug mode. |
140 |
// FIXME with the always_inline attribute, |
135 |
// FIXME with the always_inline attribute, |
141 |
// gcc 3.4.x reports the following compilation error: |
136 |
// gcc 3.4.x reports the following compilation error: |
142 |
// Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const' |
137 |
// Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const' |
143 |
// : function body not available |
138 |
// : function body not available |
144 |
#if EIGEN_GNUC_AT_LEAST(4,0) |
139 |
#if EIGEN_GNUC_AT_LEAST(4,0) |
Lines 170-185
Link Here
|
170 |
|
165 |
|
171 |
// this macro allows to get rid of linking errors about multiply defined functions. |
166 |
// this macro allows to get rid of linking errors about multiply defined functions. |
172 |
// - static is not very good because it prevents definitions from different object files to be merged. |
167 |
// - static is not very good because it prevents definitions from different object files to be merged. |
173 |
// So static causes the resulting linked executable to be bloated with multiple copies of the same function. |
168 |
// So static causes the resulting linked executable to be bloated with multiple copies of the same function. |
174 |
// - inline is not perfect either as it unwantedly hints the compiler toward inlining the function. |
169 |
// - inline is not perfect either as it unwantedly hints the compiler toward inlining the function. |
175 |
#define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS |
170 |
#define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS |
176 |
#define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline |
171 |
#define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline |
177 |
|
172 |
|
|
|
173 |
#ifdef NDEBUG |
174 |
# ifndef EIGEN_NO_DEBUG |
175 |
# define EIGEN_NO_DEBUG |
176 |
# endif |
177 |
#endif |
178 |
|
179 |
// eigen_plain_assert is where we implement the workaround for the assert() bug in GCC <= 4.3, see bug 89 |
180 |
#ifdef EIGEN_NO_DEBUG |
181 |
#define eigen_plain_assert(x) |
182 |
#else |
183 |
#if EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO |
184 |
namespace Eigen { |
185 |
namespace internal { |
186 |
inline bool copy_bool(bool b) { return b; } |
187 |
} |
188 |
} |
189 |
#define eigen_plain_assert(x) assert(x) |
190 |
#else |
191 |
// work around bug 89 |
192 |
namespace Eigen { |
193 |
namespace internal { |
194 |
// trivial function copying a bool. Must be EIGEN_DONT_INLINE, so we implement it after including Eigen headers. |
195 |
// see bug 89. |
196 |
namespace { |
197 |
EIGEN_DONT_INLINE bool copy_bool(bool b) { return b; } |
198 |
} |
199 |
inline void assert_fail(const char *condition, const char *function, const char *file, int line) |
200 |
{ |
201 |
std::cerr << "assertion failed: " << condition << " in function " << function << " at " << file << ":" << line << std::endl; |
202 |
abort(); |
203 |
} |
204 |
} |
205 |
} |
206 |
#define eigen_plain_assert(x) \ |
207 |
do { \ |
208 |
if(!Eigen::internal::copy_bool(x)) \ |
209 |
Eigen::internal::assert_fail(EIGEN_MAKESTRING(x), __PRETTY_FUNCTION__, __FILE__, __LINE__); \ |
210 |
} while(false) |
211 |
#endif |
212 |
#endif |
213 |
|
214 |
// eigen_assert can be overridden |
215 |
#ifndef eigen_assert |
216 |
#define eigen_assert(x) eigen_plain_assert(x) |
217 |
#endif |
218 |
|
219 |
#ifdef EIGEN_INTERNAL_DEBUGGING |
220 |
#define eigen_internal_assert(x) eigen_assert(x) |
221 |
#else |
222 |
#define eigen_internal_assert(x) |
223 |
#endif |
224 |
|
225 |
#ifdef EIGEN_NO_DEBUG |
226 |
#define EIGEN_ONLY_USED_FOR_DEBUG(x) (void)x |
227 |
#else |
228 |
#define EIGEN_ONLY_USED_FOR_DEBUG(x) |
229 |
#endif |
230 |
|
178 |
#if (defined __GNUC__) |
231 |
#if (defined __GNUC__) |
179 |
#define EIGEN_DEPRECATED __attribute__((deprecated)) |
232 |
#define EIGEN_DEPRECATED __attribute__((deprecated)) |
180 |
#elif (defined _MSC_VER) |
233 |
#elif (defined _MSC_VER) |
181 |
#define EIGEN_DEPRECATED __declspec(deprecated) |
234 |
#define EIGEN_DEPRECATED __declspec(deprecated) |
182 |
#else |
235 |
#else |
183 |
#define EIGEN_DEPRECATED |
236 |
#define EIGEN_DEPRECATED |
184 |
#endif |
237 |
#endif |
185 |
|
238 |
|
Lines 239-262
Link Here
|
239 |
#else |
292 |
#else |
240 |
#define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat() |
293 |
#define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat() |
241 |
#endif |
294 |
#endif |
242 |
#endif |
295 |
#endif |
243 |
|
296 |
|
244 |
// just an empty macro ! |
297 |
// just an empty macro ! |
245 |
#define EIGEN_EMPTY |
298 |
#define EIGEN_EMPTY |
246 |
|
299 |
|
247 |
// concatenate two tokens |
|
|
248 |
#define EIGEN_CAT2(a,b) a ## b |
249 |
#define EIGEN_CAT(a,b) EIGEN_CAT2(a,b) |
250 |
|
251 |
// convert a token to a string |
252 |
#define EIGEN_MAKESTRING2(a) #a |
253 |
#define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a) |
254 |
|
255 |
#if defined(_MSC_VER) && (!defined(__INTEL_COMPILER)) |
300 |
#if defined(_MSC_VER) && (!defined(__INTEL_COMPILER)) |
256 |
#define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \ |
301 |
#define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \ |
257 |
using Base::operator =; |
302 |
using Base::operator =; |
258 |
#else |
303 |
#else |
259 |
#define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \ |
304 |
#define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \ |
260 |
using Base::operator =; \ |
305 |
using Base::operator =; \ |
261 |
EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) \ |
306 |
EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) \ |
262 |
{ \ |
307 |
{ \ |