Eigen equivalent of find() in Matlab -


i'm trying write code matlab c++ using eigen, have boolean matrix

a << 1 0 0      0 1 0      1 1 0  

i'm using find function in matlab indices of non-zero values find (a) --> 1 3 5 6, how same think eigen ? thanks.

as of today not implemented inside eigen. essentially, need loop through matrix manually. should work (eigen start indexing @ 0, of course):

eigen::matrix<bool, ....> a; std::vector<eigen::index> idxs; for(eigen::index i=0; i<a.size(); ++i)     if(a(i))         idxs.push_back(i); 

Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -