20 #ifndef RANGE_H__INCLUDED 21 #define RANGE_H__INCLUDED 36 const std::size_t
rank = this->
rank();
39 std::vector<size_type> start;
40 std::vector<size_type> finish;
41 std::vector<size_type> start_element;
42 std::vector<size_type> finish_element;
46 start_element.reserve(
rank);
47 finish_element.reserve(
rank);
50 for(
unsigned int i = 0; i <
rank; ++i) {
68 typedef std::vector<TiledRange1>
Ranges;
71 TiledRange() : range_(), elements_range_(), ranges_() { }
74 template <
typename InIter>
76 range_(), elements_range_(), ranges_(first, last)
82 TiledRange(
const std::initializer_list<std::initializer_list<size_type> >& list) :
83 range_(), elements_range_(), ranges_(list.begin(), list.end())
89 TiledRange(
const std::initializer_list<TiledRange1>& list) :
90 range_(), elements_range_(), ranges_(list.begin(), list.end())
97 range_(other.range_), elements_range_(other.elements_range_), ranges_(other.ranges_)
114 Ranges temp = p * ranges_;
138 return elements_range_;
177 template <
typename Index>
178 typename std::enable_if<!std::is_integral<Index>::value,
189 template <
typename Index>
190 typename std::enable_if<! std::is_integral<Index>::value,
range_type>::type
200 for(
const auto& index_d:
index) {
201 lower.push_back(
data()[d].
tile(index_d).first);
202 upper.push_back(
data()[d].
tile(index_d).second);
216 template <
typename Integer>
218 tile(
const std::initializer_list<Integer>&
index)
const {
227 template <
typename Integer>
230 return make_tile_range<std::initializer_list<Integer>>(
index);
238 template <
typename Index>
239 typename std::enable_if<! std::is_integral<Index>::value,
typename range_type::index>::type
241 const unsigned int rank = range_.
rank();
243 result.reserve(
rank);
245 result.push_back(ranges_[i].element_to_tile(
index[i]));
253 std::size_t
rank()
const {
return ranges_.size(); }
272 range_.
swap(other.range_);
273 elements_range_.
swap(other.elements_range_);
302 std::equal(r1.
data().begin(), r1.
data().end(), r2.
data().begin());
318 #endif // RANGE_H__INCLUDED std::vector< size_type > index
Coordinate index type.
void swap(TiledRange_ &other)
constexpr bool operator==(const DenseShape &a, const DenseShape &b)
A (hyperrectangular) interval on , space of integer n-indices.
void swap(TiledRange &r0, TiledRange &r1)
Exchange the content of the two given TiledRange's.
void swap(Range &r0, Range &r1)
Exchange the values of the give two ranges.
auto data(T &t)
Container data pointer accessor.
TiledRange(const std::initializer_list< std::initializer_list< size_type > > &list)
Constructed with a set of ranges pointed to by [ first, last ).
std::size_t rank() const
The rank accessor.
constexpr bool operator!=(const DenseShape &a, const DenseShape &b)
std::array< T, N > operator*(const Permutation &, const std::array< T, N > &)
Permute a std::array.
unsigned int rank() const
Rank accessor.
const Ranges & data() const
Tile dimension boundary array accessor.
range_type::size_array size_array
index_type dim() const
Domain size accessor.
TiledRange_ & operator*=(const Permutation &p)
In place permutation of this range.
range_type make_tile_range(const size_type &i) const
Construct a range for the tile indexed by the given ordinal index.
const range_type & tiles_range() const
Access the tile range.
TiledRange(InIter first, InIter last)
Constructed with a set of ranges pointed to by [ first, last ).
TiledRange()
Default constructor.
std::vector< TiledRange1 > Ranges
range_type tile(const size_type &i) const
Constructs a range for the tile indexed by the given ordinal index.
std::enable_if<! std::is_integral< Index >::value, range_type >::type make_tile_range(const Index &index) const
Construct a range for the tile indexed by the given index.
Range data of a tiled array.
TiledRange_ & operator=(const TiledRange_ &other)
TiledRange assignment operator.
std::ostream & operator<<(std::ostream &os, const DistArray< Tile, Policy > &a)
Add the tensor to an output stream.
bool includes(const Index &index) const
Check the coordinate to make sure it is within the range.
range_type make_tile_range(const std::initializer_list< Integer > &index) const
Construct a range for the tile indexed by the given index.
Permutation of a sequence of objects indexed by base-0 indices.
DEPRECATED const range_type & tiles() const
Access the tile range.
TiledRange(const TiledRange_ &other)
Copy constructor.
const TiledRange1 & dim(std::size_t d) const
Accessor of the tiled range for one of the dimensions.
TiledRange(const std::initializer_list< TiledRange1 > &list)
Constructed with an initializer_list of TiledRange1's.
range_type tile(const std::initializer_list< Integer > &index) const
Construct a range for the tile indexed by the given index.
std::enable_if<!std::is_integral< Index >::value, range_type >::type tile(const Index &index) const
Construct a range for the tile indexed by the given index.
DEPRECATED const range_type & elements() const
Access the element range.
std::enable_if<! std::is_integral< Index >::value, typename range_type::index >::type element_to_tile(const Index &index) const
Convert an element index to a tile index.
const range_type & elements_range() const
Access the element range.