|
numpy
2.0.0
|
#include <Python.h>#include "structmember.h"#include "numpy/arrayobject.h"#include "npy_config.h"#include "npy_pycompat.h"#include "npy_import.h"#include "common.h"#include "number.h"Defines | |
| #define | PY_SSIZE_T_CLEAN |
| #define | NPY_NO_DEPRECATED_API NPY_API_VERSION |
| #define | _MULTIARRAYMODULE |
| #define | SET(op) |
| #define | GET(op) |
| #define | SAME_SLOTS(m1, m2, slot_name) |
| #define | GIVE_UP_IF_HAS_RIGHT_BINOP(m1, m2, left_name, right_name, inplace, slot_name) |
Functions | |
| NPY_NO_EXPORT int | PyArray_SetNumericOps (PyObject *dict) |
| static int | has_ufunc_attr (PyObject *obj) |
| NPY_NO_EXPORT int | needs_right_binop_forward (PyObject *self, PyObject *other, const char *right_name, int inplace_op) |
| NPY_NO_EXPORT PyObject * | PyArray_GetNumericOps (void) |
| static PyObject * | _get_keywords (int rtype, PyArrayObject *out) |
| NPY_NO_EXPORT PyObject * | PyArray_GenericReduceFunction (PyArrayObject *m1, PyObject *op, int axis, int rtype, PyArrayObject *out) |
| NPY_NO_EXPORT PyObject * | PyArray_GenericAccumulateFunction (PyArrayObject *m1, PyObject *op, int axis, int rtype, PyArrayObject *out) |
| NPY_NO_EXPORT PyObject * | PyArray_GenericBinaryFunction (PyArrayObject *m1, PyObject *m2, PyObject *op) |
| NPY_NO_EXPORT PyObject * | PyArray_GenericUnaryFunction (PyArrayObject *m1, PyObject *op) |
| static PyObject * | PyArray_GenericInplaceBinaryFunction (PyArrayObject *m1, PyObject *m2, PyObject *op) |
| static PyObject * | PyArray_GenericInplaceUnaryFunction (PyArrayObject *m1, PyObject *op) |
| static PyObject * | array_add (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_subtract (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_multiply (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_divide (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_remainder (PyArrayObject *m1, PyObject *m2) |
| static NPY_SCALARKIND | is_scalar_with_conversion (PyObject *o2, double *out_exponent) |
| static PyObject * | fast_scalar_power (PyArrayObject *a1, PyObject *o2, int inplace) |
| static PyObject * | array_power (PyArrayObject *a1, PyObject *o2, PyObject *NPY_UNUSED(modulo)) |
| static PyObject * | array_negative (PyArrayObject *m1) |
| static PyObject * | array_absolute (PyArrayObject *m1) |
| static PyObject * | array_invert (PyArrayObject *m1) |
| static PyObject * | array_left_shift (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_right_shift (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_bitwise_and (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_bitwise_or (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_bitwise_xor (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_inplace_add (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_inplace_subtract (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_inplace_multiply (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_inplace_divide (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_inplace_remainder (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_inplace_power (PyArrayObject *a1, PyObject *o2, PyObject *NPY_UNUSED(modulo)) |
| static PyObject * | array_inplace_left_shift (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_inplace_right_shift (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_inplace_bitwise_and (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_inplace_bitwise_or (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_inplace_bitwise_xor (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_floor_divide (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_true_divide (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_inplace_floor_divide (PyArrayObject *m1, PyObject *m2) |
| static PyObject * | array_inplace_true_divide (PyArrayObject *m1, PyObject *m2) |
| static int | _array_nonzero (PyArrayObject *mp) |
| static PyObject * | array_divmod (PyArrayObject *op1, PyObject *op2) |
| NPY_NO_EXPORT PyObject * | array_int (PyArrayObject *v) |
| static PyObject * | array_float (PyArrayObject *v) |
| static PyObject * | array_long (PyArrayObject *v) |
| static PyObject * | array_oct (PyArrayObject *v) |
| static PyObject * | array_hex (PyArrayObject *v) |
| static PyObject * | _array_copy_nice (PyArrayObject *self) |
| static PyObject * | array_index (PyArrayObject *v) |
Variables | |
| NPY_NO_EXPORT NumericOps | n_ops |
| NPY_NO_EXPORT PyNumberMethods | array_as_number |
| #define _MULTIARRAYMODULE |
| #define GET | ( | op | ) |
| #define GIVE_UP_IF_HAS_RIGHT_BINOP | ( | m1, | |
| m2, | |||
| left_name, | |||
| right_name, | |||
| inplace, | |||
| slot_name | |||
| ) |
do { \ if (needs_right_binop_forward((PyObject *)m1, m2, right_name, inplace) && \ (inplace || !SAME_SLOTS(m1, m2, slot_name))) { \ Py_INCREF(Py_NotImplemented); \ return Py_NotImplemented; \ } \ } while (0)
Referenced by array_bitwise_and(), array_bitwise_or(), array_bitwise_xor(), array_inplace_add(), array_inplace_bitwise_and(), array_inplace_multiply(), array_inplace_subtract(), array_invert(), array_left_shift(), array_negative(), PyArray_GenericInplaceUnaryFunction(), and PyArray_GenericUnaryFunction().
| #define NPY_NO_DEPRECATED_API NPY_API_VERSION |
| #define PY_SSIZE_T_CLEAN |
| #define SAME_SLOTS | ( | m1, | |
| m2, | |||
| slot_name | |||
| ) |
(Py_TYPE(m1)->tp_as_number != NULL && Py_TYPE(m2)->tp_as_number != NULL && \
Py_TYPE(m1)->tp_as_number->slot_name == Py_TYPE(m2)->tp_as_number->slot_name)
| #define SET | ( | op | ) |
temp = PyDict_GetItemString(dict, #op); \
if (temp != NULL) { \
if (!(PyCallable_Check(temp))) { \
return -1; \
} \
Py_INCREF(temp); \
Py_XDECREF(n_ops.op); \
n_ops.op = temp; \
}
| static PyObject* _array_copy_nice | ( | PyArrayObject * | self | ) | [static] |
| static int _array_nonzero | ( | PyArrayObject * | mp | ) | [static] |
| static PyObject* _get_keywords | ( | int | rtype, |
| PyArrayObject * | out | ||
| ) | [static] |
| static PyObject* array_absolute | ( | PyArrayObject * | m1 | ) | [static] |
| static PyObject* array_add | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
References npy_cache_import().
| static PyObject* array_bitwise_and | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_bitwise_or | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_bitwise_xor | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_divide | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_divmod | ( | PyArrayObject * | op1, |
| PyObject * | op2 | ||
| ) | [static] |
| static PyObject* array_float | ( | PyArrayObject * | v | ) | [static] |
| static PyObject* array_floor_divide | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
Referenced by array_inplace_bitwise_and().
| static PyObject* array_hex | ( | PyArrayObject * | v | ) | [static] |
| static PyObject* array_index | ( | PyArrayObject * | v | ) | [static] |
| static PyObject* array_inplace_add | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_inplace_bitwise_and | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
References array_floor_divide(), and GIVE_UP_IF_HAS_RIGHT_BINOP.
| static PyObject* array_inplace_bitwise_or | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_inplace_bitwise_xor | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_inplace_divide | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_inplace_floor_divide | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_inplace_left_shift | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_inplace_multiply | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
References NumericOps::floor_divide, GIVE_UP_IF_HAS_RIGHT_BINOP, n_ops, and PyArray_GenericBinaryFunction().
| static PyObject* array_inplace_power | ( | PyArrayObject * | a1, |
| PyObject * | o2, | ||
| PyObject * | NPY_UNUSEDmodulo | ||
| ) | [static] |
| static PyObject* array_inplace_remainder | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_inplace_right_shift | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_inplace_subtract | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_inplace_true_divide | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| NPY_NO_EXPORT PyObject* array_int | ( | PyArrayObject * | v | ) |
| static PyObject* array_invert | ( | PyArrayObject * | m1 | ) | [static] |
| static PyObject* array_left_shift | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
References fast_scalar_power(), and GIVE_UP_IF_HAS_RIGHT_BINOP.
| static PyObject* array_long | ( | PyArrayObject * | v | ) | [static] |
| static PyObject* array_multiply | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_negative | ( | PyArrayObject * | m1 | ) | [static] |
References GIVE_UP_IF_HAS_RIGHT_BINOP.
| static PyObject* array_oct | ( | PyArrayObject * | v | ) | [static] |
| static PyObject* array_power | ( | PyArrayObject * | a1, |
| PyObject * | o2, | ||
| PyObject * | NPY_UNUSEDmodulo | ||
| ) | [static] |
| static PyObject* array_remainder | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
References NPY_FLOAT_SCALAR, NPY_INTPOS_SCALAR, NPY_NOSCALAR, PyArray_Check, PyArray_ISFLOAT, PyArray_ISINTEGER, PyArray_IsScalar, and PyArray_NDIM.
| static PyObject* array_right_shift | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_subtract | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
| static PyObject* array_true_divide | ( | PyArrayObject * | m1, |
| PyObject * | m2 | ||
| ) | [static] |
References PyArray_SIZE.
| static PyObject* fast_scalar_power | ( | PyArrayObject * | a1, |
| PyObject * | o2, | ||
| int | inplace | ||
| ) | [static] |
<
References NPY_DOUBLE, PyArray_CastToType(), PyArray_DescrFromType(), and PyArray_ISFORTRAN.
Referenced by array_left_shift().
| static int has_ufunc_attr | ( | PyObject * | obj | ) | [static] |
References PyArray_Check, PyArray_CheckAnyScalar, and PyArray_CheckExact.
| static NPY_SCALARKIND is_scalar_with_conversion | ( | PyObject * | o2, |
| double * | out_exponent | ||
| ) | [static] |
<
<
| NPY_NO_EXPORT int needs_right_binop_forward | ( | PyObject * | self, |
| PyObject * | other, | ||
| const char * | right_name, | ||
| int | inplace_op | ||
| ) |
other.__class__.__r*__ is not self.__class__.__r*__
This is needed, because CPython does not call __rmul__ if the tp_number slots of the two objects are the same.
| NPY_NO_EXPORT PyObject* PyArray_GenericAccumulateFunction | ( | PyArrayObject * | m1, |
| PyObject * | op, | ||
| int | axis, | ||
| int | rtype, | ||
| PyArrayObject * | out | ||
| ) |
Referenced by PyArray_Prod(), and PyArray_Sum().
| NPY_NO_EXPORT PyObject* PyArray_GenericBinaryFunction | ( | PyArrayObject * | m1, |
| PyObject * | m2, | ||
| PyObject * | op | ||
| ) |
Referenced by array_inplace_multiply(), PyArray_GenericInplaceUnaryFunction(), and PyArray_GenericUnaryFunction().
| static PyObject* PyArray_GenericInplaceBinaryFunction | ( | PyArrayObject * | m1, |
| PyObject * | m2, | ||
| PyObject * | op | ||
| ) | [static] |
Referenced by array_bitwise_and(), array_bitwise_or(), array_bitwise_xor(), array_inplace_add(), array_inplace_subtract(), and array_invert().
| static PyObject* PyArray_GenericInplaceUnaryFunction | ( | PyArrayObject * | m1, |
| PyObject * | op | ||
| ) | [static] |
References GIVE_UP_IF_HAS_RIGHT_BINOP, n_ops, PyArray_GenericBinaryFunction(), and NumericOps::remainder.
| NPY_NO_EXPORT PyObject* PyArray_GenericReduceFunction | ( | PyArrayObject * | m1, |
| PyObject * | op, | ||
| int | axis, | ||
| int | rtype, | ||
| PyArrayObject * | out | ||
| ) |
Referenced by _strings_richcompare(), PyArray_Max(), and PyArray_Mean().
| NPY_NO_EXPORT PyObject* PyArray_GenericUnaryFunction | ( | PyArrayObject * | m1, |
| PyObject * | op | ||
| ) |
References GIVE_UP_IF_HAS_RIGHT_BINOP, n_ops, PyArray_GenericBinaryFunction(), and NumericOps::subtract.
| NPY_NO_EXPORT PyObject* PyArray_GetNumericOps | ( | void | ) |
| NPY_NO_EXPORT int PyArray_SetNumericOps | ( | PyObject * | dict | ) |
| NPY_NO_EXPORT PyNumberMethods array_as_number |
Referenced by array_bitwise_and(), array_bitwise_or(), array_bitwise_xor(), array_inplace_add(), array_inplace_multiply(), array_inplace_subtract(), array_invert(), PyArray_GenericInplaceUnaryFunction(), PyArray_GenericUnaryFunction(), PyArray_Max(), PyArray_Mean(), PyArray_Prod(), PyArray_Ptp(), and PyArray_Sum().