Boost logo

Boost Users :

Subject: [Boost-users] multiarray sub_array
From: Petros (pmamales_at_[hidden])
Date: 2012-05-01 14:34:31


Hi,
I want to be able to create an array view on a subset of a multi_array(MA)’s dimensions.
So, say I have a MA of dimension M and I want to choose N (N <M) dimensions of it which I put on a boost::array.
Say, I want to keep the entire range for each dimension.
Is there a way to do this in a general fashion, i.e. w/out the use of the subscript operator on the indices object ?
The documentation mentions something like :

typedef boost::multi_array< double, 3 > Grid3D;
typedef Grid3D::size_type size_type;
typedef Grid3D::index index;
typedef Grid3D::index_range index_range;

typedef Grid3D::array_view<2>::type Slice2D;
index_range r1; //( 0, iMax);
index_range r3; //( 0, kMax);
Grid3D::index_gen indices;
Slice2D sliceJ2 = grid[indices
    [r1]
    [2]
    [r3]
    ];
but this is not sufficient for a generic construction.

And also, what is the difference between array_view and subarray ?

Thank you very much in advance,
Petros



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