You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
9.3 KiB

  1. namespace StormEigen {
  2. /** \page TopicPreprocessorDirectives Preprocessor directives
  3. You can control some aspects of %Eigen by defining the preprocessor tokens using \c \#define. These macros
  4. should be defined before any %Eigen headers are included. Often they are best set in the project options.
  5. This page lists the preprocessor tokens recognized by %Eigen.
  6. \eigenAutoToc
  7. \section TopicPreprocessorDirectivesMajor Macros with major effects
  8. These macros have a major effect and typically break the API (Application Programming Interface) and/or the
  9. ABI (Application Binary Interface). This can be rather dangerous: if parts of your program are compiled with
  10. one option, and other parts (or libraries that you use) are compiled with another option, your program may
  11. fail to link or exhibit subtle bugs. Nevertheless, these options can be useful for people who know what they
  12. are doing.
  13. - \b EIGEN2_SUPPORT and \b EIGEN2_SUPPORT_STAGEnn_xxx are disabled starting from the 3.3 release.
  14. Defining one of these will raise a compile-error. If you need to compile Eigen2 code,
  15. <a href="http://eigen.tuxfamily.org/index.php?title=Eigen2">check this site</a>.
  16. - \b EIGEN_DEFAULT_DENSE_INDEX_TYPE - the type for column and row indices in matrices, vectors and array
  17. (DenseBase::Index). Set to \c std::ptrdiff_t by default.
  18. - \b EIGEN_DEFAULT_IO_FORMAT - the IOFormat to use when printing a matrix if no %IOFormat is specified.
  19. Defaults to the %IOFormat constructed by the default constructor IOFormat::IOFormat().
  20. - \b EIGEN_INITIALIZE_MATRICES_BY_ZERO - if defined, all entries of newly constructed matrices and arrays are
  21. initialized to zero, as are new entries in matrices and arrays after resizing. Not defined by default.
  22. \warning The unary (resp. binary) constructor of \c 1x1 (resp. \c 2x1 or \c 1x2) fixed size matrices is
  23. always interpreted as an initialization constructor where the argument(s) are the coefficient values
  24. and not the sizes. For instance, \code Vector2d v(2,1); \endcode will create a vector with coeficients [2,1],
  25. and \b not a \c 2x1 vector initialized with zeros (i.e., [0,0]). If such cases might occur, then it is
  26. recommended to use the default constructor with a explicit call to resize:
  27. \code
  28. Matrix<?,SizeAtCompileTime,1> v;
  29. v.resize(size);
  30. Matrix<?,RowsAtCompileTime,ColsAtCompileTime> m;
  31. m.resize(rows,cols);
  32. \endcode
  33. - \b EIGEN_INITIALIZE_MATRICES_BY_NAN - if defined, all entries of newly constructed matrices and arrays are
  34. initialized to NaN, as are new entries in matrices and arrays after resizing. This option is especially
  35. useful for debugging purpose, though a memory tool like <a href="http://valgrind.org/">valgrind</a> is
  36. preferable. Not defined by default.
  37. \warning See the documentation of \c EIGEN_INITIALIZE_MATRICES_BY_ZERO for a discussion on a limitations
  38. of these macros when applied to \c 1x1, \c 1x2, and \c 2x1 fixed-size matrices.
  39. - \b EIGEN_NO_AUTOMATIC_RESIZING - if defined, the matrices (or arrays) on both sides of an assignment
  40. <tt>a = b</tt> have to be of the same size; otherwise, %Eigen automatically resizes \c a so that it is of
  41. the correct size. Not defined by default.
  42. \section TopicPreprocessorDirectivesAssertions Assertions
  43. The %Eigen library contains many assertions to guard against programming errors, both at compile time and at
  44. run time. However, these assertions do cost time and can thus be turned off.
  45. - \b EIGEN_NO_DEBUG - disables %Eigen's assertions if defined. Not defined by default, unless the
  46. \c NDEBUG macro is defined (this is a standard C++ macro which disables all asserts).
  47. - \b EIGEN_NO_STATIC_ASSERT - if defined, compile-time static assertions are replaced by runtime assertions;
  48. this saves compilation time. Not defined by default.
  49. - \b eigen_assert - macro with one argument that is used inside %Eigen for assertions. By default, it is
  50. basically defined to be \c assert, which aborts the program if the assertion is violated. Redefine this
  51. macro if you want to do something else, like throwing an exception.
  52. - \b EIGEN_MPL2_ONLY - disable non MPL2 compatible features, or in other words disable the features which
  53. are still under the LGPL.
  54. \section TopicPreprocessorDirectivesPerformance Alignment, vectorization and performance tweaking
  55. - \b EIGEN_MALLOC_ALREADY_ALIGNED - Can be set to 0 or 1 to tell whether default system \c malloc already
  56. returns aligned buffers. In not defined, then this information is automatically deduced from the compiler
  57. and system preprocessor tokens.
  58. - \b EIGEN_DONT_ALIGN - disables alignment completely. %Eigen will not try to align its objects and does not
  59. expect that any objects passed to it are aligned. This will turn off vectorization. Not defined by default.
  60. - \b EIGEN_DONT_ALIGN_STATICALLY - disables alignment of arrays on the stack. Not defined by default, unless
  61. \c EIGEN_DONT_ALIGN is defined.
  62. - \b EIGEN_DONT_PARALLELIZE - if defined, this disables multi-threading. This is only relevant if you enabled OpenMP.
  63. See \ref TopicMultiThreading for details.
  64. - \b EIGEN_DONT_VECTORIZE - disables explicit vectorization when defined. Not defined by default, unless
  65. alignment is disabled by %Eigen's platform test or the user defining \c EIGEN_DONT_ALIGN.
  66. - \b EIGEN_FAST_MATH - enables some optimizations which might affect the accuracy of the result. This currently
  67. enables the SSE vectorization of sin() and cos(), and speedups sqrt() for single precision. Defined to 1 by default.
  68. Define it to 0 to disable.
  69. - \b EIGEN_UNROLLING_LIMIT - defines the size of a loop to enable meta unrolling. Set it to zero to disable
  70. unrolling. The size of a loop here is expressed in %Eigen's own notion of "number of FLOPS", it does not
  71. correspond to the number of iterations or the number of instructions. The default is value 100.
  72. - \b EIGEN_STACK_ALLOCATION_LIMIT - defines the maximum bytes for a buffer to be allocated on the stack. For internal
  73. temporary buffers, dynamic memory allocation is employed as a fall back. For fixed-size matrices or arrays, exceeding
  74. this threshold raises a compile time assertion. Use 0 to set no limit. Default is 128 KB.
  75. - \b EIGEN_HAS_POSIX_MEMALIGN - defines whether aligned memory allocation can be performed through the \c posix_memalign
  76. function. The availability of \c posix_memalign is automatically checked on most platform, but this option allows to
  77. by-pass %Eigen's built-in rules.
  78. \section TopicPreprocessorDirectivesPlugins Plugins
  79. It is possible to add new methods to many fundamental classes in %Eigen by writing a plugin. As explained in
  80. the section \ref ExtendingMatrixBase, the plugin is specified by defining a \c EIGEN_xxx_PLUGIN macro. The
  81. following macros are supported; none of them are defined by default.
  82. - \b EIGEN_ARRAY_PLUGIN - filename of plugin for extending the Array class.
  83. - \b EIGEN_ARRAYBASE_PLUGIN - filename of plugin for extending the ArrayBase class.
  84. - \b EIGEN_CWISE_PLUGIN - filename of plugin for extending the Cwise class.
  85. - \b EIGEN_DENSEBASE_PLUGIN - filename of plugin for extending the DenseBase class.
  86. - \b EIGEN_DYNAMICSPARSEMATRIX_PLUGIN - filename of plugin for extending the DynamicSparseMatrix class.
  87. - \b EIGEN_MATRIX_PLUGIN - filename of plugin for extending the Matrix class.
  88. - \b EIGEN_MATRIXBASE_PLUGIN - filename of plugin for extending the MatrixBase class.
  89. - \b EIGEN_PLAINOBJECTBASE_PLUGIN - filename of plugin for extending the PlainObjectBase class.
  90. - \b EIGEN_MAPBASE_PLUGIN - filename of plugin for extending the MapBase class.
  91. - \b EIGEN_QUATERNION_PLUGIN - filename of plugin for extending the Quaternion class.
  92. - \b EIGEN_QUATERNIONBASE_PLUGIN - filename of plugin for extending the QuaternionBase class.
  93. - \b EIGEN_SPARSEMATRIX_PLUGIN - filename of plugin for extending the SparseMatrix class.
  94. - \b EIGEN_SPARSEMATRIXBASE_PLUGIN - filename of plugin for extending the SparseMatrixBase class.
  95. - \b EIGEN_SPARSEVECTOR_PLUGIN - filename of plugin for extending the SparseVector class.
  96. - \b EIGEN_TRANSFORM_PLUGIN - filename of plugin for extending the Transform class.
  97. - \b EIGEN_FUNCTORS_PLUGIN - filename of plugin for adding new functors and specializations of functor_traits.
  98. \section TopicPreprocessorDirectivesDevelopers Macros for Eigen developers
  99. These macros are mainly meant for people developing %Eigen and for testing purposes. Even though, they might be useful for power users and the curious for debugging and testing purpose, they \b should \b not \b be \b used by real-word code.
  100. - \b EIGEN_DEFAULT_TO_ROW_MAJOR - when defined, the default storage order for matrices becomes row-major
  101. instead of column-major. Not defined by default.
  102. - \b EIGEN_INTERNAL_DEBUGGING - if defined, enables assertions in %Eigen's internal routines. This is useful
  103. for debugging %Eigen itself. Not defined by default.
  104. - \b EIGEN_NO_MALLOC - if defined, any request from inside the %Eigen to allocate memory from the heap
  105. results in an assertion failure. This is useful to check that some routine does not allocate memory
  106. dynamically. Not defined by default.
  107. - \b EIGEN_RUNTIME_NO_MALLOC - if defined, a new switch is introduced which can be turned on and off by
  108. calling <tt>set_is_malloc_allowed(bool)</tt>. If malloc is not allowed and %Eigen tries to allocate memory
  109. dynamically anyway, an assertion failure results. Not defined by default.
  110. */
  111. }