NDView

template<typename T, ssize_t Ndim = 2>
class NDView : public aare::ArrayExpr<NDView<T, 2>, 2>

Public Functions

NDView() = default
~NDView() = default
NDView(const NDView&) = default
NDView(NDView&&) = default
inline NDView(T *buffer, std::array<ssize_t, Ndim> shape)
template<typename ...Ix>
inline std::enable_if_t<sizeof...(Ix) == Ndim, T&> operator()(Ix... index)
template<typename ...Ix>
inline std::enable_if_t<sizeof...(Ix) == 1 && (Ndim > 1), NDView<T, Ndim - 1>> operator()(Ix... index)
template<typename ...Ix>
inline std::enable_if_t<sizeof...(Ix) == Ndim, const T&> operator()(Ix... index) const
inline ssize_t size() const
inline size_t total_bytes() const
inline std::array<ssize_t, Ndim> strides() const noexcept
inline T *begin()
inline T *end()
inline T const *begin() const
inline T const *end() const
inline T &operator[](ssize_t i)

Access element at index i.

inline const T &operator[](ssize_t i) const

Access element at index i.

inline bool operator==(const NDView &other) const
inline NDView &operator+=(const T val)
inline NDView &operator-=(const T val)
inline NDView &operator*=(const T val)
inline NDView &operator/=(const T val)
inline NDView &operator/=(const NDView &other)
template<size_t Size>
inline NDView &operator=(const std::array<T, Size> &arr)
inline NDView &operator=(const T val)
inline NDView &operator=(const NDView &other)
inline NDView &operator=(NDView &&other) noexcept
inline auto &shape() const
inline auto shape(ssize_t i) const
inline T *data()
inline const T *data() const
void print_all() const
inline NDView sub_view(ssize_t first, ssize_t last) const

Create a subview of a range of the first dimension. This is useful for splitting a batches of frames in parallel processing.

Parameters:
  • first – The first index of the subview (inclusive).

  • last – The last index of the subview (exclusive).

Throws:

std::runtime_error – if the range is invalid.

Returns:

A new NDView that is a subview of the current view.