Error with sparse vector and transpose of matrix

Submitted by Benjamin Chretien

Assigned to Nobody

Link to original bugzilla bug (#1005)
Version: 3.3 (current stable)

Description

Created attachment 566
Repro code

While trying to see whether #980 (closed) (http://eigen.tuxfamily.org/bz/show_bug.cgi?id=980) was solved on the default branch with one of our tests, I noticed an error in the actual result. If we do:

v += m1.transpose ();

where v is a SparseVector<double> and m a SparseMatrix<double> with the adequate size, some inner loop in Eigen's code appears to be done with the wrong size (1 instead of the vector size), resulting in a wrong result.

Repro code: https://gist.github.com/bchretien/29827af68edae49cd6d7 (attached)

Output:

(1,2)
(1,2)
(1,2)
(2,2)
(3,4)

Expected output:

(1,2)
(1,2)
(1,2)
(2,4)
(3,6)

Attachment 566, "Repro code":
eigen_sparse_bug.cpp

Blocking

#558 (closed)

Edited by Eigen Bugzilla