Inheritance diagram for TiledArray::Range:

Documentation

A (hyperrectangular) interval on $ Z^n $, space of integer $ n $-indices.

This object is a range of integers on a $ n $-dimensional, hyperrectangular domain, where rank (aka order, number of dimensions) $ n>0 $. It is fully specified by its lower and upper bounds. It also provides zero-cost access to extent (size) and stride for each mode (dimension). Range is a regular type with null default state.

Warning
Range is with rank 0 is null, i.e. invalid. There are many reasons that rank-0 Range is not supported; summarily, rank-0 Range is not a special case of rank- $ n $ Range as many invariants of nonzero-rank Range are not observed by it. E.g. for any nonempty nonzero-rank Range the lower bound differs from its upper bound. To define the 0-dimensional limit of array/tensor to be a scalar, the volume of rank-0 Range should be 1, but clearly its lower and upper bounds are equal.

Definition at line 46 of file range.h.

Public Types

typedef Range Range_
 This object type. More...
 
typedef TA_1INDEX_TYPE index1_type
 
typedef container::svector< index1_typeindex_type
 
typedef index_type index
 Coordinate index type (deprecated) More...
 
typedef detail::SizeArray< const index1_typeindex_view_type
 Non-owning variant of index_type. More...
 
typedef index_type extent_type
 Range extent type, to conform to TWG spec. More...
 
typedef std::size_t ordinal_type
 Ordinal type, to conform to TWG spec. More...
 
typedef std::make_signed_t< ordinal_typedistance_type
 Distance type. More...
 
typedef ordinal_type size_type
 Size type (deprecated) More...
 
typedef detail::RangeIterator< index1_type, Range_const_iterator
 Coordinate iterator. More...
 

Public Member Functions

 Range ()
 Default constructor. More...
 
template<typename Index1 , typename Index2 , typename std::enable_if_t< detail::is_integral_sized_range_v< Index1 > &&detail::is_integral_sized_range_v< Index2 >> * = nullptr>
 Range (const Index1 &lower_bound, const Index2 &upper_bound)
 Construct range defined by upper and lower bound ranges. More...
 
template<typename Index1 , typename Index2 , typename = std::enable_if_t<std::is_integral_v<Index1> && std::is_integral_v<Index2>>>
 Range (const std::initializer_list< Index1 > &lower_bound, const std::initializer_list< Index2 > &upper_bound)
 Construct range defined by the upper and lower bound ranges. More...
 
template<typename Index , typename std::enable_if_t< detail::is_integral_sized_range_v< Index >> * = nullptr>
 Range (const Index &extent)
 Range constructor from a range of extents. More...
 
template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
 Range (const std::initializer_list< Index > &extent)
 Range constructor from an initializer list of extents. More...
 
template<typename PairRange , typename = std::enable_if_t<detail::is_sized_range_v<PairRange> && detail::is_gpair_range_v<PairRange>>>
 Range (const PairRange &bounds)
 Construct Range defined by a range of {lower,upper} bound pairs. More...
 
template<typename GPair >
 Range (const std::initializer_list< GPair > &bounds, std::enable_if_t< detail::is_gpair_v< GPair >> *=nullptr)
 Construct range defined by an initializer_list of {lower,upper} bounds for each dimension given as a generalized pair. More...
 
template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
 Range (const std::initializer_list< std::initializer_list< Index >> &bounds)
 Construct range defined by an initializer_list of std::initializer_list{lower,upper} bounds. 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, std::enable_if_t< detail::is_integral_pair_list_v< IndexPairs... >> * = nullptr>
 Range (const IndexPairs... bounds)
 
 Range (const Range_ &other)=default
 Copy Constructor. More...
 
 Range (Range_ &&other)
 Move Constructor. More...
 
 Range (const Permutation &perm, const Range_ &other)
 Permuting copy constructor. More...
 
 ~Range ()=default
 Destructor. More...
 
Range_operator= (const Range_ &other)=default
 Copy assignment operator. More...
 
Range_operator= (Range_ &&other)
 Move assignment operator. More...
 
 operator bool () const
 Conversion to bool. More...
 
unsigned int rank () const
 Rank accessor. More...
 
std::pair< index1_type, index1_typedim (std::size_t d) const
 Accessor of the d-th dimension of the range. More...
 
const index1_typelobound_data () const
 Range lower bound data accessor. More...
 
index_view_type lobound () const
 Range lower bound accessor. More...
 
index1_type lobound (size_t dim) const
 Range lower bound element accessor. More...
 
const index1_typeupbound_data () const
 Range upper bound data accessor. More...
 
index_view_type upbound () const
 Range upper bound accessor. More...
 
index1_type upbound (size_t dim) const
 Range upped bound element accessor. More...
 
const index1_typeextent_data () const
 Range extent data accessor. More...
 
index_view_type extent () const
 Range extent accessor. More...
 
index1_type extent (size_t dim) const
 Range extent element accessor. More...
 
const index1_typestride_data () const
 Range stride data accessor. More...
 
index_view_type stride () const
 Range stride accessor. More...
 
index1_type stride (size_t dim) const
 Range stride element accessor. More...
 
ordinal_type volume () const
 Range volume accessor. More...
 
ordinal_type area () const
 
distance_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< detail::is_integral_range_v< Index >, bool >::type * = nullptr>
bool includes (const Index &index) const
 Check the coordinate to make sure it is within the range. More...
 
template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
bool includes (const std::initializer_list< Index > &index) const
 Check the coordinate to make sure it is within the range. More...
 
template<typename Ordinal >
std::enable_if< std::is_integral_v< Ordinal >, 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_t<(sizeof...(Index) > 1ul) &&(std::is_integral_v< Index > &&...), bool > includes (const Index &... index) const
 
Range_operator*= (const Permutation &perm)
 Permute this range. More...
 
template<typename Index1 , typename Index2 , typename = std::enable_if_t<detail::is_integral_sized_range_v<Index1> && detail::is_integral_sized_range_v<Index2>>>
Range_resize (const Index1 &lower_bound, const Index2 &upper_bound)
 Resize range to a new upper and lower bound. More...
 
template<typename Index , typename = std::enable_if_t<detail::is_integral_range_v<Index>>>
Range_inplace_shift (const Index &bound_shift)
 Shift the lower and upper bound of this range. More...
 
template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
Range_inplace_shift (const std::initializer_list< Index > &bound_shift)
 Shift the lower and upper bound of this range. More...
 
template<typename Index , typename = std::enable_if_t<detail::is_integral_range_v<Index>>>
Range_ shift (const Index &bound_shift)
 Create a Range with shiften lower and upper bounds. More...
 
template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
Range_ shift (const std::initializer_list< Index > &bound_shift)
 Create a Range with shiften lower and upper bounds. More...
 
ordinal_type ordinal (const ordinal_type index) const
 calculate the ordinal index of i More...
 
template<typename Index , typename std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
ordinal_type ordinal (const Index &index) const
 calculate the ordinal index of index More...
 
template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
ordinal_type ordinal (const std::initializer_list< Index > &index) const
 calculate the ordinal index of index More...
 
template<typename... Index, typename std::enable_if_t<(sizeof...(Index) > 1ul) &&(std::is_integral_v< Index > &&...)> * = nullptr>
ordinal_type ordinal (const Index &... index) const
 calculate the ordinal index of index More...
 
index_type idx (ordinal_type index) const
 calculate the coordinate index of the ordinal index, index. More...
 
template<typename Index , typename std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
const Index & idx (const Index &i) const
 calculate the index of i More...
 
template<typename Archive >
void serialize (Archive &ar)
 
void swap (Range_ &other)
 

Protected Member Functions

void init_datavec (unsigned int rank)
 
const index1_typedata () const
 
index1_typedata ()
 
index1_typelobound_data_nc ()
 
index1_typeupbound_data_nc ()
 
index1_typeextent_data_nc ()
 
index1_typestride_data_nc ()
 

Protected Attributes

container::svector< index1_type, 4 *TA_MAX_SOO_RANK_METADATA > datavec_
 
distance_type offset_ = 0l
 Ordinal index offset correction. More...
 
ordinal_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< index1_type, Range_ >
 

Member Typedef Documentation

◆ const_iterator

Coordinate iterator.

Definition at line 63 of file range.h.

◆ distance_type

typedef std::make_signed_t<ordinal_type> TiledArray::Range::distance_type

Distance type.

Definition at line 60 of file range.h.

◆ extent_type

Range extent type, to conform to TWG spec.

Definition at line 58 of file range.h.

◆ index

Coordinate index type (deprecated)

Definition at line 54 of file range.h.

◆ index1_type

typedef TA_1INDEX_TYPE TiledArray::Range::index1_type

1-index type, to conform to Tensor Working Group (TWG) spec

Definition at line 49 of file range.h.

◆ index_type

Coordinate index type, to conform to TWG spec

Definition at line 52 of file range.h.

◆ index_view_type

Non-owning variant of index_type.

Definition at line 56 of file range.h.

◆ ordinal_type

typedef std::size_t TiledArray::Range::ordinal_type

Ordinal type, to conform to TWG spec.

Definition at line 59 of file range.h.

◆ Range_

This object type.

Definition at line 48 of file range.h.

◆ size_type

Size type (deprecated)

Definition at line 61 of file range.h.

Constructor & Destructor Documentation

◆ Range() [1/13]

TiledArray::Range::Range ( )
inline

Default constructor.

Constructs a null range, i.e., it has zero volume and rank.

Definition at line 330 of file range.h.

◆ Range() [2/13]

template<typename Index1 , typename Index2 , typename std::enable_if_t< detail::is_integral_sized_range_v< Index1 > &&detail::is_integral_sized_range_v< Index2 >> * = nullptr>
TiledArray::Range::Range ( const Index1 &  lower_bound,
const Index2 &  upper_bound 
)
inline

Construct range defined by upper and lower bound ranges.

Construct a range defined by lower_bound and upper_bound. Examples of using this constructor:

std::vector<size_t> lobounds = {0, 1, 2};
std::vector<size_t> upbounds = {4, 6, 8};
Range r(lobounds, upbounds);
// or using in-place ctors
Range r2(std::vector<size_t>{0, 1, 2}, std::vector<size_t>{4, 6, 8});
assert(r == r2);
Template Parameters
Index1An integral sized range type
Index2An integral sized range type
Parameters
lower_boundA sequence of lower bounds for each dimension
upper_boundA sequence of upper bounds for each dimension
Exceptions
TiledArray::ExceptionWhen the size of lower_bound is not equal to that of upper_bound.
TiledArray::ExceptionWhen lower_bound[i] >= upper_bound[i]

Definition at line 355 of file range.h.

Here is the call graph for this function:

◆ Range() [3/13]

template<typename Index1 , typename Index2 , typename = std::enable_if_t<std::is_integral_v<Index1> && std::is_integral_v<Index2>>>
TiledArray::Range::Range ( const std::initializer_list< Index1 > &  lower_bound,
const std::initializer_list< Index2 > &  upper_bound 
)
inline

Construct range defined by the upper and lower bound ranges.

Construct a range defined by lower_bound and upper_bound. Examples of using this constructor:

Range r({0, 1, 2}, {4, 6, 8});
// WARNING: mind the parens! With braces another ctor is called
Range r2{{0, 1, 2}, {4, 6, 8}};
Template Parameters
Index1An integral type
Index2An integral type
Parameters
lower_boundAn initializer list of lower bounds for each dimension
upper_boundAn initializer list of upper bounds for each dimension
Warning
do not use uniform initialization syntax ("curly braces") to invoke this
Exceptions
TiledArray::ExceptionWhen the size of lower_bound is not equal to that of upper_bound.
TiledArray::ExceptionWhen lower_bound[i] >= upper_bound[i]

Definition at line 389 of file range.h.

Here is the call graph for this function:

◆ Range() [4/13]

template<typename Index , typename std::enable_if_t< detail::is_integral_sized_range_v< Index >> * = nullptr>
TiledArray::Range::Range ( const Index &  extent)
inlineexplicit

Range constructor from a range of extents.

Construct a range with a lower bound of zero and an upper bound equal to extents. Examples of using this constructor:

Range r(std::vector<size_t>{4, 5, 6});
Template Parameters
IndexA vector type
Parameters
extentA vector that defines the size of each dimension

Definition at line 414 of file range.h.

Here is the call graph for this function:

◆ Range() [5/13]

template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
TiledArray::Range::Range ( const std::initializer_list< Index > &  extent)
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. Examples of using this constructor:

Range r{4, 5, 6};
Template Parameters
IndexAn integral type
Parameters
extentAn initializer list that defines the size of each dimension

Definition at line 437 of file range.h.

Here is the call graph for this function:

◆ Range() [6/13]

template<typename PairRange , typename = std::enable_if_t<detail::is_sized_range_v<PairRange> && detail::is_gpair_range_v<PairRange>>>
TiledArray::Range::Range ( const PairRange &  bounds)
inlineexplicit

Construct Range defined by a range of {lower,upper} bound pairs.

Examples of using this constructor:

// using vector of pairs
std::vector<std::pair<size_t,size_t>> vpbounds{{0,4}, {1,6}, {2,8}};
Range r0(vpbounds);
// using vector of tuples
std::vector<std::tuple<size_t,size_t>> vtbounds{{0,4}, {1,6}, {2,8}};
Range r1(vtbounds);
assert(r0 == r1);
// using zipped ranges of bounds (using Boost.Range)
// need to #include <boost/range/combine.hpp>
std::vector<size_t> lobounds = {0, 1, 2};
std::vector<size_t> upbounds = {4, 6, 8};
Range r2(boost::combine(lobounds, upbounds));
assert(r0 == r2);
// using zipped ranges of bounds (using Range-V3)
// need to #include <range/v3/view/zip.hpp>
Range r3(ranges::views::zip(lobounds, upbounds));
assert(r0 == r3);
Template Parameters
PairRangeType representing a sized range of generalized pairs (see TiledArray::detail::is_gpair_v )
Parameters
boundA range of {lower,upper} bounds for each dimension
Exceptions
TiledArray::ExceptionWhen bound[i].lower>=bound[i].upper for any i .

Definition at line 480 of file range.h.

Here is the call graph for this function:

◆ Range() [7/13]

template<typename GPair >
TiledArray::Range::Range ( const std::initializer_list< GPair > &  bounds,
std::enable_if_t< detail::is_gpair_v< GPair >> *  = nullptr 
)
inlineexplicit

Construct range defined by an initializer_list of {lower,upper} bounds for each dimension given as a generalized pair.

Examples of using this constructor:

Range r{std::pair{0,4}, std::pair{1,6}, std::pair{2,8}};
Template Parameters
GPaira generalized pair of integral types
Parameters
boundA sequence of {lower,upper} bounds for each dimension
Exceptions
TiledArray::ExceptionWhen bound[i].lower>=bound[i].upper for any i .

Definition at line 502 of file range.h.

Here is the call graph for this function:

◆ Range() [8/13]

template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
TiledArray::Range::Range ( const std::initializer_list< std::initializer_list< Index >> &  bounds)
inlineexplicit

Construct range defined by an initializer_list of std::initializer_list{lower,upper} bounds.

Examples of using this constructor:

Range r{{0,4}, {1,6}, {2,8}};
// or can add extra parens
Range r2({{0,4}, {1,6}, {2,8}});
assert(r == r2);
Template Parameters
IndexAn integral type
Parameters
boundA sequence of {lower,upper} bounds for each dimension
Exceptions
TiledArray::ExceptionWhen bound[i].lower>=bound[i].upper for any i .

Definition at line 537 of file range.h.

Here is the call graph for this function:

◆ Range() [9/13]

template<typename... Index, typename std::enable_if< detail::is_integral_list< Index... >::value >::type * = nullptr>
TiledArray::Range::Range ( const Index...  extents)
inlineexplicit

Range constructor from a pack of extents for each dimension.

Examples of using this constructor:

Range r(4, 5, 6);
Template Parameters
IndexPack of integer types
Parameters
extentsA pack of extents for each dimension
Postcondition
Range has a lower bound of 0, and an upper bound of (extents...).

Definition at line 565 of file range.h.

◆ Range() [10/13]

template<typename... IndexPairs, std::enable_if_t< detail::is_integral_pair_list_v< IndexPairs... >> * = nullptr>
TiledArray::Range::Range ( const IndexPairs...  bounds)
inlineexplicit

Range constructor from a pack of std::pair{lo,up} bounds for each dimension Examples of using this constructor:

Range r(std::pair{0,4}, std::pair{1,6}, std::pair{2,8});
Template Parameters
IndexPairsPack of std::pair's of integer types
Parameters
extentsA pack of pairs of lobound and upbound for each dimension

Definition at line 581 of file range.h.

◆ Range() [11/13]

TiledArray::Range::Range ( const Range_ other)
default

Copy Constructor.

Parameters
otherThe range to be copied

◆ Range() [12/13]

TiledArray::Range::Range ( Range_ &&  other)
inline

Move Constructor.

Parameters
otherThe range to be copied

Definition at line 594 of file range.h.

◆ Range() [13/13]

TiledArray::Range::Range ( const Permutation perm,
const Range_ other 
)
inline

Permuting copy constructor.

Parameters
permThe permutation applied to other
otherThe range to be permuted and copied

Definition at line 611 of file range.h.

Here is the call graph for this function:

◆ ~Range()

TiledArray::Range::~Range ( )
default

Destructor.

Member Function Documentation

◆ area()

ordinal_type TiledArray::Range::area ( ) const
inline

alias to volume() to conform to the TWG specification

Returns
The total number of elements in the range.
Exceptions
nothing

Definition at line 788 of file range.h.

◆ begin()

const_iterator TiledArray::Range::begin ( ) const
inline

Index iterator factory.

The iterator dereferences to an index. The order of iteration matches the data layout of a row-major tensor.

Returns
An iterator that holds the lower bound index of a tensor (unless it has zero volume, then it returns same result as end())
Exceptions
nothing

Definition at line 803 of file range.h.

Here is the call graph for this function:

◆ data() [1/2]

index1_type* TiledArray::Range::data ( )
inlineprotected

Definition at line 84 of file range.h.

◆ data() [2/2]

const index1_type* TiledArray::Range::data ( ) const
inlineprotected

Definition at line 83 of file range.h.

Here is the caller graph for this function:

◆ dim()

std::pair<index1_type, index1_type> TiledArray::Range::dim ( std::size_t  d) const
inline

Accessor of the d-th dimension of the range.

Parameters
dthe dimension index, a nonnegative integer less than rank()
Returns
the pair of {lower,upper} bounds for dimension d

Definition at line 675 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ end()

const_iterator TiledArray::Range::end ( ) const
inline

Index iterator factory.

The iterator dereferences to an index. The order of iteration matches the data layout of a row-major tensor.

Returns
An iterator that holds the upper bound element index of a tensor
Exceptions
nothing

Definition at line 813 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extent() [1/2]

index_view_type TiledArray::Range::extent ( ) const
inline

Range extent accessor.

Returns
A range that contains the extent for each dimension.
Exceptions
nothing

Definition at line 741 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extent() [2/2]

index1_type TiledArray::Range::extent ( size_t  dim) const
inline

Range extent element accessor.

Returns
The extent of dimension dim.
Exceptions
nothing

Definition at line 749 of file range.h.

Here is the call graph for this function:

◆ extent_data()

const index1_type* TiledArray::Range::extent_data ( ) const
inline

Range extent data accessor.

Returns
A pointer to the extent data (see Range::extent() )
Note
Not necessarily nullptr for rank-0 or null Range
Exceptions
nothing

Definition at line 735 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ extent_data_nc()

index1_type* TiledArray::Range::extent_data_nc ( )
inlineprotected

Definition at line 88 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ idx() [1/2]

template<typename Index , typename std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
const Index& TiledArray::Range::idx ( const Index &  i) const
inline

calculate the index of i

This function is just a pass-through so the user can call idx() on a template parameter that can be an index or an ordinal_type.

Template Parameters
IndexAn integral range type
Parameters
iThe index
Returns
i (unchanged)

Definition at line 1114 of file range.h.

Here is the call graph for this function:

◆ idx() [2/2]

index_type TiledArray::Range::idx ( ordinal_type  index) const
inline

calculate the coordinate index of the ordinal index, index.

Convert an ordinal index to a coordinate index.

Parameters
indexOrdinal index
Returns
The index of the ordinal index
Exceptions
TiledArray::ExceptionWhen index is not included in this range

Definition at line 1076 of file range.h.

Here is the call graph for this function:

◆ includes() [1/4]

template<typename... Index>
std::enable_if_t< (sizeof...(Index) > 1ul) && (std::is_integral_v<Index> && ...), bool> TiledArray::Range::includes ( const Index &...  index) const
inline

Definition at line 880 of file range.h.

Here is the call graph for this function:

◆ includes() [2/4]

template<typename Index , typename std::enable_if< detail::is_integral_range_v< Index >, bool >::type * = nullptr>
bool TiledArray::Range::includes ( const Index &  index) const
inline

Check the coordinate to make sure it is within the range.

Template Parameters
IndexAn integral range type
Parameters
indexThe coordinate index to check for inclusion in the range
Returns
true when i >= lobound and i < upbound, otherwise false
Exceptions
TiledArray::ExceptionWhen the rank of this range is not equal to the size of the index.

Definition at line 826 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ includes() [3/4]

template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
bool TiledArray::Range::includes ( const std::initializer_list< Index > &  index) const
inline

Check the coordinate to make sure it is within the range.

Template Parameters
IndexAn integral type
Parameters
indexThe element index whose presence in the range is queried
Returns
true when i >= lobound and i < upbound, otherwise false
Exceptions
TiledArray::ExceptionWhen the rank of this range is not equal to the size of the index.

Definition at line 861 of file range.h.

◆ includes() [4/4]

template<typename Ordinal >
std::enable_if<std::is_integral_v<Ordinal>, bool>::type TiledArray::Range::includes ( Ordinal  i) const
inline

Check the ordinal index to make sure it is within the range.

Parameters
iThe ordinal index to check for inclusion in the range
Returns
true when i >= 0 and i < volume
Exceptions
nothing

Definition at line 871 of file range.h.

◆ init_datavec()

void TiledArray::Range::init_datavec ( unsigned int  rank)
inlineprotected

Definition at line 82 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inplace_shift() [1/2]

template<typename Index , typename = std::enable_if_t<detail::is_integral_range_v<Index>>>
Range_& TiledArray::Range::inplace_shift ( const Index &  bound_shift)
inline

Shift the lower and upper bound of this range.

Template Parameters
IndexAn integral range type
Parameters
bound_shiftThe shift to be applied to the range
Returns
A reference to this range

Definition at line 933 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inplace_shift() [2/2]

template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
Range_& TiledArray::Range::inplace_shift ( const std::initializer_list< Index > &  bound_shift)
inline

Shift the lower and upper bound of this range.

Template Parameters
IndexAn integral type
Parameters
bound_shiftThe shift to be applied to the range
Returns
A reference to this range

Definition at line 971 of file range.h.

◆ lobound() [1/2]

index_view_type TiledArray::Range::lobound ( ) const
inline

Range lower bound accessor.

Returns
A index view that contains the lower bounds for each dimension of the block range.
Exceptions
nothing

Definition at line 692 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lobound() [2/2]

index1_type TiledArray::Range::lobound ( size_t  dim) const
inline

Range lower bound element accessor.

Returns
The lower bound of dimension dim.
Exceptions
nothing

Definition at line 700 of file range.h.

Here is the call graph for this function:

◆ lobound_data()

const index1_type* TiledArray::Range::lobound_data ( ) const
inline

Range lower bound data accessor.

Returns
A pointer to the lower bound data (see Range::lobound() )
Note
Not necessarily nullptr for rank-0 or null Range
Exceptions
nothing

Definition at line 685 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lobound_data_nc()

index1_type* TiledArray::Range::lobound_data_nc ( )
inlineprotected

Definition at line 86 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ offset()

distance_type TiledArray::Range::offset ( ) const
inline

Range offset.

The range ordinal offset is equal to the dot product of the lower bound and stride vector. It is used internally to compute ordinal offsets.

Returns
The ordinal index offset

Definition at line 795 of file range.h.

◆ operator bool()

TiledArray::Range::operator bool ( ) const
inlineexplicit

Conversion to bool.

Returns
false if is null state, i.e. this->rank()==0

Definition at line 663 of file range.h.

Here is the call graph for this function:

◆ operator*=()

Range & TiledArray::Range::operator*= ( const Permutation perm)
inline

Permute this range.

Parameters
permThe permutation to be applied to this range
Returns
A reference to this range
Exceptions
TiledArray::ExceptionWhen the rank of this range is not equal to the rank of the permutation.

Definition at line 1218 of file range.h.

Here is the call graph for this function:

◆ operator=() [1/2]

Range_& TiledArray::Range::operator= ( const Range_ other)
default

Copy assignment operator.

Parameters
otherThe range to be copied
Returns
A reference to this object

◆ operator=() [2/2]

Range_& TiledArray::Range::operator= ( Range_ &&  other)
inline

Move assignment operator.

Parameters
otherThe range to be copied
Returns
A reference to this object
Exceptions
nothing

Definition at line 644 of file range.h.

◆ ordinal() [1/4]

template<typename... Index, typename std::enable_if_t<(sizeof...(Index) > 1ul) &&(std::is_integral_v< Index > &&...)> * = nullptr>
ordinal_type TiledArray::Range::ordinal ( const Index &...  index) const
inline

calculate the ordinal index of index

Convert a coordinate index to an ordinal index.

Template Parameters
IndexA pack of integral types
Parameters
indexThe index to be converted to an ordinal index
Returns
The ordinal index of index
Exceptions
Whenindex is not included in this range.

Definition at line 1064 of file range.h.

Here is the call graph for this function:

◆ ordinal() [2/4]

template<typename Index , typename std::enable_if_t< detail::is_integral_range_v< Index >> * = nullptr>
ordinal_type TiledArray::Range::ordinal ( const Index &  index) const
inline

calculate the ordinal index of index

Convert a coordinate index to an ordinal index.

Template Parameters
IndexAn integral range type
Parameters
indexThe index to be converted to an ordinal index
Returns
The ordinal index of index
Exceptions
Whenindex is not included in this range.

Definition at line 1022 of file range.h.

Here is the call graph for this function:

◆ ordinal() [3/4]

ordinal_type TiledArray::Range::ordinal ( const ordinal_type  index) const
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.

Parameters
indexOrdinal index
Returns
index (unchanged)
Exceptions
Whenindex is not included in this range

Definition at line 1008 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ordinal() [4/4]

template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
ordinal_type TiledArray::Range::ordinal ( const std::initializer_list< Index > &  index) const
inline

calculate the ordinal index of index

Convert a coordinate index to an ordinal index.

Template Parameters
IndexAn integral type
Parameters
indexThe index to be converted to an ordinal index
Returns
The ordinal index of index
Exceptions
Whenindex is not included in this range.

Definition at line 1049 of file range.h.

◆ rank()

unsigned int TiledArray::Range::rank ( ) const
inline

Rank accessor.

Returns
The rank (number of dimensions) of this range
Exceptions
nothing

Definition at line 669 of file range.h.

Here is the caller graph for this function:

◆ resize()

template<typename Index1 , typename Index2 , typename = std::enable_if_t<detail::is_integral_sized_range_v<Index1> && detail::is_integral_sized_range_v<Index2>>>
Range_& TiledArray::Range::resize ( const Index1 &  lower_bound,
const Index2 &  upper_bound 
)
inline

Resize range to a new upper and lower bound.

Template Parameters
Index1An integral sized range type
Index2An integral sized range type
Parameters
lower_boundThe lower bounds of the N-dimensional range
upper_boundThe upper bound of the N-dimensional range
Returns
A reference to this range
Exceptions
TiledArray::ExceptionWhen the size of lower_bound is not equal to that of upper_bound.
TiledArray::ExceptionWhen lower_bound[i] >= upper_bound[i]

Definition at line 908 of file range.h.

Here is the call graph for this function:

◆ serialize()

template<typename Archive >
void TiledArray::Range::serialize ( Archive &  ar)
inline

Definition at line 1120 of file range.h.

Here is the caller graph for this function:

◆ shift() [1/2]

template<typename Index , typename = std::enable_if_t<detail::is_integral_range_v<Index>>>
Range_ TiledArray::Range::shift ( const Index &  bound_shift)
inline

Create a Range with shiften lower and upper bounds.

Template Parameters
IndexAn integral range type
Parameters
bound_shiftThe shift to be applied to the range
Returns
A shifted copy of this range

Definition at line 982 of file range.h.

Here is the call graph for this function:

◆ shift() [2/2]

template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
Range_ TiledArray::Range::shift ( const std::initializer_list< Index > &  bound_shift)
inline

Create a Range with shiften lower and upper bounds.

Template Parameters
IndexAn integral type
Parameters
bound_shiftThe shift to be applied to the range
Returns
A shifted copy of this range

Definition at line 995 of file range.h.

Here is the call graph for this function:

◆ stride() [1/2]

index_view_type TiledArray::Range::stride ( ) const
inline

Range stride accessor.

Returns
An index view that contains the stride for each dimension of the block range.
Exceptions
nothing

Definition at line 766 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stride() [2/2]

index1_type TiledArray::Range::stride ( size_t  dim) const
inline

Range stride element accessor.

Returns
The stride of dimension dim.
Exceptions
nothing

Definition at line 774 of file range.h.

Here is the call graph for this function:

◆ stride_data()

const index1_type* TiledArray::Range::stride_data ( ) const
inline

Range stride data accessor.

Returns
A pointer to the stride data (see Range::stride() )
Note
Not necessarily nullptr for rank-0 or null Range
Exceptions
nothing

Definition at line 759 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stride_data_nc()

index1_type* TiledArray::Range::stride_data_nc ( )
inlineprotected

Definition at line 89 of file range.h.

Here is the call graph for this function:

◆ swap()

void TiledArray::Range::swap ( Range_ other)
inline

Definition at line 1124 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ upbound() [1/2]

index_view_type TiledArray::Range::upbound ( ) const
inline

Range upper bound accessor.

Returns
An index view that contains the upper bounds for each dimension of the block range.
Exceptions
nothing

Definition at line 717 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ upbound() [2/2]

index1_type TiledArray::Range::upbound ( size_t  dim) const
inline

Range upped bound element accessor.

Returns
The upper bound of dimension dim.
Exceptions
nothing

Definition at line 725 of file range.h.

Here is the call graph for this function:

◆ upbound_data()

const index1_type* TiledArray::Range::upbound_data ( ) const
inline

Range upper bound data accessor.

Returns
A pointer to the upper bound data (see Range::upbound() )
Note
Not necessarily nullptr for rank-0 or null Range
Exceptions
nothing

Definition at line 710 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ upbound_data_nc()

index1_type* TiledArray::Range::upbound_data_nc ( )
inlineprotected

Definition at line 87 of file range.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ volume()

ordinal_type TiledArray::Range::volume ( ) const
inline

Range volume accessor.

Returns
The total number of elements in the range, or 0 if this is a null Range
Exceptions
nothing

Definition at line 783 of file range.h.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ detail::RangeIterator< index1_type, Range_ >

friend class detail::RangeIterator< index1_type, Range_ >
friend

Definition at line 63 of file range.h.

Member Data Documentation

◆ datavec_

container::svector<index1_type, 4 * TA_MAX_SOO_RANK_METADATA> TiledArray::Range::datavec_
protected

A vector that holds the dimension information of the range. Its layout:

{ lobound[0], ..., lobound[rank_ - 1],
upbound[0], ..., upbound[rank_ - 1],
extent[0], ..., extent[rank_ - 1],
stride[0], ..., stride[rank_ - 1] }

Definition at line 77 of file range.h.

◆ offset_

distance_type TiledArray::Range::offset_ = 0l
protected

Ordinal index offset correction.

Definition at line 78 of file range.h.

◆ rank_

unsigned int TiledArray::Range::rank_ = 0u
protected

The rank (or number of dimensions) in the range.

Definition at line 80 of file range.h.

◆ volume_

ordinal_type TiledArray::Range::volume_ = 0ul
protected

Total number of elements.

Definition at line 79 of file range.h.


The documentation for this class was generated from the following file:
index_view_type lobound() const
Range lower bound accessor.
Definition: range.h:692
index_view_type extent() const
Range extent accessor.
Definition: range.h:741
index_view_type stride() const
Range stride accessor.
Definition: range.h:766
Range()
Default constructor.
Definition: range.h:330
unsigned int rank_
The rank (or number of dimensions) in the range.
Definition: range.h:80
index_view_type upbound() const
Range upper bound accessor.
Definition: range.h:717