Registered Member
|
I frequently find myself attempting to resize a matrix block before copying it to a fixed-size matrix or using it in a function call. Something like
Matrix<double, 9, Dynamic> A; Matrix3d B = A.col(0).conservativeResize(3, 3); This is not allowed so my current work-around is to make B a dynamic matrix: MatrixXd B = A.col(0); B.conservativeResize(3, 3); If I really want a fixed-size matrix, I have make another copy, Matrix3d C = B; Is there a better way to accomplish this? |
Moderator
|
What you want is to "reshape" an expression, not resizing it. You can workaround using Map on the lhs or rhs, e.g.:
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]