New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
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
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-26 17:36 UTC by Desire NUENTSA
Modified: 2014-05-05 23:05 UTC (History)
2 users (show)



Attachments
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 ?
Thanks
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.

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