This bugzilla service is closed. All entries have been migrated to

Bug 1130

Summary: fast filter of outer dimension
Product: Eigen Reporter: Joshua Pritikin <jpritikin>
Component: SparseAssignee: Nobody <eigen.nobody>
Status: CONFIRMED ---    
Severity: Feature Request CC: chtz, gael.guennebaud, jpritikin
Priority: Normal    
Version: 3.3 (current stable)   
Hardware: All   
OS: All   
Description Flags
proposed change none

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?
Comment 4 Nobody 2019-12-04 15:15:44 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: