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

DenseBase< Derived >::nonZeros is broken

Tags: None
(comma "," separated)
xaffeine
Registered Member
Posts
24
Karma
0
The name of this function implies that it returns the number of non-zero elements in the array. The documentation says that, too. In reality, it returns the total number of elements in the array, including any zeros.
M00nMan
Registered Member
Posts
32
Karma
0
To documentation says:
>the number of nonzero coefficients which is in practice the number of stored coefficients.

So this implies that all, including zero coefficients, are counted.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
To count the number of numerical non-zeros, you can do either:
- (mat.array() != 0).count()
- mat.sparseView().nonZeros()


Bookmarks



Who is online

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