Boost logo

Ublas :

From: Peter Melchior (pmelchior_at_[hidden])
Date: 2007-01-30 06:35:39


Hello,

> > I'm trying to use vector expressions for atlas methods.
> > I did a fresh checkout of the sandbox and tried to compile the
> > example
> >
> > >from the atlas bindings documentation:
> >
>
> > Error: vector_expression() is private
>
> The default constructor of vector_expression is private, because it is
> not allowed to directly instantiate a vector_expression. This means one
> cannot have functions like:
>
> template < class V>
> foo(const vector_expression<V> v);
>
> but one has to use
>
> template < class V>
> foo(const vector_expression<V> & v); // note the reference!
>
> maybe there are some mistakes of such type in the atlas bindings.
>
> Can you check this?

This is the implementation of nrm2 in the atlas bindings.

   // nrm2 <- ||x||_2
    template <typename Vct>
    inline
    typename traits::type_traits<
#ifndef BOOST_NUMERIC_BINDINGS_POOR_MANS_TRAITS
      typename traits::vector_traits<Vct>::value_type
#else
      typename Vct::value_type
#endif
>::real_type
    nrm2 (Vct const& x) {
      return detail::nrm2 (traits::vector_size (x),
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
                           traits::vector_storage (x),
#else
                           traits::vector_storage_const (x),
#endif
                           traits::vector_stride (x));
    }

So the vector is passed by reference.

Regards,

Peter Melchior