10#ifndef XTENSOR_VECTORIZE_HPP 
   11#define XTENSOR_VECTORIZE_HPP 
   16#include "../core/xfunction.hpp" 
   17#include "../utils/xutils.hpp" 
   26    template <
class F, 
class R>
 
   34        template <
class Func, 
class = std::enable_if_t<!std::is_same<std::decay_t<Func>, xvectorizer>::value>>
 
   35        xvectorizer(Func&& f);
 
   38        xfunction_type<E...> operator()(E&&... e) 
const;
 
   42        typename std::remove_reference<F>::type m_f;
 
 
   48        using get_function_type = remove_class_t<
decltype(&std::remove_reference_t<F>::operator())>;
 
   51    template <
class R, 
class... Args>
 
   52    xvectorizer<R (*)(Args...), R> vectorize(R (*f)(Args...));
 
   54    template <
class F, 
class R, 
class... Args>
 
   55    xvectorizer<F, R> vectorize(F&& f, R (*)(Args...));
 
   63        -> 
decltype(vectorize(std::forward<F>(f), std::declval<detail::get_function_type<F>*>()));
 
   70    template <
class F, 
class R>
 
   71    template <
class Func, 
class>
 
   72    inline xvectorizer<F, R>::xvectorizer(Func&& f)
 
   73        : m_f(std::forward<Func>(f))
 
   77    template <
class F, 
class R>
 
   79    inline auto xvectorizer<F, R>::operator()(E&&... e) 
const -> xfunction_type<E...>
 
   81        return xfunction_type<E...>(m_f, std::forward<E>(e)...);
 
   84    template <
class R, 
class... Args>
 
   85    inline xvectorizer<R (*)(Args...), R> vectorize(R (*f)(Args...))
 
   90    template <
class F, 
class R, 
class... Args>
 
   97    inline auto vectorize(F&& f)
 
   98        -> 
decltype(vectorize(std::forward<F>(f), std::declval<detail::get_function_type<F>*>()))
 
  100        return vectorize(std::forward<F>(f), 
static_cast<detail::get_function_type<F>*
>(
nullptr));
 
Multidimensional function operating on xtensor expressions.
standard mathematical functions for xexpressions