I am using Eigen on a C++ program.
I wonder if there is a way to cast from Eigen::MatrixXd
to Eigen::MatrixXf
.
static_cast <Eigen::MatrixXf>
doesn't seem to work and neither A.cast<MatrixXf>
(this is the cast method from Eigen).
Any solution for this type of cast?
Try this:
Eigen::MatrixXd d; // Matrix of doubles.
Eigen::MatrixXf f = d.cast <float> (); // Matrix of floats.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.