Have you tried: vector z = prod(m,x); On 2012-10-26 13:08, Vipin Varma wrote:
Dear all,
My basic requirement is to multiply a matrix and a vector and then to store it into a vector using Boost's UBLAS.
When I multiply a boost::numeric::ublas::compressed_matrix with a boost::numeric::ublas::vector using prod(matrix, vector), the output is a boost::numeric::ublas::matrix_vector_binary1. E.g. <PSEUDOCODE> boost::numeric::ublas::compressed_matrix m; boost::numeric::ublas::vector x; boost::numeric::ublas::matrix_vector_binary1
tmp; tmp = prod(m,x); <PSEUDOCODE> The problem is that in the third field --- which expects the operation type --- in line 3, I do not know what to enter or how to specify the type of operation; I tried '*' and 'prod' and 'vector' and 'compressed_matrix' but none work.
Alternatively, I can avoid the tmp variable altogether and get a working program to copy the result of matrix-vector multiplication onto a new vector y but then I would need two multiplications. E.g. <CODE> std::copy(prod(m,x).begin(), prod(m,x).end(), y.begin()); <CODE>
Any suggestions on how to declare a matrix_vector_binary1 correctly or how to get the finaly result efficiently onto a vector will be appreciated.
Regards, Vipin _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users