In MATLAB, the line below converts a Matrix to a Vector.It flattens the matrix column by column into a vector.
myvar(:)
Ho
Another way to do it is:
... VectorXd B = A; B.resize(B.cols()*B.rows(), 1);
or, if you want the vector in row order:
... VectorXd B = A.transpose(); B.resize(B.cols()*B.rows(), 1);
Regards.