mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Improve documentation of plugins.
This commit is contained in:
@@ -9,7 +9,7 @@ Eigen can be extended in several ways, for instance, by defining global methods,
|
||||
- \ref InheritingFromMatrix
|
||||
- \ref CustomScalarType
|
||||
|
||||
\section ExtendingMatrixBase Extending MatrixBase
|
||||
\section ExtendingMatrixBase Extending MatrixBase (and other classes)
|
||||
|
||||
In this section we will see how to add custom methods to MatrixBase. Since all expressions and matrix types inherit MatrixBase, adding a method to MatrixBase make it immediately available to all expressions ! A typical use case is, for instance, to make Eigen compatible with another API.
|
||||
|
||||
@@ -22,9 +22,11 @@ class MatrixBase {
|
||||
#endif
|
||||
};
|
||||
\endcode
|
||||
Therefore to extend MatrixBase with you own methods you just have to create a file with your method declaration and define EIGEN_MATRIXBASE_PLUGIN before you include any Eigen's header file.
|
||||
Therefore to extend MatrixBase with your own methods you just have to create a file with your method declaration and define EIGEN_MATRIXBASE_PLUGIN before you include any Eigen's header file.
|
||||
|
||||
Here is an example of such an extension file: \n
|
||||
You can extend many of the other classes used in Eigen by defining similarly named preprocessor symbols. For instance, define \c EIGEN_ARRAYBASE_PLUGIN if you want to extend the ArrayBase class. A full list of classes that can be extended in this way and the corresponding preprocessor symbols can be found on our page \ref TopicPreprocessorDirectives.
|
||||
|
||||
Here is an example of an extension file for adding methods to MatrixBase: \n
|
||||
\b MatrixBaseAddons.h
|
||||
\code
|
||||
inline Scalar at(uint i, uint j) const { return this->operator()(i,j); }
|
||||
|
||||
@@ -18,6 +18,8 @@ This page lists the preprocesor tokens recognised by Eigen.
|
||||
|
||||
- \b EIGEN2_SUPPORT - if defined, enables the Eigen2 compatibility mode. This is meant to ease the transition
|
||||
of Eigen2 to Eigen3 (see \ref Eigen2ToEigen3). Not defined by default.
|
||||
- \b EIGEN2_SUPPORT_STAGEnn_xxx (for various values of nn and xxx) - staged migration path from Eigen2 to
|
||||
Eigen3; see \ref Eigen2SupportModes.
|
||||
- \b EIGEN_DEFAULT_TO_ROW_MAJOR - when defined, the default storage order for matrices becomes row-major
|
||||
instead of column-major. Not defined by default.
|
||||
- \b EIGEN_DEFAULT_IO_FORMAT - the IOFormat to use when printing a matrix if no #IOFormat is specified.
|
||||
@@ -60,17 +62,22 @@ It is possible to add new methods to many fundamental classes in Eigen by writin
|
||||
the section \ref ExtendingMatrixBase, the plugin is specified by defining a \c EIGEN_xxx_PLUGIN macro. The
|
||||
following macros are supported; none of them are defined by default.
|
||||
|
||||
- \b EIGEN_ARRAYBASE_PLUGIN - filename of plugin for extending the ArrayBase class.
|
||||
- \b EIGEN_ARRAY_PLUGIN - filename of plugin for extending the Array class.
|
||||
- \b EIGEN_ARRAYBASE_PLUGIN - filename of plugin for extending the ArrayBase class.
|
||||
- \b EIGEN_CWISE_PLUGIN - filename of plugin for extending the Cwise class.
|
||||
- \b EIGEN_DENSEBASE_PLUGIN - filename of plugin for extending the DenseBase class.
|
||||
- \b EIGEN_MATRIXBASE_PLUGIN - filename of plugin for extending the MatrixBase class.
|
||||
- \b EIGEN_DYNAMICSPARSEMATRIX_PLUGIN - filename of plugin for extending the DynamicSparseMatrix class.
|
||||
- \b EIGEN_MATRIX_PLUGIN - filename of plugin for extending the Matrix class.
|
||||
- \b EIGEN_MATRIXBASE_PLUGIN - filename of plugin for extending the MatrixBase class.
|
||||
- \b EIGEN_PLAINOBJECTBASE_PLUGIN - filename of plugin for extending the PlainObjectBase class.
|
||||
- \b EIGEN_QUATERNIONBASE_PLUGIN - filename of plugin for extending the QuaternionBase class.
|
||||
- \b EIGEN_SPARSEMATRIX_PLUGIN - filename of plugin for extending the SparseMatrix class.
|
||||
- \b EIGEN_SPARSEMATRIXBASE_PLUGIN - filename of plugin for extending the SparseMatrixBase class.
|
||||
- \b EIGEN_SPARSEVECTOR_PLUGIN - filename of plugin for extending the SparseVector class.
|
||||
- \b EIGEN_TRANSFORM_PLUGIN - filename of plugin for extending the Transform class.
|
||||
- \b EIGEN_FUNCTORS_PLUGIN - filename of plugin for adding new functors and specializations of functor_traits.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user