Registered Member
|
I need to compute the sparse matrix-matrix product M^T*M many times, where the values of M's entries changes every time, but the sparsity pattern stays the same. Is there any way of more efficiently computing the product, other than just
MTM = M.transpose()*M; each time? |
Moderator
|
Yes, here is what you could do:
first time: R = M.adjoint() * M; then: loop over the non-zeros of R as usual (see http://eigen.tuxfamily.org/dox-devel/gr ... tml#title2), and in the nested for loops: it.valueRef() = M.col(it.row()).dot(M.col(it.col)); This should work, please let us know whether you get a significant gain... |
Registered Member
|
Actually I get a significant speed *loss.*
If I write my own code to compute the sparse column dot product I still get a speed loss, though slightly less. |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]