mirror of
https://github.com/boostorg/multi_array.git
synced 2025-05-12 13:51:36 +00:00
Rename extents parameters
This commit is contained in:
parent
0c5348bef7
commit
894c172d10
@ -158,7 +158,7 @@ public:
|
|||||||
|
|
||||||
template <class ExtentList>
|
template <class ExtentList>
|
||||||
explicit multi_array(
|
explicit multi_array(
|
||||||
ExtentList const& extents,
|
ExtentList const& _extents,
|
||||||
const Allocator& alloc = Allocator()
|
const Allocator& alloc = Allocator()
|
||||||
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
|
||||||
, typename mpl::if_<
|
, typename mpl::if_<
|
||||||
@ -166,7 +166,7 @@ public:
|
|||||||
int&,int>::type* = 0
|
int&,int>::type* = 0
|
||||||
#endif
|
#endif
|
||||||
) :
|
) :
|
||||||
super_type((T*)initial_base_,extents),
|
super_type((T*)initial_base_,_extents),
|
||||||
alloc_base(boost::empty_init_t(),alloc) {
|
alloc_base(boost::empty_init_t(),alloc) {
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||||
@ -175,9 +175,9 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
template <class ExtentList>
|
template <class ExtentList>
|
||||||
explicit multi_array(ExtentList const& extents,
|
explicit multi_array(ExtentList const& _extents,
|
||||||
const general_storage_order<NumDims>& so) :
|
const general_storage_order<NumDims>& so) :
|
||||||
super_type((T*)initial_base_,extents,so),
|
super_type((T*)initial_base_,_extents,so),
|
||||||
alloc_base(boost::empty_init_t()) {
|
alloc_base(boost::empty_init_t()) {
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||||
@ -185,10 +185,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class ExtentList>
|
template <class ExtentList>
|
||||||
explicit multi_array(ExtentList const& extents,
|
explicit multi_array(ExtentList const& _extents,
|
||||||
const general_storage_order<NumDims>& so,
|
const general_storage_order<NumDims>& so,
|
||||||
Allocator const& alloc) :
|
Allocator const& alloc) :
|
||||||
super_type((T*)initial_base_,extents,so),
|
super_type((T*)initial_base_,_extents,so),
|
||||||
alloc_base(boost::empty_init_t(),alloc) {
|
alloc_base(boost::empty_init_t(),alloc) {
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||||
@ -433,7 +433,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
template <typename ExtentList>
|
template <typename ExtentList>
|
||||||
multi_array& resize(const ExtentList& extents) {
|
multi_array& resize(const ExtentList& _extents) {
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
detail::multi_array::CollectionConcept<ExtentList> >();
|
detail::multi_array::CollectionConcept<ExtentList> >();
|
||||||
|
|
||||||
@ -442,7 +442,7 @@ public:
|
|||||||
|
|
||||||
for (int i=0; i != NumDims; ++i) {
|
for (int i=0; i != NumDims; ++i) {
|
||||||
typedef typename gen_type::range range_type;
|
typedef typename gen_type::range range_type;
|
||||||
ranges.ranges_[i] = range_type(0,extents[i]);
|
ranges.ranges_[i] = range_type(0,_extents[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this->resize(ranges);
|
return this->resize(ranges);
|
||||||
|
@ -128,15 +128,15 @@ protected:
|
|||||||
// used by array operator[] and iterators to get reference types.
|
// used by array operator[] and iterators to get reference types.
|
||||||
template <typename Reference, typename TPtr>
|
template <typename Reference, typename TPtr>
|
||||||
Reference access(boost::type<Reference>,index idx,TPtr base,
|
Reference access(boost::type<Reference>,index idx,TPtr base,
|
||||||
const size_type* extents,
|
const size_type* _extents,
|
||||||
const index* strides,
|
const index* strides,
|
||||||
const index* index_bases) const {
|
const index* index_bases) const {
|
||||||
|
|
||||||
BOOST_ASSERT(idx - index_bases[0] >= 0);
|
BOOST_ASSERT(idx - index_bases[0] >= 0);
|
||||||
BOOST_ASSERT(size_type(idx - index_bases[0]) < extents[0]);
|
BOOST_ASSERT(size_type(idx - index_bases[0]) < _extents[0]);
|
||||||
// return a sub_array<T,NDims-1> proxy object
|
// return a sub_array<T,NDims-1> proxy object
|
||||||
TPtr newbase = base + idx * strides[0];
|
TPtr newbase = base + idx * strides[0];
|
||||||
return Reference(newbase,extents+1,strides+1,index_bases+1);
|
return Reference(newbase,_extents+1,strides+1,index_bases+1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,14 +168,14 @@ protected:
|
|||||||
// used by array operator[] and iterators to get reference types.
|
// used by array operator[] and iterators to get reference types.
|
||||||
template <typename Reference, typename TPtr>
|
template <typename Reference, typename TPtr>
|
||||||
Reference access(boost::type<Reference>,index idx,TPtr base,
|
Reference access(boost::type<Reference>,index idx,TPtr base,
|
||||||
const size_type* extents,
|
const size_type* _extents,
|
||||||
const index* strides,
|
const index* strides,
|
||||||
const index* index_bases) const {
|
const index* index_bases) const {
|
||||||
|
|
||||||
ignore_unused_variable_warning(index_bases);
|
ignore_unused_variable_warning(index_bases);
|
||||||
ignore_unused_variable_warning(extents);
|
ignore_unused_variable_warning(_extents);
|
||||||
BOOST_ASSERT(idx - index_bases[0] >= 0);
|
BOOST_ASSERT(idx - index_bases[0] >= 0);
|
||||||
BOOST_ASSERT(size_type(idx - index_bases[0]) < extents[0]);
|
BOOST_ASSERT(size_type(idx - index_bases[0]) < _extents[0]);
|
||||||
return *(base + idx * strides[0]);
|
return *(base + idx * strides[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,17 +299,17 @@ protected:
|
|||||||
Reference access_element(boost::type<Reference>,
|
Reference access_element(boost::type<Reference>,
|
||||||
const IndexList& indices,
|
const IndexList& indices,
|
||||||
TPtr base,
|
TPtr base,
|
||||||
const size_type* extents,
|
const size_type* _extents,
|
||||||
const index* strides,
|
const index* strides,
|
||||||
const index* index_bases) const {
|
const index* index_bases) const {
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
CollectionConcept<IndexList> >();
|
CollectionConcept<IndexList> >();
|
||||||
ignore_unused_variable_warning(index_bases);
|
ignore_unused_variable_warning(index_bases);
|
||||||
ignore_unused_variable_warning(extents);
|
ignore_unused_variable_warning(_extents);
|
||||||
#if !defined(NDEBUG) && !defined(BOOST_DISABLE_ASSERTS)
|
#if !defined(NDEBUG) && !defined(BOOST_DISABLE_ASSERTS)
|
||||||
for (size_type i = 0; i != NumDims; ++i) {
|
for (size_type i = 0; i != NumDims; ++i) {
|
||||||
BOOST_ASSERT(indices[i] - index_bases[i] >= 0);
|
BOOST_ASSERT(indices[i] - index_bases[i] >= 0);
|
||||||
BOOST_ASSERT(size_type(indices[i] - index_bases[i]) < extents[i]);
|
BOOST_ASSERT(size_type(indices[i] - index_bases[i]) < _extents[i]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -408,7 +408,7 @@ protected:
|
|||||||
generate_array_view(boost::type<ArrayRef>,
|
generate_array_view(boost::type<ArrayRef>,
|
||||||
const boost::detail::multi_array::
|
const boost::detail::multi_array::
|
||||||
index_gen<NumDims,NDims>& indices,
|
index_gen<NumDims,NDims>& indices,
|
||||||
const size_type* extents,
|
const size_type* _extents,
|
||||||
const index* strides,
|
const index* strides,
|
||||||
const index* index_bases,
|
const index* index_bases,
|
||||||
TPtr base) const {
|
TPtr base) const {
|
||||||
@ -422,7 +422,7 @@ protected:
|
|||||||
|
|
||||||
// Use array specs and input specs to produce real specs.
|
// Use array specs and input specs to produce real specs.
|
||||||
const index default_start = index_bases[n];
|
const index default_start = index_bases[n];
|
||||||
const index default_finish = default_start+extents[n];
|
const index default_finish = default_start+_extents[n];
|
||||||
const index_range& current_range = indices.ranges_[n];
|
const index_range& current_range = indices.ranges_[n];
|
||||||
index start = current_range.get_start(default_start);
|
index start = current_range.get_start(default_start);
|
||||||
index finish = current_range.get_finish(default_finish);
|
index finish = current_range.get_finish(default_finish);
|
||||||
@ -453,8 +453,8 @@ protected:
|
|||||||
// exactly in the set of legal indices
|
// exactly in the set of legal indices
|
||||||
// with a special case for empty arrays
|
// with a special case for empty arrays
|
||||||
BOOST_ASSERT(index_bases[n] <= start &&
|
BOOST_ASSERT(index_bases[n] <= start &&
|
||||||
((start <= index_bases[n]+index(extents[n])) ||
|
((start <= index_bases[n]+index(_extents[n])) ||
|
||||||
(start == index_bases[n] && extents[n] == 0)));
|
(start == index_bases[n] && _extents[n] == 0)));
|
||||||
|
|
||||||
#ifndef BOOST_DISABLE_ASSERTS
|
#ifndef BOOST_DISABLE_ASSERTS
|
||||||
// finish marks the open side of the range, so it can go one past
|
// finish marks the open side of the range, so it can go one past
|
||||||
@ -462,7 +462,7 @@ protected:
|
|||||||
// if stride is negative).
|
// if stride is negative).
|
||||||
index bound_adjustment = stride < 0 ? 1 : 0;
|
index bound_adjustment = stride < 0 ? 1 : 0;
|
||||||
BOOST_ASSERT(((index_bases[n] - bound_adjustment) <= finish) &&
|
BOOST_ASSERT(((index_bases[n] - bound_adjustment) <= finish) &&
|
||||||
(finish <= (index_bases[n] + index(extents[n]) - bound_adjustment)));
|
(finish <= (index_bases[n] + index(_extents[n]) - bound_adjustment)));
|
||||||
ignore_unused_variable_warning(bound_adjustment);
|
ignore_unused_variable_warning(bound_adjustment);
|
||||||
#endif // BOOST_DISABLE_ASSERTS
|
#endif // BOOST_DISABLE_ASSERTS
|
||||||
|
|
||||||
|
@ -94,10 +94,10 @@ public:
|
|||||||
|
|
||||||
array_iterator() {}
|
array_iterator() {}
|
||||||
|
|
||||||
array_iterator(index idx, TPtr base, const size_type* extents,
|
array_iterator(index idx, TPtr base, const size_type* _extents,
|
||||||
const index* strides,
|
const index* strides,
|
||||||
const index* index_base) :
|
const index* index_base) :
|
||||||
idx_(idx), base_(base), extents_(extents),
|
idx_(idx), base_(base), extents_(_extents),
|
||||||
strides_(strides), index_base_(index_base) { }
|
strides_(strides), index_base_(index_base) { }
|
||||||
|
|
||||||
template <typename OPtr, typename ORef, typename Cat>
|
template <typename OPtr, typename ORef, typename Cat>
|
||||||
|
@ -87,24 +87,24 @@ public:
|
|||||||
num_elements_(other.num_elements_) { }
|
num_elements_(other.num_elements_) { }
|
||||||
|
|
||||||
template <typename ExtentList>
|
template <typename ExtentList>
|
||||||
explicit const_multi_array_ref(TPtr base, const ExtentList& extents) :
|
explicit const_multi_array_ref(TPtr base, const ExtentList& _extents) :
|
||||||
base_(base), storage_(c_storage_order()) {
|
base_(base), storage_(c_storage_order()) {
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
CollectionConcept<ExtentList> >();
|
CollectionConcept<ExtentList> >();
|
||||||
|
|
||||||
index_base_list_.assign(0);
|
index_base_list_.assign(0);
|
||||||
init_multi_array_ref(extents.begin());
|
init_multi_array_ref(_extents.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ExtentList>
|
template <typename ExtentList>
|
||||||
explicit const_multi_array_ref(TPtr base, const ExtentList& extents,
|
explicit const_multi_array_ref(TPtr base, const ExtentList& _extents,
|
||||||
const general_storage_order<NumDims>& so) :
|
const general_storage_order<NumDims>& so) :
|
||||||
base_(base), storage_(so) {
|
base_(base), storage_(so) {
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
CollectionConcept<ExtentList> >();
|
CollectionConcept<ExtentList> >();
|
||||||
|
|
||||||
index_base_list_.assign(0);
|
index_base_list_.assign(0);
|
||||||
init_multi_array_ref(extents.begin());
|
init_multi_array_ref(_extents.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit const_multi_array_ref(TPtr base,
|
explicit const_multi_array_ref(TPtr base,
|
||||||
@ -162,14 +162,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename SizeList>
|
template <typename SizeList>
|
||||||
void reshape(const SizeList& extents) {
|
void reshape(const SizeList& _extents) {
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
CollectionConcept<SizeList> >();
|
CollectionConcept<SizeList> >();
|
||||||
BOOST_ASSERT(num_elements_ ==
|
BOOST_ASSERT(num_elements_ ==
|
||||||
std::accumulate(extents.begin(),extents.end(),
|
std::accumulate(_extents.begin(),_extents.end(),
|
||||||
size_type(1),std::multiplies<size_type>()));
|
size_type(1),std::multiplies<size_type>()));
|
||||||
|
|
||||||
std::copy(extents.begin(),extents.end(),extent_list_.begin());
|
std::copy(_extents.begin(),_extents.end(),extent_list_.begin());
|
||||||
this->compute_strides(stride_list_,extent_list_,storage_);
|
this->compute_strides(stride_list_,extent_list_,storage_);
|
||||||
|
|
||||||
origin_offset_ =
|
origin_offset_ =
|
||||||
@ -325,7 +325,7 @@ public:
|
|||||||
const_multi_array_ref(TPtr base,
|
const_multi_array_ref(TPtr base,
|
||||||
const storage_order_type& so,
|
const storage_order_type& so,
|
||||||
const index * index_bases,
|
const index * index_bases,
|
||||||
const size_type* extents) :
|
const size_type* _extents) :
|
||||||
base_(base), storage_(so), origin_offset_(0), directional_offset_(0)
|
base_(base), storage_(so), origin_offset_(0), directional_offset_(0)
|
||||||
{
|
{
|
||||||
// If index_bases or extents is null, then initialize the corresponding
|
// If index_bases or extents is null, then initialize the corresponding
|
||||||
@ -336,8 +336,8 @@ public:
|
|||||||
} else {
|
} else {
|
||||||
std::fill_n(index_base_list_.begin(),NumDims,0);
|
std::fill_n(index_base_list_.begin(),NumDims,0);
|
||||||
}
|
}
|
||||||
if(extents) {
|
if(_extents) {
|
||||||
init_multi_array_ref(extents);
|
init_multi_array_ref(_extents);
|
||||||
} else {
|
} else {
|
||||||
boost::array<index,NumDims> extent_list;
|
boost::array<index,NumDims> extent_list;
|
||||||
extent_list.assign(0);
|
extent_list.assign(0);
|
||||||
@ -371,12 +371,12 @@ private:
|
|||||||
boost::mem_fun_ref(&extent_range::start));
|
boost::mem_fun_ref(&extent_range::start));
|
||||||
|
|
||||||
// calculate the extents
|
// calculate the extents
|
||||||
extent_list extents;
|
extent_list _extents;
|
||||||
std::transform(ranges.ranges_.begin(),ranges.ranges_.end(),
|
std::transform(ranges.ranges_.begin(),ranges.ranges_.end(),
|
||||||
extents.begin(),
|
_extents.begin(),
|
||||||
boost::mem_fun_ref(&extent_range::size));
|
boost::mem_fun_ref(&extent_range::size));
|
||||||
|
|
||||||
init_multi_array_ref(extents.begin());
|
init_multi_array_ref(_extents.begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -442,16 +442,16 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class ExtentList>
|
template <class ExtentList>
|
||||||
explicit multi_array_ref(T* base, const ExtentList& extents) :
|
explicit multi_array_ref(T* base, const ExtentList& _extents) :
|
||||||
super_type(base,extents) {
|
super_type(base,_extents) {
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
CollectionConcept<ExtentList> >();
|
CollectionConcept<ExtentList> >();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ExtentList>
|
template <class ExtentList>
|
||||||
explicit multi_array_ref(T* base, const ExtentList& extents,
|
explicit multi_array_ref(T* base, const ExtentList& _extents,
|
||||||
const general_storage_order<NumDims>& so) :
|
const general_storage_order<NumDims>& so) :
|
||||||
super_type(base,extents,so) {
|
super_type(base,_extents,so) {
|
||||||
boost::function_requires<
|
boost::function_requires<
|
||||||
CollectionConcept<ExtentList> >();
|
CollectionConcept<ExtentList> >();
|
||||||
}
|
}
|
||||||
@ -612,8 +612,8 @@ protected:
|
|||||||
explicit multi_array_ref(T* base,
|
explicit multi_array_ref(T* base,
|
||||||
const storage_order_type& so,
|
const storage_order_type& so,
|
||||||
const index* index_bases,
|
const index* index_bases,
|
||||||
const size_type* extents) :
|
const size_type* _extents) :
|
||||||
super_type(base,so,index_bases,extents) { }
|
super_type(base,so,index_bases,_extents) { }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -176,10 +176,10 @@ public: // Should be protected
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
const_sub_array (TPtr base,
|
const_sub_array (TPtr base,
|
||||||
const size_type* extents,
|
const size_type* _extents,
|
||||||
const index* strides,
|
const index* strides,
|
||||||
const index* index_base) :
|
const index* index_base) :
|
||||||
base_(base), extents_(extents), strides_(strides),
|
base_(base), extents_(_extents), strides_(strides),
|
||||||
index_base_(index_base) {
|
index_base_(index_base) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,10 +356,10 @@ public: // should be private
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
sub_array (T* base,
|
sub_array (T* base,
|
||||||
const size_type* extents,
|
const size_type* _extents,
|
||||||
const index* strides,
|
const index* strides,
|
||||||
const index* index_base) :
|
const index* index_base) :
|
||||||
super_type(base,extents,strides,index_base) {
|
super_type(base,_extents,strides,index_base) {
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -227,7 +227,7 @@ public: // should be protected
|
|||||||
// to create strides
|
// to create strides
|
||||||
template <typename ExtentList, typename Index>
|
template <typename ExtentList, typename Index>
|
||||||
explicit const_multi_array_view(TPtr base,
|
explicit const_multi_array_view(TPtr base,
|
||||||
const ExtentList& extents,
|
const ExtentList& _extents,
|
||||||
const boost::array<Index,NumDims>& strides):
|
const boost::array<Index,NumDims>& strides):
|
||||||
base_(base), origin_offset_(0) {
|
base_(base), origin_offset_(0) {
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ public: // should be protected
|
|||||||
|
|
||||||
// Get the extents and strides
|
// Get the extents and strides
|
||||||
boost::detail::multi_array::
|
boost::detail::multi_array::
|
||||||
copy_n(extents.begin(),NumDims,extent_list_.begin());
|
copy_n(_extents.begin(),NumDims,extent_list_.begin());
|
||||||
boost::detail::multi_array::
|
boost::detail::multi_array::
|
||||||
copy_n(strides.begin(),NumDims,stride_list_.begin());
|
copy_n(strides.begin(),NumDims,stride_list_.begin());
|
||||||
|
|
||||||
@ -429,9 +429,9 @@ public: // should be private
|
|||||||
// generate array views
|
// generate array views
|
||||||
template <typename ExtentList, typename Index>
|
template <typename ExtentList, typename Index>
|
||||||
explicit multi_array_view(T* base,
|
explicit multi_array_view(T* base,
|
||||||
const ExtentList& extents,
|
const ExtentList& _extents,
|
||||||
const boost::array<Index,NumDims>& strides) :
|
const boost::array<Index,NumDims>& strides) :
|
||||||
super_type(base,extents,strides) { }
|
super_type(base,_extents,strides) { }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user