#ifndef PYTHONIC_NUMPY_BROADCAST_TO_HPP #define PYTHONIC_NUMPY_BROADCAST_TO_HPP #include "pythonic/include/numpy/broadcast_to.hpp" #include "pythonic/utils/functor.hpp" #include "pythonic/types/ndarray.hpp" #include "pythonic/numpy/empty.hpp" PYTHONIC_NS_BEGIN namespace numpy { template auto broadcast_to(E const &expr, pS shape) -> decltype(numpy::functor::empty{}( shape, typename types::dtype_t::type>{})) { using dtype = typename types::dtype_of::type; using BExpr = typename std::conditional::value, types::broadcast, E const &>::type; auto out = numpy::functor::empty{}(shape, typename types::dtype_t{}); using array_type = decltype(out); BExpr bexpr = expr; utils::broadcast_copy::value, std::remove_reference::type::is_vectorizable>( out, bexpr); return out; } } PYTHONIC_NS_END #endif