6 #include "../os/memory.h"
10 #define MF_NDARRAY_VIEW_FUNC_(func) \
11 template<typename... Args> decltype(auto) func(Args&&... args) { \
12 return view().func(std::forward<Args>(args)...); \
14 template<typename... Args> decltype(auto) func(Args&&... args) const { \
15 return cview().func(std::forward<Args>(args)...); \
25 template<std::
size_t Dim,
typename T,
typename Allocator = raw_allocator>
71 ndarray(shp, 0, sizeof(T), allocator) { }
122 template<std::
size_t Dim,
typename T>
typename view_type::iterator iterator
Definition: ndarray.h:43
#define MF_NDARRAY_VIEW_FUNC_(func)
Definition: ndarray.h:10
ndarray_iterator< ndarray_view > iterator
Definition: ndarray_view.h:79
std::size_t padding() const noexcept
Definition: ndarray.h:104
index_type coordinates_to_index(const coordinates_type &coord) const
Definition: ndarray.h:90
static constexpr std::size_t dimension
Definition: ndarray.h:46
ndsize< Dim > shape_type
Definition: ndarray_view.h:75
const_view_type cview() const
Definition: ndarray.h:83
Multidimensional array container.
Definition: ndarray.h:26
ndarray & operator=(const ndarray &arr)
Definition: ndarray.h:79
strides_type strides_with_padding_(const shape_type &shape, std::size_t padding)
Definition: ndarray.tcc:8
typename view_type::index_type index_type
Definition: ndarray.h:31
const shape_type & shape() const noexcept
Definition: ndarray_view.h:200
view_type view()
Definition: ndarray.h:81
const byte & const_reference
Definition: ndarray.h:41
coordinates_type index_to_coordinates(const index_type &index) const
Definition: ndarray.h:88
byte & reference
Definition: ndarray.h:40
typename view_type::shape_type shape_type
Definition: ndarray.h:33
ndarray_view< Dim, T > view_type
Definition: ndarray.h:28
ndarray_view< Dim, const T > const_view_type
Definition: ndarray.h:29
std::ptrdiff_t contiguous_length() const noexcept
Definition: ndarray_view.h:202
~ndarray()
Definition: ndarray.tcc:70
auto make_ndarray(const ndarray_view< Dim, T > &vw)
Definition: ndarray.h:123
ndarray(const ndarray &arr)
Definition: ndarray.h:74
pointer start() noexcept
Definition: ndarray.h:99
std::size_t size() const noexcept
Definition: ndarray.h:97
decltype(auto) slice(Args &&...args)
Definition: ndarray.h:107
ndarray & operator=(const const_view_type &arr)
Definition: ndarray.tcc:76
std::size_t padding_
Padding between frames, in bytes.
Definition: ndarray.h:51
const_pointer coordinates_to_pointer(const coordinates_type &coord) const
Definition: ndarray.h:94
ndptrdiff< Dim > strides_type
Definition: ndarray_view.h:76
decltype(auto) at(Args &&...args)
Definition: ndarray.h:110
ndptrdiff< Dim > coordinates_type
Definition: ndarray_view.h:74
iterator begin()
Definition: ndarray.h:112
typename view_type::strides_type strides_type
Definition: ndarray.h:34
pointer coordinates_to_pointer(const coordinates_type &) const
Definition: ndarray_view.tcc:153
decltype(auto) section(Args &&...args)
Definition: ndarray.h:106
std::size_t size() const
Definition: ndarray_view.h:197
pointer coordinates_to_pointer(const coordinates_type &coord)
Definition: ndarray.h:92
const_pointer start() const noexcept
Definition: ndarray.h:100
void deallocate_()
Definition: ndarray.tcc:42
std::ptrdiff_t index_type
Definition: ndarray_view.h:73
const shape_type & shape() const noexcept
Definition: ndarray.h:101
coordinates_type index_to_coordinates(const index_type &) const
Definition: ndarray_view.tcc:101
ndarray(const shape_type &shp, const Allocator &allocator=Allocator())
Definition: ndarray.h:70
ndarray(const shape_type &shape, std::size_t padding, std::size_t stride, const Allocator &allocator)
Constructor for use by derived classes.
Definition: ndarray.tcc:50
iterator end()
Definition: ndarray.h:115
std::size_t allocated_size_
Allocated memory size, in bytes.
Definition: ndarray.h:52
const_iterator begin() const
Definition: ndarray.h:113
std::size_t stride_
Stride of elements, in bytes.
Definition: ndarray.h:50
const_iterator cbegin() const
Definition: ndarray.h:114
const_iterator end() const
Definition: ndarray.h:116
const byte * const_pointer
Definition: ndarray.h:39
const_view_type view() const
Definition: ndarray.h:82
typename view_type::coordinates_type coordinates_type
Definition: ndarray.h:32
typename const_view_type::iterator const_iterator
Definition: ndarray.h:44
iterator begin() const
Definition: ndarray_view.tcc:170
void allocate_()
Definition: ndarray.tcc:17
byte * pointer
Definition: ndarray.h:38
ndspan< Dim > span_type
Definition: ndarray_view.h:77
std::size_t contiguous_length() const noexcept
Definition: ndarray.h:103
index_type coordinates_to_index(const coordinates_type &) const
Definition: ndarray_view.tcc:117
view_type view_
View used to access items.
Definition: ndarray.h:53
const strides_type & strides() const noexcept
Definition: ndarray_view.h:201
iterator end() const
Definition: ndarray_view.tcc:176
pointer start() const noexcept
Definition: ndarray_view.h:199
const_iterator cend() const
Definition: ndarray.h:117
byte value_type
Definition: ndarray.h:37
typename view_type::span_type span_type
Definition: ndarray.h:35
const strides_type & strides() const noexcept
Definition: ndarray.h:102
Allocator allocator_
Raw allocator used to allocate memory, in bytes.
Definition: ndarray.h:49