storage -- unbounded_array

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

storage -- unbounded_array

Alexey Luchko
Hi folks,

I'm trying to start with boost uBLAS.

My intention is to replace some custom code preserving existing API.

The first goal is to create vector and matrix from a C array.

I've found that Storage concept offers range constructor, however both
bounded and unbounded array storages do not provide it.
http://www.boost.org/doc/libs/1_55_0/libs/numeric/ublas/doc/storage_concept.htm
http://www.boost.org/doc/libs/1_55_0/libs/numeric/ublas/doc/bounded_array.htm
http://www.boost.org/doc/libs/1_55_0/libs/numeric/ublas/doc/unbounded_array.htm

First of all, it is disappointing.  Is there a special purpose for the mismatch?

--
Regards,
Alex
_______________________________________________
ublas mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: storage -- unbounded_array

Oswin Krause
Hi Alex,

I assume you want to create a vector/matrix from some provided external
piece of memory and not a vector/matrix using c-arrays (because the
latter is implemented in uBLAS and works pretty well). So take some
advise from someone who went down the first road:

The storage concept is not compatible with what you want to do. It -and
everything that uses it - assumes that storage can be *copied* and is
owned by a *single* vector/matrix. Essentially the whole concept of
implementing a vector using external storage as a vector_container is
seriously flawed and it can only be safely implemented as a new
vector_proxy in the style of vector_range (only that it does not access
another vector but the c-array).

I don't know what the current status is but i heard that people wanted
to do add this kind of proxy to uBLAS. Also there are already a few
projects which want to "replace some custom code preserving existing
API" (for example my own). Maybe all you want to do is already done in
one of these projects.

Best,
Oswin

On 22.07.2014 16:44, Alexey Luchko wrote:

> Hi folks,
>
> I'm trying to start with boost uBLAS.
>
> My intention is to replace some custom code preserving existing API.
>
> The first goal is to create vector and matrix from a C array.
>
> I've found that Storage concept offers range constructor, however both
> bounded and unbounded array storages do not provide it.
> http://www.boost.org/doc/libs/1_55_0/libs/numeric/ublas/doc/storage_concept.htm
> http://www.boost.org/doc/libs/1_55_0/libs/numeric/ublas/doc/bounded_array.htm
> http://www.boost.org/doc/libs/1_55_0/libs/numeric/ublas/doc/unbounded_array.htm
>
> First of all, it is disappointing.  Is there a special purpose for the mismatch?
>
> --
> Regards,
> Alex
> _______________________________________________
> ublas mailing list
> [hidden email]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: [hidden email]

_______________________________________________
ublas mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: storage -- unbounded_array

Alexey Luchko
Hi, Oswin!

I understood that Storage makes a copy.  I accept it.
It would be a really short way to create a *copy* of a `double data[M*N]` like:

   matrix<double> mat(M, N, unbounded_array(begin(data), end(data));

And the Storage concept makes me to expect it works stating there
should be a range copy constructor.  However neither bounded, nor
unbounded array storage classes provide the thing.  That is the point.

It would be nice the range copy constructor.  But more significant the
concepts and implementation should match :)

2014-07-22 20:00 GMT+03:00 oswin krause <[hidden email]>:

> Hi Alex,
>
> I assume you want to create a vector/matrix from some provided external
> piece of memory and not a vector/matrix using c-arrays (because the latter
> is implemented in uBLAS and works pretty well). So take some advise from
> someone who went down the first road:
>
> The storage concept is not compatible with what you want to do. It -and
> everything that uses it - assumes that storage can be *copied* and is owned
> by a *single* vector/matrix. Essentially the whole concept of implementing a
> vector using external storage as a vector_container is seriously flawed and
> it can only be safely implemented as a new vector_proxy in the style of
> vector_range (only that it does not access another vector but the c-array).
>
> I don't know what the current status is but i heard that people wanted to do
> add this kind of proxy to uBLAS. Also there are already a few projects which
> want to "replace some custom code preserving existing API" (for example my
> own). Maybe all you want to do is already done in one of these projects.
>
> Best,
> Oswin
>
>
> On 22.07.2014 16:44, Alexey Luchko wrote:
>>
>> Hi folks,
>>
>> I'm trying to start with boost uBLAS.
>>
>> My intention is to replace some custom code preserving existing API.
>>
>> The first goal is to create vector and matrix from a C array.
>>
>> I've found that Storage concept offers range constructor, however both
>> bounded and unbounded array storages do not provide it.
>>
>> http://www.boost.org/doc/libs/1_55_0/libs/numeric/ublas/doc/storage_concept.htm
>>
>> http://www.boost.org/doc/libs/1_55_0/libs/numeric/ublas/doc/bounded_array.htm
>>
>> http://www.boost.org/doc/libs/1_55_0/libs/numeric/ublas/doc/unbounded_array.htm
>>
>> First of all, it is disappointing.  Is there a special purpose for the
>> mismatch?
>>
>> --
>> Regards,
>> Alex
>> _______________________________________________
>> ublas mailing list
>> [hidden email]
>> http://lists.boost.org/mailman/listinfo.cgi/ublas
>> Sent to: [hidden email]
>
>
> _______________________________________________
> ublas mailing list
> [hidden email]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: [hidden email]
_______________________________________________
ublas mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: [hidden email]