New user self-registration is disabled due to spam. Please email eigen-core-team @ if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 1130 - fast filter of outer dimension
Summary: fast filter of outer dimension
Alias: None
Product: Eigen
Classification: Unclassified
Component: Sparse (show other bugs)
Version: 3.3 (current stable)
Hardware: All All
: Normal Feature Request
Assignee: Nobody
Depends on:
Reported: 2015-12-08 19:29 UTC by Joshua Pritikin
Modified: 2015-12-21 14:55 UTC (History)
3 users (show)

proposed change (4.12 KB, patch)
2015-12-09 18:42 UTC, Joshua Pritikin
no flags Details | Diff

Description Joshua Pritikin 2015-12-08 19:29:44 UTC
I wrote some simple code that filters a sparse matrix using a std::vector<bool>. The outer dimension (columns for column major mode) are removed from the matrix when the corresponding mask in the vector is false. Other columns are unchanged. This operation can be really fast because we just rewrite the outerIndexPtr and account for the extra storage entries using innerNonZeroPtr.

Would you accept this method as a contribution to SparseMatrix?
Comment 1 Gael Guennebaud 2015-12-09 14:07:18 UTC
Yes, and one could even think about applying a permutation of the columns "in-place" using this "trick" (as we manually do in SparseLU), but this case is more tricky because then the starting indices would not monotonically increase anymore. So let's focus on the mask first!
Comment 2 Joshua Pritikin 2015-12-09 18:42:59 UTC
Created attachment 634 [details]
proposed change

How does this look?
Comment 3 Joshua Pritikin 2015-12-21 14:55:04 UTC
Can somebody review my proposed patch?

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