I am trying to sort a multi_array along a dimension that is not the last.
In other words, I can sort the rows of a 2D multi_array like so:
typedef boost::multi_array array_type;
typedef array_type::iterator iterator2;
typedef array_type::template subarray<1>::type::iterator iterator1;
array_type A(boost::extents[10][10]);
for (iterator2 i = A.begin(); i!=A.end(); ++i){
sort((*i).begin(),(*i).end());
What I can't seem to do is sort the columns. Is there a way I can create
a view with the dimensions reordered? Or, can I somehow create a strided
iterator that will do the job (select the values in a column)? I would
like to avoid transposing the array. Pointers to the relevant documentation
or suggestions are appreciated.
James