Helps wrap a C++ functor taking a single scalar argument as a broadcasting ufunc-like Python object. More...
#include <ufunc.hpp>
Static Public Member Functions | |
static python::object | call (TUnaryFunctor &self, python::object const &input, python::object const &output) |
A C++ function with object arguments that broadcasts its arguments before passing them to the underlying C++ functor. | |
static python::object | make () |
Construct a boost.python function object from call() with reasonable keyword names. |
Helps wrap a C++ functor taking a single scalar argument as a broadcasting ufunc-like Python object.
Typical usage looks like this:
struct TimesPI { typedef double argument_type; typedef double result_type; double operator()(double input) const { return input * M_PI; } }; BOOST_PYTHON_MODULE(example) { class_< TimesPI >("TimesPI") .def("__call__", unary_ufunc<TimesPI>::make()); }
static python::object boost::numpy::unary_ufunc< TUnaryFunctor, TArgument, TResult >::call | ( | TUnaryFunctor & | self, |
python::object const & | input, | ||
python::object const & | output | ||
) | [inline, static] |
static python::object boost::numpy::unary_ufunc< TUnaryFunctor, TArgument, TResult >::make | ( | ) | [inline, static] |
Construct a boost.python function object from call() with reasonable keyword names.
Users will often want to specify their own keyword names with the same signature, but this is a convenient shortcut.