Template Numerical Library version\ main:9e7b0f4
|
Indexer for N-dimensional arrays. It does not store any data, only the sizes of each dimension. More...
#include <TNL/Containers/NDArrayIndexer.h>
Public Types | |
using | IndexType = typename SizesHolder::IndexType |
Type of indices used for addressing the array elements. | |
using | OverlapsType = Overlaps |
Type of the underlying object which represents the overlaps in each dimension of a distributed N-dimensional array. | |
using | SizesHolderType = SizesHolder |
Type of the underlying object which represents the sizes of the N-dimensional array. | |
using | StridesHolderType = StridesHolder |
Type of the underlying object which represents the strides of the N-dimensional array. |
Public Member Functions | |
__cuda_callable__ | NDArrayIndexer ()=default |
Constructs an empty indexer with zero sizes and strides. | |
__cuda_callable__ | NDArrayIndexer (SizesHolderType sizes, StridesHolderType strides, OverlapsType overlaps) |
Creates the indexer with given sizes and strides. | |
template<std::size_t level> | |
__cuda_callable__ IndexType | getOverlap () const |
Returns the overlap of a distributed N-dimensional array along the specified axis. | |
__cuda_callable__ const OverlapsType & | getOverlaps () const |
Returns the N-dimensional overlaps holder instance. | |
template<std::size_t level> | |
__cuda_callable__ IndexType | getSize () const |
Returns a specific component of the N-dimensional sizes. | |
__cuda_callable__ const SizesHolderType & | getSizes () const |
Returns the N-dimensional array sizes held by the indexer. | |
template<typename... IndexTypes> | |
__cuda_callable__ IndexType | getStorageIndex (IndexTypes &&... indices) const |
Computes the one-dimensional storage index for a specific element of the N-dimensional array. | |
__cuda_callable__ IndexType | getStorageSize () const |
Returns the size (number of elements) needed to store the N-dimensional array. | |
template<std::size_t level> | |
__cuda_callable__ IndexType | getStride () const |
Returns a specific component of the N-dimensional strides. | |
__cuda_callable__ const StridesHolderType & | getStrides () const |
Returns the N-dimensional strides holder instance. | |
template<typename BeginsHolder, typename EndsHolder> | |
__cuda_callable__ bool | isContiguousBlock (const BeginsHolder &begins, const EndsHolder &ends) const |
Static Public Member Functions | |
static constexpr std::size_t | getDimension () |
Returns the dimension of the N-dimensional array, i.e. N. |
Protected Member Functions | |
__cuda_callable__ OverlapsType & | getOverlaps () |
Returns a non-constant reference to the underlying overlaps. | |
__cuda_callable__ SizesHolderType & | getSizes () |
Returns a non-constant reference to the underlying sizes. | |
__cuda_callable__ StridesHolderType & | getStrides () |
Returns a non-constant reference to the underlying strides. |
Protected Attributes | |
OverlapsType | overlaps |
Underlying object which represents the overlaps of the N-dimensional array. | |
SizesHolderType | sizes |
Underlying object which represents the sizes of the N-dimensional array. | |
StridesHolderType | strides |
Underlying object which represents the strides of the N-dimensional array. |
Indexer for N-dimensional arrays. It does not store any data, only the sizes of each dimension.
SizesHolder | Instance of SizesHolder that will represent the array sizes. |
StridesHolder | Type of the base class which represents the strides of the N-dimensional array. |
Overlaps | Sequence of integers representing the overlaps in each dimension a distributed N-dimensional array. |
|
inlinenodiscard |
Returns the overlap of a distributed N-dimensional array along the specified axis.
level | Integer specifying the axis of the array. |
|
inlinenodiscardprotected |
Returns a non-constant reference to the underlying overlaps.
The function is not public – only subclasses like NDArrayStorage may modify the strides.
|
inlinenodiscard |
Returns a specific component of the N-dimensional sizes.
level | Integer specifying the component of the sizes to be returned. |
|
inlinenodiscardprotected |
Returns a non-constant reference to the underlying sizes.
The function is not public – only subclasses like NDArrayStorage may modify the sizes.
|
inlinenodiscard |
Computes the one-dimensional storage index for a specific element of the N-dimensional array.
indices | Indices of the element in the N-dimensional array. The number of indices supplied must be equal to N, i.e. getDimension(). |
|
inlinenodiscard |
Returns the size (number of elements) needed to store the N-dimensional array.
|
inlinenodiscard |
Returns a specific component of the N-dimensional strides.
level | Integer specifying the component of the strides to be returned. |
|
inlinenodiscardprotected |
Returns a non-constant reference to the underlying strides.
The function is not public – only subclasses like NDArrayStorage may modify the strides.