summaryrefslogtreecommitdiffstats
path: root/contrib/python/pythran/pythran/pythonic/numpy/ndarray/flatten.hpp
blob: 6e0afe6fb3f666d7a17b718d91ea50fc60233433 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef PYTHONIC_NUMPY_NDARRAY_FLATTEN_HPP
#define PYTHONIC_NUMPY_NDARRAY_FLATTEN_HPP

#include "pythonic/include/numpy/ndarray/flatten.hpp"

#include "pythonic/utils/functor.hpp"
#include "pythonic/types/ndarray.hpp"

PYTHONIC_NS_BEGIN

namespace numpy
{

  namespace ndarray
  {
    template <class T, class pS>
    types::ndarray<T, types::pshape<long>>
    flatten(types::ndarray<T, pS> const &a)
    {
      return {a.mem, types::pshape<long>{a.flat_size()}};
    }

    NUMPY_EXPR_TO_NDARRAY0_IMPL(flatten);
  }
}
PYTHONIC_NS_END

#endif