Registered Member
|
Hi all,
I am very new in Eigen and C++ but I need it urgently for my research work. In one part of my code I need to multiply a Sparse Matrix with a vector and this is not working Here my step with a small test model: 1) I created a very simple sparse Matrix (3X3) SparseMatrix<int> SpNM2(3,3); SpNM2.coeffRef(i,j)=(i+(j*i)); Here the Sparse: 0 0 0 1 2 3 2 4 6 I created a Vector VectorXd v(3); And then test: SpNM*v; And I got the next message: Error 7 error C2039: 'Scalar' : is not a member of 'Eigen::internal::traits<T>' c:\eigen2\eigen\src\core\densebase.h 48 Eigen32 Then I though I should try with a Sparse Vector better..., SparseVector<int> v(ne); SpNM*v; And I got this. Error 3 error C2039: 'reserve' : is not a member of 'Eigen::Matrix<_Scalar,_Rows,_Cols>' c:\eigen2\eigen\src\sparsecore\sparsesparseproductwithpruning.h 65 Eigen32 I am sure I miss something very big!! but I cannot find it in the tutorial. Please any help would very appreciate Thanks!!! Robin |
Registered Member
|
I doubt you can multiply a SparseMatrix<int> (where all the entries are an int) with a MatrixXd (where all the entries are a double), so that may explain the first error.
For the second error, I don't know. It would help if you could post the whole program (try to make it as small as possible). |
Registered Member
|
Fantastic!! It seems that with all in double is working fine
I will prepare a small clean code to illustrate better the second problem ( Sparse Matrix * Sparse Vector). I move a bench of new question as a new topic (viewtopic.php?f=74&t=106957) if you have a chance Thanks again you save my day! Cheers, Robin |
Registered users: Baidu [Spider], Bing [Bot], Google [Bot]