| namespace Eigen |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| ; |
| \endcode |
| 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. |
|
|
| 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 |
| inline Scalar& at(uint i, uint j) |
| inline Scalar at(uint i) const |
| inline Scalar& at(uint i) |
|
|
| inline RealScalar squaredLength() const |
| inline RealScalar length() const |
| inline RealScalar invLength(void) const |
|
|
| template<typename OtherDerived> |
| inline Scalar squaredDistanceTo(const MatrixBase<OtherDerived>& other) const |
| |
|
|
| template<typename OtherDerived> |
| inline RealScalar distanceTo(const MatrixBase<OtherDerived>& other) const |
| |
|
|
| inline void scaleTo(RealScalar l) |
|
|
| inline Transpose<Derived> transposed() |
| inline const Transpose<Derived> transposed() const |
|
|
| inline uint minComponentId(void) const |
| inline uint maxComponentId(void) const |
|
|
| template<typename OtherDerived> |
| void makeFloor(const MatrixBase<OtherDerived>& other) |
| template<typename OtherDerived> |
| void makeCeil(const MatrixBase<OtherDerived>& other) |
|
|
| const CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const Derived, const ConstantReturnType> |
| operator+(const Scalar& scalar) const |
| |
|
|
| friend const CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const ConstantReturnType, Derived> |
| operator+(const Scalar& scalar, const MatrixBase<Derived>& mat) |
| |
| \endcode |
|
|
| Then one can the following declaration in the config.h or whatever prerequisites header file of his project: |
| \code |
| #define EIGEN_MATRIXBASE_PLUGIN "MatrixBaseAddons.h" |
| \endcode |
|
|
| */ |
|
|
| } |
|
|