TiledArray
0.7.0
|
A (hyperrectangular) interval on , space of integer n-indices. More...
#include <range.h>
Public Types | |
typedef Range | Range_ |
This object type. More... | |
typedef std::size_t | size_type |
Size type. More... | |
typedef std::vector< size_type > | index |
Coordinate index type. More... | |
typedef index | index_type |
Coordinate index type, to conform Tensor Working Group spec. More... | |
typedef detail::SizeArray< const size_type > | size_array |
Size array type. More... | |
typedef size_array | extent_type |
Range extent type, to conform Tensor Working Group spec. More... | |
typedef std::size_t | ordinal_type |
Ordinal type, to conform Tensor Working Group spec. More... | |
typedef detail::RangeIterator< size_type, Range_ > | const_iterator |
Coordinate iterator. More... | |
Public Member Functions | |
Range () | |
Default constructor. More... | |
template<typename Index , typename std::enable_if<! std::is_integral< Index >::value >::type * = nullptr> | |
Range (const Index &lower_bound, const Index &upper_bound) | |
Construct range defined by upper and lower bound sequences. More... | |
template<typename Index1 , typename std::enable_if< std::is_integral< Index1 >::value >::type * = nullptr> | |
Range (const std::initializer_list< Index1 > &lower_bound, const std::initializer_list< Index1 > &upper_bound) | |
Construct range defined by the upper and lower bound sequences. More... | |
template<typename Index , typename std::enable_if<! std::is_integral< Index >::value &&std::is_integral< typename Index::value_type >::value >::type * = nullptr> | |
Range (const Index &extent) | |
Range constructor from a sequence of extents. More... | |
template<typename Index1 , typename std::enable_if< std::is_integral< Index1 >::value >::type * = nullptr> | |
Range (const std::initializer_list< Index1 > &extent) | |
Range constructor from an initializer list of extents. More... | |
template<typename Index , typename std::enable_if<! std::is_integral< Index >::value &&detail::is_pair< typename Index::value_type >::value >::type * = nullptr> | |
Range (const Index &bounds) | |
Construct range defined by a sequence of {lower,upper} bound pairs. More... | |
template<typename Index1 , typename Index2 > | |
Range (const std::initializer_list< std::pair< Index1, Index2 >> &bounds) | |
Construct range defined by an initializer_list of {lower,upper} bound pairs. More... | |
template<typename... Index, typename std::enable_if< detail::is_integral_list< Index... >::value >::type * = nullptr> | |
Range (const Index... extents) | |
Range constructor from a pack of extents for each dimension. More... | |
template<typename ... IndexPairs, typename std::enable_if< detail::is_integral_pair_list< IndexPairs... >::value >::type * = nullptr> | |
Range (const IndexPairs... bounds) | |
Range constructor from a pack of {lo,up} bounds for each dimension. More... | |
Range (const Range_ &other) | |
Copy Constructor. More... | |
Range (Range_ &&other) | |
Copy Constructor. More... | |
Range (const Permutation &perm, const Range_ &other) | |
Permuting copy constructor. More... | |
~Range () | |
Destructor. More... | |
Range_ & | operator= (const Range_ &other) |
Copy assignment operator. More... | |
Range_ & | operator= (Range_ &&other) |
Move assignment operator. More... | |
unsigned int | rank () const |
Rank accessor. More... | |
const size_type * | lobound_data () const |
Range lower bound data accessor. More... | |
size_array | lobound () const |
Range lower bound accessor. More... | |
size_type | lobound (size_t dim) const |
Range lower bound element accessor. More... | |
const size_type * | upbound_data () const |
Range upper bound data accessor. More... | |
size_array | upbound () const |
Range upper bound accessor. More... | |
size_type | upbound (size_t dim) const |
Range upped bound element accessor. More... | |
const size_type * | extent_data () const |
Range extent data accessor. More... | |
extent_type | extent () const |
Range extent accessor. More... | |
size_type | extent (size_t dim) const |
Range extent element accessor. More... | |
const size_type * | stride_data () const |
Range stride data accessor. More... | |
size_array | stride () const |
Range stride accessor. More... | |
size_type | stride (size_t dim) const |
Range stride element accessor. More... | |
ordinal_type | volume () const |
Range volume accessor. More... | |
ordinal_type | area () const |
ordinal_type | offset () const |
Range offset. More... | |
const_iterator | begin () const |
Index iterator factory. More... | |
const_iterator | end () const |
Index iterator factory. More... | |
template<typename Index , typename std::enable_if<! std::is_integral< Index >::value, bool >::type * = nullptr> | |
bool | includes (const Index &index) const |
Check the coordinate to make sure it is within the range. More... | |
template<typename Integer > | |
bool | includes (const std::initializer_list< Integer > &index) const |
Check the coordinate to make sure it is within the range. More... | |
template<typename Ordinal > | |
std::enable_if< std::is_integral< Ordinal >::value, bool >::type | includes (Ordinal i) const |
Check the ordinal index to make sure it is within the range. More... | |
template<typename... Index> | |
std::enable_if<(sizeof...(Index) > 1ul), size_type >::type | includes (const Index &... index) const |
Range_ & | operator*= (const Permutation &perm) |
Permute this range. More... | |
template<typename Index > | |
Range_ & | resize (const Index &lower_bound, const Index &upper_bound) |
Resize range to a new upper and lower bound. More... | |
template<typename Index > | |
Range_ & | inplace_shift (const Index &bound_shift) |
Shift the lower and upper bound of this range. More... | |
template<typename Index > | |
Range_ | shift (const Index &bound_shift) |
Shift the lower and upper bound of this range. More... | |
ordinal_type | ordinal (const ordinal_type index) const |
calculate the ordinal index of i More... | |
template<typename Index , typename std::enable_if<! std::is_integral< Index >::value >::type * = nullptr> | |
ordinal_type | ordinal (const Index &index) const |
calculate the ordinal index of index More... | |
template<typename... Index, typename std::enable_if<(sizeof...(Index) > 1ul> | |
size_type | ordinal (const Index &... index) const |
calculate the ordinal index of index More... | |
index | idx (size_type index) const |
calculate the coordinate index of the ordinal index, index . More... | |
template<typename Index , typename std::enable_if<! std::is_integral< Index >::value >::type * = nullptr> | |
const Index & | idx (const Index &i) const |
calculate the index of i More... | |
template<typename Archive , typename std::enable_if< madness::archive::is_input_archive< Archive >::value >::type * = nullptr> | |
void | serialize (const Archive &ar) |
template<typename Archive , typename std::enable_if< madness::archive::is_output_archive< Archive >::value >::type * = nullptr> | |
void | serialize (const Archive &ar) const |
void | swap (Range_ &other) |
Protected Attributes | |
size_type * | data_ = nullptr |
size_type | offset_ = 0ul |
Ordinal index offset correction. More... | |
size_type | volume_ = 0ul |
Total number of elements. More... | |
unsigned int | rank_ = 0u |
The rank (or number of dimensions) in the range. More... | |
Friends | |
class | detail::RangeIterator< size_type, Range_ > |
A (hyperrectangular) interval on , space of integer n-indices.
This object represents an n-dimensional, hyperrectangular array of integers. It provides information on the rank (number of dimensions), (nonnegative) lower bound, upper bound, extent (size), and stride of each dimension. It can also be used to test if an element is included in the range with a coordinate index or ordinal offset. Finally, it can be used to convert coordinate indices to ordinal offsets and vice versa. TODO add Range support for negative indices
typedef std::vector<size_type> TiledArray::Range::index |
typedef index TiledArray::Range::index_type |
typedef std::size_t TiledArray::Range::ordinal_type |
typedef Range TiledArray::Range::Range_ |
typedef detail::SizeArray<const size_type> TiledArray::Range::size_array |
typedef std::size_t TiledArray::Range::size_type |
|
inline |
|
inline |
Construct range defined by upper and lower bound sequences.
Construct a range defined by lower_bound
and upper_bound
.
Index | An array type |
lower_bound | A sequence of lower bounds for each dimension |
upper_bound | A sequence of upper bounds for each dimension |
TiledArray::Exception | When the size of lower_bound is not equal to that of upper_bound . |
TiledArray::Exception | When lower_bound[i] >= upper_bound[i] |
std::bad_alloc | When memory allocation fails. |
Definition at line 307 of file range.h.
|
inline |
Construct range defined by the upper and lower bound sequences.
Construct a range defined by lower_bound
and upper_bound
.
lower_bound | An initializer list of lower bounds for each dimension |
upper_bound | An initializer list of upper bounds for each dimension |
TiledArray::Exception | When the size of lower_bound is not equal to that of upper_bound . |
TiledArray::Exception | When lower_bound[i] >= upper_bound[i] |
std::bad_alloc | When memory allocation fails. |
Definition at line 329 of file range.h.
|
inlineexplicit |
Range constructor from a sequence of extents.
Construct a range with a lower bound of zero and an upper bound equal to extents
.
Index | A vector type |
extent | A vector that defines the size of each dimension |
std::bad_alloc | When memory allocation fails. |
Definition at line 352 of file range.h.
|
inlineexplicit |
Range constructor from an initializer list of extents.
Construct a range with a lower bound of zero and an upper bound equal to extent
.
extent | An initializer list that defines the size of each dimension |
std::bad_alloc | When memory allocation fails. |
Definition at line 370 of file range.h.
|
inline |
Construct range defined by a sequence of {lower,upper} bound pairs.
Index | An array (contiguous sequence) type |
lower_bound | A sequence of lower bounds for each dimension |
upper_bound | A sequence of upper bounds for each dimension |
TiledArray::Exception | When the size of lower_bound is not equal to that of upper_bound . |
TiledArray::Exception | When lower_bound[i] >= upper_bound[i] |
std::bad_alloc | When memory allocation fails. |
Definition at line 392 of file range.h.
|
inline |
Construct range defined by an initializer_list of {lower,upper} bound pairs.
Index | An initializer list type |
lower_bound | A sequence of lower bounds for each dimension |
upper_bound | A sequence of upper bounds for each dimension |
TiledArray::Exception | When the size of lower_bound is not equal to that of upper_bound . |
TiledArray::Exception | When lower_bound[i] >= upper_bound[i] |
std::bad_alloc | When memory allocation fails. |
Definition at line 412 of file range.h.
|
inlineexplicit |
|
inlineexplicit |
Range constructor from a pack of {lo,up} bounds for each dimension.
IndexPairs | Pack of std::pair's of integer types |
extents | A pack of pairs of lobound and upbound for each dimension |
std::bad_alloc | When memory allocation fails. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
calculate the coordinate index of the ordinal index, index
.
Convert an ordinal index to a coordinate index.
index | Ordinal index |
TiledArray::Exception | When index is not included in this range |
std::bad_alloc | When memory allocation fails |
Definition at line 877 of file range.h.
|
inline |
|
inline |
Check the coordinate to make sure it is within the range.
Index | The coordinate index array type |
index | The coordinate index to check for inclusion in the range |
true
when i >= lobound
and i < upbound
, otherwise false
TiledArray::Exception | When the rank of this range is not equal to the size of the index. |
Definition at line 682 of file range.h.
|
inline |
Check the coordinate to make sure it is within the range.
Integer | An integer type |
index | The element index to check for inclusion in the range, as an std::initializer_list<Integer> |
true
when i >= lobound
and i < upbound
, otherwise false
TiledArray::Exception | When the rank of this range is not equal to the size of the index. |
|
inline |
|
inline |
|
inline |
Shift the lower and upper bound of this range.
Index | The shift array type |
bound_shift | The shift to be applied to the range |
Definition at line 778 of file range.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Permute this range.
perm | The permutation to be applied to this range |
TiledArray::Exception | When the rank of this range is not equal to the rank of the permutation. |
std::bad_alloc | When memory allocation fails. |
Definition at line 1031 of file range.h.
|
inline |
calculate the ordinal index of i
This function is just a pass-through so the user can call ordinal()
on a template parameter that can be a coordinate index or an integral.
index | Ordinal index |
index
(unchanged) When | index is not included in this range |
Definition at line 826 of file range.h.
|
inline |
calculate the ordinal index of index
Convert a coordinate index to an ordinal index.
Index | A coordinate index type (array type) |
index | The index to be converted to an ordinal index |
index
When | index is not included in this range. |
Definition at line 840 of file range.h.
|
inline |
calculate the ordinal index of index
Convert a coordinate index to an ordinal index.
Index | A coordinate index type (array type) |
index | The index to be converted to an ordinal index |
index
When | index is not included in this range. |
Definition at line 865 of file range.h.
|
inline |
|
inline |
Resize range to a new upper and lower bound.
Index | An array type |
lower_bound | The lower bounds of the N-dimensional range |
upper_bound | The upper bound of the N-dimensional range |
TiledArray::Exception | When the size of lower_bound is not equal to that of upper_bound . |
TiledArray::Exception | When lower_bound[i] >= upper_bound[i] |
std::bad_alloc | When memory allocation fails. |
Definition at line 754 of file range.h.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
friend |
|
protected |
|
protected |
|
protected |
|
protected |