简体   繁体   中英

How to get an Eigen vector from an Eigen matrix column/row?

The thing I want to do is this:

MatrixXd M;
// Whatever assigned to `X`
VectorXd V = M(1);

Eigen does not support this. Is there a way to retrieve an Eigen vector from an Eigen matrix?

Eigen Slicing and Indexing is of much use here.

To retrieve an i -th row vector:

VectorXd V = M(i, all);

To retrieve an i -th column vector:

VectorXd V = M(all, i);

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM