Boost logo

Ublas :

From: Manoj Rajagopalan (rmanoj_at_[hidden])
Date: 2006-04-17 10:18:26


Does c have to be declared with dimensions or will the expression
evaluate to a temporary according to which c is resized and allocated?

Stefan Tarrant wrote:
> The result of this vector matrix product is a vector, not a matrix.
>
> Neal Becker wrote:
>> I'm stumped - any hints?
>>
>> #include <boost/numeric/ublas/vector.hpp>
>> #include <boost/numeric/ublas/matrix.hpp>
>>
>> int main() {
>> namespace ublas = boost::numeric::ublas;
>>
>> ublas::vector<int> a (4);
>> ublas::matrix<int> b (4,4);
>> ublas::matrix<int> c = ublas::prod (a, b);
>> }
>>
>> Test.cc: In function ‘int main()’:
>> Test.cc:9: error: conversion from
>> ‘boost::numeric::ublas::matrix_vector_binary2<boost::numeric::ublas::vector<int,
>> boost::numeric::ublas::unbounded_array<int, std::allocator<int> > >,
>> boost::numeric::ublas::matrix<int,
>> boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
>> boost::numeric::ublas::unbounded_array<int, std::allocator<int> > >,
>> boost::numeric::ublas::matrix_vector_prod2<int, int, int> >’ to non-scalar
>> type ‘boost::numeric::ublas::matrix<int,
>> boost::numeric::ublas::basic_row_major<long unsigned int, long int>,
>> boost::numeric::ublas::unbounded_array<int, std::allocator<int> > >’
>> requested
>>
>> _______________________________________________
>> ublas mailing list
>> ublas_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/ublas
>