It seems that (*=) can't be operated on row view of a ColMajor sparsematrix in Eigen 3.2.10 as follows
SparseMatrix<double, ColMajor> spmat(3, 3);
spmat.coeffRef(0, 0) = 1.1;
spmat.coeffRef(1, 1) = 2.2;
spmat.coeffRef(2, 2) = 3.3;
spmat.row(2) *= 2.0; // compile failed!
where the spmat.row(2)
in a SparseMatrix<double, ColMajor>
type is read-only type, not the reference type.
In the changelog of Eigen 3.2.10, it says ' fix support for row (resp. column) of a column-major (resp. row-major) sparse matrix', but I think the operation *= in row view of a ColMajor sparmatrix is necessary, so does anyone have a good solution to this problem?
spmat.row(n)
can be modified, maybe it is a bug that make the code inefficient as you said. – Steve Shi