This bugzilla service is closed. All entries have been migrated to
Bug 576 - Sparse reductions
Summary: Sparse reductions
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: Sparse (show other bugs)
Version: unspecified
Hardware: All All
: Normal enhancement
Assignee: Desire NUENTSA
Depends on:
Reported: 2013-03-26 17:36 UTC by Desire NUENTSA
Modified: 2019-12-04 12:12 UTC (History)
2 users (show)

Support for the sparse reduction (7.48 KB, patch)
2013-03-26 17:36 UTC, Desire NUENTSA
no flags Details | Diff

Description Desire NUENTSA 2013-03-26 17:36:02 UTC
Created attachment 321 [details]
Support for the sparse reduction

We are thinking about adding support for the reductions in the sparse modules. See a beginning in the attached patch.
However, most of them have a very ambiguous meaning on sparse matrices : should we consider or not the implicit zero elements ?
If yes, mincoeff() or prod() should always return 0. maxcoeff() as well if the matrix is negative. Should mean() take only the nonzeros counts ?

If we work only the nonzero elements (or explicitly stored zero), then we might consider adding a proxy to let the user know that he is working only on nonzero elements. something like spmat.nonzeroCoeffs().minCoeff(). 

What do you think about this ?
Comment 1 Carlos Guerreiro 2014-05-05 22:29:19 UTC
This would be useful to me, I just hit the limitation. It would be great if partial reductions (row and column wise) would be possible as well.

In my opinion implicit zeros should be considered in methods meant to be parallel to the dense Matrix API => principle of least surprise. Those zeros are part of the matrix just as any other value, they are just stored more compactly - implicitly.
In practice mincoeff() or prod() would practically always return 0 in a complete reduction. However, this would not be so much the case when reducing partially rowwise or columnwise. I can imagine cases where most of the rows would have mostly zeros but a few might have no zero at all.

In any case, sum() and mean() would be extremely useful.
Comment 2 Nobody 2019-12-04 12:12:40 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance:

Note You need to log in before you can comment on or make changes to this bug.