[eigen] Casting matrices

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hello list,
I want to convert a Eigen::MatrixXi to  a double *  (already allocated
and of the right size).
A way to do it is to iterate:
for(int i=0;i<mat.rows();++i)
  for(int j=0;j<mat.cols();++j)
     double_ptr[i*mat.cols()+j] = static_cast<double>(mat(i,j));

However I would like to use MatrixXd::Map in this occasion.

More generally, it is not currently possible to do casting operations
like Vector3i = Vector3d and I want to add it on the wishlist if you
know of an elegant way to do it.

Best regards

Timothee Hunter

---


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/