R.J.
R.J.

Reputation: 1503

Access a column of a matrix as a vector in Eigen

How can I access a single vector from a matrix?

For example: Is there a way to extract a vector using something like A(i) for a matrix Eigen::MatrixXf A(10,10) that returns an Eigen::VectorXf A(10)?

Upvotes: 40

Views: 34774

Answers (1)

R.J.
R.J.

Reputation: 1503

Found in the documentation :/ The way to access a single column is .col(i), and similarly for row, its .row(i). Also of interest is .block<>.

Upvotes: 63

Related Questions