Subject: [Boost-bugs] [Boost C++ Libraries] #6353: memory layout specifiers doc clarification
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-01-03 14:44:56
#6353: memory layout specifiers doc clarification
------------------------------+---------------------------------------------
Reporter: cppljevans | Owner: garcia
Type: Support Requests | Status: new
Milestone: To Be Determined | Component: multi_array
Version: Boost 1.48.0 | Severity: Cosmetic
Keywords: stride docs |
------------------------------+---------------------------------------------
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
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6353> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:08 UTC