This will hopefully be fairly simple, but I cannot find a way to do this in the Eigen documentation.
Let's say I have a 2D vector, i.e.
std::vector<std::vector<double> > data
Suppose it is populated with a 10 x 4 dataset.
How can I use this data to populate an Eigen::MatrixXd mat .
The obvious way is to use a for loop as follows:
#Pseudo code Eigen::MatrixXd mat(10, 4); for i : 1 -> 10 mat(i, 0) = data[i][0]; mat(i, 1) = data[i][1]; ... end
But should there be a better way that is native to Eigen?
c ++ eigen
Fantastic Mr Fox
source share