1271
2016-08-05 03:48:23 +0000
Add view to nonZeros of SparseMatrix
2019-12-04 16:05:05 +0000
1
1
1
Unclassified
Eigen
Sparse
3.4 (development)
All
All
CONFIRMED
Normal
Feature Request
---
1104
1
darcy
eigen.nobody
chtz
darcy
gael.guennebaud
oldest_to_newest
6057
0
darcy
2016-08-05 03:48:23 +0000
DESIRED FEATURE:
The ability to call a method that zeros the coefficients in a sparse matrix.
Currently the setZero() method zeros all allocated memory but it would be nice to set the Aij coefficients to zero, while keeping the row and column arrays allocated and populated.
6079
1
gael.guennebaud
2016-08-22 09:04:20 +0000
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.
6093
2
chtz
2016-08-23 12:29:34 +0000
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.
6096
3
gael.guennebaud
2016-08-23 14:24:49 +0000
I agree with the two suggestions (compressed-only + array).
6116
4
gael.guennebaud
2016-08-29 10:08:38 +0000
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.
6117
5
darcy
2016-08-29 10:14:21 +0000
Fantastic, suits my purposes. Many thanks!
9715
6
eigen.nobody
2019-12-04 16:05:05 +0000
-- 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.