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, npy_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, npy_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

Referenced by array_contains().


Function Documentation

NPY_NO_EXPORT PyObject* add_new_axes_0d ( PyArrayObject ,
int   
)
NPY_NO_EXPORT int array_ass_big_item ( PyArrayObject self,
npy_intp  i,
PyObject *  v 
)
For multi-dimensional arrays, use CopyObject
Bounds check and get the data pointer
NPY_NO_EXPORT PyObject* array_big_item ( PyArrayObject self,
npy_intp  i 
)
Bounds check and get the data pointer
Create the view array
Set the base object

Referenced by array_item_nice(), and fancy_indexing_check().

NPY_NO_EXPORT PyObject* array_item_nice ( PyArrayObject self,
Py_ssize_t  _i 
)
contains optimization for 1-d arrays
Workaround Python 2.4: Py_ssize_t not the same as npyint_p
Bounds check and get the data pointer

References array_big_item(), PyArray_FailUnlessWriteable(), and PyArray_NDIM.

Referenced by array_contains().

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 PyArray_NDIM.

Referenced by array_contains().

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
Boolean indexing special case
The SIZE check might be overly cautious
wrap arguments into a mapiter object
NPY_NO_EXPORT int count_new_axes_0d ( PyObject *  tuple)
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: PyArray_NDIM(arr) > 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
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

Referenced by test_pydatamem_seteventhook_start().

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