Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2001-04-02 18:32:23


Serge Barral wrote:

> On Mon, 02 Apr 2001 17:26:06 Jeremy Siek wrote:
> > On Mon, 2 Apr 2001, Serge Barral wrote:
> > sbarra> Actually, the result of A[3 <= stride(2) < 7][all][0 <= stride(1)
> > < 10]
> > sbarra> would be a 3 dimensional subarray.
> > sbarra> The current proposal suggests that subarrays will support
> > indexing, but how
> > sbarra> about slicing? Is it really often necessary in practice?

One example of subarray slicing is the recursive strassen[1] matrix multiplication.
However, I've also heard that this is NOT used in practice because it's slow
(I guess because of the recursion).

>
> >
> > I think it is important to keep subarray's as close to array's as
> > possible... it is conceptually simpler for the user that way.
> >
>
> I see. But then what's the type of a subarray of subarray?
>
> > [...]
> > sbarra> But if my assumption above is correct, I don't understand how the
> > result of
> > sbarra> indirect slicing and the result of slicing with Range objects can
> > be of the
> > sbarra> same type, since these are two different kind of views.
> >
> > I don't either ;) They will need to be different types. I haven't figured
> > out how to express the different types yet (in terms of the interface
> > presented to the user).
> >

I'm unsure what indirect slicing is. Is it the use of an vector of indices to create
a subarray, as in the following?

   int indices0[] = {1,5,6,10};
   int indices1[] = {5,4,6};
   int xshape[] = {10,6};
   array<double,2> x(xshape);
   int yshape[] = {4,3};
   array<double,2> y(yshape);
   y = x[indices0][indices1];

   ====================== references ==============
[1] Strassen, volker, "Gaussian elimination is not optimal"
_Numerische Mathematik_, vol. 13, pp. 354-356, 1969.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk