#include <ufunctors.h>
|
static PyObject * | _call_ (TUnaryFunctor const &self, PyObject *input, PyObject *output) |
|
template<typename TUnaryFunctor, typename TArgument = typename TUnaryFunctor::argument_type, typename TResult = typename TUnaryFunctor::result_type>
struct ndarray::PyUnaryUFunctor< TUnaryFunctor, TArgument, TResult >
Definition at line 39 of file ufunctors.h.
template<typename TUnaryFunctor , typename TArgument = typename TUnaryFunctor::argument_type, typename TResult = typename TUnaryFunctor::result_type>
static PyObject* ndarray::PyUnaryUFunctor< TUnaryFunctor, TArgument, TResult >::_call_ |
( |
TUnaryFunctor const & |
self, |
|
|
PyObject * |
input, |
|
|
PyObject * |
output |
|
) |
| |
|
inlinestatic |
Definition at line 41 of file ufunctors.h.
42 PyObject* input_array = PyArray_FROM_OTF(input,detail::NumpyTraits<TArgument>::getCode(),
44 if (input_array == NULL)
return NULL;
45 PyObject* output_array;
46 if (output == NULL || output == Py_None) {
47 output_array = PyArray_SimpleNew(PyArray_NDIM(input_array),
48 PyArray_DIMS(input_array),
49 detail::NumpyTraits<TResult>::getCode());
51 output_array = PyArray_FROM_OTF(output,detail::NumpyTraits<TResult>::getCode(),
52 NPY_ALIGNED | NPY_WRITEABLE | NPY_UPDATEIFCOPY);
54 if (output_array == NULL) {
55 Py_DECREF(input_array);
58 PyObject*
iter = PyArray_MultiIterNew(2,input_array,output_array);
60 Py_DECREF(input_array);
61 Py_DECREF(output_array);
64 int size = ((PyArrayMultiIterObject*)(iter))->size;
66 TArgument* arg = (TArgument*)PyArray_MultiIter_DATA(iter,0);
67 TResult* res = (TResult*)PyArray_MultiIter_DATA(iter,1);
69 PyArray_MultiIter_NEXT(iter);
71 Py_DECREF(input_array);
73 return PyArray_Return(reinterpret_cast<PyArrayObject*>(output_array));
The documentation for this struct was generated from the following file:
- /home/lsstsw/stack/Linux64/ndarray/11.0.rc2+1/include/ndarray/swig/ufunctors.h