#ifndef PYTHONIC_NUMPY_RANDOM_GAMMA_HPP #define PYTHONIC_NUMPY_RANDOM_GAMMA_HPP #include "pythonic/include/numpy/random/gamma.hpp" #include "pythonic/include/numpy/random/generator.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/types/NoneType.hpp" #include "pythonic/types/tuple.hpp" #include "pythonic/utils/functor.hpp" #include #include PYTHONIC_NS_BEGIN namespace numpy { namespace random { template types::ndarray gamma(double shape, double scale, pS const &array_shape) { types::ndarray result{array_shape, types::none_type()}; std::gamma_distribution distribution{shape, scale}; std::generate(result.fbegin(), result.fend(), [&]() { return distribution(details::generator); }); return result; } auto gamma(double shape, double scale, long size) -> decltype(gamma(shape, scale, types::array{{size}})) { return gamma(shape, scale, types::array{{size}}); } double gamma(double shape, double scale, types::none_type d) { return std::gamma_distribution{shape, scale}(details::generator); } } } PYTHONIC_NS_END #endif