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.

112 lines
7.2 KiB

  1. namespace Eigen {
  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 preprocesor tokens recognised by %Eigen.
  6. <b>Table of contents</b>
  7. - \ref TopicPreprocessorDirectivesMajor
  8. - \ref TopicPreprocessorDirectivesAssertions
  9. - \ref TopicPreprocessorDirectivesPerformance
  10. - \ref TopicPreprocessorDirectivesPlugins
  11. - \ref TopicPreprocessorDirectivesDevelopers
  12. \section TopicPreprocessorDirectivesMajor Macros with major effects
  13. These macros have a major effect and typically break the API (Application Programming Interface) and/or the
  14. ABI (Application Binary Interface). This can be rather dangerous: if parts of your program are compiled with
  15. one option, and other parts (or libraries that you use) are compiled with another option, your program may
  16. fail to link or exhibit subtle bugs. Nevertheless, these options can be useful for people who know what they
  17. are doing.
  18. - \b EIGEN2_SUPPORT - if defined, enables the Eigen2 compatibility mode. This is meant to ease the transition
  19. of Eigen2 to Eigen3 (see \ref Eigen2ToEigen3). Not defined by default.
  20. - \b EIGEN2_SUPPORT_STAGEnn_xxx (for various values of nn and xxx) - staged migration path from Eigen2 to
  21. Eigen3; see \ref Eigen2SupportModes.
  22. - \b EIGEN_DEFAULT_DENSE_INDEX_TYPE - the type for column and row indices in matrices, vectors and array
  23. (DenseBase::Index). Set to \c std::ptrdiff_t by default.
  24. - \b EIGEN_DEFAULT_IO_FORMAT - the IOFormat to use when printing a matrix if no #IOFormat is specified.
  25. Defaults to the #IOFormat constructed by the default constructor IOFormat().
  26. - \b EIGEN_INITIALIZE_MATRICES_BY_ZERO - if defined, all entries of newly constructed matrices and arrays are
  27. initializes to zero, as are new entries in matrices and arrays after resizing. Not defined by default.
  28. - \b EIGEN_NO_AUTOMATIC_RESIZING - if defined, the matrices (or arrays) on both sides of an assignment
  29. <tt>a = b</tt> have to be of the same size; otherwise, %Eigen automatically resizes \c a so that it is of
  30. the correct size. Not defined by default.
  31. \section TopicPreprocessorDirectivesAssertions Assertions
  32. The %Eigen library contains many assertions to guard against programming errors, both at compile time and at
  33. run time. However, these assertions do cost time and can thus be turned off.
  34. - \b EIGEN_NO_DEBUG - disables %Eigen's assertions if defined. Not defined by default, unless the
  35. \c NDEBUG macro is defined (this is a standard C++ macro which disables all asserts).
  36. - \b EIGEN_NO_STATIC_ASSERT - if defined, compile-time static assertions are replaced by runtime assertions;
  37. this saves compilation time. Not defined by default.
  38. - \b eigen_assert - macro with one argument that is used inside %Eigen for assertions. By default, it is
  39. basically defined to be \c assert, which aborts the program if the assertion is violated. Redefine this
  40. macro if you want to do something else, like throwing an exception.
  41. - \b EIGEN_MPL2_ONLY - disable non MPL2 compatible features, or in other words disable the features which
  42. are still under the LGPL.
  43. \section TopicPreprocessorDirectivesPerformance Alignment, vectorization and performance tweaking
  44. - \b EIGEN_DONT_ALIGN - disables alignment completely. %Eigen will not try to align its objects and does not
  45. expect that any objects passed to it are aligned. This will turn off vectorization. Not defined by default.
  46. - \b EIGEN_DONT_ALIGN_STATICALLY - disables alignment of arrays on the stack. Not defined by default, unless
  47. \c EIGEN_DONT_ALIGN is defined.
  48. - \b EIGEN_DONT_VECTORIZE - disables explicit vectorization when defined. Not defined by default, unless
  49. alignment is disabled by %Eigen's platform test or the user defining \c EIGEN_DONT_ALIGN.
  50. - \b EIGEN_FAST_MATH - enables some optimizations which might affect the accuracy of the result. The only
  51. optimization this currently includes is single precision sin() and cos() in the present of SSE
  52. vectorization. Defined by default.
  53. - \b EIGEN_UNROLLING_LIMIT - defines the size of a loop to enable meta unrolling. Set it to zero to disable
  54. unrolling. The size of a loop here is expressed in %Eigen's own notion of "number of FLOPS", it does not
  55. correspond to the number of iterations or the number of instructions. The default is value 100.
  56. \section TopicPreprocessorDirectivesPlugins Plugins
  57. It is possible to add new methods to many fundamental classes in %Eigen by writing a plugin. As explained in
  58. the section \ref ExtendingMatrixBase, the plugin is specified by defining a \c EIGEN_xxx_PLUGIN macro. The
  59. following macros are supported; none of them are defined by default.
  60. - \b EIGEN_ARRAY_PLUGIN - filename of plugin for extending the Array class.
  61. - \b EIGEN_ARRAYBASE_PLUGIN - filename of plugin for extending the ArrayBase class.
  62. - \b EIGEN_CWISE_PLUGIN - filename of plugin for extending the Cwise class.
  63. - \b EIGEN_DENSEBASE_PLUGIN - filename of plugin for extending the DenseBase class.
  64. - \b EIGEN_DYNAMICSPARSEMATRIX_PLUGIN - filename of plugin for extending the DynamicSparseMatrix class.
  65. - \b EIGEN_MATRIX_PLUGIN - filename of plugin for extending the Matrix class.
  66. - \b EIGEN_MATRIXBASE_PLUGIN - filename of plugin for extending the MatrixBase class.
  67. - \b EIGEN_PLAINOBJECTBASE_PLUGIN - filename of plugin for extending the PlainObjectBase class.
  68. - \b EIGEN_QUATERNIONBASE_PLUGIN - filename of plugin for extending the QuaternionBase class.
  69. - \b EIGEN_SPARSEMATRIX_PLUGIN - filename of plugin for extending the SparseMatrix class.
  70. - \b EIGEN_SPARSEMATRIXBASE_PLUGIN - filename of plugin for extending the SparseMatrixBase class.
  71. - \b EIGEN_SPARSEVECTOR_PLUGIN - filename of plugin for extending the SparseVector class.
  72. - \b EIGEN_TRANSFORM_PLUGIN - filename of plugin for extending the Transform class.
  73. - \b EIGEN_FUNCTORS_PLUGIN - filename of plugin for adding new functors and specializations of functor_traits.
  74. \section TopicPreprocessorDirectivesDevelopers Macros for Eigen developers
  75. 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.
  76. - \b EIGEN_DEFAULT_TO_ROW_MAJOR - when defined, the default storage order for matrices becomes row-major
  77. instead of column-major. Not defined by default.
  78. - \b EIGEN_INTERNAL_DEBUGGING - if defined, enables assertions in %Eigen's internal routines. This is useful
  79. for debugging %Eigen itself. Not defined by default.
  80. - \b EIGEN_NO_MALLOC - if defined, any request from inside the %Eigen to allocate memory from the heap
  81. results in an assertion failure. This is useful to check that some routine does not allocate memory
  82. dynamically. Not defined by default.
  83. - \b EIGEN_RUNTIME_NO_MALLOC - if defined, a new switch is introduced which can be turned on and off by
  84. calling <tt>set_is_malloc_allowed(bool)</tt>. If malloc is not allowed and %Eigen tries to allocate memory
  85. dynamically anyway, an assertion failure results. Not defined by default.
  86. */
  87. }