Alexandria
2.14.1
Please provide a description of the project.
|
Go to the documentation of this file.
25 #ifndef ALEXANDRIA_MATRIX_H
26 #define ALEXANDRIA_MATRIX_H
44 template<
typename T,
template<
class...>
class Container =
std::vector>
47 typedef typename Container<T>::iterator
iterator;
191 template <
typename ...D>
192 T &
at(
size_t i, D... rest) {
207 template <
typename ...D>
208 const T &
at(
size_t i, D... rest)
const {
248 const Container<T>&
data()
const {
290 for (
size_t i = 0; i < coords.
size(); ++i) {
306 template <
typename ...D>
322 template <
typename ...D>
339 template<
typename T,
template<
class...>
class Container>
342 auto shape = ndarray.shape();
344 if (ndarray.size()) {
346 for (i = 0; i < shape.size() - 1; ++i) {
347 out << shape[i] <<
",";
349 out << shape[i] <<
">";
350 for (i = 0; i < ndarray.size() - 1; ++i) {
351 out << ndarray.data()[i] <<
",";
353 out << ndarray.data()[i];
361 #endif // ALEXANDRIA_MATRIX_H
Container< T >::const_iterator const_iterator
const T & at(size_t i, D... rest) const
Container< T > m_container
T & at(const std::vector< size_t > &coords)
bool operator!=(const self_type &b) const
T & at_helper(std::vector< size_t > &acc)
NdArray & operator=(const NdArray &)=default
T & at(size_t i, D... rest)
T & at_helper(std::vector< size_t > &acc, size_t i, D... rest)
size_t getOffset(const std::vector< size_t > &coords) const
const T & at_helper(std::vector< size_t > &acc) const
NdArray(const std::vector< size_t > &shape)
std::vector< size_t > m_shape
const Container< T > & data() const
std::vector< size_t > m_stride_size
const std::vector< size_t > shape() const
const T & at(const std::vector< size_t > &coords) const
NdArray(const std::vector< size_t > &shape, Container< T > &&data)
const_iterator end() const
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
NdArray(const std::initializer_list< size_t > &shape)
std::ostream & operator<<(std::ostream &out, const NdArray< T, Container > &ndarray)
const_iterator begin() const
NdArray< T, Container > self_type
virtual ~NdArray()=default
Container< T >::iterator iterator
bool operator==(const self_type &b) const