Re: [eigen] Copy into a MappedSparseMatrix

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On 07/16/2015 09:27 AM, Christoph Hertzberg wrote:
On 16.07.2015 at 17:22, Norman Goldstein wrote:
So,  copy( a, b ) works, but copy( a*b, c ) does not work.

Directly assigning a product to a MappedSparseMatrix won't work, since the number of non zeros are not known beforehand, so you need to evaluate into a temporary anyways. The reason why your code does not automatically convert into a temporary is that implicit type conversions are disabled for templated functions.

I still don't understand why you want to assign your result to a Mapped matrix?

I am interfacing Eigen to another library, and I would prefer to do the sparse-sparse product directly into the other's data structures. No big deal, though -- this is not a critical section of code.



N.B.: I thought about "recomputing" sparse products (without re-allocating) quite a while ago (http://eigen.tuxfamily.org/bz/show_bug.cgi?id=284, http://eigen.tuxfamily.org/bz/show_bug.cgi?id=385), but never found it important enough to further work on that. If someone wants to work on that, contributions are welcome.

The bug report states:

Moreover it might be possible to 'recompute' a Sparse*Sparse product
where the structure did not change thus no overhead for reallocation would arise.


Eigen already does sparse sparse products, so there is already the algorithm coded for calculating the number of (structural/symbolic) nonzeros in the product. I suppose I don't understand the expression evaluation infrastructure of Eigen well enough to wrap
my mind around the actual problem that this upgrade would entail.




Christoph







Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/