Registered Member
|
It's OK to do this
cout << ((MatrixXf(1,2) << 0, 2).finished()) * ((MatrixXf(2,1) << 0, 2).finished()) << endl; But when I try to do this MatrixXf mtemp(2,1); mtemp(0,0) = ((MatrixXf(1,2) << 0, 2).finished()) * ((MatrixXf(2,1) << 0, 2).finished()); It said 'cannot convert const Eigen::GeneralProduct to float in assignment'. |
Moderator
|
Because the result of the matrix product is a matrix. If you use vectors instead of dynamically sized matrices, then Eigen will predict that the result is a 1x1 matrix and allow you to do the conversion. Also using vectors is much faster.
|
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]