Problem with "prod" function
The following code is not working for me: --------------------------------------- using namespace boost::numeric::ublas; matrix<double> m (3, 3); matrix<double> o (3, 3); for (unsigned i = 0; i < m.size1 (); ++ i) for (unsigned j = 0; j < m.size2 (); ++ j) { m (i, j) = 3 * i + j; o (i, j) = 3 * i + j; } std::cout << m << o << std::endl; matrix_vector_binary2< matrix_row< matrix<double> >, matrix<double>, double > D; D = prod(row(m, 1),o); --------------------------------------- the error is 1>c:\program files (x86) \boost\boost_1_42\boost\numeric\ublas\matrix_expression.hpp(3809) : error C2825: 'F': must be a class or namespace when followed by '::' 1> c:\users\alex\desktop\testngage\testngage\testngage.cpp(21) : see reference to class template instantiation 'boost::numeric::ublas:: matrix_vector_binary2<E1,E2,F>' being compiled 1> with 1> [ 1> E1=boost::numeric::ublas::matrix_row<boost::numeric::ublas:: matrix<double>>, 1> E2=boost::numeric::ublas::matrix<double>, 1> F=double 1> ] 1>c:\program files (x86) \boost\boost_1_42\boost\numeric\ublas\matrix_expression.hpp(3809) : error C2039: 'result_type' : is not a member of '`global namespace'' 1>c:\program files (x86) \boost\boost_1_42\boost\numeric\ublas\matrix_expression.hpp(3809) : error C2146: syntax error : missing ';' before identifier 'value_type' 1>c:\program files (x86) \boost\boost_1_42\boost\numeric\ublas\matrix_expression.hpp(3809) : error C4430: missing type specifier - int assumed. Note: C++ does not support default- int 1>c:\program files (x86) \boost\boost_1_42\boost\numeric\ublas\matrix_expression.hpp(3810) : error C2146: syntax error : missing ';' before identifier 'const_reference' 1>c:\program files (x86) \boost\boost_1_42\boost\numeric\ublas\matrix_expression.hpp(3810) : error C4430: missing type specifier - int assumed. Note: C++ does not support default- int 1>c:\program files (x86) \boost\boost_1_42\boost\numeric\ublas\matrix_expression.hpp(3810) : error C4430: missing type specifier - int assumed. Note: C++ does not support default- int 1>c:\program files (x86) \boost\boost_1_42\boost\numeric\ublas\matrix_expression.hpp(3811) : error C2146: syntax error : missing ';' before identifier 'reference' 1>c:\program files (x86) \boost\boost_1_42\boost\numeric\ublas\matrix_expression.hpp(3811) : error C4430: missing type specifier - int assumed. Note: C++ does not support default- int 1>c:\program files (x86) \boost\boost_1_42\boost\numeric\ublas\matrix_expression.hpp(3811) : error C4430: missing type specifier - int assumed. Note: C++ does not support default- int 1>c:\users\alex\desktop\testngage\testngage\testngage.cpp(21) : error C2512: 'boost::numeric::ublas::matrix_vector_binary2<E1,E2,F>' : no appropriate default constructor available 1> with 1> [ 1> E1=boost::numeric::ublas::matrix_row<boost::numeric::ublas:: matrix<double>>, 1> E2=boost::numeric::ublas::matrix<double>, 1> F=double 1> ] 1>c:\users\alex\desktop\testngage\testngage\testngage.cpp(23) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'boost:: numeric::ublas::matrix_vector_binary2<E1,E2,F>' (or there is no acceptable conversion) 1> with 1> [ 1> E1=boost::numeric::ublas::matrix_row<boost::numeric::ublas:: matrix<double>>, 1> E2=boost::numeric::ublas::matrix<double>, 1> F=boost::numeric::ublas::matrix_vector_prod2<boost::numeric:: ublas::matrix_row<boost::numeric::ublas::matrix<double>>,boost::numeric::ublas:: matrix<double>,double> 1> ] 1> c:\program files (x86) \boost\boost_1_42\boost\numeric\ublas\matrix_expression.hpp(4075): could be 'boost::numeric::ublas::matrix_vector_binary2<E1,E2,F> &boost::numeric::ublas:: matrix_vector_binary2<E1,E2,F>::operator =(const boost::numeric::ublas:: matrix_vector_binary2<E1,E2,F> &)' 1> with 1> [ 1> E1=boost::numeric::ublas::matrix_row<boost::numeric::ublas:: matrix<double>>, 1> E2=boost::numeric::ublas::matrix<double>, 1> F=double 1> ] 1> while trying to match the argument list '(boost::numeric::ublas:: matrix_vector_binary2<E1,E2,F>, boost::numeric::ublas::matrix_vector_binary2<E1, E2,F>)' 1> with 1> [ 1> E1=boost::numeric::ublas::matrix_row<boost::numeric::ublas:: matrix<double>>, 1> E2=boost::numeric::ublas::matrix<double>, 1> F=double 1> ] 1> and 1> [ 1> E1=boost::numeric::ublas::matrix_row<boost::numeric::ublas:: matrix<double>>, 1> E2=boost::numeric::ublas::matrix<double>, 1> F=boost::numeric::ublas::matrix_vector_prod2<boost::numeric:: ublas::matrix_row<boost::numeric::ublas::matrix<double>>,boost::numeric::ublas:: matrix<double>,double> 1> ] where am I getting wrong?
AMDG gicatena@libero.it wrote:
The following code is not working for me: --------------------------------------- using namespace boost::numeric::ublas; matrix<double> m (3, 3); matrix<double> o (3, 3); for (unsigned i = 0; i < m.size1 (); ++ i) for (unsigned j = 0; j < m.size2 (); ++ j) { m (i, j) = 3 * i + j; o (i, j) = 3 * i + j; } std::cout << m << o << std::endl;
matrix_vector_binary2< matrix_row< matrix<double> >, matrix<double>, double > D;
Use the correct function object instead of double as the last argument.
D = prod(row(m, 1),o); ---------------------------------------
the error is
1>c:\program files (x86) \boost\boost_1_42\boost\numeric\ublas\matrix_expression.hpp(3809) : error C2825: 'F': must be a class or namespace when followed by '::' 1> c:\users\alex\desktop\testngage\testngage\testngage.cpp(21) : see reference to class template instantiation 'boost::numeric::ublas:: matrix_vector_binary2<E1,E2,F>' being compiled 1> with 1> [ 1> E1=boost::numeric::ublas::matrix_row<boost::numeric::ublas:: matrix<double>>, 1> E2=boost::numeric::ublas::matrix<double>, 1> F=double 1> ] <snip>
where am I getting wrong?
In Christ, Steven Watanabe
Thanks Steven, but I'm a newbie and I've read all the documentation in the boost website: it did not help me Can you please tell me what kind of object (I assume is a "functor") I have to pass to get the code working? Or alternatively can you provide me a link to study how to write properly this code? As i've stated, I read the boost library without success "Steven Watanabe" <watanabesj@gmail.com> ha scritto nel messaggio news:4BF000A8.7090903@providere-consulting.com...
AMDG
gicatena@libero.it wrote:
The following code is not working for me: --------------------------------------- using namespace boost::numeric::ublas; matrix<double> m (3, 3); matrix<double> o (3, 3); for (unsigned i = 0; i < m.size1 (); ++ i) for (unsigned j = 0; j < m.size2 (); ++ j) { m (i, j) = 3 * i + j; o (i, j) = 3 * i + j; } std::cout << m << o << std::endl;
matrix_vector_binary2< matrix_row< matrix<double> >, matrix<double>, double > D;
Use the correct function object instead of double as the last argument.
D = prod(row(m, 1),o); ---------------------------------------
the error is
1>c:\program files (x86) \boost\boost_1_42\boost\numeric\ublas\matrix_expression.hpp(3809) : error C2825: 'F': must be a class or namespace when followed by '::' 1> c:\users\alex\desktop\testngage\testngage\testngage.cpp(21) : see reference to class template instantiation 'boost::numeric::ublas:: matrix_vector_binary2<E1,E2,F>' being compiled 1> with 1> [ 1> E1=boost::numeric::ublas::matrix_row<boost::numeric::ublas:: matrix<double>>, 1> E2=boost::numeric::ublas::matrix<double>, 1> F=double 1> ] <snip>
where am I getting wrong?
In Christ, Steven Watanabe
participants (3)
-
Alex34
-
gicatena@libero.it
-
Steven Watanabe