Boost logo

Ublas :

From: Gunter Winkler (guwi17_at_[hidden])
Date: 2006-10-13 02:09:43


On Friday 13 October 2006 06:14, Nico Galoppo wrote:
> I got storage_adaptors.hpp, which I think is a great idea for read-only
> adapters to in-memory data. Unfortunately, I can't get it to work with
> axpy_prod (even though it works with prod):
>
> // this fails
> axpy_prod(A, ublas::make_vector_from_pointer(n, reinterpret_cast<real_type
> const *>(&core_v_minus[0])), b_lambda, false);

> 1>d:\dev\boost\boost\numeric\ublas\functional.hpp(405) : error C3892: 't' :
> you cannot assign to a variable that is const
> 1> d:\dev\boost\boost\numeric\ublas\vector_expression.hpp(1460) :
> see reference to function template instantiation 'const double
> boost::numeric::ublas::vector_norm_1<T>::apply<boost::numeric::ublas::vecto
>r_reference<E>>(const
> boost::numeric::ublas::vector_expression<boost::numeric::ublas::vector_refe
>rence<E>> &)' being compiled
> 1> with
> 1> [
> 1> T=const double,
> 1> E=const boost::numeric::ublas::vector<const double,a_t>
> 1> ]

The problem is, that the value type of the vector adaptor is (const double)
and norm_1 tries to use it as type of the temporary. One should not use
real_type as type for temporary results, but something like

remove_const< real_type >

Does any one know the correct syntax or type lib to use?

mfg
Gunter

PS: the quick fix is to define NDEBUG which skips the computation of norms.