colddie colddie - 1 year ago 195
C++ Question

how to convert a matrix in dlib to a std::vector

I have a colume vector defined in dlib. How can I convert it to std::vector?

typedef dlib::matrix<double,0,1> column_vector;
column_vector starting_point(4);
starting_point = 1,2,3,4;
std::vector x = ??


Answer Source

There are many ways. You could copy it via a for loop. Or use the std::vector constructor that takes iterators: std::vector<double> x(starting_point.begin(), starting_point.end()).