TiledArray::BlockRange Class Reference
Inheritance diagram for TiledArray::BlockRange:
Collaboration diagram for TiledArray::BlockRange:

Documentation

Range that references a subblock of another range.

Definition at line 34 of file block_range.h.

Public Member Functions

 BlockRange ()=default
 
 BlockRange (const BlockRange &)=default
 
 BlockRange (BlockRange &&)=default
 
 ~BlockRange ()=default
 
BlockRangeoperator= (const BlockRange &)=default
 
BlockRangeoperator= (BlockRange &&)=default
 
template<typename Index1 , typename Index2 , typename = std::enable_if_t<detail::is_integral_range_v<Index1> && detail::is_integral_range_v<Index2>>>
 BlockRange (const Range &range, const Index1 &lower_bound, const Index2 &upper_bound)
 Construct a BlockRange defined by lower and upper bounds. More...
 
template<typename Index1 , typename Index2 , typename = std::enable_if_t<std::is_integral_v<Index1> && std::is_integral_v<Index2>>>
 BlockRange (const Range &range, const std::initializer_list< Index1 > &lower_bound, const std::initializer_list< Index2 > &upper_bound)
 Construct a BlockRange defined by lower and upper bounds. More...
 
template<typename PairRange , typename = std::enable_if_t<detail::is_gpair_range_v<PairRange>>>
 BlockRange (const Range &range, const PairRange &bounds)
 Construct Range defined by a range of {lower,upper} bound pairs. More...
 
template<typename GPair >
 BlockRange (const Range &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 std::initializer_list{lower,upper} bounds. More...
 
template<typename Index , typename = std::enable_if_t<std::is_integral_v<Index>>>
 BlockRange (const Range &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_t< detail::is_integral_range_v< Index >> * = nullptr>
ordinal_type ordinal (const Index &index) const
 calculate the ordinal index of i More...
 
template<typename... Index, typename std::enable_if<(sizeof...(Index) > 1ul)>::type * = nullptr>
ordinal_type ordinal (const Index &... index) const
 
ordinal_type ordinal (ordinal_type index) const
 calculate the coordinate index of the ordinal index, index. More...
 
template<typename Index >
BlockRangeresize (const Index &, const Index &)
 Resize of block range is not supported. More...
 
template<typename Index >
Range_inplace_shift (const Index &)
 Shift the lower and upper bound of this range. More...
 
template<typename Index >
Range_ shift (const Index &)
 Shift the lower and upper bound of this range. More...
 
void swap (BlockRange &other)
 
template<typename Archive >
void serialize (const Archive &ar) const
 Serialization Block range. More...
 
- Public Member Functions inherited from TiledArray::Range
 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)
 

Friends

bool operator== (const BlockRange &r1, const BlockRange &r2)
 BlockRange equality comparison. More...
 

Additional Inherited Members

- Public Types inherited from TiledArray::Range
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...
 
- Protected Member Functions inherited from TiledArray::Range
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 inherited from TiledArray::Range
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...
 

Constructor & Destructor Documentation

◆ BlockRange() [1/8]

TiledArray::BlockRange::BlockRange ( )
default

◆ BlockRange() [2/8]

TiledArray::BlockRange::BlockRange ( const BlockRange )
default

◆ BlockRange() [3/8]

TiledArray::BlockRange::BlockRange ( BlockRange &&  )
default

◆ ~BlockRange()

TiledArray::BlockRange::~BlockRange ( )
default

◆ BlockRange() [4/8]

template<typename Index1 , typename Index2 , typename = std::enable_if_t<detail::is_integral_range_v<Index1> && detail::is_integral_range_v<Index2>>>
TiledArray::BlockRange::BlockRange ( const Range range,
const Index1 &  lower_bound,
const Index2 &  upper_bound 
)
inline

Construct a BlockRange defined by lower and upper bounds.

Construct a BlockRange within host Range defined by lower_bound and upper_bound. Examples of using this constructor:

Range r(10, 10, 10);
std::vector<size_t> lobounds = {0, 1, 2};
std::vector<size_t> upbounds = {4, 6, 8};
BlockRange br(r, lobounds, upbounds);
// or using in-place ctors
Range br2(r, std::vector<size_t>{0, 1, 2}, std::vector<size_t>{4, 6, 8});
assert(r == r2);
Template Parameters
IndexAn integral range type
Parameters
rangethe host Range
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 181 of file block_range.h.

◆ BlockRange() [5/8]

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

Construct a BlockRange defined by lower and upper bounds.

Construct a BlockRange within host Range defined by lower_bound and upper_bound. Examples of using this constructor:

Range r(10, 10, 10);
BlockRange br(r, {0, 1, 2}, {4, 6, 8});
Template Parameters
Index1An integral type
Index2An integral type
Parameters
rangethe host Range
lower_boundAn initializer list of lower bounds for each dimension
upper_boundAn initializer list 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 208 of file block_range.h.

◆ BlockRange() [6/8]

template<typename PairRange , typename = std::enable_if_t<detail::is_gpair_range_v<PairRange>>>
TiledArray::BlockRange::BlockRange ( const Range range,
const PairRange &  bounds 
)
inline

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

Examples of using this constructor:

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

Definition at line 248 of file block_range.h.

◆ BlockRange() [7/8]

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

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

Examples of using this constructor:

Range r(10, 10, 10);
BlockRange br0(r, {std::make_pair(0,4), std::pair{1,6}, std::pair(2,8)});
Template Parameters
GPaira generalized pair of integral types
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 265 of file block_range.h.

◆ BlockRange() [8/8]

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

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

Examples of using this constructor:

Range r(10, 10, 10);
BlockRange br0(r, {{0,4}, {1,6}, {2,8}});
Template Parameters
IndexAn integral type
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 292 of file block_range.h.

Member Function Documentation

◆ inplace_shift()

template<typename Index >
Range_& TiledArray::BlockRange::inplace_shift ( const Index &  )
inline

Shift the lower and upper bound of this range.

Warning
This function is here to shadow the base class inplace_shift function, and disable it.

Definition at line 365 of file block_range.h.

◆ operator=() [1/2]

BlockRange& TiledArray::BlockRange::operator= ( BlockRange &&  )
default

◆ operator=() [2/2]

BlockRange& TiledArray::BlockRange::operator= ( const BlockRange )
default

◆ ordinal() [1/3]

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

Definition at line 318 of file block_range.h.

Here is the call graph for this function:

◆ ordinal() [2/3]

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

calculate the ordinal index of i

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 312 of file block_range.h.

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

◆ ordinal() [3/3]

ordinal_type TiledArray::BlockRange::ordinal ( 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 328 of file block_range.h.

Here is the call graph for this function:

◆ resize()

template<typename Index >
BlockRange& TiledArray::BlockRange::resize ( const Index &  ,
const Index &   
)
inline

Resize of block range is not supported.

Definition at line 354 of file block_range.h.

◆ serialize()

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

Serialization Block range.

Definition at line 387 of file block_range.h.

Here is the call graph for this function:

◆ shift()

template<typename Index >
Range_ TiledArray::BlockRange::shift ( const Index &  )
inline

Shift the lower and upper bound of this range.

Warning
This function is here to shadow the base class shift function, and disable it.

Definition at line 375 of file block_range.h.

◆ swap()

void TiledArray::BlockRange::swap ( BlockRange other)
inline

Definition at line 380 of file block_range.h.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator==

bool operator== ( const BlockRange r1,
const BlockRange r2 
)
friend

BlockRange equality comparison.

Parameters
r1The first range to be compared
r2The second range to be compared
Returns
true when r1 represents the same range as r2, otherwise false.

Definition at line 433 of file block_range.h.


The documentation for this class was generated from the following file:
Range()
Default constructor.
Definition: range.h:330