numpy  2.0.0
src/private/ufunc_override.h File Reference
#include <npy_config.h>
#include "numpy/arrayobject.h"
#include "common.h"
#include <string.h>
#include "numpy/ufuncobject.h"

Go to the source code of this file.

Functions

static void normalize___call___args (PyUFuncObject *ufunc, PyObject *args, PyObject **normal_args, PyObject **normal_kwds, int nin)
static void normalize_reduce_args (PyUFuncObject *ufunc, PyObject *args, PyObject **normal_args, PyObject **normal_kwds)
static void normalize_accumulate_args (PyUFuncObject *ufunc, PyObject *args, PyObject **normal_args, PyObject **normal_kwds)
static void normalize_reduceat_args (PyUFuncObject *ufunc, PyObject *args, PyObject **normal_args, PyObject **normal_kwds)
static void normalize_outer_args (PyUFuncObject *ufunc, PyObject *args, PyObject **normal_args, PyObject **normal_kwds)
static void normalize_at_args (PyUFuncObject *ufunc, PyObject *args, PyObject **normal_args, PyObject **normal_kwds)
static int PyUFunc_CheckOverride (PyUFuncObject *ufunc, char *method, PyObject *args, PyObject *kwds, PyObject **result, int nin)

Function Documentation

static void normalize___call___args ( PyUFuncObject ufunc,
PyObject *  args,
PyObject **  normal_args,
PyObject **  normal_kwds,
int  nin 
) [static]
ufunc.__call__(*args, **kwds)

System Message: WARNING/2 (<string>, line 1); backlink Inline emphasis start-string without end-string.
System Message: WARNING/2 (<string>, line 1); backlink Inline strong start-string without end-string.
ufuncs accept 'sig' or 'signature' normalize to 'signature'
If we have more args than nin, they must be the output variables.
static void normalize_accumulate_args ( PyUFuncObject ufunc,
PyObject *  args,
PyObject **  normal_args,
PyObject **  normal_kwds 
) [static]
ufunc.accumulate(a[, axis, dtype, out])
axis
dtype
out
static void normalize_at_args ( PyUFuncObject ufunc,
PyObject *  args,
PyObject **  normal_args,
PyObject **  normal_kwds 
) [static]
ufunc.at(a, indices[, b])
static void normalize_outer_args ( PyUFuncObject ufunc,
PyObject *  args,
PyObject **  normal_args,
PyObject **  normal_kwds 
) [static]
ufunc.outer(A, B) This has no kwds so we don't need to do any kwd stuff.
static void normalize_reduce_args ( PyUFuncObject ufunc,
PyObject *  args,
PyObject **  normal_args,
PyObject **  normal_kwds 
) [static]
ufunc.reduce(a[, axis, dtype, out, keepdims])
axis
dtype
out
keepdims
static void normalize_reduceat_args ( PyUFuncObject ufunc,
PyObject *  args,
PyObject **  normal_args,
PyObject **  normal_kwds 
) [static]
ufunc.reduceat(a, indicies[, axis, dtype, out])
a and indicies
Handled above, when i == 0.
axis
dtype
out
static int PyUFunc_CheckOverride ( PyUFuncObject ufunc,
char *  method,
PyObject *  args,
PyObject *  kwds,
PyObject **  result,
int  nin 
) [static]
Check a set of args for the <cite>__numpy_ufunc__</cite> method. If more than one of the input arguments implements <cite>__numpy_ufunc__</cite>, they are tried in the order: subclasses before superclasses, otherwise left to right. The first routine returning something other than <cite>NotImplemented</cite> determines the result. If all of the <cite>__numpy_ufunc__</cite> operations returns <cite>NotImplemented</cite>, a <cite>TypeError</cite> is raised.
Returns 0 on success and 1 on exception. On success, *result contains the result of the operation, if any. If *result is NULL, there is no override.

System Message: WARNING/2 (<string>, line 8); backlink Inline emphasis start-string without end-string.
System Message: WARNING/2 (<string>, line 8); backlink Inline emphasis start-string without end-string.

<

Position of override in args.

<

Number of overriding args.

<

normal_* holds normalized arguments.
Pos of each override in args
2016-01-29: Disable for now in master -- can re-enable once details are sorted out. All commented bits are tagged NUMPY_UFUNC_DISABLED. -njs
Check inputs
be sure to include possible 'out' keyword argument.
TODO: could use PyArray_GetAttrString_SuppressException if it weren't private to multiarray.so
No overrides, bail out.
Normalize ufunc arguments.
Build new kwds
decide what to do based on the method.
ufunc.__call__
ufunc.reduce
ufunc.accumulate
ufunc.reduceat
ufunc.outer
ufunc.at
Call __numpy_ufunc__ functions in correct order
Choose an overriding argument
Get the first instance of an overriding arg.
Check for sub-types to the right of obj.
override_obj had no subtypes to the right.

<

We won't call this one again
Check if there is a method left to call
No acceptable override found.
Call the override
Exception occurred
Try the next one
Good result.
Override found, return it.

Referenced by ufunc_geterr().