The implementation of binary operations such as += and -= in Sparse module is very inefficient. When the sparse vector/matrix dimension is big, it causes out of memory. += and -= should just modify the original sparse vector/matrix in place without allocating new memory.
I'm not sure how exactly you intend to perform this in-place if the non-zero patterns do not match. If you are certain that they match, you can access the values directly with a Map on .valuePtr()
-- 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/713.