Boost logo

Ublas :

From: Hongzheng Wang (wanghz_at_[hidden])
Date: 2008-05-29 04:59:32


Hi,

Thank you very much.

On Thu, May 29, 2008 at 5:03 AM, Gunter Winkler <guwi17_at_[hidden]> wrote:

> This operation is not implemented. An efficient implementation would be
> to create a new vector_proxy (similar to vector_range and vector_slice)
> that does the index calculation.
......
> When you create a range from a range then the resulting type should
> simply be a range and not a range_of_range. Thus ranges have to be
> "composed". (like the function f(g(x)) is the composition of f and g)

I see now. But it is really disappointing since it is now what I am
looking for :(
In fact, both this question and the above one come from my experience
using std::valarray. I find it is a convenient and productive
mechanism to bring in the concepts of 'general slice', 'indirect
array' and 'masked array' etc. For example, suppose idx is an index
array, say, idx[0]=5, idx[1]=6, idx[2]=10, then something like
indirect subsets can be expressed as va[idx]. When I come to uBLAS, I
notice that there are only slice and range. As a result, it seems to
be difficult to express such a thing. My first attempt is to look for
some combination method for ranges and slices so that any indices
pattern (in theory) could be constructed. I had thought 'compose' is
the answer, but I'm wrong obviously.

I wonder if such mechanisms could be implemented in uBLAS. After all,
std::valarray is not a proper storage representation to be used to
construct ublas::vector/matrix (so it is difficult to let
std::valarray and uBLAS work together if not impossible), and it would
be a loss without these atractive features.

> These adaptors are the answer, however the code is still experimental.
> This means the documentation is very sparse and the use can lead to
> unexpected surprises.
>
> maybe this thread helps:
> http://lists.boost.org/MailArchives/ublas/2007/06/2148.php

It would be helpful.

-- 
HZ