#ifndef PYTHONIC_INCLUDE_NUMPY_FROMFUNCTION_HPP #define PYTHONIC_INCLUDE_NUMPY_FROMFUNCTION_HPP #include "pythonic/include/utils/functor.hpp" #include "pythonic/include/types/ndarray.hpp" #include "pythonic/include/builtins/None.hpp" #include "pythonic/include/utils/tags.hpp" PYTHONIC_NS_BEGIN namespace numpy { template struct fromfunction_helper; template struct fromfunction_helper { template types::ndarray::type>::type>::type, pS> operator()(F &&f, pS const &shape, dtype d = dtype()); }; template struct fromfunction_helper { template types::ndarray< typename std::remove_cv::type>::type>::type, pS> operator()(F &&f, pS const &shape, dtype d = dtype()); }; template auto fromfunction(F &&f, pS const &shape, dtype d = dtype()) -> decltype(fromfunction_helper::value, dtype, typename pythonic::purity_of::type>()( std::forward(f), shape)); /* TODO: must specialize for higher order */ DEFINE_FUNCTOR(pythonic::numpy, fromfunction); } PYTHONIC_NS_END #endif