Array

template<typename T, size_t N = 1>
class Array : public kmm::ArrayBase

Public Functions

inline virtual size_t rank() const final

Returns the rank (i.e., the number of dimensions).

inline virtual index_t size(size_t axis) const final

Returns the number of elements along the provided axis.

Parameters:

axis – The target axis.

Returns:

The dimensionality along the provided axis.

inline std::array<index_t, N> sizes() const

Returns the N-dimensional shape of this array.

template<typename I>
inline void read(T *dst_ptr, I length) const

Read the data of this array into the provided memory location. This method blocks until the data is available.

Parameters:
  • dst_ptr – The memory location where the data will be written.

  • length – The size of the memory location in number of elements. Must equal size().

inline void read(view_mut<T, N> v) const

Read the data of this array into the provided memory location. This method blocks until the data is available.

Parameters:

v – The host view where the output will be stored.

inline std::vector<T> read() const

Read the data of this array into a std::vector<T>. This methods blocks until the data is available.

Returns:

The data of this array.

index_t size() const

Returns the total volume of this array (i.e., the total number of elements).

Returns:

The volume of this array.