@@ -584,25 +584,26 @@ From other objects
584584 did not have the _ARRAY_ macro namespace in them. That form
585585 of the constant names is deprecated in 1.7.
586586
587- .. c:macro:: NPY_ARRAY_NOTSWAPPED
587+ .. c:macro:: NPY_ARRAY_NOTSWAPPED
588588
589- Make sure the returned array has a data-type descriptor that is in
590- machine byte-order, over-riding any specification in the *dtype*
591- argument. Normally, the byte-order requirement is determined by
592- the *dtype* argument. If this flag is set and the dtype argument
593- does not indicate a machine byte-order descriptor (or is NULL and
594- the object is already an array with a data-type descriptor that is
595- not in machine byte- order), then a new data-type descriptor is
596- created and used with its byte-order field set to native.
589+ Make sure the returned array has a data-type descriptor that is in
590+ machine byte-order, over-riding any specification in the *dtype*
591+ argument. Normally, the byte-order requirement is determined by
592+ the *dtype* argument. If this flag is set and the dtype argument
593+ does not indicate a machine byte-order descriptor (or is NULL and
594+ the object is already an array with a data-type descriptor that is
595+ not in machine byte- order), then a new data-type descriptor is
596+ created and used with its byte-order field set to native.
597597
598- .. c:macro:: NPY_ARRAY_BEHAVED_NS
598+ .. c:macro:: NPY_ARRAY_BEHAVED_NS
599599
600- :c:data:`NPY_ARRAY_ALIGNED` \| :c:data:`NPY_ARRAY_WRITEABLE` \| :c:data:`NPY_ARRAY_NOTSWAPPED`
600+ :c:data:`NPY_ARRAY_ALIGNED` \| :c:data:`NPY_ARRAY_WRITEABLE` \|
601+ :c:data:`NPY_ARRAY_NOTSWAPPED`
601602
602- .. c:macro:: NPY_ARRAY_ELEMENTSTRIDES
603+ .. c:macro:: NPY_ARRAY_ELEMENTSTRIDES
603604
604- Make sure the returned array has strides that are multiples of the
605- element size.
605+ Make sure the returned array has strides that are multiples of the
606+ element size.
606607
607608.. c:function:: PyObject* PyArray_FromArray( \
608609 PyArrayObject* op, PyArray_Descr* newtype, int requirements)
@@ -723,6 +724,13 @@ From other objects
723724 broadcastable to the shape of ``dest``. The data areas of dest
724725 and src must not overlap.
725726
727+ .. c:function:: int PyArray_CopyObject(PyArrayObject* dest, PyObject* src)
728+
729+ Assign an object ``src`` to a NumPy array ``dest`` according to
730+ array-coercion rules. This is basically identical to
731+ :c:func:`PyArray_FromAny`, but assigns directly to the output array.
732+ Returns 0 on success and -1 on failures.
733+
726734.. c:function:: int PyArray_MoveInto(PyArrayObject* dest, PyArrayObject* src)
727735
728736 Move data from the source array, ``src``, into the destination
@@ -2707,6 +2715,45 @@ cost of a slight overhead.
27072715 neighborhood. Calling this function after every point of the
27082716 neighborhood has been visited is undefined.
27092717
2718+ Array mapping
2719+ -------------
2720+
2721+ Array mapping is the machinery behind advanced indexing.
2722+
2723+ .. c:function:: PyObject* PyArray_MapIterArray(PyArrayObject *a, \
2724+ PyObject *index)
2725+
2726+ Use advanced indexing to iterate an array.
2727+
2728+ .. c :function :: void PyArray_MapIterSwapAxes (PyArrayMapIterObject *mit, \
2729+ PyArrayObject **ret, int getmap)
2730+
2731+ Swap the axes to or from their inserted form. ``MapIter `` always puts the
2732+ advanced (array) indices first in the iteration. But if they are
2733+ consecutive, it will insert/transpose them back before returning.
2734+ This is stored as ``mit->consec != 0`` (the place where they are inserted).
2735+ For assignments, the opposite happens: the values to be assigned are
2736+ transposed (``getmap=1 `` instead of ``getmap=0 ``). ``getmap=0`` and
2737+ ``getmap=1`` undo the other operation.
2738+
2739+ .. c:function:: void PyArray_MapIterNext(PyArrayMapIterObject *mit)
2740+
2741+ This function needs to update the state of the map iterator
2742+ and point ``mit->dataptr `` to the memory-location of the next object.
2743+
2744+ Note that this function never handles an extra operand but provides
2745+ compatibility for an old (exposed) API.
2746+
2747+ .. c:function:: PyObject* PyArray_MapIterArrayCopyIfOverlap(PyArrayObject *a, \
2748+ PyObject *index, int copy_if_overlap, PyArrayObject *extra_op)
2749+
2750+ Similar to :c:func: `PyArray_MapIterArray ` but with an additional
2751+ ``copy_if_overlap `` argument. If ``copy_if_overlap != 0 ``, checks if ``a ``
2752+ has memory overlap with any of the arrays in ``index `` and with
2753+ ``extra_op ``, and make copies as appropriate to avoid problems if the
2754+ input is modified during the iteration. ``iter->array `` may contain a
2755+ copied array (UPDATEIFCOPY/WRITEBACKIFCOPY set).
2756+
27102757Array Scalars
27112758-------------
27122759
0 commit comments