Registered Member
|
The sparse matrix quick reference guide indicates that I can (1) use block operations to access sub-matrices of a SparseMatrix, and (2) add and subtract with sparse matrices.
Is it possible to combine these operations (in such a way that I can write changes back to the original sparse matrix)? It's not obvious to me from glancing at the docs. e.g.,
I'm getting a compile error when trying to do this. I can readily imagine this might not be convenient to support, so I'm not necessarily surprised. If it's not supported, is there a recommended alternative way to accomplish the same thing? |
Moderator
|
Indeed, only subset of columns are writable for a column-major matrix.
I'll accept a patch generalizing the implementation to any submatrices. Might be useful for quick testing or when performance is not critical, or in some cases where the structure does not change. The current implementation is in Eigen/src/SparseCore/SparseBlock.h, in the function:
Perhaps the easiest would be to do the merging within the temporary matrix ('tmp'), and then keep the insertion into the actual matrix unchanged. |
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]