numpy 2.0.0
src/multiarray/iterators.h File Reference

Go to the source code of this file.

Functions

NPY_NO_EXPORT intp parse_subindex (PyObject *op, intp *step_size, intp *n_steps, intp max)
NPY_NO_EXPORT int parse_index (PyArrayObject *self, PyObject *op, intp *dimensions, intp *strides, intp *offset_ptr)
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, intp length, intp *start, intp *stop, intp *step, 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, PyArrayIterObject_tag::index, parse_subindex(), PseudoIndex, PyArray_DATA, PyArray_ITER_GOTO1D, PyArray_ITER_NEXT, PyArray_ITER_RESET, RubberIndex, SingleIndex, 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 becasue 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

NPY_NO_EXPORT int parse_index ( PyArrayObject self,
PyObject *  op,
intp dimensions,
intp strides,
intp offset_ptr 
)

this relies on the fact that n==1 for loop below

References parse_subindex(), PseudoIndex, RubberIndex, and SingleIndex.

NPY_NO_EXPORT intp parse_subindex ( PyObject *  op,
intp step_size,
intp n_steps,
intp  max 
)
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 parse_subindex().