Alexandria
2.18
Please provide a description of the project.
|
Go to the documentation of this file.
25 #ifndef ALEXANDRIA_NDARRAY_H
26 #define ALEXANDRIA_NDARRAY_H
50 template <
template <
class...>
class Container =
std::vector>
62 class Iterator :
public std::iterator<std::random_access_iterator_tag, typename std::conditional<Const, const T, T>::type> {
199 template <
template <
class...>
class Container =
std::vector>
216 template <
template <
class...>
class Container =
std::vector>
231 template <
typename Iterator>
244 template <
typename... Args>
314 template <
typename... D>
367 template <
typename... D>
368 T&
at(
size_t i, D... rest);
380 template <
typename... D>
381 const T&
at(
size_t i, D... rest)
const;
447 T
at(
size_t offset)
const {
452 T&
at(
size_t offset) {
457 virtual size_t size()
const = 0;
466 template <
template <
class...>
class Container>
477 template <
typename... Args>
486 template <
typename T2>
492 template <
typename T2>
506 resizeImpl<T>(
shape);
511 return Euclid::make_unique<ContainerWrapper>(
m_container);
544 template <
typename... D>
560 template <
typename... D>
568 template <
typename... D>
577 template <
typename T>
587 #endif // ALEXANDRIA_NDARRAY_H
self_type & reshape(const std::vector< size_t > new_shape)
bool operator!=(const Iterator &other) const
virtual std::unique_ptr< ContainerInterface > copy() const =0
Expected to generate a deep copy of the underlying data.
virtual void resize(const std::vector< size_t > &shape)=0
Resize container.
std::unique_ptr< ContainerInterface > copy() const final
size_t get_offset(const std::vector< size_t > &coords) const
std::vector< size_t > m_shape
Iterator operator+(size_t n)
T & at(size_t i, D... rest)
Iterator & operator-=(size_t n)
const T & at_helper(std::vector< size_t > &acc) const
ContainerInterface * m_container_ptr
NdArray(const std::vector< size_t > &shape_)
ContainerWrapper(ContainerWrapper &&)=default
Iterator & operator+=(size_t n)
NdArray(const self_type &)=default
virtual size_t size() const =0
Iterator< false > iterator
const_iterator begin() const
value_t & operator[](size_t i)
NdArray(const std::vector< size_t > &shape_, const Container< T > &data)
const T & at_helper(std::vector< size_t > &acc, size_t i, D... rest) const
std::vector< size_t > m_stride_size
NdArray(const std::initializer_list< size_t > &shape_)
bool operator>(const Iterator &other)
bool operator==(const self_type &b) const
size_t get_offset(std::vector< size_t > coords, const std::string &attr) const
T & at_helper(std::vector< size_t > &acc, const std::string &attr)
NdArray(const self_type *other)
Iterator(const Iterator< false > &other)
self_type & concatenate(const self_type &other)
self_type & reshape(size_t i, D... rest)
NdArray(const std::vector< size_t > &shape_, const std::vector< std::string > &attr_names, Args &&... args)
self_type & reshape_helper(std::vector< size_t > &acc)
std::shared_ptr< ContainerInterface > m_container
void resize(const std::vector< size_t > &shape) final
const_iterator end() const
Iterator< true > const_iterator
virtual ~NdArray()=default
Iterator operator-(size_t n)
bool operator!=(const self_type &b) const
std::ostream & operator<<(std::ostream &out, const NdArray< T > &ndarray)
NdArray(self_type &&)=default
size_t size() const final
const T & at(const std::vector< size_t > &coords) const
T & at(const std::vector< size_t > &coords, const std::string &attr)
NdArray(const std::vector< size_t > &shape_, Iterator begin, Iterator end)
T at(size_t offset) const
std::vector< std::string > m_attr_names
NdArray(const std::vector< size_t > &shape_, Container< T > &&data)
bool operator<(const Iterator &other)
auto resizeImpl(const std::vector< size_t > &shape) -> decltype((void) std::declval< Container< T2 >>().resize(std::vector< size_t >
ContainerWrapper(Args &&... args)
NdArray & operator=(const NdArray &)=default
const std::vector< size_t > shape() const
const T & at(const std::vector< size_t > &coords, const std::string &attr) const
T & at_helper(std::vector< size_t > &acc, size_t i, D... rest)
T & at(const std::vector< size_t > &coords)
typename std::conditional< Const, const T, T >::type value_t
self_type & reshape_helper(std::vector< size_t > &acc, size_t i, D... rest)
bool operator==(const Iterator &other) const
ContainerWrapper(const ContainerWrapper &)=delete
difference_type operator-(const Iterator &other)
const std::vector< std::string > & attributes() const
virtual ~ContainerInterface()=default
Iterator(ContainerInterface *container_ptr, size_t offset)
T & at_helper(std::vector< size_t > &acc)
const T & at(size_t i, D... rest) const
~ContainerWrapper()=default
Container< T > m_container
value_t operator*() const