Boost logo

Ublas :

From: Stanislav Funiak (sfuniak_at_[hidden])
Date: 2007-12-03 21:37:00


Hi,

I'm using the indirect array proxies with
BOOST_UBLAS_ENABLE_PROXY_SHORTCUTS turned on.

When compiling the following code

matrix_type lambda;
indirect_array<std::vector<size_type> > indx;
...
lambda(indx, indx) = x.lambda;

I get the following error message:

../../libs/boost-trunk/boost/numeric/ublas/expression_types.hpp:380:
error: no matching function for call to
'boost::numeric::ublas::matrix_indirect<boost::numeric::ublas::matrix<double,
boost::numeric::ublas::basic_row_major<unsigned int, int>,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>
> >, std::vector<unsigned int, std::allocator<unsigned int> >
>::matrix_indirect(boost::numeric::ublas::matrix<double,
boost::numeric::ublas::basic_row_major<unsigned int, int>,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>
> >&, const boost::numeric::ublas::indirect_array<std::vector<unsigned
int, std::allocator<unsigned int> > >&, const
boost::numeric::ublas::indirect_array<std::vector<unsigned int,
std::allocator<unsigned int> > >&)'

../../libs/boost-trunk/boost/numeric/ublas/matrix_proxy.hpp:4202:
note: candidates are: boost::numeric::ublas::matrix_indirect<M,
IA>::matrix_indirect(const typename
boost::mpl::if_<boost::is_const<C>, typename V::const_closure_type,
typename V::closure_type>::type&, const IA&, const IA&, int) [with M =
boost::numeric::ublas::matrix<double,
boost::numeric::ublas::basic_row_major<unsigned int, int>,
boost::numeric::ublas::unbounded_array<double, std::allocator<double>
> >, IA = std::vector<unsigned int, std::allocator<unsigned int> >]

etc.

The relevant line in expression_types.hpp (372-381 in SVN revision 39369):

        template<class A>
        BOOST_UBLAS_INLINE
        const matrix_indirect<const E, A> operator () (const
indirect_array<A> &ia1, const indirect_array<A> &ia2) const {
            return matrix_indirect<const E, A> (operator () (), ia1, ia2);
        }
        template<class A>
        BOOST_UBLAS_INLINE
        matrix_indirect<E, A> operator () (const indirect_array<A>
&ia1, const indirect_array<A> &ia2) {
            return matrix_indirect<E, A > (operator () (), ia1, ia2);
        }

Changing matrix_indirect<E, A > to matrix_indirect<E,
indirect_array<A> > solves the problem.

The same goes for vector_expression & vector_indirect.

Stano