numpy 2.0.0
|
#include <Python.h>
#include "structmember.h"
#include "numpy/arrayobject.h"
#include "numpy/arrayscalars.h"
#include "npy_config.h"
#include "numpy/npy_3kcompat.h"
#include "arrayobject.h"
#include "iterators.h"
#include "ctors.h"
#include "common.h"
Defines | |
#define | PY_SSIZE_T_CLEAN |
#define | _MULTIARRAYMODULE |
#define | NPY_NO_PREFIX |
#define | PseudoIndex -1 |
#define | RubberIndex -2 |
#define | SingleIndex -3 |
#define | _INF_SET_PTR(c) |
#define | _NPY_IS_EVEN(x) ((x) % 2 == 0) |
#define | _INF_SET_PTR_MIRROR(c) |
#define | _INF_SET_PTR_CIRCULAR(c) |
Functions | |
NPY_NO_EXPORT npy_intp | parse_subindex (PyObject *op, npy_intp *step_size, npy_intp *n_steps, npy_intp max) |
NPY_NO_EXPORT int | parse_index (PyArrayObject *self, PyObject *op, npy_intp *dimensions, npy_intp *strides, npy_intp *offset_ptr) |
static int | slice_coerce_index (PyObject *o, npy_intp *v) |
NPY_NO_EXPORT int | slice_GetIndices (PySliceObject *r, npy_intp length, npy_intp *start, npy_intp *stop, npy_intp *step, npy_intp *slicelength) |
static char * | get_ptr_simple (PyArrayIterObject *iter, npy_intp *coordinates) |
static PyObject * | array_iter_base_init (PyArrayIterObject *it, PyArrayObject *ao) |
static void | array_iter_base_dealloc (PyArrayIterObject *it) |
NPY_NO_EXPORT PyObject * | PyArray_IterNew (PyObject *obj) |
NPY_NO_EXPORT PyObject * | PyArray_BroadcastToShape (PyObject *obj, npy_intp *dims, int nd) |
NPY_NO_EXPORT PyObject * | PyArray_IterAllButAxis (PyObject *obj, int *inaxis) |
NPY_NO_EXPORT int | PyArray_RemoveSmallest (PyArrayMultiIterObject *multi) |
static PyObject * | arrayiter_next (PyArrayIterObject *it) |
static void | arrayiter_dealloc (PyArrayIterObject *it) |
static Py_ssize_t | iter_length (PyArrayIterObject *self) |
static PyObject * | iter_subscript_Bool (PyArrayIterObject *self, PyArrayObject *ind) |
static PyObject * | iter_subscript_int (PyArrayIterObject *self, PyArrayObject *ind) |
NPY_NO_EXPORT PyObject * | iter_subscript (PyArrayIterObject *self, PyObject *ind) |
static int | iter_ass_sub_Bool (PyArrayIterObject *self, PyArrayObject *ind, PyArrayIterObject *val, int swap) |
static int | iter_ass_sub_int (PyArrayIterObject *self, PyArrayObject *ind, PyArrayIterObject *val, int swap) |
NPY_NO_EXPORT int | iter_ass_subscript (PyArrayIterObject *self, PyObject *ind, PyObject *val) |
static PyObject * | iter_array (PyArrayIterObject *it, PyObject *NPY_UNUSED(op)) |
static PyObject * | iter_copy (PyArrayIterObject *it, PyObject *args) |
static PyObject * | iter_richcompare (PyArrayIterObject *self, PyObject *other, int cmp_op) |
static PyObject * | iter_coords_get (PyArrayIterObject *self) |
NPY_NO_EXPORT int | PyArray_Broadcast (PyArrayMultiIterObject *mit) |
NPY_NO_EXPORT PyObject * | PyArray_MultiIterFromObjects (PyObject **mps, int n, int nadd,...) |
NPY_NO_EXPORT PyObject * | PyArray_MultiIterNew (int n,...) |
static PyObject * | arraymultiter_new (PyTypeObject *NPY_UNUSED(subtype), PyObject *args, PyObject *kwds) |
static PyObject * | arraymultiter_next (PyArrayMultiIterObject *multi) |
static void | arraymultiter_dealloc (PyArrayMultiIterObject *multi) |
static PyObject * | arraymultiter_size_get (PyArrayMultiIterObject *self) |
static PyObject * | arraymultiter_index_get (PyArrayMultiIterObject *self) |
static PyObject * | arraymultiter_shape_get (PyArrayMultiIterObject *self) |
static PyObject * | arraymultiter_iters_get (PyArrayMultiIterObject *self) |
static PyObject * | arraymultiter_reset (PyArrayMultiIterObject *self, PyObject *args) |
static void | neighiter_dealloc (PyArrayNeighborhoodIterObject *iter) |
static char * | _set_constant (PyArrayNeighborhoodIterObject *iter, PyArrayObject *fill) |
static char * | get_ptr_constant (PyArrayIterObject *_iter, npy_intp *coordinates) |
static NPY_INLINE npy_intp | __npy_pos_remainder (npy_intp i, npy_intp n) |
static char * | get_ptr_mirror (PyArrayIterObject *_iter, npy_intp *coordinates) |
static NPY_INLINE npy_intp | __npy_euclidean_division (npy_intp i, npy_intp n) |
static char * | get_ptr_circular (PyArrayIterObject *_iter, npy_intp *coordinates) |
NPY_NO_EXPORT PyObject * | PyArray_NeighborhoodIterNew (PyArrayIterObject *x, npy_intp *bounds, int mode, PyArrayObject *fill) |
Variables | |
static PyMappingMethods | iter_as_mapping |
static PyMethodDef | iter_methods [] |
static PyMemberDef | iter_members [] |
static PyGetSetDef | iter_getsets [] |
NPY_NO_EXPORT PyTypeObject | PyArrayIter_Type |
static PyGetSetDef | arraymultiter_getsetlist [] |
static PyMemberDef | arraymultiter_members [] |
static PyMethodDef | arraymultiter_methods [] |
NPY_NO_EXPORT PyTypeObject | PyArrayMultiIter_Type |
NPY_NO_EXPORT PyTypeObject | PyArrayNeighborhoodIter_Type |
#define _INF_SET_PTR | ( | c | ) |
#define _INF_SET_PTR_CIRCULAR | ( | c | ) |
lb = p->limits[c][0]; \ bd = coordinates[c] + p->coordinates[c] - lb; \ _coordinates[c] = lb + __npy_euclidean_division(bd, p->limits_sizes[c]);
Referenced by arraymultiter_size_get().
#define _INF_SET_PTR_MIRROR | ( | c | ) |
lb = p->limits[c][0]; \ bd = coordinates[c] + p->coordinates[c] - lb; \ _coordinates[c] = lb + __npy_pos_remainder(bd, p->limits_sizes[c]);
Referenced by arraymultiter_next().
#define _MULTIARRAYMODULE |
#define _NPY_IS_EVEN | ( | x | ) | ((x) % 2 == 0) |
#define NPY_NO_PREFIX |
#define PseudoIndex -1 |
Referenced by iter_ass_subscript(), parse_index(), and parse_subindex().
#define PY_SSIZE_T_CLEAN |
#define RubberIndex -2 |
Referenced by iter_ass_subscript(), parse_index(), and parse_subindex().
#define SingleIndex -3 |
Referenced by iter_ass_subscript(), parse_index(), and parse_subindex().
static char* _set_constant | ( | PyArrayNeighborhoodIterObject * | iter, |
PyArrayObject * | fill | ||
) | [static] |
static void array_iter_base_dealloc | ( | PyArrayIterObject * | it | ) | [static] |
static PyObject* array_iter_base_init | ( | PyArrayIterObject * | it, |
PyArrayObject * | ao | ||
) | [static] |
Referenced by arraymultiter_index_get().
static void arrayiter_dealloc | ( | PyArrayIterObject * | it | ) | [static] |
static PyObject* arrayiter_next | ( | PyArrayIterObject * | it | ) | [static] |
static void arraymultiter_dealloc | ( | PyArrayMultiIterObject * | multi | ) | [static] |
References NPY_MAXDIMS.
static PyObject* arraymultiter_index_get | ( | PyArrayMultiIterObject * | self | ) | [static] |
References _pya_malloc, PyArrayIterObject_tag::ao, array_iter_base_init(), and PyArrayNeighborhoodIter_Type.
static PyObject* arraymultiter_iters_get | ( | PyArrayMultiIterObject * | self | ) | [static] |
static PyObject* arraymultiter_new | ( | PyTypeObject * | NPY_UNUSEDsubtype, |
PyObject * | args, | ||
PyObject * | kwds | ||
) | [static] |
static PyObject* arraymultiter_next | ( | PyArrayMultiIterObject * | multi | ) | [static] |
References _INF_SET_PTR_MIRROR.
static PyObject* arraymultiter_reset | ( | PyArrayMultiIterObject * | self, |
PyObject * | args | ||
) | [static] |
static PyObject* arraymultiter_shape_get | ( | PyArrayMultiIterObject * | self | ) | [static] |
static PyObject* arraymultiter_size_get | ( | PyArrayMultiIterObject * | self | ) | [static] |
References _INF_SET_PTR_CIRCULAR.
static char* get_ptr_circular | ( | PyArrayIterObject * | _iter, |
npy_intp * | coordinates | ||
) | [static] |
static char* get_ptr_constant | ( | PyArrayIterObject * | _iter, |
npy_intp * | coordinates | ||
) | [static] |
static char* get_ptr_mirror | ( | PyArrayIterObject * | _iter, |
npy_intp * | coordinates | ||
) | [static] |
static char* get_ptr_simple | ( | PyArrayIterObject * | iter, |
npy_intp * | coordinates | ||
) | [static] |
References PyArrayIterObject_tag::contiguous.
static PyObject* iter_array | ( | PyArrayIterObject * | it, |
PyObject * | NPY_UNUSEDop | ||
) | [static] |
static int iter_ass_sub_Bool | ( | PyArrayIterObject * | self, |
PyArrayObject * | ind, | ||
PyArrayIterObject * | val, | ||
int | swap | ||
) | [static] |
static int iter_ass_sub_int | ( | PyArrayIterObject * | self, |
PyArrayObject * | ind, | ||
PyArrayIterObject * | val, | ||
int | swap | ||
) | [static] |
References _PyArray_Descr::f, and PyArray_ArrFuncs::setitem.
NPY_NO_EXPORT int iter_ass_subscript | ( | PyArrayIterObject * | self, |
PyObject * | ind, | ||
PyObject * | val | ||
) |
References PyArrayIterObject_tag::dataptr, PyArrayIterObject_tag::index, parse_subindex(), PseudoIndex, PyArray_DATA, PyArray_ITER_GOTO1D, PyArray_ITER_NEXT, PyArray_ITER_RESET, RubberIndex, SingleIndex, and PyArrayIterObject_tag::size.
static PyObject* iter_coords_get | ( | PyArrayIterObject * | self | ) | [static] |
static PyObject* iter_copy | ( | PyArrayIterObject * | it, |
PyObject * | args | ||
) | [static] |
static Py_ssize_t iter_length | ( | PyArrayIterObject * | self | ) | [static] |
References Bool.
static PyObject* iter_richcompare | ( | PyArrayIterObject * | self, |
PyObject * | other, | ||
int | cmp_op | ||
) | [static] |
NPY_NO_EXPORT PyObject* iter_subscript | ( | PyArrayIterObject * | self, |
PyObject * | ind | ||
) |
<
<
static PyObject* iter_subscript_Bool | ( | PyArrayIterObject * | self, |
PyArrayObject * | ind | ||
) | [static] |
static PyObject* iter_subscript_int | ( | PyArrayIterObject * | self, |
PyArrayObject * | ind | ||
) | [static] |
static void neighiter_dealloc | ( | PyArrayNeighborhoodIterObject * | iter | ) | [static] |
NPY_NO_EXPORT int parse_index | ( | PyArrayObject * | self, |
PyObject * | op, | ||
npy_intp * | dimensions, | ||
npy_intp * | strides, | ||
npy_intp * | offset_ptr | ||
) |
References parse_subindex(), PseudoIndex, RubberIndex, and SingleIndex.
NPY_NO_EXPORT npy_intp parse_subindex | ( | PyObject * | op, |
npy_intp * | step_size, | ||
npy_intp * | n_steps, | ||
npy_intp | max | ||
) |
References error_converting, PseudoIndex, PyArray_PyIntAsIntp(), RubberIndex, SingleIndex, and slice_GetIndices().
Referenced by iter_ass_subscript(), and parse_index().
NPY_NO_EXPORT int PyArray_Broadcast | ( | PyArrayMultiIterObject * | mit | ) |
NPY_NO_EXPORT PyObject* PyArray_BroadcastToShape | ( | PyObject * | obj, |
npy_intp * | dims, | ||
int | nd | ||
) |
NPY_NO_EXPORT PyObject* PyArray_IterAllButAxis | ( | PyObject * | obj, |
int * | inaxis | ||
) |
NPY_NO_EXPORT PyObject* PyArray_IterNew | ( | PyObject * | obj | ) |
Referenced by array_subscript_nice(), PyArray_SearchSorted(), and PyArray_ToFile().
NPY_NO_EXPORT PyObject* PyArray_MultiIterFromObjects | ( | PyObject ** | mps, |
int | n, | ||
int | nadd, | ||
... | |||
) |
NPY_NO_EXPORT PyObject* PyArray_MultiIterNew | ( | int | n, |
... | |||
) |
NPY_NO_EXPORT PyObject* PyArray_NeighborhoodIterNew | ( | PyArrayIterObject * | x, |
npy_intp * | bounds, | ||
int | mode, | ||
PyArrayObject * | fill | ||
) |
NPY_NO_EXPORT int PyArray_RemoveSmallest | ( | PyArrayMultiIterObject * | multi | ) |
the smallest sum of iterator strides is not iterated over. Returns dimension which is smallest in the range [0,multi->nd). A -1 is returned if multi->nd == 0.
don't use with PyArray_ITER_GOTO1D because factors are not adjusted
References PyArrayIterObject_tag::ao, PyArrayIterObject_tag::dataptr, PyArray_ITER_NEXT, and PyArray_ToScalar.
static int slice_coerce_index | ( | PyObject * | o, |
npy_intp * | v | ||
) | [static] |
NPY_NO_EXPORT int slice_GetIndices | ( | PySliceObject * | r, |
npy_intp | length, | ||
npy_intp * | start, | ||
npy_intp * | stop, | ||
npy_intp * | step, | ||
npy_intp * | slicelength | ||
) |
Referenced by parse_subindex().
PyGetSetDef arraymultiter_getsetlist[] [static] |
{ {"size", (getter)arraymultiter_size_get, NULL, NULL, NULL}, {"index", (getter)arraymultiter_index_get, NULL, NULL, NULL}, {"shape", (getter)arraymultiter_shape_get, NULL, NULL, NULL}, {"iters", (getter)arraymultiter_iters_get, NULL, NULL, NULL}, {NULL, NULL, NULL, NULL, NULL}, }
PyMemberDef arraymultiter_members[] [static] |
{ {"numiter", T_INT, offsetof(PyArrayMultiIterObject, numiter), READONLY, NULL}, {"nd", T_INT, offsetof(PyArrayMultiIterObject, nd), READONLY, NULL}, {NULL, 0, 0, 0, NULL}, }
PyMethodDef arraymultiter_methods[] [static] |
{ {"reset", (PyCFunction) arraymultiter_reset, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL}, }
PyMappingMethods iter_as_mapping [static] |
{ (inquiry)iter_length, (binaryfunc)iter_subscript, (objobjargproc)iter_ass_subscript, }
PyGetSetDef iter_getsets[] [static] |
{ {"coords", (getter)iter_coords_get, NULL, NULL, NULL}, {NULL, NULL, NULL, NULL, NULL}, }
PyMemberDef iter_members[] [static] |
{ {"base", T_OBJECT, offsetof(PyArrayIterObject, ao), READONLY, NULL}, {"index", T_INT, offsetof(PyArrayIterObject, index), READONLY, NULL}, {NULL, 0, 0, 0, NULL}, }
PyMethodDef iter_methods[] [static] |
{ {"__array__", (PyCFunction)iter_array, METH_VARARGS, NULL}, {"copy", (PyCFunction)iter_copy, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }
NPY_NO_EXPORT PyTypeObject PyArrayIter_Type |
NPY_NO_EXPORT PyTypeObject PyArrayMultiIter_Type |
NPY_NO_EXPORT PyTypeObject PyArrayNeighborhoodIter_Type |
Referenced by arraymultiter_index_get().