NGen
Loading...
Searching...
No Matches
ngen::mdarray< T > Class Template Reference

#include <mdarray.hpp>

+ Collaboration diagram for ngen::mdarray< T >:

Classes

struct  iterator
 

Public Types

using value_type = T
 
using container_type = std::vector<value_type>
 
using size_type = typename container_type::size_type
 
using difference_type = typename container_type::difference_type
 
using reference = typename container_type::reference
 
using const_reference = typename container_type::const_reference
 
using pointer = typename container_type::pointer
 
using const_pointer = typename container_type::const_pointer
 

Public Member Functions

 mdarray ()=default
 
 mdarray (const boost::span< const size_type > dsizes)
 
constexpr mdarray (std::initializer_list< size_type > dsizes)
 
reference at (const boost::span< const size_type > n)
 
reference operator[] (const boost::span< const size_type > n) noexcept
 
const_reference at (const boost::span< const size_type > n) const
 
const_reference operator[] (const boost::span< const size_type > n) const noexcept
 
void insert (const boost::span< const size_type > n, value_type value)
 Insert a multi-dimensonal value at the given index.
 
void insert (std::initializer_list< std::pair< const boost::span< const size_type >, value_type > > args)
 
size_type size () const noexcept
 Get the size of allocated values in this mdarray (aka the allocated elements in the backing vector)
 
iterator begin () const noexcept
 
iterator end () const noexcept
 
size_type rank () const noexcept
 Get the rank of this mdarray.
 
boost::span< const size_t > shape () const noexcept
 Get the shape of this mdarray.
 
size_type index (const boost::span< const size_type > n) const
 Index a multi-dimensional set of indices to a single address index.
 
void deindex (size_type idx, boost::span< size_type > n) const
 Retrieve the multi-dimensional index from a given address index.
 

Public Attributes

friend iterator
 

Private Member Functions

template<typename Tp >
size_type max_size (Tp shape)
 
void bounds_check (const boost::span< const size_type > n) const
 

Private Attributes

std::vector< size_typem_shape
 
container_type m_data
 

Member Typedef Documentation

◆ const_pointer

template<typename T >
using ngen::mdarray< T >::const_pointer = typename container_type::const_pointer

◆ const_reference

template<typename T >
using ngen::mdarray< T >::const_reference = typename container_type::const_reference

◆ container_type

template<typename T >
using ngen::mdarray< T >::container_type = std::vector<value_type>

◆ difference_type

template<typename T >
using ngen::mdarray< T >::difference_type = typename container_type::difference_type

◆ pointer

template<typename T >
using ngen::mdarray< T >::pointer = typename container_type::pointer

◆ reference

template<typename T >
using ngen::mdarray< T >::reference = typename container_type::reference

◆ size_type

template<typename T >
using ngen::mdarray< T >::size_type = typename container_type::size_type

◆ value_type

template<typename T >
using ngen::mdarray< T >::value_type = T

Constructor & Destructor Documentation

◆ mdarray() [1/3]

template<typename T >
ngen::mdarray< T >::mdarray ( )
default

◆ mdarray() [2/3]

template<typename T >
ngen::mdarray< T >::mdarray ( const boost::span< const size_type > dsizes)
inline

◆ mdarray() [3/3]

template<typename T >
ngen::mdarray< T >::mdarray ( std::initializer_list< size_type > dsizes)
inlineconstexpr

Member Function Documentation

◆ at() [1/2]

template<typename T >
reference ngen::mdarray< T >::at ( const boost::span< const size_type > n)
inline

◆ at() [2/2]

template<typename T >
const_reference ngen::mdarray< T >::at ( const boost::span< const size_type > n) const
inline

◆ begin()

template<typename T >
iterator ngen::mdarray< T >::begin ( ) const
inlinenoexcept

◆ bounds_check()

template<typename T >
void ngen::mdarray< T >::bounds_check ( const boost::span< const size_type > n) const
inlineprivate

◆ deindex()

template<typename T >
void ngen::mdarray< T >::deindex ( size_type idx,
boost::span< size_type > n ) const
inline

Retrieve the multi-dimensional index from a given address index.

Parameters
[in]idxAddress index (aka flat index)
[out]noutputted index
Examples
/github/workspace/include/utilities/mdarray/mdarray.hpp.

References ngen::mdarray< T >::m_shape, ngen::mdarray< T >::rank(), and ngen::mdarray< T >::size().

◆ end()

template<typename T >
iterator ngen::mdarray< T >::end ( ) const
inlinenoexcept

◆ index()

template<typename T >
size_type ngen::mdarray< T >::index ( const boost::span< const size_type > n) const
inline

◆ insert() [1/2]

template<typename T >
void ngen::mdarray< T >::insert ( const boost::span< const size_type > n,
value_type value )
inline

Insert a multi-dimensonal value at the given index.

Parameters
nA multi-dimensional index with the same size as m_shape.
valueThe value to set at the given index.
Examples
/github/workspace/include/utilities/mdarray/mdarray.hpp.

References ngen::mdarray< T >::bounds_check(), ngen::mdarray< T >::index(), and ngen::mdarray< T >::m_data.

Referenced by ngen::mdarray< T >::insert().

◆ insert() [2/2]

template<typename T >
void ngen::mdarray< T >::insert ( std::initializer_list< std::pair< const boost::span< const size_type >, value_type > > args)
inline

◆ max_size()

template<typename T >
template<typename Tp >
size_type ngen::mdarray< T >::max_size ( Tp shape)
inlineprivate

◆ operator[]() [1/2]

template<typename T >
const_reference ngen::mdarray< T >::operator[] ( const boost::span< const size_type > n) const
inlinenoexcept

◆ operator[]() [2/2]

template<typename T >
reference ngen::mdarray< T >::operator[] ( const boost::span< const size_type > n)
inlinenoexcept

◆ rank()

template<typename T >
size_type ngen::mdarray< T >::rank ( ) const
inlinenoexcept

Get the rank of this mdarray.

Returns
size_type
Examples
/github/workspace/include/utilities/mdarray/mdarray.hpp.

References ngen::mdarray< T >::m_shape.

Referenced by ngen::mdarray< T >::deindex(), and ngen::mdarray< T >::index().

◆ shape()

template<typename T >
boost::span< const size_t > ngen::mdarray< T >::shape ( ) const
inlinenoexcept

Get the shape of this mdarray.

Returns
span of the extents per dimension
Examples
/github/workspace/include/utilities/mdarray/mdarray.hpp.

References ngen::mdarray< T >::m_shape.

Referenced by ngen::mdarray< T >::max_size().

◆ size()

template<typename T >
size_type ngen::mdarray< T >::size ( ) const
inlinenoexcept

Get the size of allocated values in this mdarray (aka the allocated elements in the backing vector)

Returns
size_type
Examples
/github/workspace/include/utilities/mdarray/mdarray.hpp.

References ngen::mdarray< T >::m_data.

Referenced by ngen::mdarray< T >::deindex(), and ngen::mdarray< T >::index().

Member Data Documentation

◆ iterator

◆ m_data

◆ m_shape


The documentation for this class was generated from the following file: