mf
Media Framework
|
Multidimensional array container. More...
#include <ndarray.h>
Public Types | |
using | view_type = ndarray_view< Dim, T > |
using | const_view_type = ndarray_view< Dim, const T > |
using | index_type = typename view_type::index_type |
using | coordinates_type = typename view_type::coordinates_type |
using | shape_type = typename view_type::shape_type |
using | strides_type = typename view_type::strides_type |
using | span_type = typename view_type::span_type |
using | value_type = T |
using | pointer = T * |
using | const_pointer = const T * |
using | reference = T & |
using | const_reference = const T & |
using | iterator = typename view_type::iterator |
using | const_iterator = typename const_view_type::iterator |
Public Member Functions | |
ndarray (const shape_type &shp, const Allocator &allocator=Allocator()) | |
ndarray (const const_view_type &) | |
ndarray (const ndarray &arr) | |
~ndarray () | |
ndarray & | operator= (const const_view_type &arr) |
ndarray & | operator= (const ndarray &arr) |
view_type | view () |
const_view_type | view () const |
const_view_type | cview () const |
operator view_type () noexcept | |
operator const_view_type () const noexcept | |
coordinates_type | index_to_coordinates (const index_type &index) const |
index_type | coordinates_to_index (const coordinates_type &coord) const |
pointer | coordinates_to_pointer (const coordinates_type &coord) |
const_pointer | coordinates_to_pointer (const coordinates_type &coord) const |
std::size_t | size () const noexcept |
pointer | start () noexcept |
const_pointer | start () const noexcept |
const shape_type & | shape () const noexcept |
const strides_type & | strides () const noexcept |
std::size_t | contiguous_length () const noexcept |
std::size_t | padding () const noexcept |
template<typename... Args> | |
decltype(auto) | section (Args &&...args) |
template<typename... Args> | |
decltype(auto) | section (Args &&...args) const |
template<typename... Args> | |
decltype(auto) | slice (Args &&...args) |
template<typename... Args> | |
decltype(auto) | slice (Args &&...args) const |
template<typename... Args> | |
decltype(auto) | operator() (Args &&...args) |
template<typename... Args> | |
decltype(auto) | operator() (Args &&...args) const |
template<typename... Args> | |
decltype(auto) | operator[] (Args &&...args) |
template<typename... Args> | |
decltype(auto) | operator[] (Args &&...args) const |
template<typename... Args> | |
decltype(auto) | at (Args &&...args) |
template<typename... Args> | |
decltype(auto) | at (Args &&...args) const |
iterator | begin () |
const_iterator | begin () const |
const_iterator | cbegin () const |
iterator | end () |
const_iterator | end () const |
const_iterator | cend () const |
Static Public Attributes | |
static constexpr std::size_t | dimension = Dim |
Protected Member Functions | |
void | allocate_ () |
void | deallocate_ () |
ndarray (const shape_type &shape, std::size_t padding, std::size_t stride, const Allocator &allocator) | |
Constructor for use by derived classes. More... | |
strides_type | strides_with_padding_ (const shape_type &shape, std::size_t padding) |
Protected Attributes | |
Allocator | allocator_ |
Raw allocator used to allocate memory, in bytes. More... | |
std::size_t | stride_ |
Stride of elements, in bytes. More... | |
std::size_t | padding_ |
Padding between frames, in bytes. More... | |
std::size_t | allocated_size_ = 0 |
Allocated memory size, in bytes. More... | |
view_type | view_ |
View used to access items. More... | |
Multidimensional array container.
Based on ndarray_view
, but also owns items. Allocates and deallocates memory. Const-correct interface. Uses default strides when created from public constructor. Derived classes (i.e. ring) can create ndarray with padding between elements (last dimension), and padding between frames (first dimension).
using mf::ndarray< Dim, T, Allocator >::const_iterator = typename const_view_type::iterator |
using mf::ndarray< Dim, T, Allocator >::const_pointer = const T* |
using mf::ndarray< Dim, T, Allocator >::const_reference = const T& |
using mf::ndarray< Dim, T, Allocator >::const_view_type = ndarray_view<Dim, const T> |
using mf::ndarray< Dim, T, Allocator >::coordinates_type = typename view_type::coordinates_type |
using mf::ndarray< Dim, T, Allocator >::index_type = typename view_type::index_type |
using mf::ndarray< Dim, T, Allocator >::iterator = typename view_type::iterator |
using mf::ndarray< Dim, T, Allocator >::pointer = T* |
using mf::ndarray< Dim, T, Allocator >::reference = T& |
using mf::ndarray< Dim, T, Allocator >::shape_type = typename view_type::shape_type |
using mf::ndarray< Dim, T, Allocator >::span_type = typename view_type::span_type |
using mf::ndarray< Dim, T, Allocator >::strides_type = typename view_type::strides_type |
using mf::ndarray< Dim, T, Allocator >::value_type = T |
using mf::ndarray< Dim, T, Allocator >::view_type = ndarray_view<Dim, T> |
|
protected |
Constructor for use by derived classes.
Size of allocated memory segment is shape.front() * (padding + shape.tail().product()*stride)
. Caller must ensure this satisfies requirements of allocator.
shape | Shape of entire array. First component is length of array, remaining components is frame shape. |
padding | Padding between frames, in bytes. |
stride | Stride of elements, in bytes. Must be multiple of alignof(T) and leq to sizeof(T). |
allocator | Allocator instance. |
|
inlineexplicit |
|
explicit |
|
inline |
mf::ndarray< Dim, T, Allocator >::~ndarray | ( | ) |
|
protected |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
auto mf::ndarray< Dim, T, Allocator >::operator= | ( | const const_view_type & | arr | ) |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
protected |
|
inline |
|
inline |
|
protected |
Allocated memory size, in bytes.
|
protected |
Raw allocator used to allocate memory, in bytes.
|
static |
|
protected |
Padding between frames, in bytes.
|
protected |
Stride of elements, in bytes.
|
protected |
View used to access items.