Hi there,

yes, it is possible to do something like this. Please have a look at Vector Proxies.


using namespace boost::numeric::ublas;
using vtype = vector<double>;
using vrange = vector_range<vtype>;

auto v = vtype(3);
auto r = range(0,v.size()); // complete range
auto vr = vrange(v,r); // no copy of v

Best
CB





Am Mo., 21. Jan. 2019 um 11:28 Uhr schrieb dariomt--- via ublas <ublas@lists.boost.org>:
Hi list,

Say I have a (GSL-like) span (which is basically a pointer and a length).

Is it possible to build a vector-like view over that span, so that the result is usable within the ublas expression template machinery? Some kind of ublas::vector_view(T*, size)?

The objective is to avoid having to copy all that data into a ublas::vector just to interoperate with other ublas code.

Thanks in advance!
_______________________________________________
ublas mailing list
ublas@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: cem.bassoy@gmail.com