Get matrix views/blocks from a Eigen::VectorXd without copying (shared memory)

拈花ヽ惹草 提交于 2019-11-30 15:58:22

If you want to reinterpret a subvector as a matrix then yes, you have to use Map:

Map<Matrix2d> A(W.data());          // using the first 4 elements
Map<Matrix2d> B(W.tail(4).data());  // using the last 4 elements
Map<MatrixXd> C(W.data()+6, 2,2);   // using the 6th to 10th elements
                                    // with sizes defined at runtime.
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!