E.g., if I have an Eigen::MatrixXd
of size 10 columns and 3 rows, how can I alias that to a std::vector
of 10 elements of Eigen::Vector3d
?
when I say alias I mean using the same memory block without copying.
I know that I can do the reversed mapping by something like:
std::vector<Vector3d> v(10);
...
Map<Matrix<double,3,Dynamic> > m(v.data().data(), 3, 10);
but reversely, if I have an Eigen::Matrix, I tried to convert it to a vector of Eigen::vector but the following code line failed compilation
Eigen::Matrix2Xd points;
...
std::vector<Eigen::Vector2d> v_points(points.data()
Eigen::aligned_allocator<Eigen::vector2d>(points_data()))