Summary: | Adding a diagonal matrix to a sparse matrix causes assertion failed | ||
---|---|---|---|
Product: | Eigen | Reporter: | taroxd |
Component: | Core - general | Assignee: | Nobody <eigen.nobody> |
Status: | CONFIRMED --- | ||
Severity: | Crash | CC: | chtz, gael.guennebaud, jacob.benoit.1 |
Priority: | Normal | ||
Version: | 3.4 (development) | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Bug Depends on: | |||
Bug Blocks: | 814 |
Description
taroxd
2018-07-17 13:25:55 UTC
Not super-urgent, but should be fixable until 3.4. A similar issue is Bug 610. This was on purpose and this limitation is documented: https://eigen.tuxfamily.org/dox/classEigen_1_1SparseMatrix.html#title16 Removing this limitation is not straightforward regarding the strategy to adopt regarding memory reallocation and copies. I implemented an evaluator for Diagonal* so that vec.asDiagonal().sparseView() can work. Sadly, this only works with column-major sparse matrices because mixing row and column major sparse expressions is not allowed, e.g.: row_major_sparse += vec.asDiagonal().sparseView() won't work because by default vec.asDiagonal() is seen as column-major expression. This is a pity because here we really don't care about the storage order. This could be handled through a "symmetric" bit flag stating that calling coeff(i,j) or coeff(j,i) is exactly the same. Actually, we already have a similar problem with sparseView on dense expressions: row_major_sparse + col_major_dense.sparseView() is not allowed though it could easily be accomplished as dense expressions can be traversed row-wise or column-wise. Here the fix would be more complicated as the col_major_dense.sparseView() would has to say "can be traversed in both direction", and the iterator should have to be instantiated with the chosen order. In both cases, that's a lot of internal design changes, so not asDiagonal().sparseView() for 3.4. The code is quite sophisticated but it could be reused to implement smarter versions of SparseMatrix's =, +=, -= working in-place if possible. https://bitbucket.org/eigen/eigen/commits/06d261957e675 -- 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/1574. |