"/>

Create Eigen::Ref from std::vector

It is easy to copy data between e.g. Eigen::VectorXd and std::vector<double> or std::vector<Eigen::Vector3d>, for example

std::vector<Eigen::Vector3> vec1(10, {0,0,0});
Eigen::VectorXd vec2(30);
VectorXd::Map(&vec2[0], vec1.size()) = vec1;

(see e.g. http://stackoverflow.com/a/26094708/4069571 or http://stackoverflow.com/a/21560121/4069571)

Also, it is possible to create an Eigen::Ref<VectorXd> from a Matrix block/column/... for example like

MatrixXd mat(10,10);
Eigen::Ref<VectorXd> vec = mat.col(0);

The Question

Is it possible to create an Eigen::Ref<VectorXd> from a std::vector<double> or even std::vector<Eigen::Vector3d> without first copying the data?

Read Full News
Submit your Tech Updates