Open
Description
We have the (working) rvectorize, but afaik there is no way to expose just a function pointer with RCpp
(without the decorations).
Maybe @eddelbuettel has a hint?
I.e. this is corresponding code for xtensor-python, where the result of xt::pyvectorize
get's bound to a function name in python.
#include "pybind11/pybind11.h"
#include "xtensor-python/pyvectorize.hpp"
#include <numeric>
#include <cmath>
namespace py = pybind11;
double scalar_func(double i, double j)
{
return std::sin(i) - std::cos(j);
}
PYBIND11_PLUGIN(xtensor_python_test)
{
py::module m("xtensor_python_test", "Test module for xtensor python bindings");
m.def("vectorized_func", xt::pyvectorize(scalar_func), "");
return m.ptr();
}