Registered Member
|
As a newbie, I am surprised that I haven't been able to get iterators for Eigen arrays or matrices. I want to get the number of non-zero entries in a matrix, but it's not clear what is the neatest approach. If there were iterators, I could use std::count_if().
|
Registered Member
|
If A is your dense matrix of array, the following expression should count the number of non zeros coefficients: (A != 0).count();
|
Registered Member
|
That makes sense. For general iteration, should I use myMat.data() and myMat.data()+myMat.size() in places where I would have used begin() and end() on a standard container?
|
Registered users: Baidu [Spider], Bing [Bot], Google [Bot], rblackwell