Boost logo

Ublas :

Subject: Re: [ublas] vector_view over (T*,size)
From: Cem Bassoy (cem.bassoy_at_[hidden])
Date: 2019-01-23 09:18:22


Hi there,

yes, it is possible to do something like this. Please have a look at Vector
Proxies.
<https://www.boost.org/doc/libs/1_69_0/libs/numeric/ublas/doc/vector_proxy.html>

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_at_[hidden]>:

> 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_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: cem.bassoy_at_[hidden]
>