Inner Product and Sparse Matrix in Boost
Hi all, Is there a boost library that allow inner product between sparse matrix and vector? - Gundala Viswanath Jakarta - Indonesia
Gundala Viswanath wrote:
Is there a boost library that allow inner product between sparse matrix and vector?
The uBlas library (http://www.boost.org/doc/libs/1_37_0/libs/numeric/ublas/doc/index.htm) might help you here. The following code compiles at least, so there is good hope that it does more or less what you want. (There is a special mailing list for ublas, if you need more information/help.) #include <boost/numeric/ublas/vector.hpp> #include <boost/numeric/ublas/matrix_sparse.hpp> void test() { boost::numeric::ublas::mapped_matrix<double> A(3,3, 3*3); boost::numeric::ublas::compressed_matrix<double> B(3,3, 3*3); boost::numeric::ublas::coordinate_matrix<double> C(3,3, 3*3); boost::numeric::ublas::vector<double> x(3); boost::numeric::ublas::vector<double> a = boost::numeric::ublas::prod(A,x); boost::numeric::ublas::vector<double> b = boost::numeric::ublas::prod(B,x); boost::numeric::ublas::vector<double> c = boost::numeric::ublas::prod(C,x); boost::numeric::ublas::vector<double> d = boost::numeric::ublas::prod(x,C); } Regards, Thomas
participants (2)
-
Gundala Viswanath
-
Thomas Klimpel