|
array
C++ library for multi-dimensional arrays
|
#include <array.h>
Public Types | |
| using | base_range = interval< Min_, Extent_ > |
Public Member Functions | |
| NDARRAY_HOST_DEVICE | dim (index_t min, index_t extent, index_t stride=DefaultStride) |
| NDARRAY_HOST_DEVICE | dim (index_t extent) |
| NDARRAY_HOST_DEVICE | dim (const base_range &interval, index_t stride=DefaultStride) |
| NDARRAY_HOST_DEVICE | dim (const dim &)=default |
| NDARRAY_HOST_DEVICE | dim (dim &&)=default |
| NDARRAY_HOST_DEVICE dim & | operator= (const dim &)=default |
| NDARRAY_HOST_DEVICE dim & | operator= (dim &&)=default |
| template<index_t CopyMin, index_t CopyExtent, index_t CopyStride, class = internal::disable_if_not_equal<Min, CopyMin>, class = internal::disable_if_not_equal<Extent, CopyExtent>, class = internal::disable_if_not_equal<Stride, CopyStride>> | |
| NDARRAY_HOST_DEVICE | dim (const dim< CopyMin, CopyExtent, CopyStride > &other) |
| template<index_t CopyMin, index_t CopyExtent, index_t CopyStride, class = internal::disable_if_not_equal<Min, CopyMin>, class = internal::disable_if_not_equal<Extent, CopyExtent>, class = internal::disable_if_not_equal<Stride, CopyStride>> | |
| NDARRAY_HOST_DEVICE dim & | operator= (const dim< CopyMin, CopyExtent, CopyStride > &other) |
| NDARRAY_INLINE NDARRAY_HOST_DEVICE index_t | stride () const |
| NDARRAY_INLINE NDARRAY_HOST_DEVICE void | set_stride (index_t stride) |
| NDARRAY_INLINE NDARRAY_HOST_DEVICE index_t | flat_offset (index_t at) const |
| template<index_t OtherMin, index_t OtherExtent, index_t OtherStride> | |
| NDARRAY_HOST_DEVICE bool | operator== (const dim< OtherMin, OtherExtent, OtherStride > &other) const |
| template<index_t OtherMin, index_t OtherExtent, index_t OtherStride> | |
| NDARRAY_HOST_DEVICE bool | operator!= (const dim< OtherMin, OtherExtent, OtherStride > &other) const |
Static Public Attributes | |
| static constexpr index_t | Stride = Stride_ |
| static constexpr index_t | DefaultStride = internal::is_static(Stride) ? Stride : unresolved |
Protected Attributes | |
| internal::constexpr_index< Stride_ > | stride_ |
Protected Attributes inherited from interval< Min_, Extent_ > | |
| internal::constexpr_index< Min_ > | min_ |
| internal::constexpr_index< Extent_ > | extent_ |
Additional Inherited Members | |
Protected Member Functions inherited from interval< Min_, Extent_ > | |
| NDARRAY_HOST_DEVICE | interval (index_t min, index_t extent) |
| NDARRAY_HOST_DEVICE | interval (index_t min) |
| NDARRAY_HOST_DEVICE | interval (const interval &)=default |
| NDARRAY_HOST_DEVICE | interval (interval &&)=default |
| NDARRAY_HOST_DEVICE interval & | operator= (const interval &)=default |
| NDARRAY_HOST_DEVICE interval & | operator= (interval &&)=default |
| template<index_t CopyMin, index_t CopyExtent, class = internal::disable_if_not_equal<Min, CopyMin>, class = internal::disable_if_not_equal<Extent, CopyExtent>> | |
| NDARRAY_HOST_DEVICE | interval (const interval< CopyMin, CopyExtent > &other) |
| template<index_t CopyMin, index_t CopyExtent, class = internal::disable_if_not_equal<Min, CopyMin>, class = internal::disable_if_not_equal<Extent, CopyExtent>> | |
| NDARRAY_HOST_DEVICE interval & | operator= (const interval< CopyMin, CopyExtent > &other) |
| NDARRAY_INLINE NDARRAY_HOST_DEVICE index_t | min () const |
| NDARRAY_INLINE NDARRAY_HOST_DEVICE void | set_min (index_t min) |
| NDARRAY_INLINE NDARRAY_HOST_DEVICE index_t | extent () const |
| NDARRAY_INLINE NDARRAY_HOST_DEVICE index_t | size () const |
| NDARRAY_INLINE NDARRAY_HOST_DEVICE void | set_extent (index_t extent) |
| NDARRAY_INLINE NDARRAY_HOST_DEVICE index_t | max () const |
| NDARRAY_INLINE NDARRAY_HOST_DEVICE void | set_max (index_t max) |
| NDARRAY_INLINE NDARRAY_HOST_DEVICE bool | is_in_range (index_t at) const |
| template<index_t OtherMin, index_t OtherExtent> | |
| NDARRAY_INLINE NDARRAY_HOST_DEVICE bool | is_in_range (const interval< OtherMin, OtherExtent > &at) const |
| template<index_t OtherMin, index_t OtherExtent, index_t OtherStride> | |
| NDARRAY_INLINE NDARRAY_HOST_DEVICE bool | is_in_range (const dim< OtherMin, OtherExtent, OtherStride > &at) const |
| NDARRAY_HOST_DEVICE index_iterator | begin () const |
| NDARRAY_HOST_DEVICE index_iterator | end () const |
| template<index_t OtherMin, index_t OtherExtent> | |
| NDARRAY_HOST_DEVICE bool | operator== (const interval< OtherMin, OtherExtent > &other) const |
| template<index_t OtherMin, index_t OtherExtent> | |
| NDARRAY_HOST_DEVICE bool | operator!= (const interval< OtherMin, OtherExtent > &other) const |
Static Protected Attributes inherited from interval< Min_, Extent_ > | |
| static constexpr index_t | Min = Min_ |
| static constexpr index_t | Extent = Extent_ |
| static constexpr index_t | Max = internal::static_sub(internal::static_add(Min, Extent), 1) |
Describes one dimension of an array. The template parameters enable providing compile time constants for the min, extent, and stride of the dim.
These parameters define a mapping from the indices of the dimension to offsets: offset(x) = (x - min)*stride. The extent does not affect the mapping directly. Values not in the interval [min, min + extent) are considered to be out of bounds.
Construct a new dim object. If the min, extent or stride are specified in the constructor, it must have a value compatible with Min, Extent, or Stride, respectively.
The default values if not specified in the constructor are:
min is Min if Min is static, or 0 if not.extent is Extent if Extent is static, or 0 if not.stride is Stride. Copy construction or assignment of another dim object, possibly with different compile-time template parameters. other.min(), other.extent(), and other.stride() must be compatible with Min, Extent, and Stride, respectively.
|
inline |
Get or set the distance in flat indices between neighboring elements in this dim.
Offset of the index at in this dim in the flat array.
|
inline |
Two dim objects are considered equal if their mins, extents, and strides are equal.
1.8.11