This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to perform indexing operations in Eigen?

Tags: None
(comma "," separated)
quantdev
Registered Member
Posts
17
Karma
0
Suppose I have an Eigen Matrix like this:

Code: Select all
Eigen::Array<double,Eigen::Dynamic,1> mat();


And now I would like to produce a 2nd matrix which contains the indices of elements in the above matrix which compare equal to some condition (say, they compare equal to true). So if I have a matrix which looks like this:

0
0
1
0
1
0

I would want an output like this:

2
4

I can do this manually by looping through individual elements, but this would be cumbersome and would destroy any of the benefits of using Eigen (performance and simplicity). Is there some sort of functionality within Eigen that I can leverage to achieve something like this?


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]