Search code examples
c++eigeneigen3

Where are the MatrixXd and VectorXd define in Eigen(c++)? I can't find the definition of them through the grep command


I search through the entire source code of Eigen(https://github.com/eigenteam/eigen-git-mirror), but can not fine the definition of some types such as MatrixXd and VectorXd.

The document of Eigen(https://eigen.tuxfamily.org/dox/group__matrixtypedefs.html#ga99b41a69f0bf64eadb63a97f357ab412) says that MatrixXd is defined as

typedef Matrix< double , Dynamic , Dynamic > Eigen::MatrixXd

but I didn't find them is the source code.


Solution

  • MatrixXd is defined by the expansion of the macro EIGEN_MAKE_TYPEDEFS_ALL_SIZES(double, d) on line 451 of Matrix.h.

    In fact, that macro ends up expanding to the typedefs for Matrix2d, Vector2d, RowVector2d, Matrix3d, Vector3d, RowVector3d, Matrix4d, Vector4d, RowVector4d, MatrixXd, VectorXd, RowVectorXd, Matrix2Xd, MatrixX2d, Matrix3Xd, MatrixX3d, Matrix4Xd, and MatrixX4d.