1 #ifndef MF_NDARRAY_VIEW_GENERIC_H_
2 #define MF_NDARRAY_VIEW_GENERIC_H_
5 #include "../ndarray_view.h"
6 #include "../ndarray_timed_view.h"
7 #include "../../common.h"
24 template<std::
size_t Dim>
39 base(vw), format_(format) { }
42 base(start, shape, strides),
52 decltype(
auto) operator[](std::ptrdiff_t c)
const
55 decltype(
auto) operator()(std::ptrdiff_t
start, std::ptrdiff_t
end, std::ptrdiff_t step = 1)
const
58 decltype(
auto) operator()(std::ptrdiff_t c)
const
61 decltype(
auto) operator()()
const
66 format_ = other.format_;
77 template<std::
size_t Generic_dim, std::
size_t Concrete_dim,
typename Concrete_elem>
78 ndarray_view_generic<Generic_dim>
to_generic(
const ndarray_view<Concrete_dim, Concrete_elem>& vw);
83 template<std::
size_t Concrete_dim,
typename Concrete_elem, std::
size_t Generic_dim>
85 const ndarray_view_generic<Generic_dim>& vw,
86 const ndsize<Concrete_dim - Generic_dim>& frame_shape
Generic ndarray_view where lower dimension(s) are type-erased.
Definition: ndarray_view_generic.h:25
Mapping between coordinates, indices, and addresses of multi-dimensional data.
Definition: ndarray_view.h:16
std::uint8_t byte
Single byte type.
Definition: common.h:56
ndsize< Dim > shape_type
Definition: ndarray_view.h:75
const shape_type & shape() const noexcept
Definition: ndarray_view.h:200
static ndarray_view_generic null()
Definition: ndarray_view_generic.h:45
typename base::shape_type shape_type
Definition: ndarray_view_generic.h:29
decltype(auto) operator[](std::ptrdiff_t c) const
Subscript operator, creates slice on first dimension.
Definition: ndarray_view.h:163
ndarray_view< Dim-1, byte > slice(std::ptrdiff_t c, std::ptrdiff_t dimension) const
Create ndarray_view with one less dimension, by fixing coordinate of axis dimension to c...
void reset(const ndarray_view_generic &other) noexcept
Definition: ndarray_view_generic.h:64
ndarray_timed_view_generic< Generic_dim > to_generic(const ndarray_timed_view< Concrete_dim, Concrete_elem > &vw)
Definition: ndarray_timed_view_generic.h:56
ndptrdiff< Dim > strides_type
Definition: ndarray_view.h:76
ndarray_view_generic(byte *start, const frame_format &format, const shape_type &shape, const strides_type &strides)
Definition: ndarray_view_generic.h:41
const frame_format & format() const noexcept
Definition: ndarray_view_generic.h:47
typename base::strides_type strides_type
Definition: ndarray_view_generic.h:30
ndarray_view_generic(const base &vw, const frame_format &format)
Definition: ndarray_view_generic.h:38
void reset() noexcept
Definition: ndarray_view_generic.h:68
static constexpr std::size_t dimension
Definition: ndarray_view.h:81
const strides_type & strides() const noexcept
Definition: ndarray_view.h:201
pointer start() const noexcept
Definition: ndarray_view.h:199
void reset() noexcept
Definition: ndarray_view.h:127
ndarray_timed_view< Concrete_dim, Concrete_elem > from_generic(const ndarray_timed_view_generic< Generic_dim > &gen_vw, const ndsize< Concrete_dim-Generic_dim > &frame_shape)
Definition: ndarray_timed_view_generic.h:64
decltype(auto) slice(std::ptrdiff_t c, std::ptrdiff_t dimension) const
Definition: ndarray_view_generic.h:49