Boost logo

Boost Users :

Subject: [Boost-users] Trouble with vector and matrix multiplication
From: Philip Goh (philip_at_[hidden])
Date: 2008-11-03 14:44:43


I'm trying to multiply a vector by a matrix. Pretty simple, but I'm running
into problems as the compiler is complaining about the overloaded operator *

Here's some code that produces the error.
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <boost/numeric/ublas/vector.hpp>

typedef boost::numeric::ublas::matrix<double> boost_matrix;
typedef boost::numeric::ublas::vector<double> boost_vector;

int _tmain(int argc, _TCHAR* argv[])
    boost_matrix mat(5,5);
    boost_vector v1(5), v2(5);

    v1 = v2 * mat;

 return 0;

The error message I'm getting is : "Error 1 error C2666:
'boost::numeric::ublas::operator *' : 2 overloads have similar conversions
boost_matrix_multiplication.cpp 18"

I'm using Visual Studio 2008 Express and boost 1.36.

This looks like a very simple problem, and any help would be greatly


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at