Summary: | Add view to nonZeros of SparseMatrix | ||
---|---|---|---|
Product: | Eigen | Reporter: | Darcy <darcy> |
Component: | Sparse | Assignee: | Nobody <eigen.nobody> |
Status: | CONFIRMED --- | ||
Severity: | Feature Request | CC: | chtz, darcy, gael.guennebaud |
Priority: | Normal | ||
Version: | 3.4 (development) | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Bug Depends on: | |||
Bug Blocks: | 1104 |
Description
Darcy
2016-08-05 03:48:23 UTC
Exposing a dense "view" on the non-zeros would solve this issue, e.g.: mat.nonZerosView().setZero(); while enabling many more efficient manipulations on the non zero coefficients. I've suggested this solution several times, e.g. in bug 1104. Implementing it for compressed matrices is just a matter of returning a 1D dense Eigen::Map. For un-compressed ones, this is much more tricky because we would need to return a list of dense Map for which random access would be extremely inefficient. I like the idea of providing a nonZerosView(). If it is to complicated for un-compressed matrices, I think simply restricting this feature to compressed matrices would be ok. Minor question: Should the return value be a vector or an array? I'm tending towards array, since nonZerosView() would behave more like independent scalars. I agree with the two suggestions (compressed-only + array). Done for compressed mode: https://bitbucket.org/eigen/eigen/commits/614aeef Supporting non compressed mode would require a more general expression to concatenate an arbitrary number of vectors/matrices. Fantastic, suits my purposes. Many thanks! -- 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/1271. |