Boost logo

Boost Users :

From: James N. Knight (nate_at_[hidden])
Date: 2004-04-01 20:30:00


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<double, 2> 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


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