1 namespace Eigen { 2 3 /** \page TopicCustomizing_InheritingMatrix Inheriting from Matrix 4 5 Before inheriting from Matrix, be really, I mean REALLY, sure that using 6 EIGEN_MATRIX_PLUGIN is not what you really want (see previous section). 7 If you just need to add few members to Matrix, this is the way to go. 8 9 An example of when you actually need to inherit Matrix, is when you 10 have several layers of heritage such as 11 MyVerySpecificVector1, MyVerySpecificVector2 -> MyVector1 -> Matrix and 12 MyVerySpecificVector3, MyVerySpecificVector4 -> MyVector2 -> Matrix. 13 14 In order for your object to work within the %Eigen framework, you need to 15 define a few members in your inherited class. 16 17 Here is a minimalistic example: 18 19 \include CustomizingEigen_Inheritance.cpp 20 21 Output: \verbinclude CustomizingEigen_Inheritance.out 22 23 This is the kind of error you can get if you don't provide those methods 24 \verbatim 25 error: no match for operator= in v = Eigen::operator*( 26 const Eigen::MatrixBase<Eigen::Matrix<double, -0x000000001, 1, 0, -0x000000001, 1> >::Scalar&, 27 const Eigen::MatrixBase<Eigen::Matrix<double, -0x000000001, 1> >::StorageBaseType&) 28 (((const Eigen::MatrixBase<Eigen::Matrix<double, -0x000000001, 1> >::StorageBaseType&) 29 ((const Eigen::MatrixBase<Eigen::Matrix<double, -0x000000001, 1> >::StorageBaseType*)(& v)))) 30 \endverbatim 31 32 */ 33 34 } 35