![]() Registered Member ![]()
|
Hi,
my compiler (g++ (Debian 4.3.2-1) 4.3.2) is not able to compile the following program:
g++ test.cpp -I/usr/local/include/eigen2 /usr/local/include/eigen2/Eigen/src/Sparse/SparseMatrixBase.h: In member function ‘Derived& Eigen::SparseMatrixBase<Derived>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::SparseProduct<const Eigen::SparseMatrix<double, 1>&, const Eigen::SparseVector<double, 1>&, 3>, Derived = Eigen::SparseVector<double, 1>]’: /usr/local/include/eigen2/Eigen/src/Sparse/SparseVector.h:242: instantiated from ‘Eigen::SparseVector<_Scalar, _Flags>& Eigen::SparseVector<_Scalar, _Flags>::operator=(const Eigen::SparseMatrixBase<OtherDerived>&) [with OtherDerived = Eigen::SparseProduct<const Eigen::SparseMatrix<double, 1>&, const Eigen::SparseVector<double, 1>&, 3>, _Scalar = double, int _Flags = 1]’ test.cpp:9: instantiated from here /usr/local/include/eigen2/Eigen/src/Sparse/SparseMatrixBase.h:199: error: no type named ‘InnerIterator’ in ‘class Eigen::SparseProduct<const Eigen::SparseMatrix<double, 1>&, const Eigen::SparseVector<double, 1>&, 3>’ Is calculating the product of a SparseMatrix and a SparseVector not possible? - wette |
![]() Registered Member ![]()
|
Interestingly enough, I can make a slight modification and make this compile:
It looks like SparseMatrix has an operator=(SparseProduct<,>), but SparseVector does not. I'd agree that for completeness, one would like to be able to write sparsevector = sparseproduct. It may be the case that the product won't be sparse, though. But the programmer should know ahead of time if the product is sparse and choose the storage appropriately. |
![]() Moderator ![]()
|
indeed, the pb was a missing overload of operator= in SparseVector, should work now in the devel branch (I did not check though....)
|
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]