1 #ifndef PYTHONIC_NUMPY_FULL_HPP
2 #define PYTHONIC_NUMPY_FULL_HPP
3 
4 #include "pythonic/include/numpy/full.hpp"
5 
6 #include "pythonic/utils/functor.hpp"
7 #include "pythonic/types/ndarray.hpp"
8 
9 PYTHONIC_NS_BEGIN
10 
11 namespace numpy
12 {
13 
14   template <class pS, class F, class dtype>
15   types::ndarray<typename dtype::type, sutils::shape_t<pS>>
full(pS const & shape,F fill_value,dtype d)16   full(pS const &shape, F fill_value, dtype d)
17   {
18     return {(sutils::shape_t<pS>)shape, typename dtype::type(fill_value)};
19   }
20 
21   template <class F, class dtype>
22   types::ndarray<typename dtype::type, types::pshape<long>>
full(long size,F fill_value,dtype d)23   full(long size, F fill_value, dtype d)
24   {
25     return full(types::pshape<long>(size), fill_value, d);
26   }
27 
28   template <long N, class F, class dtype>
29   types::ndarray<typename dtype::type,
30                  types::pshape<std::integral_constant<long, N>>>
full(std::integral_constant<long,N>,F fill_value,dtype d)31   full(std::integral_constant<long, N>, F fill_value, dtype d)
32   {
33     return full(types::pshape<std::integral_constant<long, N>>({}), fill_value,
34                 d);
35   }
36 
37   template <class pS, class F>
full(pS const & shape,F fill_value,types::none_type)38   types::ndarray<F, sutils::shape_t<pS>> full(pS const &shape, F fill_value,
39                                               types::none_type)
40   {
41     return {(sutils::shape_t<pS>)shape, fill_value};
42   }
43 
44   template <class F>
full(long size,F fill_value,types::none_type nt)45   types::ndarray<F, types::pshape<long>> full(long size, F fill_value,
46                                               types::none_type nt)
47   {
48     return full(types::pshape<long>(size), fill_value, nt);
49   }
50 
51   template <long N, class F>
52   types::ndarray<F, types::pshape<std::integral_constant<long, N>>>
full(std::integral_constant<long,N>,F fill_value,types::none_type nt)53   full(std::integral_constant<long, N>, F fill_value, types::none_type nt)
54   {
55     return full(types::pshape<std::integral_constant<long, N>>({}), fill_value,
56                 nt);
57   }
58 }
59 PYTHONIC_NS_END
60 
61 #endif
62