[eigen] Sparse Vector

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hello,

I have some questions about SparseVector. I can't say
http://eigen.tuxfamily.org/dox-devel/classEigen_1_1SparseVector.html
was very useful :(

and
http://eigen.tuxfamily.org/dox-devel/group__TutorialSparse.html
barely mentions those.

My first question is about construction. SparseMatrix has
setFromTriplets(), but i can't find anything similar for vectors. The
method with 'insert' might work as well, but then how does the reserve()
stuff works...?

Second question : i need to compute densevector.dot(sparsevector), but
this wont compile (funny error message at the end). I've "solved' this
by using sparsevector.dot(densevector), which works.. is that
expected/known ?

Third question: in the never-ending quest "how to write functions
accepting different kind of eigen objects", I'd like to have a function
accepting either a dense or sparse vector... is that feasible ? easy ?

Well... that's it for my first glimpse at eigen sparse :)

regards,
Thomas



error message for densevector.dot(sparsevector)
/home/orzel/hg/eigen/Eigen/src/Core/MatrixBase.h:198:5: note:
template<class OtherDerived> typename
Eigen::internal::scalar_product_traits<typename
Eigen::internal::traits<T>::Scalar, typename
Eigen::internal::traits<OtherDerived>::Scalar>::ReturnType
Eigen::MatrixBase::dot(const Eigen::MatrixBase<OtherDerived>&) const
[with OtherDerived = OtherDerived; Derived = Eigen::Matrix<double, 10, 1>]
/home/orzel/hg/eigen/Eigen/src/Core/MatrixBase.h:198:5: note: template
argument deduction/substitution failed:
eigentest.cpp:16:42: note: ‘Eigen::SparseVector<double>’ is not derived
from ‘const Eigen::MatrixBase<Derived>’

-- 
Thomas Capricelli <orzel@xxxxxxxxxxxxxxx>
http://www.freehackers.org/thomas/






Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/