numpy 2.0.0
src/multiarray/mapping.h File Reference

Go to the source code of this file.

Defines

#define array_ass_item   array_ass_big_item

Functions

NPY_NO_EXPORT PyObject * array_big_item (PyArrayObject *self, intp i)
NPY_NO_EXPORT Py_ssize_t array_length (PyArrayObject *self)
NPY_NO_EXPORT PyObject * array_item_nice (PyArrayObject *self, Py_ssize_t i)
NPY_NO_EXPORT PyObject * array_subscript (PyArrayObject *self, PyObject *op)
NPY_NO_EXPORT int array_ass_big_item (PyArrayObject *self, intp i, PyObject *v)
NPY_NO_EXPORT PyObject * add_new_axes_0d (PyArrayObject *, int)
NPY_NO_EXPORT int count_new_axes_0d (PyObject *tuple)
NPY_NO_EXPORT void PyArray_MapIterReset (PyArrayMapIterObject *mit)
NPY_NO_EXPORT void PyArray_MapIterNext (PyArrayMapIterObject *mit)
NPY_NO_EXPORT void PyArray_MapIterBind (PyArrayMapIterObject *, PyArrayObject *)
NPY_NO_EXPORT PyObject * PyArray_MapIterNew (PyObject *, int, int)

Variables

NPY_NO_EXPORT PyMappingMethods array_as_mapping

Define Documentation

#define array_ass_item   array_ass_big_item

Function Documentation

NPY_NO_EXPORT PyObject* add_new_axes_0d ( PyArrayObject ,
int   
)

Referenced by array_subscript().

NPY_NO_EXPORT int array_ass_big_item ( PyArrayObject self,
intp  i,
PyObject *  v 
)
NPY_NO_EXPORT PyObject* array_big_item ( PyArrayObject self,
intp  i 
)
NPY_NO_EXPORT PyObject* array_item_nice ( PyArrayObject self,
Py_ssize_t  i 
)
contains optimization for 1-d arrays

References PyArray_ISWRITEABLE.

NPY_NO_EXPORT Py_ssize_t array_length ( PyArrayObject self)
System Message: SEVERE/4 (<string>, line 1)
Title overline & underline mismatch.

                    IMPLEMENT MAPPING PROTOCOL                          ***
 

References index2ptr().

NPY_NO_EXPORT PyObject* array_subscript ( PyArrayObject self,
PyObject *  op 
)

Check for multiple field access
extract multiple fields if all elements in sequence are either string or unicode (i.e. no break occurred).
Allow Boolean mask selection also
wrap arguments into a mapiter object

References add_new_axes_0d(), count_new_axes_0d(), NPY_DEFAULT, Py_TYPE, PyArray_Check, PyArray_DIMS, PyArray_ISBOOL, and PyArray_NewFromDescr().

Referenced by _strings_richcompare().

NPY_NO_EXPORT int count_new_axes_0d ( PyObject *  tuple)
NPY_NO_EXPORT void PyArray_MapIterBind ( PyArrayMapIterObject mit,
PyArrayObject arr 
)
Bind a mapiteration to a particular array <blockquote>
Determine if subspace iteration is necessary. If so, 1) Fill in mit->iteraxes 2) Create subspace iterator 3) Update nd, dimensions, and size.
Subspace iteration is necessary if: arr->nd > mit->numiter </blockquote>
Need to check for index-errors somewhere.
Let's do it at bind time and also convert all <0 values to >0 here as well.

no subspace iteration needed. Finish up and Return
all indexing arrays have been converted to 0 therefore we can extract the subspace with a simple getitem call which will use view semantics
But, be sure to do it with a true array.
Expand dimensions of result
Now, we still need to interpret the ellipsis and slice objects to determine which axes the indexing arrays are referring to
The number of dimensions an ellipsis takes up
Now fill in iteraxes -- remember indexing arrays have been converted to 0's in mit->indexobj
Only expand the first ellipsis
We need to fill in the starting coordinates for the subspace
Should be slice object or another Ellipsis
Here check the indexes (now that we have iteraxes)

NPY_NO_EXPORT PyObject* PyArray_MapIterNew ( PyObject *  ,
int  ,
int   
)

Must have some kind of fancy indexing if we are here indexobj is either a list, an arrayobject, or a tuple (with at least 1 list or arrayobject or Bool object)
convert all inputs to iterators
must be a tuple
Make a copy of the tuple -- we will be replacing index objects with 0's
we need to grow the new indexing object and fill it with 0s for each of the iterators produced
Store the number of iterators actually converted These will be mapped to actual axes at bind time

References arraymapiter_dealloc().

NPY_NO_EXPORT void PyArray_MapIterNext ( PyArrayMapIterObject mit)
This function needs to update the state of the map iterator and point mit->dataptr to the memory-location of the next object

Sub-space iteration
reset coord to coordinates of beginning of the subspace

References Py_TYPE.

NPY_NO_EXPORT void PyArray_MapIterReset ( PyArrayMapIterObject mit)
Prototypes for Mapping calls --- not part of the C-API because only useful as part of a getitem call.
Reset the map iterator to the beginning

Variable Documentation

NPY_NO_EXPORT PyMappingMethods array_as_mapping