Opened 11 years ago
#6353 new Support Requests
memory layout specifiers doc clarification
| Reported by: | cppljevans | Owned by: | Ronald Garcia |
|---|---|---|---|
| Milestone: | To Be Determined | Component: | multi_array |
| Version: | Boost 1.48.0 | Severity: | Cosmetic |
| Keywords: | stride docs | Cc: |
Description
http://www.boost.org/doc/libs/1_48_0/libs/multi_array/doc/reference.html#memory_layout
Contains an ambiguous specification of storage ordering. This lead me to making the wrong assumption about the meaning as shown by the following post:
http://article.gmane.org/gmane.comp.lib.boost.user/72160
As indicated in that post, *if* I had read the page:
http://www.boost.org/doc/libs/1_48_0/libs/multi_array/doc/user.html#sec_storage
the meaning or storage ordering would have been clear; however, I thought reading the reference.html#memory_layout page would have been the most unambiguous doc since it is the reference manual.
I think the following snippet of code, or something similar, on the reference.html#memory_layout would make the meaning clearer:
std::vector<unsigned>
strides_expected
( std::vector<unsigned> const& a_permut
//storage order(a permutaion 0..a_lengths.size()-1)
, std::vector<unsigned> const& a_lengths
//length of axes.
)
{
unsigned const n=a_lengths.size();
std::vector<unsigned> strides(n);
strides[permut_i[0]]=1;
for( unsigned i=1; i<n; ++i)
{
unsigned i_prev=permut_i[i-1];
strides[permut_i[i]]=strides[i_prev]*a_lengths[i_prev];
}
return strides;//strides of the axes
}
