Boost logo

Boost Users :

Subject: Re: [Boost-users] multi_array: how can I efficiently have a column selected?
From: Rhys Ulerich (rhys.ulerich_at_[hidden])
Date: 2010-01-29 14:41:43


> I, say, have a 3d array (fortran storage), and want to create a view to it
> so that I select say:
> grid[ indices[
>         [range(9,10)]
>         [3],
>         [range(9,10)] ];
>
> I am not clear on exactly what this creates: from the documentation, I see
> this creating a 3d view.

I think this would be a 2d slice since you provided the single value 3
in the second position. The underling type would be accessible through
either the templated array_view typedefs or else the array_view_gen
mechanism.

> Can I use stl-like iterators on this, to use stl type algorithms?

You can use stl-algorithms on the 2d view. Be aware that iterators
retrieved from the 2D view (via begin(), end()) walk over 1D views
in your example.

> Is there any other repository of examples that would use high-level
> constructs like this so that I could look into a few examples?

Other than the tutorial, the reference, and an article [1], I'm not
aware of any.

- Rhys

[1] http://www3.interscience.wiley.com/journal/109793810/abstract


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net