NDArray

template<typename T, int64_t Ndim = 2>
class NDArray : public aare::ArrayExpr<NDArray<T, 2>, 2>

Public Types

using value_type = T

Public Functions

inline NDArray()

Default constructor. Will construct an empty NDArray.

inline explicit NDArray(std::array<int64_t, Ndim> shape)

Construct a new NDArray object with a given shape.

Note

The data is uninitialized.

Parameters:

shape – shape of the new NDArray

inline NDArray(std::array<int64_t, Ndim> shape, T value)

Construct a new NDArray object with a shape and value.

Parameters:
  • shape – shape of the new array

  • value – value to initialize the array with

inline explicit NDArray(const NDView<T, Ndim> v)

Construct a new NDArray object from a NDView.

Note

The data is copied from the view to the NDArray.

Parameters:

v – view of data to initialize the NDArray with

inline NDArray(NDArray &&other) noexcept
inline NDArray(const NDArray &other)
template<typename E>
inline NDArray(ArrayExpr<E, Ndim> &&expr)
inline ~NDArray()
inline auto begin()
inline auto end()
NDArray &operator=(NDArray &&other) noexcept
NDArray &operator=(const NDArray &other)
NDArray &operator+=(const NDArray &other)
NDArray &operator-=(const NDArray &other)
NDArray &operator*=(const NDArray &other)
template<typename V>
inline NDArray &operator/=(const NDArray<V, Ndim> &other)
NDArray<bool, Ndim> operator>(const NDArray &other)
bool operator==(const NDArray &other) const
bool operator!=(const NDArray &other) const
NDArray &operator=(const T&)
NDArray &operator+=(const T&)
NDArray operator+(const T&)
NDArray &operator-=(const T&)
NDArray operator-(const T&)
NDArray &operator*=(const T&)
NDArray operator*(const T&)
NDArray &operator/=(const T&)
NDArray operator/(const T&)
NDArray &operator&=(const T&)
inline void sqrt()
NDArray &operator++()
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) == Ndim, T&> operator()(Ix... index) const
template<typename ...Ix>
inline std::enable_if_t<sizeof...(Ix) == Ndim, T> value(Ix... index)
inline T &operator()(int64_t i)
inline const T &operator()(int64_t i) const
inline T &operator[](int64_t i)
inline const T &operator[](int64_t i) const
inline T *data()
inline std::byte *buffer()
inline size_t size() const
inline size_t total_bytes() const
inline std::array<int64_t, Ndim> shape() const noexcept
inline int64_t shape(int64_t i) const noexcept
inline std::array<int64_t, Ndim> strides() const noexcept
inline size_t bitdepth() const noexcept
inline std::array<int64_t, Ndim> byte_strides() const noexcept
inline NDView<T, Ndim> view() const

Create a view of the NDArray.

Returns:

NDView<T, Ndim>

void Print()
void Print_all()
void Print_some()
inline void reset()