|
Ublas : |
From: Ott Toomet (otoomet_at_[hidden])
Date: 2005-09-09 03:55:04
Dear list,
I am new in c++/ublas. I cannot find out how to assign a
matrix/vector product to a matrix variable. I want to compile the
following
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
int main() {
using namespace boost::numeric::ublas;
vector<double> v(3);
matrix<double> m(3,3);
matrix<double> n;
// ... snip ....
n = prod(v, m);
std::cout << "v*m=" << prod(v,m) << std::endl;
}
However, the compiler gives an error on line 'n = prod(v, m)'. What
do I need to do in order to be able to do a similar assignment? I am
using g++ 3.4.3 if that matters.
Thanks in advance
Ott
g++ -c boostKatse.c++ -O2 -Wall -Wno-unknown-pragmas -I/usr/include
boostKatse.c++: In function `int main()':
boostKatse.c++:11: error: no match for 'operator=' in 'n =
boost::numeric::ublas::prod(const
boost::numeric::ublas::vector_expression<E>&, const
boost::numeric::ublas::matrix_expression<E2>&) [with E1 =
boost::numeric::ublas::vector<double,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>
> >, E2 = boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>
> >](((const
boost::numeric::ublas::matrix_expression<boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>
> > >&)((const
boost::numeric::ublas::matrix_expression<boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>
> >
>*)((boost::numeric::ublas::matrix_expression<boost::numeric::ublas::matrix<double,
boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>
> > >*)(&m)))))'
/usr/include/boost/numeric/ublas/matrix.hpp:175: note: candidates are:
boost::numeric::ublas::matrix<T, F, A>&
boost::numeric::ublas::matrix<T, F, A>::operator=(const
boost::numeric::ublas::matrix<T, F, A>&) [with T = double, F =
boost::numeric::ublas::row_major, A =
boost::numeric::ublas::unbounded_array<double, std::allocator<double>
>]