Created attachment 8 [details]
When multiplying an mxn SparseMatrix by an nxp, iff m > p I get
Eigen3/src/Sparse/SparseMatrix.h:190: void Eigen3::SparseMatrix<_Scalar, _Flags, _Index>::startVec(typename Eigen3::ei_traits<Eigen3::SparseMatrix<_Scalar, _Options, _Index> >::Index) [with _Scalar = double, int _Options = 1, _Index = int]: Assertion `m_outerIndex[outer+1]==0 && "You must call startVec for each inner vector sequentially"' failed.
Column-major matrices don't have this problem. Haven't tried mixed.
I attach a test program:
$ testEigenSparseRowMajorProduct m n n p
Created attachment 130 [details]
I also recently ran into this problem (I am using Eigen 3 Beta 4). It seems that its cause is the res.resize() instruction in function sparse_product_impl, line 136 in file src/Sparse/SparseSparseProduct.h.
I was able to get things running by replacing said line with this ugly hack:
if (res.innerSize() != rows || res.outerSize() != cols)
I've tested this with:
- ColMajor ColMajor ColMajor
- ColMajor ColMajor RowMajor
- RowMajor RowMajor RowMajor
The problem thus seems to be that resizing should happen according to inner/outer size of res, not according to rows/cols of res.
I'm attaching the patched SparseSparseProduct.h and another test case.
Created attachment 131 [details]
Silly me... A clean solution seems to be simply checking for ResultType::IsRowMajor. I'm attaching a patch that should be usable.
Created attachment 133 [details]
Patch for src/Sparse/SparseSparseProduct.h
thanks for the patch. I'm currently extending the unit tests and I'll apply your patch soon...
-- 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/37.