Hi,
I am coming back to the list with a question on multi_array views.
Some time ago, I asked if I could have a view that would offer a “rotated” multi_array.
That is, if I have a 3D MA (=multi_array) of dimensions (shape) {L,M,N}), I would like to obtain a
reference to it which would look like {M,N,L} i.e. cyclically rotated (I would actually wish to be able to perform
this rotation many times). The operation should be performed at compile time (no need/wish to do it at run
time and pay the possible overhead in speed).
A couple of friends suggested that I used a storage structure something like this (files are attached for convenience of inspection).
namespace boost {
class cyclic_storage_order
{
typedef detail::multi_array::size_type size_type;
public:
cyclic_storage_order( const std::size_t shift )
:shift_(shift)
{}
template
From the value of abc I can infer the coordinates of the element in the main array. Following the cascade of iterators to sub_arrays, I see that, in the end, I obtain for each value of the first coordinate, the corresponding slices. Then I do a rotation (once) and descend down the iterators. I would expect now 3 slices (instead of 2, before), organized so that each one has the same middle digit (in the abc “representation”. This, however, is not happenning! I attach the code which I have built successfully w/msvc2010 on win7. I use boost1.45. A friend (Larry Evans) , who had offered a lot of help in the past and whom I contacted for suggestion let me know that, the program did not compile in his environment (gcc 4.6.0 and boost v1.46). Any suggestion, help will be greatly appreciated. Kind Regards, Petros
On 06/27/11 20:38, petros wrote: Hi Petros, [snip]
cout << endl << "In Rotated System" << endl; for ( iterator3CRef it3 = rotated.begin(); it3 != rotated.end(); ++ it3 ) { cout << "in first iterator:"; //boost::const_multi_array_ref::const_sub_array
& d2 = *it3;
Changing this from '& d2' to 'const& d2' allowed me to compile the code with gcc4.6.
A friend (Larry Evans) , who had offered a lot of help in the past and whom I contacted for suggestion let me know that, the program did not compile in his environment (gcc 4.6.0 and boost v1.46). [snip] -regards, Larry
Hi Larry, This is strange, since this line is commented out!! Best Regards, Petros -----Original Message----- From: Larry Evans Sent: Monday, June 27, 2011 10:53 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] Multi_array and rotated views On 06/27/11 20:38, petros wrote: Hi Petros, [snip]
cout << endl << "In Rotated System" << endl; for ( iterator3CRef it3 = rotated.begin(); it3 != rotated.end(); ++ it3 ) { cout << "in first iterator:"; //boost::const_multi_array_ref::const_sub_array
& d2 = *it3;
Changing this from '& d2' to 'const& d2' allowed me to compile the code with gcc4.6.
A friend (Larry Evans) , who had offered a lot of help in the past and whom I contacted for suggestion let me know that, the program did not compile in his environment (gcc 4.6.0 and boost v1.46). [snip] -regards, Larry
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On 06/27/11 23:48, petros wrote:
Hi Larry, This is strange, since this line is commented out!! Best Regards, Petros Yes. Very. Hmm... OOPS. Should have been:
typedef boost::subarray_gen
::type::const_iterator iterator1; for ( iterator3 it3 = a.begin(); it3 != a.end(); ++ it3 ) { cout << "in first iterator:"; boost::detail::multi_array::const_sub_array
const& d2 = *it3; cout << (d2.shape())[0] << "x" << (d2.shape())[1] << endl;
IOW, it was in the non-rotated printout loops. Sorry for careless quoting :(
participants (2)
-
Larry Evans
-
petros