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?
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!
Created attachment 634 [details]
How does this look?
Can somebody review my proposed patch?
-- GitLab Migration Automatic Message --
This bug has been migrated to gitlab.com'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: https://gitlab.com/libeigen/eigen/issues/1130.