Static Public Member Functions
boost::numpy::unary_ufunc< TUnaryFunctor, TArgument, TResult > Struct Template Reference

Helps wrap a C++ functor taking a single scalar argument as a broadcasting ufunc-like Python object. More...

#include <ufunc.hpp>

List of all members.

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.

Detailed Description

template<typename TUnaryFunctor, typename TArgument = typename TUnaryFunctor::argument_type, typename TResult = typename TUnaryFunctor::result_type>
struct boost::numpy::unary_ufunc< TUnaryFunctor, TArgument, TResult >

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());
  }

Definition at line 98 of file ufunc.hpp.


Member Function Documentation

template<typename TUnaryFunctor , typename TArgument = typename TUnaryFunctor::argument_type, typename TResult = typename TUnaryFunctor::result_type>
static python::object boost::numpy::unary_ufunc< TUnaryFunctor, TArgument, TResult >::call ( TUnaryFunctor &  self,
python::object const &  input,
python::object const &  output 
) [inline, static]

A C++ function with object arguments that broadcasts its arguments before passing them to the underlying C++ functor.

Definition at line 105 of file ufunc.hpp.

template<typename TUnaryFunctor , typename TArgument = typename TUnaryFunctor::argument_type, typename TResult = typename TUnaryFunctor::result_type>
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.

Definition at line 130 of file ufunc.hpp.


The documentation for this struct was generated from the following file:


boost_numpy
Author(s): Jim Bosch, Ankit Daftery
autogenerated on Fri Aug 28 2015 10:10:40