Boost logo

Ublas :

Subject: [ublas] Problems with nested product compilation?
From: Jesse Perla (jesseperla_at_[hidden])
Date: 2009-04-21 15:16:05


Using Intel 11.0 on Windows with boost 1.38

>From the documentation, it appears that the following (potentially
inefficient) code should work. It doesn't, see compiler error below:namespace
ublas = boost::numeric::ublas;
ublas::matrix<double> A(2,2);
ublas::matrix<double> B(2,2);
ublas::matrix<double> C(2,2);
ublas::matrix<double> D(2,2);
D = prod(A, prod(B,C));

This gives:
1>C:\working\libraries\boost\boost/numeric/ublas/matrix_expression.hpp(4811):
error: incomplete type is not allowed
1> BOOST_STATIC_ASSERT (E1::complexity == 0 && E2::complexity ==
0);
1> ^
1> detected during instantiation of
"boost::numeric::ublas::matrix_matrix_binary_traits<E1::value_type, E1,
E2::value_type, E2>::result_type boost::numeric::ublas::prod(const
boost::numeric::ublas::matrix_expression<E> &, const
boost::numeric::ublas::matrix_expression<E2> &) [with
E1=boost::numeric::ublas::matrix<double, boost::numeric::ublas::row_major,
boost::numeric::ublas::unbounded_array<double,
std::allocator<QuantLib::Real={double}>>>,

It also suggests that the following (with temps) should work. Which does!:
    D = prod(A, ublas::matrix<double>(prod(B,C)));

And it suggests that the following should work, which doesn't:
    D = prod(A, prod<ublas::matrix<double>>(B,C));

This is what I get:
1>C:\working\etk_lib\test_suite\etk\ublas\test_ublas2.cpp(25): error:
identifier "prod" is undefined
1> D = prod(A, prod<ublas::matrix<double>>(B,C));