Eigen  3.2.7
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Macros.h
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2010 Gael Guennebaud <[email protected]>
5 // Copyright (C) 2006-2008 Benoit Jacob <[email protected]>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 #ifndef EIGEN_MACROS_H
12 #define EIGEN_MACROS_H
13 
14 #define EIGEN_WORLD_VERSION 3
15 #define EIGEN_MAJOR_VERSION 2
16 #define EIGEN_MINOR_VERSION 7
17 
18 #define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
19  (EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
20  EIGEN_MINOR_VERSION>=z))))
21 
22 
23 // Compiler identification, EIGEN_COMP_*
24 
26 #ifdef __GNUC__
27  #define EIGEN_COMP_GNUC 1
28 #else
29  #define EIGEN_COMP_GNUC 0
30 #endif
31 
33 #if defined(__clang__)
34  #define EIGEN_COMP_CLANG 1
35 #else
36  #define EIGEN_COMP_CLANG 0
37 #endif
38 
39 
41 #if defined(__llvm__)
42  #define EIGEN_COMP_LLVM 1
43 #else
44  #define EIGEN_COMP_LLVM 0
45 #endif
46 
48 #if defined(__INTEL_COMPILER)
49  #define EIGEN_COMP_ICC __INTEL_COMPILER
50 #else
51  #define EIGEN_COMP_ICC 0
52 #endif
53 
55 #if defined(__MINGW32__)
56  #define EIGEN_COMP_MINGW 1
57 #else
58  #define EIGEN_COMP_MINGW 0
59 #endif
60 
62 #if defined(__SUNPRO_CC)
63  #define EIGEN_COMP_SUNCC 1
64 #else
65  #define EIGEN_COMP_SUNCC 0
66 #endif
67 
69 #if defined(_MSC_VER)
70  #define EIGEN_COMP_MSVC _MSC_VER
71 #else
72  #define EIGEN_COMP_MSVC 0
73 #endif
74 
76 #if EIGEN_COMP_MSVC && !(EIGEN_COMP_ICC)
77  #define EIGEN_COMP_MSVC_STRICT _MSC_VER
78 #else
79  #define EIGEN_COMP_MSVC_STRICT 0
80 #endif
81 
83 #if defined(__IBMCPP__) || defined(__xlc__)
84  #define EIGEN_COMP_IBM 1
85 #else
86  #define EIGEN_COMP_IBM 0
87 #endif
88 
90 #if defined(__PGI)
91  #define EIGEN_COMP_PGI 1
92 #else
93  #define EIGEN_COMP_PGI 0
94 #endif
95 
97 #if defined(__CC_ARM) || defined(__ARMCC_VERSION)
98  #define EIGEN_COMP_ARM 1
99 #else
100  #define EIGEN_COMP_ARM 0
101 #endif
102 
103 
105 #if EIGEN_COMP_GNUC && !(EIGEN_COMP_CLANG || EIGEN_COMP_ICC || EIGEN_COMP_MINGW || EIGEN_COMP_PGI || EIGEN_COMP_IBM || EIGEN_COMP_ARM )
106  #define EIGEN_COMP_GNUC_STRICT 1
107 #else
108  #define EIGEN_COMP_GNUC_STRICT 0
109 #endif
110 
111 
112 #if EIGEN_COMP_GNUC
113  #define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__==x && __GNUC_MINOR__>=y) || __GNUC__>x)
114  #define EIGEN_GNUC_AT_MOST(x,y) ((__GNUC__==x && __GNUC_MINOR__<=y) || __GNUC__<x)
115  #define EIGEN_GNUC_AT(x,y) ( __GNUC__==x && __GNUC_MINOR__==y )
116 #else
117  #define EIGEN_GNUC_AT_LEAST(x,y) 0
118  #define EIGEN_GNUC_AT_MOST(x,y) 0
119  #define EIGEN_GNUC_AT(x,y) 0
120 #endif
121 
122 // FIXME: could probably be removed as we do not support gcc 3.x anymore
123 #if EIGEN_COMP_GNUC && (__GNUC__ <= 3)
124 #define EIGEN_GCC3_OR_OLDER 1
125 #else
126 #define EIGEN_GCC3_OR_OLDER 0
127 #endif
128 
129 
130 // Architecture identification, EIGEN_ARCH_*
131 
132 #if defined(__x86_64__) || defined(_M_X64) || defined(__amd64)
133  #define EIGEN_ARCH_x86_64 1
134 #else
135  #define EIGEN_ARCH_x86_64 0
136 #endif
137 
138 #if defined(__i386__) || defined(_M_IX86) || defined(_X86_) || defined(__i386)
139  #define EIGEN_ARCH_i386 1
140 #else
141  #define EIGEN_ARCH_i386 0
142 #endif
143 
144 #if EIGEN_ARCH_x86_64 || EIGEN_ARCH_i386
145  #define EIGEN_ARCH_i386_OR_x86_64 1
146 #else
147  #define EIGEN_ARCH_i386_OR_x86_64 0
148 #endif
149 
151 #if defined(__arm__)
152  #define EIGEN_ARCH_ARM 1
153 #else
154  #define EIGEN_ARCH_ARM 0
155 #endif
156 
158 #if defined(__aarch64__)
159  #define EIGEN_ARCH_ARM64 1
160 #else
161  #define EIGEN_ARCH_ARM64 0
162 #endif
163 
164 #if EIGEN_ARCH_ARM || EIGEN_ARCH_ARM64
165  #define EIGEN_ARCH_ARM_OR_ARM64 1
166 #else
167  #define EIGEN_ARCH_ARM_OR_ARM64 0
168 #endif
169 
171 #if defined(__mips__) || defined(__mips)
172  #define EIGEN_ARCH_MIPS 1
173 #else
174  #define EIGEN_ARCH_MIPS 0
175 #endif
176 
178 #if defined(__sparc__) || defined(__sparc)
179  #define EIGEN_ARCH_SPARC 1
180 #else
181  #define EIGEN_ARCH_SPARC 0
182 #endif
183 
185 #if defined(__ia64__)
186  #define EIGEN_ARCH_IA64 1
187 #else
188  #define EIGEN_ARCH_IA64 0
189 #endif
190 
192 #if defined(__powerpc__) || defined(__ppc__) || defined(_M_PPC)
193  #define EIGEN_ARCH_PPC 1
194 #else
195  #define EIGEN_ARCH_PPC 0
196 #endif
197 
198 
199 
200 // Operating system identification, EIGEN_OS_*
201 
203 #if defined(__unix__) || defined(__unix)
204  #define EIGEN_OS_UNIX 1
205 #else
206  #define EIGEN_OS_UNIX 0
207 #endif
208 
210 #if defined(__linux__)
211  #define EIGEN_OS_LINUX 1
212 #else
213  #define EIGEN_OS_LINUX 0
214 #endif
215 
217 // note: ANDROID is defined when using ndk_build, __ANDROID__ is defined when using a standalone toolchain.
218 #if defined(__ANDROID__) || defined(ANDROID)
219  #define EIGEN_OS_ANDROID 1
220 #else
221  #define EIGEN_OS_ANDROID 0
222 #endif
223 
225 #if defined(__gnu_linux__) && !(EIGEN_OS_ANDROID)
226  #define EIGEN_OS_GNULINUX 1
227 #else
228  #define EIGEN_OS_GNULINUX 0
229 #endif
230 
232 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
233  #define EIGEN_OS_BSD 1
234 #else
235  #define EIGEN_OS_BSD 0
236 #endif
237 
239 #if defined(__APPLE__)
240  #define EIGEN_OS_MAC 1
241 #else
242  #define EIGEN_OS_MAC 0
243 #endif
244 
246 #if defined(__QNX__)
247  #define EIGEN_OS_QNX 1
248 #else
249  #define EIGEN_OS_QNX 0
250 #endif
251 
253 #if defined(_WIN32)
254  #define EIGEN_OS_WIN 1
255 #else
256  #define EIGEN_OS_WIN 0
257 #endif
258 
260 #if defined(_WIN64)
261  #define EIGEN_OS_WIN64 1
262 #else
263  #define EIGEN_OS_WIN64 0
264 #endif
265 
267 #if defined(_WIN32_WCE)
268  #define EIGEN_OS_WINCE 1
269 #else
270  #define EIGEN_OS_WINCE 0
271 #endif
272 
274 #if defined(__CYGWIN__)
275  #define EIGEN_OS_CYGWIN 1
276 #else
277  #define EIGEN_OS_CYGWIN 0
278 #endif
279 
281 #if EIGEN_OS_WIN && !( EIGEN_OS_WINCE || EIGEN_OS_CYGWIN )
282  #define EIGEN_OS_WIN_STRICT 1
283 #else
284  #define EIGEN_OS_WIN_STRICT 0
285 #endif
286 
288 #if (defined(sun) || defined(__sun)) && !(defined(__SVR4) || defined(__svr4__))
289  #define EIGEN_OS_SUN 1
290 #else
291  #define EIGEN_OS_SUN 0
292 #endif
293 
295 #if (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__))
296  #define EIGEN_OS_SOLARIS 1
297 #else
298  #define EIGEN_OS_SOLARIS 0
299 #endif
300 
301 
302 #if EIGEN_GNUC_AT_MOST(4,3) && !defined(__clang__)
303  // see bug 89
304  #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 0
305 #else
306  #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 1
307 #endif
308 
309 // 16 byte alignment is only useful for vectorization. Since it affects the ABI, we need to enable
310 // 16 byte alignment on all platforms where vectorization might be enabled. In theory we could always
311 // enable alignment, but it can be a cause of problems on some platforms, so we just disable it in
312 // certain common platform (compiler+architecture combinations) to avoid these problems.
313 // Only static alignment is really problematic (relies on nonstandard compiler extensions that don't
314 // work everywhere, for example don't work on GCC/ARM), try to keep heap alignment even
315 // when we have to disable static alignment.
316 #if defined(__GNUC__) && !(defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__ppc__) || defined(__ia64__))
317 #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 1
318 #else
319 #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 0
320 #endif
321 
322 // static alignment is completely disabled with GCC 3, Sun Studio, and QCC/QNX
323 #if !EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT \
324  && !EIGEN_GCC3_OR_OLDER \
325  && !defined(__SUNPRO_CC) \
326  && !defined(__QNXNTO__)
327  #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 1
328 #else
329  #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 0
330 #endif
331 
332 #ifdef EIGEN_DONT_ALIGN
333  #ifndef EIGEN_DONT_ALIGN_STATICALLY
334  #define EIGEN_DONT_ALIGN_STATICALLY
335  #endif
336  #define EIGEN_ALIGN 0
337 #else
338  #define EIGEN_ALIGN 1
339 #endif
340 
341 // EIGEN_ALIGN_STATICALLY is the true test whether we want to align arrays on the stack or not. It takes into account both the user choice to explicitly disable
342 // alignment (EIGEN_DONT_ALIGN_STATICALLY) and the architecture config (EIGEN_ARCH_WANTS_STACK_ALIGNMENT). Henceforth, only EIGEN_ALIGN_STATICALLY should be used.
343 #if EIGEN_ARCH_WANTS_STACK_ALIGNMENT && !defined(EIGEN_DONT_ALIGN_STATICALLY)
344  #define EIGEN_ALIGN_STATICALLY 1
345 #else
346  #define EIGEN_ALIGN_STATICALLY 0
347  #ifndef EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
348  #define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
349  #endif
350 #endif
351 
352 #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
353 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION RowMajor
354 #else
355 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION ColMajor
356 #endif
357 
358 #ifndef EIGEN_DEFAULT_DENSE_INDEX_TYPE
359 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t
360 #endif
361 
362 // A Clang feature extension to determine compiler features.
363 // We use it to determine 'cxx_rvalue_references'
364 #ifndef __has_feature
365 # define __has_feature(x) 0
366 #endif
367 
368 // Do we support r-value references?
369 #if (__has_feature(cxx_rvalue_references) || \
370  defined(__GXX_EXPERIMENTAL_CXX0X__) || \
371  (defined(_MSC_VER) && _MSC_VER >= 1600))
372  #define EIGEN_HAVE_RVALUE_REFERENCES
373 #endif
374 
375 
376 // Cross compiler wrapper around LLVM's __has_builtin
377 #ifdef __has_builtin
378 # define EIGEN_HAS_BUILTIN(x) __has_builtin(x)
379 #else
380 # define EIGEN_HAS_BUILTIN(x) 0
381 #endif
382 
388 #ifndef EIGEN_FAST_MATH
389 #define EIGEN_FAST_MATH 1
390 #endif
391 
392 #define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl;
393 
394 // concatenate two tokens
395 #define EIGEN_CAT2(a,b) a ## b
396 #define EIGEN_CAT(a,b) EIGEN_CAT2(a,b)
397 
398 // convert a token to a string
399 #define EIGEN_MAKESTRING2(a) #a
400 #define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a)
401 
402 // EIGEN_STRONG_INLINE is a stronger version of the inline, using __forceinline on MSVC,
403 // but it still doesn't use GCC's always_inline. This is useful in (common) situations where MSVC needs forceinline
404 // but GCC is still doing fine with just inline.
405 #if (defined _MSC_VER) || (defined __INTEL_COMPILER)
406 #define EIGEN_STRONG_INLINE __forceinline
407 #else
408 #define EIGEN_STRONG_INLINE inline
409 #endif
410 
411 // EIGEN_ALWAYS_INLINE is the stronget, it has the effect of making the function inline and adding every possible
412 // attribute to maximize inlining. This should only be used when really necessary: in particular,
413 // it uses __attribute__((always_inline)) on GCC, which most of the time is useless and can severely harm compile times.
414 // FIXME with the always_inline attribute,
415 // gcc 3.4.x reports the following compilation error:
416 // Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const'
417 // : function body not available
418 #if EIGEN_GNUC_AT_LEAST(4,0)
419 #define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline
420 #else
421 #define EIGEN_ALWAYS_INLINE EIGEN_STRONG_INLINE
422 #endif
423 
424 #if (defined __GNUC__)
425 #define EIGEN_DONT_INLINE __attribute__((noinline))
426 #elif (defined _MSC_VER)
427 #define EIGEN_DONT_INLINE __declspec(noinline)
428 #else
429 #define EIGEN_DONT_INLINE
430 #endif
431 
432 #if (defined __GNUC__)
433 #define EIGEN_PERMISSIVE_EXPR __extension__
434 #else
435 #define EIGEN_PERMISSIVE_EXPR
436 #endif
437 
438 // this macro allows to get rid of linking errors about multiply defined functions.
439 // - static is not very good because it prevents definitions from different object files to be merged.
440 // So static causes the resulting linked executable to be bloated with multiple copies of the same function.
441 // - inline is not perfect either as it unwantedly hints the compiler toward inlining the function.
442 #define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
443 #define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline
444 
445 #ifdef NDEBUG
446 # ifndef EIGEN_NO_DEBUG
447 # define EIGEN_NO_DEBUG
448 # endif
449 #endif
450 
451 // eigen_plain_assert is where we implement the workaround for the assert() bug in GCC <= 4.3, see bug 89
452 #ifdef EIGEN_NO_DEBUG
453  #define eigen_plain_assert(x)
454 #else
455  #if EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO
456  namespace Eigen {
457  namespace internal {
458  inline bool copy_bool(bool b) { return b; }
459  }
460  }
461  #define eigen_plain_assert(x) assert(x)
462  #else
463  // work around bug 89
464  #include <cstdlib> // for abort
465  #include <iostream> // for std::cerr
466 
467  namespace Eigen {
468  namespace internal {
469  // trivial function copying a bool. Must be EIGEN_DONT_INLINE, so we implement it after including Eigen headers.
470  // see bug 89.
471  namespace {
472  EIGEN_DONT_INLINE bool copy_bool(bool b) { return b; }
473  }
474  inline void assert_fail(const char *condition, const char *function, const char *file, int line)
475  {
476  std::cerr << "assertion failed: " << condition << " in function " << function << " at " << file << ":" << line << std::endl;
477  abort();
478  }
479  }
480  }
481  #define eigen_plain_assert(x) \
482  do { \
483  if(!Eigen::internal::copy_bool(x)) \
484  Eigen::internal::assert_fail(EIGEN_MAKESTRING(x), __PRETTY_FUNCTION__, __FILE__, __LINE__); \
485  } while(false)
486  #endif
487 #endif
488 
489 // eigen_assert can be overridden
490 #ifndef eigen_assert
491 #define eigen_assert(x) eigen_plain_assert(x)
492 #endif
493 
494 #ifdef EIGEN_INTERNAL_DEBUGGING
495 #define eigen_internal_assert(x) eigen_assert(x)
496 #else
497 #define eigen_internal_assert(x)
498 #endif
499 
500 #ifdef EIGEN_NO_DEBUG
501 #define EIGEN_ONLY_USED_FOR_DEBUG(x) (void)x
502 #else
503 #define EIGEN_ONLY_USED_FOR_DEBUG(x)
504 #endif
505 
506 #ifndef EIGEN_NO_DEPRECATED_WARNING
507  #if (defined __GNUC__)
508  #define EIGEN_DEPRECATED __attribute__((deprecated))
509  #elif (defined _MSC_VER)
510  #define EIGEN_DEPRECATED __declspec(deprecated)
511  #else
512  #define EIGEN_DEPRECATED
513  #endif
514 #else
515  #define EIGEN_DEPRECATED
516 #endif
517 
518 #if (defined __GNUC__)
519 #define EIGEN_UNUSED __attribute__((unused))
520 #else
521 #define EIGEN_UNUSED
522 #endif
523 
524 // Suppresses 'unused variable' warnings.
525 namespace Eigen {
526  namespace internal {
527  template<typename T> void ignore_unused_variable(const T&) {}
528  }
529 }
530 #define EIGEN_UNUSED_VARIABLE(var) Eigen::internal::ignore_unused_variable(var);
531 
532 #if !defined(EIGEN_ASM_COMMENT)
533  #if (defined __GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
534  #define EIGEN_ASM_COMMENT(X) __asm__("#" X)
535  #else
536  #define EIGEN_ASM_COMMENT(X)
537  #endif
538 #endif
539 
540 /* EIGEN_ALIGN_TO_BOUNDARY(n) forces data to be n-byte aligned. This is used to satisfy SIMD requirements.
541  * However, we do that EVEN if vectorization (EIGEN_VECTORIZE) is disabled,
542  * so that vectorization doesn't affect binary compatibility.
543  *
544  * If we made alignment depend on whether or not EIGEN_VECTORIZE is defined, it would be impossible to link
545  * vectorized and non-vectorized code.
546  */
547 #if (defined __GNUC__) || (defined __PGI) || (defined __IBMCPP__) || (defined __ARMCC_VERSION)
548  #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
549 #elif (defined _MSC_VER)
550  #define EIGEN_ALIGN_TO_BOUNDARY(n) __declspec(align(n))
551 #elif (defined __SUNPRO_CC)
552  // FIXME not sure about this one:
553  #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
554 #else
555  #error Please tell me what is the equivalent of __attribute__((aligned(n))) for your compiler
556 #endif
557 
558 #define EIGEN_ALIGN8 EIGEN_ALIGN_TO_BOUNDARY(8)
559 #define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16)
560 
561 #if EIGEN_ALIGN_STATICALLY
562 #define EIGEN_USER_ALIGN_TO_BOUNDARY(n) EIGEN_ALIGN_TO_BOUNDARY(n)
563 #define EIGEN_USER_ALIGN16 EIGEN_ALIGN16
564 #else
565 #define EIGEN_USER_ALIGN_TO_BOUNDARY(n)
566 #define EIGEN_USER_ALIGN16
567 #endif
568 
569 #ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD
570  #define EIGEN_RESTRICT
571 #endif
572 #ifndef EIGEN_RESTRICT
573  #define EIGEN_RESTRICT __restrict
574 #endif
575 
576 #ifndef EIGEN_STACK_ALLOCATION_LIMIT
577 // 131072 == 128 KB
578 #define EIGEN_STACK_ALLOCATION_LIMIT 131072
579 #endif
580 
581 #ifndef EIGEN_DEFAULT_IO_FORMAT
582 #ifdef EIGEN_MAKING_DOCS
583 // format used in Eigen's documentation
584 // needed to define it here as escaping characters in CMake add_definition's argument seems very problematic.
585 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat(3, 0, " ", "\n", "", "")
586 #else
587 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat()
588 #endif
589 #endif
590 
591 // just an empty macro !
592 #define EIGEN_EMPTY
593 
594 #if defined(_MSC_VER) && (_MSC_VER < 1900) && (!defined(__INTEL_COMPILER))
595 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
596  using Base::operator =;
597 #elif defined(__clang__) // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653)
598 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
599  using Base::operator =; \
600  EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) { Base::operator=(other); return *this; } \
601  template <typename OtherDerived> \
602  EIGEN_STRONG_INLINE Derived& operator=(const DenseBase<OtherDerived>& other) { Base::operator=(other.derived()); return *this; }
603 #else
604 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
605  using Base::operator =; \
606  EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) \
607  { \
608  Base::operator=(other); \
609  return *this; \
610  }
611 #endif
612 
617 #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
618 
627 #define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
628  typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
629  typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
630  typedef typename Base::CoeffReturnType CoeffReturnType; \
631  typedef typename Eigen::internal::nested<Derived>::type Nested; \
632  typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
633  typedef typename Eigen::internal::traits<Derived>::Index Index; \
634  enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
635  ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
636  Flags = Eigen::internal::traits<Derived>::Flags, \
637  CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
638  SizeAtCompileTime = Base::SizeAtCompileTime, \
639  MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
640  IsVectorAtCompileTime = Base::IsVectorAtCompileTime };
641 
642 
643 #define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
644  typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
645  typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
646  typedef typename Base::PacketScalar PacketScalar; \
647  typedef typename Base::CoeffReturnType CoeffReturnType; \
648  typedef typename Eigen::internal::nested<Derived>::type Nested; \
649  typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
650  typedef typename Eigen::internal::traits<Derived>::Index Index; \
651  enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
652  ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
653  MaxRowsAtCompileTime = Eigen::internal::traits<Derived>::MaxRowsAtCompileTime, \
654  MaxColsAtCompileTime = Eigen::internal::traits<Derived>::MaxColsAtCompileTime, \
655  Flags = Eigen::internal::traits<Derived>::Flags, \
656  CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
657  SizeAtCompileTime = Base::SizeAtCompileTime, \
658  MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
659  IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
660  using Base::derived; \
661  using Base::const_cast_derived;
662 
663 
664 #define EIGEN_PLAIN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)
665 #define EIGEN_PLAIN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b)
666 
667 // EIGEN_SIZE_MIN_PREFER_DYNAMIC gives the min between compile-time sizes. 0 has absolute priority, followed by 1,
668 // followed by Dynamic, followed by other finite values. The reason for giving Dynamic the priority over
669 // finite values is that min(3, Dynamic) should be Dynamic, since that could be anything between 0 and 3.
670 #define EIGEN_SIZE_MIN_PREFER_DYNAMIC(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
671  : ((int)a == 1 || (int)b == 1) ? 1 \
672  : ((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
673  : ((int)a <= (int)b) ? (int)a : (int)b)
674 
675 // EIGEN_SIZE_MIN_PREFER_FIXED is a variant of EIGEN_SIZE_MIN_PREFER_DYNAMIC comparing MaxSizes. The difference is that finite values
676 // now have priority over Dynamic, so that min(3, Dynamic) gives 3. Indeed, whatever the actual value is
677 // (between 0 and 3), it is not more than 3.
678 #define EIGEN_SIZE_MIN_PREFER_FIXED(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
679  : ((int)a == 1 || (int)b == 1) ? 1 \
680  : ((int)a == Dynamic && (int)b == Dynamic) ? Dynamic \
681  : ((int)a == Dynamic) ? (int)b \
682  : ((int)b == Dynamic) ? (int)a \
683  : ((int)a <= (int)b) ? (int)a : (int)b)
684 
685 // see EIGEN_SIZE_MIN_PREFER_DYNAMIC. No need for a separate variant for MaxSizes here.
686 #define EIGEN_SIZE_MAX(a,b) (((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
687  : ((int)a >= (int)b) ? (int)a : (int)b)
688 
689 #define EIGEN_ADD_COST(a,b) int(a)==Dynamic || int(b)==Dynamic ? Dynamic : int(a)+int(b)
690 
691 #define EIGEN_LOGICAL_XOR(a,b) (((a) || (b)) && !((a) && (b)))
692 
693 #define EIGEN_IMPLIES(a,b) (!(a) || (b))
694 
695 #define EIGEN_MAKE_CWISE_BINARY_OP(METHOD,FUNCTOR) \
696  template<typename OtherDerived> \
697  EIGEN_STRONG_INLINE const CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived> \
698  (METHOD)(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
699  { \
700  return CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived>(derived(), other.derived()); \
701  }
702 
703 // the expression type of a cwise product
704 #define EIGEN_CWISE_PRODUCT_RETURN_TYPE(LHS,RHS) \
705  CwiseBinaryOp< \
706  internal::scalar_product_op< \
707  typename internal::traits<LHS>::Scalar, \
708  typename internal::traits<RHS>::Scalar \
709  >, \
710  const LHS, \
711  const RHS \
712  >
713 
714 #endif // EIGEN_MACROS_H