numpy  2.0.0
src/multiarray/iterators.h File Reference

Go to the source code of this file.

Functions

NPY_NO_EXPORT int parse_index (PyArrayObject *self, PyObject *op, npy_intp *out_dimensions, npy_intp *out_strides, npy_intp *out_offset)
NPY_NO_EXPORT PyObject * iter_subscript (PyArrayIterObject *, PyObject *)
NPY_NO_EXPORT int iter_ass_subscript (PyArrayIterObject *, PyObject *, PyObject *)
NPY_NO_EXPORT int slice_GetIndices (PySliceObject *r, npy_intp length, npy_intp *start, npy_intp *stop, npy_intp *step, npy_intp *slicelength)

Function Documentation

NPY_NO_EXPORT int iter_ass_subscript ( PyArrayIterObject ,
PyObject *  ,
PyObject *   
)
Check for Boolean -- this is first becasue Bool is a subclass of Int
Check Slice
Integer
convert to INTP array if Integer array scalar or List
Check for Boolean object
Check for integer array

References PyArrayIterObject_tag::dataptr, ELLIPSIS_INDEX, PyArrayIterObject_tag::index, NEWAXIS_INDEX, parse_index_entry(), PyArray_DATA, PyArray_ITER_GOTO1D, PyArray_ITER_NEXT, PyArray_ITER_RESET, SINGLE_INDEX, and PyArrayIterObject_tag::size.

NPY_NO_EXPORT PyObject* iter_subscript ( PyArrayIterObject self,
PyObject *  ind 
)
Always returns arrays
Tuples >1d not accepted --- i.e. no newaxis Could implement this with adjusted strides and dimensions in iterator Check for Boolean -- this is first because Bool is a subclass of Int

<

empty array
Check for Integer or Slice

<

Integer
convert to INTP array if Integer array scalar or List
Check for Boolean object
Check for integer array

Referenced by iter_subscript_int().

NPY_NO_EXPORT int parse_index ( PyArrayObject self,
PyObject *  op,
npy_intp out_dimensions,
npy_intp out_strides,
npy_intp out_offset 
)
Parses an index that has no fancy indexing. Populates out_dimensions, out_strides, and out_offset.
this relies on the fact that n==1 for loop below

References ELLIPSIS_INDEX, NEWAXIS_INDEX, parse_index_entry(), PyArray_DIMS, PyArray_NDIM, PyArray_STRIDES, and SINGLE_INDEX.

Referenced by fancy_indexing_check().

NPY_NO_EXPORT int slice_GetIndices ( PySliceObject *  r,
npy_intp  length,
npy_intp start,
npy_intp stop,
npy_intp step,
npy_intp slicelength 
)
This is basically PySlice_GetIndicesEx, but with our coercion of indices to integers (plus, that function is new in Python 2.3)
defstart = *step < 0 ? length - 1 : 0;

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

Referenced by _nonzero_indices(), and parse_index_entry().