Template Numerical Library: TNL::Containers::NDArrayIndexer< SizesHolder, StridesHolder, Overlaps > Class Template Reference

Template Numerical Library version\ main:be7e16d88

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TNL::Containers::NDArrayIndexer< SizesHolder, StridesHolder, Overlaps > Class Template Reference
N-dimensional arrays

Indexer for N-dimensional arrays. It does not store any data, only the sizes of each dimension. More...

`#include <TNL/Containers/NDArrayIndexer.h>`

Inheritance diagram for TNL::Containers::NDArrayIndexer< SizesHolder, StridesHolder, Overlaps >:
[legend]
Collaboration diagram for TNL::Containers::NDArrayIndexer< SizesHolder, StridesHolder, Overlaps >:
[legend]

## 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.

## Detailed Description

template<typename SizesHolder, typename StridesHolder, typename Overlaps = ConstStaticSizesHolder< typename SizesHolder::IndexType, SizesHolder::getDimension(), 0 >>
class TNL::Containers::NDArrayIndexer< SizesHolder, StridesHolder, Overlaps >

Indexer for N-dimensional arrays. It does not store any data, only the sizes of each dimension.

Template Parameters

  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.

## Member Function Documentation

## ◆ getOverlap()

template<typename SizesHolder, typename StridesHolder, typename Overlaps = ConstStaticSizesHolder< typename SizesHolder::IndexType, SizesHolder::getDimension(), 0 >>
template<std::size_t level>

__cuda_callable__ IndexType TNL::Containers::NDArrayIndexer< SizesHolder, StridesHolder, Overlaps >::getOverlap | ( |  | ) | const
| inlinenodiscard

Returns the overlap of a distributed N-dimensional array along the specified axis.

Template Parameters

  level | Integer specifying the axis of the array.

## ◆ getOverlaps()

template<typename SizesHolder, typename StridesHolder, typename Overlaps = ConstStaticSizesHolder< typename SizesHolder::IndexType, SizesHolder::getDimension(), 0 >>

__cuda_callable__ OverlapsType & TNL::Containers::NDArrayIndexer< SizesHolder, StridesHolder, Overlaps >::getOverlaps | ( |  | ) |
| inlinenodiscardprotected

Returns a non-constant reference to the underlying overlaps.

The function is not public – only subclasses like NDArrayStorage may modify the strides.

## ◆ getSize()

template<typename SizesHolder, typename StridesHolder, typename Overlaps = ConstStaticSizesHolder< typename SizesHolder::IndexType, SizesHolder::getDimension(), 0 >>
template<std::size_t level>

__cuda_callable__ IndexType TNL::Containers::NDArrayIndexer< SizesHolder, StridesHolder, Overlaps >::getSize | ( |  | ) | const
| inlinenodiscard

Returns a specific component of the N-dimensional sizes.

Template Parameters

  level | Integer specifying the component of the sizes to be returned.

## ◆ getSizes()

template<typename SizesHolder, typename StridesHolder, typename Overlaps = ConstStaticSizesHolder< typename SizesHolder::IndexType, SizesHolder::getDimension(), 0 >>

__cuda_callable__ SizesHolderType & TNL::Containers::NDArrayIndexer< SizesHolder, StridesHolder, Overlaps >::getSizes | ( |  | ) |
| inlinenodiscardprotected

Returns a non-constant reference to the underlying sizes.

The function is not public – only subclasses like NDArrayStorage may modify the sizes.

## ◆ getStorageIndex()

template<typename SizesHolder, typename StridesHolder, typename Overlaps = ConstStaticSizesHolder< typename SizesHolder::IndexType, SizesHolder::getDimension(), 0 >>
template<typename... IndexTypes>

__cuda_callable__ IndexType TNL::Containers::NDArrayIndexer< SizesHolder, StridesHolder, Overlaps >::getStorageIndex | ( | IndexTypes &&... | indices | ) | const
| inlinenodiscard

Computes the one-dimensional storage index for a specific element of the N-dimensional array.

Parameters

  indices | Indices of the element in the N-dimensional array. The number of indices supplied must be equal to N, i.e. getDimension().

Returns
  An index that can be used to address the element in a one-dimensional array.

## ◆ getStorageSize()

template<typename SizesHolder, typename StridesHolder, typename Overlaps = ConstStaticSizesHolder< typename SizesHolder::IndexType, SizesHolder::getDimension(), 0 >>

__cuda_callable__ IndexType TNL::Containers::NDArrayIndexer< SizesHolder, StridesHolder, Overlaps >::getStorageSize | ( |  | ) | const
| inlinenodiscard

Returns the size (number of elements) needed to store the N-dimensional array.

Returns
  The product of the aligned sizes.

## ◆ getStride()

template<typename SizesHolder, typename StridesHolder, typename Overlaps = ConstStaticSizesHolder< typename SizesHolder::IndexType, SizesHolder::getDimension(), 0 >>
template<std::size_t level>

__cuda_callable__ IndexType TNL::Containers::NDArrayIndexer< SizesHolder, StridesHolder, Overlaps >::getStride | ( |  | ) | const
| inlinenodiscard

Returns a specific component of the N-dimensional strides.

Template Parameters

  level | Integer specifying the component of the strides to be returned.

## ◆ getStrides()

template<typename SizesHolder, typename StridesHolder, typename Overlaps = ConstStaticSizesHolder< typename SizesHolder::IndexType, SizesHolder::getDimension(), 0 >>

__cuda_callable__ StridesHolderType & TNL::Containers::NDArrayIndexer< SizesHolder, StridesHolder, Overlaps >::getStrides | ( |  | ) |
| inlinenodiscardprotected

Returns a non-constant reference to the underlying strides.

The function is not public – only subclasses like NDArrayStorage may modify the strides.

The documentation for this class was generated from the following file:

- src/TNL/Containers/NDArrayIndexer.h