summaryrefslogtreecommitdiff
path: root/doc/source/reference/c-api.iterator.rst
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2015-07-01 11:44:49 -0600
committerCharles Harris <charlesr.harris@gmail.com>2015-07-01 23:40:55 -0600
commit6646bdfeac189c50b19b032ea8b6795ea7fd2074 (patch)
tree5ae42a27c3852f62c561e5c2ccb02e40349faedb /doc/source/reference/c-api.iterator.rst
parent61d2a445881f80b52bc9facdbd4f58f6e74c637b (diff)
downloadnumpy-6646bdfeac189c50b19b032ea8b6795ea7fd2074.tar.gz
DOC: Fix outdated sphinx directives.
Examples :cdata: -> :c:data: .. cfunction:: -> .. c:function::
Diffstat (limited to 'doc/source/reference/c-api.iterator.rst')
-rw-r--r--doc/source/reference/c-api.iterator.rst400
1 files changed, 200 insertions, 200 deletions
diff --git a/doc/source/reference/c-api.iterator.rst b/doc/source/reference/c-api.iterator.rst
index 1d90ce302..ce1210737 100644
--- a/doc/source/reference/c-api.iterator.rst
+++ b/doc/source/reference/c-api.iterator.rst
@@ -31,7 +31,7 @@ Simple Iteration Example
The best way to become familiar with the iterator is to look at its
usage within the NumPy codebase itself. For example, here is a slightly
-tweaked version of the code for :cfunc:`PyArray_CountNonzero`, which counts the
+tweaked version of the code for :c:func:`PyArray_CountNonzero`, which counts the
number of non-zero elements in an array.
.. code-block:: c
@@ -120,7 +120,7 @@ Simple Multi-Iteration Example
Here is a simple copy function using the iterator. The ``order`` parameter
is used to control the memory layout of the allocated result, typically
-:cdata:`NPY_KEEPORDER` is desired.
+:c:data:`NPY_KEEPORDER` is desired.
.. code-block:: c
@@ -209,52 +209,52 @@ Iterator Data Types
The iterator layout is an internal detail, and user code only sees
an incomplete struct.
-.. ctype:: NpyIter
+.. c:type:: NpyIter
This is an opaque pointer type for the iterator. Access to its contents
can only be done through the iterator API.
-.. ctype:: NpyIter_Type
+.. c:type:: NpyIter_Type
This is the type which exposes the iterator to Python. Currently, no
API is exposed which provides access to the values of a Python-created
iterator. If an iterator is created in Python, it must be used in Python
and vice versa. Such an API will likely be created in a future version.
-.. ctype:: NpyIter_IterNextFunc
+.. c:type:: NpyIter_IterNextFunc
This is a function pointer for the iteration loop, returned by
- :cfunc:`NpyIter_GetIterNext`.
+ :c:func:`NpyIter_GetIterNext`.
-.. ctype:: NpyIter_GetMultiIndexFunc
+.. c:type:: NpyIter_GetMultiIndexFunc
This is a function pointer for getting the current iterator multi-index,
- returned by :cfunc:`NpyIter_GetGetMultiIndex`.
+ returned by :c:func:`NpyIter_GetGetMultiIndex`.
Construction and Destruction
----------------------------
-.. cfunction:: NpyIter* NpyIter_New(PyArrayObject* op, npy_uint32 flags, NPY_ORDER order, NPY_CASTING casting, PyArray_Descr* dtype)
+.. c:function:: NpyIter* NpyIter_New(PyArrayObject* op, npy_uint32 flags, NPY_ORDER order, NPY_CASTING casting, PyArray_Descr* dtype)
Creates an iterator for the given numpy array object ``op``.
Flags that may be passed in ``flags`` are any combination
of the global and per-operand flags documented in
- :cfunc:`NpyIter_MultiNew`, except for :cdata:`NPY_ITER_ALLOCATE`.
+ :c:func:`NpyIter_MultiNew`, except for :c:data:`NPY_ITER_ALLOCATE`.
- Any of the :ctype:`NPY_ORDER` enum values may be passed to ``order``. For
- efficient iteration, :ctype:`NPY_KEEPORDER` is the best option, and
+ Any of the :c:type:`NPY_ORDER` enum values may be passed to ``order``. For
+ efficient iteration, :c:type:`NPY_KEEPORDER` is the best option, and
the other orders enforce the particular iteration pattern.
- Any of the :ctype:`NPY_CASTING` enum values may be passed to ``casting``.
- The values include :cdata:`NPY_NO_CASTING`, :cdata:`NPY_EQUIV_CASTING`,
- :cdata:`NPY_SAFE_CASTING`, :cdata:`NPY_SAME_KIND_CASTING`, and
- :cdata:`NPY_UNSAFE_CASTING`. To allow the casts to occur, copying or
+ Any of the :c:type:`NPY_CASTING` enum values may be passed to ``casting``.
+ The values include :c:data:`NPY_NO_CASTING`, :c:data:`NPY_EQUIV_CASTING`,
+ :c:data:`NPY_SAFE_CASTING`, :c:data:`NPY_SAME_KIND_CASTING`, and
+ :c:data:`NPY_UNSAFE_CASTING`. To allow the casts to occur, copying or
buffering must also be enabled.
If ``dtype`` isn't ``NULL``, then it requires that data type.
If copying is allowed, it will make a temporary copy if the data
- is castable. If :cdata:`NPY_ITER_UPDATEIFCOPY` is enabled, it will
+ is castable. If :c:data:`NPY_ITER_UPDATEIFCOPY` is enabled, it will
also copy the data back with another cast upon iterator destruction.
Returns NULL if there is an error, otherwise returns the allocated
@@ -282,22 +282,22 @@ Construction and Destruction
dtype);
Py_DECREF(dtype);
-.. cfunction:: NpyIter* NpyIter_MultiNew(npy_intp nop, PyArrayObject** op, npy_uint32 flags, NPY_ORDER order, NPY_CASTING casting, npy_uint32* op_flags, PyArray_Descr** op_dtypes)
+.. c:function:: NpyIter* NpyIter_MultiNew(npy_intp nop, PyArrayObject** op, npy_uint32 flags, NPY_ORDER order, NPY_CASTING casting, npy_uint32* op_flags, PyArray_Descr** op_dtypes)
Creates an iterator for broadcasting the ``nop`` array objects provided
in ``op``, using regular NumPy broadcasting rules.
- Any of the :ctype:`NPY_ORDER` enum values may be passed to ``order``. For
- efficient iteration, :cdata:`NPY_KEEPORDER` is the best option, and the
+ Any of the :c:type:`NPY_ORDER` enum values may be passed to ``order``. For
+ efficient iteration, :c:data:`NPY_KEEPORDER` is the best option, and the
other orders enforce the particular iteration pattern. When using
- :cdata:`NPY_KEEPORDER`, if you also want to ensure that the iteration is
+ :c:data:`NPY_KEEPORDER`, if you also want to ensure that the iteration is
not reversed along an axis, you should pass the flag
- :cdata:`NPY_ITER_DONT_NEGATE_STRIDES`.
+ :c:data:`NPY_ITER_DONT_NEGATE_STRIDES`.
- Any of the :ctype:`NPY_CASTING` enum values may be passed to ``casting``.
- The values include :cdata:`NPY_NO_CASTING`, :cdata:`NPY_EQUIV_CASTING`,
- :cdata:`NPY_SAFE_CASTING`, :cdata:`NPY_SAME_KIND_CASTING`, and
- :cdata:`NPY_UNSAFE_CASTING`. To allow the casts to occur, copying or
+ Any of the :c:type:`NPY_CASTING` enum values may be passed to ``casting``.
+ The values include :c:data:`NPY_NO_CASTING`, :c:data:`NPY_EQUIV_CASTING`,
+ :c:data:`NPY_SAFE_CASTING`, :c:data:`NPY_SAME_KIND_CASTING`, and
+ :c:data:`NPY_UNSAFE_CASTING`. To allow the casts to occur, copying or
buffering must also be enabled.
If ``op_dtypes`` isn't ``NULL``, it specifies a data type or ``NULL``
@@ -309,17 +309,17 @@ Construction and Destruction
Flags that may be passed in ``flags``, applying to the whole
iterator, are:
- .. cvar:: NPY_ITER_C_INDEX
+ .. c:var:: NPY_ITER_C_INDEX
Causes the iterator to track a raveled flat index matching C
- order. This option cannot be used with :cdata:`NPY_ITER_F_INDEX`.
+ order. This option cannot be used with :c:data:`NPY_ITER_F_INDEX`.
- .. cvar:: NPY_ITER_F_INDEX
+ .. c:var:: NPY_ITER_F_INDEX
Causes the iterator to track a raveled flat index matching Fortran
- order. This option cannot be used with :cdata:`NPY_ITER_C_INDEX`.
+ order. This option cannot be used with :c:data:`NPY_ITER_C_INDEX`.
- .. cvar:: NPY_ITER_MULTI_INDEX
+ .. c:var:: NPY_ITER_MULTI_INDEX
Causes the iterator to track a multi-index.
This prevents the iterator from coalescing axes to
@@ -332,26 +332,26 @@ Construction and Destruction
However, it is possible to remove axes again and use the iterator
normally if the size is small enough after removal.
- .. cvar:: NPY_ITER_EXTERNAL_LOOP
+ .. c:var:: NPY_ITER_EXTERNAL_LOOP
Causes the iterator to skip iteration of the innermost
loop, requiring the user of the iterator to handle it.
- This flag is incompatible with :cdata:`NPY_ITER_C_INDEX`,
- :cdata:`NPY_ITER_F_INDEX`, and :cdata:`NPY_ITER_MULTI_INDEX`.
+ This flag is incompatible with :c:data:`NPY_ITER_C_INDEX`,
+ :c:data:`NPY_ITER_F_INDEX`, and :c:data:`NPY_ITER_MULTI_INDEX`.
- .. cvar:: NPY_ITER_DONT_NEGATE_STRIDES
+ .. c:var:: NPY_ITER_DONT_NEGATE_STRIDES
- This only affects the iterator when :ctype:`NPY_KEEPORDER` is
+ This only affects the iterator when :c:type:`NPY_KEEPORDER` is
specified for the order parameter. By default with
- :ctype:`NPY_KEEPORDER`, the iterator reverses axes which have
+ :c:type:`NPY_KEEPORDER`, the iterator reverses axes which have
negative strides, so that memory is traversed in a forward
direction. This disables this step. Use this flag if you
want to use the underlying memory-ordering of the axes,
but don't want an axis reversed. This is the behavior of
``numpy.ravel(a, order='K')``, for instance.
- .. cvar:: NPY_ITER_COMMON_DTYPE
+ .. c:var:: NPY_ITER_COMMON_DTYPE
Causes the iterator to convert all the operands to a common
data type, calculated based on the ufunc type promotion rules.
@@ -360,16 +360,16 @@ Construction and Destruction
If the common data type is known ahead of time, don't use this
flag. Instead, set the requested dtype for all the operands.
- .. cvar:: NPY_ITER_REFS_OK
+ .. c:var:: NPY_ITER_REFS_OK
Indicates that arrays with reference types (object
arrays or structured arrays containing an object type)
may be accepted and used in the iterator. If this flag
is enabled, the caller must be sure to check whether
- :cfunc:`NpyIter_IterationNeedsAPI`(iter) is true, in which case
+ :c:func:`NpyIter_IterationNeedsAPI(iter)` is true, in which case
it may not release the GIL during iteration.
- .. cvar:: NPY_ITER_ZEROSIZE_OK
+ .. c:var:: NPY_ITER_ZEROSIZE_OK
Indicates that arrays with a size of zero should be permitted.
Since the typical iteration loop does not naturally work with
@@ -377,7 +377,7 @@ Construction and Destruction
than zero before entering the iteration loop.
Currently only the operands are checked, not a forced shape.
- .. cvar:: NPY_ITER_REDUCE_OK
+ .. c:var:: NPY_ITER_REDUCE_OK
Permits writeable operands with a dimension with zero
stride and size greater than one. Note that such operands
@@ -388,56 +388,56 @@ Construction and Destruction
not trample on values being reduced.
Note that if you want to do a reduction on an automatically
- allocated output, you must use :cfunc:`NpyIter_GetOperandArray`
+ allocated output, you must use :c:func:`NpyIter_GetOperandArray`
to get its reference, then set every value to the reduction
unit before doing the iteration loop. In the case of a
buffered reduction, this means you must also specify the
- flag :cdata:`NPY_ITER_DELAY_BUFALLOC`, then reset the iterator
+ flag :c:data:`NPY_ITER_DELAY_BUFALLOC`, then reset the iterator
after initializing the allocated operand to prepare the
buffers.
- .. cvar:: NPY_ITER_RANGED
+ .. c:var:: NPY_ITER_RANGED
Enables support for iteration of sub-ranges of the full
``iterindex`` range ``[0, NpyIter_IterSize(iter))``. Use
- the function :cfunc:`NpyIter_ResetToIterIndexRange` to specify
+ the function :c:func:`NpyIter_ResetToIterIndexRange` to specify
a range for iteration.
- This flag can only be used with :cdata:`NPY_ITER_EXTERNAL_LOOP`
- when :cdata:`NPY_ITER_BUFFERED` is enabled. This is because
+ This flag can only be used with :c:data:`NPY_ITER_EXTERNAL_LOOP`
+ when :c:data:`NPY_ITER_BUFFERED` is enabled. This is because
without buffering, the inner loop is always the size of the
innermost iteration dimension, and allowing it to get cut up
would require special handling, effectively making it more
like the buffered version.
- .. cvar:: NPY_ITER_BUFFERED
+ .. c:var:: NPY_ITER_BUFFERED
Causes the iterator to store buffering data, and use buffering
to satisfy data type, alignment, and byte-order requirements.
- To buffer an operand, do not specify the :cdata:`NPY_ITER_COPY`
- or :cdata:`NPY_ITER_UPDATEIFCOPY` flags, because they will
+ To buffer an operand, do not specify the :c:data:`NPY_ITER_COPY`
+ or :c:data:`NPY_ITER_UPDATEIFCOPY` flags, because they will
override buffering. Buffering is especially useful for Python
code using the iterator, allowing for larger chunks
of data at once to amortize the Python interpreter overhead.
- If used with :cdata:`NPY_ITER_EXTERNAL_LOOP`, the inner loop
+ If used with :c:data:`NPY_ITER_EXTERNAL_LOOP`, the inner loop
for the caller may get larger chunks than would be possible
without buffering, because of how the strides are laid out.
- Note that if an operand is given the flag :cdata:`NPY_ITER_COPY`
- or :cdata:`NPY_ITER_UPDATEIFCOPY`, a copy will be made in preference
+ Note that if an operand is given the flag :c:data:`NPY_ITER_COPY`
+ or :c:data:`NPY_ITER_UPDATEIFCOPY`, a copy will be made in preference
to buffering. Buffering will still occur when the array was
broadcast so elements need to be duplicated to get a constant
stride.
In normal buffering, the size of each inner loop is equal
to the buffer size, or possibly larger if
- :cdata:`NPY_ITER_GROWINNER` is specified. If
- :cdata:`NPY_ITER_REDUCE_OK` is enabled and a reduction occurs,
+ :c:data:`NPY_ITER_GROWINNER` is specified. If
+ :c:data:`NPY_ITER_REDUCE_OK` is enabled and a reduction occurs,
the inner loops may become smaller depending
on the structure of the reduction.
- .. cvar:: NPY_ITER_GROWINNER
+ .. c:var:: NPY_ITER_GROWINNER
When buffering is enabled, this allows the size of the inner
loop to grow when buffering isn't necessary. This option
@@ -445,10 +445,10 @@ Construction and Destruction
data, rather than anything with small cache-friendly arrays
of temporary values for each inner loop.
- .. cvar:: NPY_ITER_DELAY_BUFALLOC
+ .. c:var:: NPY_ITER_DELAY_BUFALLOC
When buffering is enabled, this delays allocation of the
- buffers until :cfunc:`NpyIter_Reset` or another reset function is
+ buffers until :c:func:`NpyIter_Reset` or another reset function is
called. This flag exists to avoid wasteful copying of
buffer data when making multiple copies of a buffered
iterator for multi-threaded iteration.
@@ -457,29 +457,29 @@ Construction and Destruction
After the iterator is created, and a reduction output
is allocated automatically by the iterator (be sure to use
READWRITE access), its value may be initialized to the reduction
- unit. Use :cfunc:`NpyIter_GetOperandArray` to get the object.
- Then, call :cfunc:`NpyIter_Reset` to allocate and fill the buffers
+ unit. Use :c:func:`NpyIter_GetOperandArray` to get the object.
+ Then, call :c:func:`NpyIter_Reset` to allocate and fill the buffers
with their initial values.
Flags that may be passed in ``op_flags[i]``, where ``0 <= i < nop``:
- .. cvar:: NPY_ITER_READWRITE
- .. cvar:: NPY_ITER_READONLY
- .. cvar:: NPY_ITER_WRITEONLY
+ .. c:var:: NPY_ITER_READWRITE
+ .. c:var:: NPY_ITER_READONLY
+ .. c:var:: NPY_ITER_WRITEONLY
Indicate how the user of the iterator will read or write
to ``op[i]``. Exactly one of these flags must be specified
per operand.
- .. cvar:: NPY_ITER_COPY
+ .. c:var:: NPY_ITER_COPY
Allow a copy of ``op[i]`` to be made if it does not
meet the data type or alignment requirements as specified
by the constructor flags and parameters.
- .. cvar:: NPY_ITER_UPDATEIFCOPY
+ .. c:var:: NPY_ITER_UPDATEIFCOPY
- Triggers :cdata:`NPY_ITER_COPY`, and when an array operand
+ Triggers :c:data:`NPY_ITER_COPY`, and when an array operand
is flagged for writing and is copied, causes the data
in a copy to be copied back to ``op[i]`` when the iterator
is destroyed.
@@ -489,9 +489,9 @@ Construction and Destruction
to back to ``op[i]`` on destruction, instead of doing
the unecessary copy operation.
- .. cvar:: NPY_ITER_NBO
- .. cvar:: NPY_ITER_ALIGNED
- .. cvar:: NPY_ITER_CONTIG
+ .. c:var:: NPY_ITER_NBO
+ .. c:var:: NPY_ITER_ALIGNED
+ .. c:var:: NPY_ITER_CONTIG
Causes the iterator to provide data for ``op[i]``
that is in native byte order, aligned according to
@@ -510,10 +510,10 @@ Construction and Destruction
the NBO flag overrides it and the requested data type is
converted to be in native byte order.
- .. cvar:: NPY_ITER_ALLOCATE
+ .. c:var:: NPY_ITER_ALLOCATE
This is for output arrays, and requires that the flag
- :cdata:`NPY_ITER_WRITEONLY` or :cdata:`NPY_ITER_READWRITE`
+ :c:data:`NPY_ITER_WRITEONLY` or :c:data:`NPY_ITER_READWRITE`
be set. If ``op[i]`` is NULL, creates a new array with
the final broadcast dimensions, and a layout matching
the iteration order of the iterator.
@@ -529,50 +529,50 @@ Construction and Destruction
output will be in native byte order.
After being allocated with this flag, the caller may retrieve
- the new array by calling :cfunc:`NpyIter_GetOperandArray` and
+ the new array by calling :c:func:`NpyIter_GetOperandArray` and
getting the i-th object in the returned C array. The caller
must call Py_INCREF on it to claim a reference to the array.
- .. cvar:: NPY_ITER_NO_SUBTYPE
+ .. c:var:: NPY_ITER_NO_SUBTYPE
- For use with :cdata:`NPY_ITER_ALLOCATE`, this flag disables
+ For use with :c:data:`NPY_ITER_ALLOCATE`, this flag disables
allocating an array subtype for the output, forcing
it to be a straight ndarray.
TODO: Maybe it would be better to introduce a function
``NpyIter_GetWrappedOutput`` and remove this flag?
- .. cvar:: NPY_ITER_NO_BROADCAST
+ .. c:var:: NPY_ITER_NO_BROADCAST
Ensures that the input or output matches the iteration
dimensions exactly.
- .. cvar:: NPY_ITER_ARRAYMASK
+ .. c:var:: NPY_ITER_ARRAYMASK
.. versionadded:: 1.7
Indicates that this operand is the mask to use for
selecting elements when writing to operands which have
- the :cdata:`NPY_ITER_WRITEMASKED` flag applied to them.
- Only one operand may have :cdata:`NPY_ITER_ARRAYMASK` flag
+ the :c:data:`NPY_ITER_WRITEMASKED` flag applied to them.
+ Only one operand may have :c:data:`NPY_ITER_ARRAYMASK` flag
applied to it.
The data type of an operand with this flag should be either
- :cdata:`NPY_BOOL`, :cdata:`NPY_MASK`, or a struct dtype
+ :c:data:`NPY_BOOL`, :c:data:`NPY_MASK`, or a struct dtype
whose fields are all valid mask dtypes. In the latter case,
it must match up with a struct operand being WRITEMASKED,
as it is specifying a mask for each field of that array.
This flag only affects writing from the buffer back to
the array. This means that if the operand is also
- :cdata:`NPY_ITER_READWRITE` or :cdata:`NPY_ITER_WRITEONLY`,
+ :c:data:`NPY_ITER_READWRITE` or :c:data:`NPY_ITER_WRITEONLY`,
code doing iteration can write to this operand to
control which elements will be untouched and which ones will be
modified. This is useful when the mask should be a combination
of input masks, for example. Mask values can be created
- with the :cfunc:`NpyMask_Create` function.
+ with the :c:func:`NpyMask_Create` function.
- .. cvar:: NPY_ITER_WRITEMASKED
+ .. c:var:: NPY_ITER_WRITEMASKED
.. versionadded:: 1.7
@@ -580,24 +580,24 @@ Construction and Destruction
the ARRAYMASK flag indicates are intended to be modified
by the iteration. In general, the iterator does not enforce
this, it is up to the code doing the iteration to follow
- that promise. Code can use the :cfunc:`NpyMask_IsExposed`
+ that promise. Code can use the :c:func:`NpyMask_IsExposed`
inline function to test whether the mask at a particular
element allows writing.
When this flag is used, and this operand is buffered, this
changes how data is copied from the buffer into the array.
A masked copying routine is used, which only copies the
- elements in the buffer for which :cfunc:`NpyMask_IsExposed`
+ elements in the buffer for which :c:func:`NpyMask_IsExposed`
returns true from the corresponding element in the ARRAYMASK
operand.
-.. cfunction:: NpyIter* NpyIter_AdvancedNew(npy_intp nop, PyArrayObject** op, npy_uint32 flags, NPY_ORDER order, NPY_CASTING casting, npy_uint32* op_flags, PyArray_Descr** op_dtypes, int oa_ndim, int** op_axes, npy_intp* itershape, npy_intp buffersize)
+.. c:function:: NpyIter* NpyIter_AdvancedNew(npy_intp nop, PyArrayObject** op, npy_uint32 flags, NPY_ORDER order, NPY_CASTING casting, npy_uint32* op_flags, PyArray_Descr** op_dtypes, int oa_ndim, int** op_axes, npy_intp* itershape, npy_intp buffersize)
- Extends :cfunc:`NpyIter_MultiNew` with several advanced options providing
+ Extends :c:func:`NpyIter_MultiNew` with several advanced options providing
more control over broadcasting and buffering.
If -1/NULL values are passed to ``oa_ndim``, ``op_axes``, ``itershape``,
- and ``buffersize``, it is equivalent to :cfunc:`NpyIter_MultiNew`.
+ and ``buffersize``, it is equivalent to :c:func:`NpyIter_MultiNew`.
The parameter ``oa_ndim``, when not zero or -1, specifies the number of
dimensions that will be iterated with customized broadcasting.
@@ -615,7 +615,7 @@ Construction and Destruction
**Note**: Before NumPy 1.8 ``oa_ndim == 0` was used for signalling that
that ``op_axes`` and ``itershape`` are unused. This is deprecated and
should be replaced with -1. Better backward compatibility may be
- achieved by using :cfunc:`NpyIter_MultiNew` for this case.
+ achieved by using :c:func:`NpyIter_MultiNew` for this case.
.. code-block:: c
@@ -640,7 +640,7 @@ Construction and Destruction
Returns NULL if there is an error, otherwise returns the allocated
iterator.
-.. cfunction:: NpyIter* NpyIter_Copy(NpyIter* iter)
+.. c:function:: NpyIter* NpyIter_Copy(NpyIter* iter)
Makes a copy of the given iterator. This function is provided
primarily to enable multi-threaded iteration of the data.
@@ -649,29 +649,29 @@ Construction and Destruction
The recommended approach to multithreaded iteration is to
first create an iterator with the flags
- :cdata:`NPY_ITER_EXTERNAL_LOOP`, :cdata:`NPY_ITER_RANGED`,
- :cdata:`NPY_ITER_BUFFERED`, :cdata:`NPY_ITER_DELAY_BUFALLOC`, and
- possibly :cdata:`NPY_ITER_GROWINNER`. Create a copy of this iterator
+ :c:data:`NPY_ITER_EXTERNAL_LOOP`, :c:data:`NPY_ITER_RANGED`,
+ :c:data:`NPY_ITER_BUFFERED`, :c:data:`NPY_ITER_DELAY_BUFALLOC`, and
+ possibly :c:data:`NPY_ITER_GROWINNER`. Create a copy of this iterator
for each thread (minus one for the first iterator). Then, take
the iteration index range ``[0, NpyIter_GetIterSize(iter))`` and
split it up into tasks, for example using a TBB parallel_for loop.
When a thread gets a task to execute, it then uses its copy of
- the iterator by calling :cfunc:`NpyIter_ResetToIterIndexRange` and
+ the iterator by calling :c:func:`NpyIter_ResetToIterIndexRange` and
iterating over the full range.
When using the iterator in multi-threaded code or in code not
holding the Python GIL, care must be taken to only call functions
- which are safe in that context. :cfunc:`NpyIter_Copy` cannot be safely
+ which are safe in that context. :c:func:`NpyIter_Copy` cannot be safely
called without the Python GIL, because it increments Python
references. The ``Reset*`` and some other functions may be safely
called by passing in the ``errmsg`` parameter as non-NULL, so that
the functions will pass back errors through it instead of setting
a Python exception.
-.. cfunction:: int NpyIter_RemoveAxis(NpyIter* iter, int axis)``
+.. c:function:: int NpyIter_RemoveAxis(NpyIter* iter, int axis)``
Removes an axis from iteration. This requires that
- :cdata:`NPY_ITER_MULTI_INDEX` was set for iterator creation, and does
+ :c:data:`NPY_ITER_MULTI_INDEX` was set for iterator creation, and does
not work if buffering is enabled or an index is being tracked. This
function also resets the iterator to its initial state.
@@ -688,7 +688,7 @@ Construction and Destruction
Returns ``NPY_SUCCEED`` or ``NPY_FAIL``.
-.. cfunction:: int NpyIter_RemoveMultiIndex(NpyIter* iter)
+.. c:function:: int NpyIter_RemoveMultiIndex(NpyIter* iter)
If the iterator is tracking a multi-index, this strips support for them,
and does further iterator optimizations that are possible if multi-indices
@@ -699,17 +699,17 @@ Construction and Destruction
the iterator. Any cached functions or pointers from the iterator
must be retrieved again!
- After calling this function, :cfunc:`NpyIter_HasMultiIndex`(iter) will
+ After calling this function, :c:func:`NpyIter_HasMultiIndex(iter)` will
return false.
Returns ``NPY_SUCCEED`` or ``NPY_FAIL``.
-.. cfunction:: int NpyIter_EnableExternalLoop(NpyIter* iter)
+.. c:function:: int NpyIter_EnableExternalLoop(NpyIter* iter)
- If :cfunc:`NpyIter_RemoveMultiIndex` was called, you may want to enable the
- flag :cdata:`NPY_ITER_EXTERNAL_LOOP`. This flag is not permitted
- together with :cdata:`NPY_ITER_MULTI_INDEX`, so this function is provided
- to enable the feature after :cfunc:`NpyIter_RemoveMultiIndex` is called.
+ If :c:func:`NpyIter_RemoveMultiIndex` was called, you may want to enable the
+ flag :c:data:`NPY_ITER_EXTERNAL_LOOP`. This flag is not permitted
+ together with :c:data:`NPY_ITER_MULTI_INDEX`, so this function is provided
+ to enable the feature after :c:func:`NpyIter_RemoveMultiIndex` is called.
This function also resets the iterator to its initial state.
**WARNING**: This function changes the internal logic of the iterator.
@@ -718,14 +718,14 @@ Construction and Destruction
Returns ``NPY_SUCCEED`` or ``NPY_FAIL``.
-.. cfunction:: int NpyIter_Deallocate(NpyIter* iter)
+.. c:function:: int NpyIter_Deallocate(NpyIter* iter)
Deallocates the iterator object. This additionally frees any
copies made, triggering UPDATEIFCOPY behavior where necessary.
Returns ``NPY_SUCCEED`` or ``NPY_FAIL``.
-.. cfunction:: int NpyIter_Reset(NpyIter* iter, char** errmsg)
+.. c:function:: int NpyIter_Reset(NpyIter* iter, char** errmsg)
Resets the iterator back to its initial state, at the beginning
of the iteration range.
@@ -736,12 +736,12 @@ Construction and Destruction
non-NULL, the function may be safely called without holding
the Python GIL.
-.. cfunction:: int NpyIter_ResetToIterIndexRange(NpyIter* iter, npy_intp istart, npy_intp iend, char** errmsg)
+.. c:function:: int NpyIter_ResetToIterIndexRange(NpyIter* iter, npy_intp istart, npy_intp iend, char** errmsg)
Resets the iterator and restricts it to the ``iterindex`` range
- ``[istart, iend)``. See :cfunc:`NpyIter_Copy` for an explanation of
+ ``[istart, iend)``. See :c:func:`NpyIter_Copy` for an explanation of
how to use this for multi-threaded iteration. This requires that
- the flag :cdata:`NPY_ITER_RANGED` was passed to the iterator constructor.
+ the flag :c:data:`NPY_ITER_RANGED` was passed to the iterator constructor.
If you want to reset both the ``iterindex`` range and the base
pointers at the same time, you can do the following to avoid
@@ -763,7 +763,7 @@ Construction and Destruction
non-NULL, the function may be safely called without holding
the Python GIL.
-.. cfunction:: int NpyIter_ResetBasePointers(NpyIter *iter, char** baseptrs, char** errmsg)
+.. c:function:: int NpyIter_ResetBasePointers(NpyIter *iter, char** baseptrs, char** errmsg)
Resets the iterator back to its initial state, but using the values
in ``baseptrs`` for the data instead of the pointers from the arrays
@@ -781,12 +781,12 @@ Construction and Destruction
Creating iterators for nested iteration requires some care. All
the iterator operands must match exactly, or the calls to
- :cfunc:`NpyIter_ResetBasePointers` will be invalid. This means that
+ :c:func:`NpyIter_ResetBasePointers` will be invalid. This means that
automatic copies and output allocation should not be used haphazardly.
It is possible to still use the automatic data conversion and casting
features of the iterator by creating one of the iterators with
all the conversion parameters enabled, then grabbing the allocated
- operands with the :cfunc:`NpyIter_GetOperandArray` function and passing
+ operands with the :c:func:`NpyIter_GetOperandArray` function and passing
them into the constructors for the rest of the iterators.
**WARNING**: When creating iterators for nested iteration,
@@ -825,7 +825,7 @@ Construction and Destruction
} while (iternext2(iter2));
} while (iternext1(iter1));
-.. cfunction:: int NpyIter_GotoMultiIndex(NpyIter* iter, npy_intp* multi_index)
+.. c:function:: int NpyIter_GotoMultiIndex(NpyIter* iter, npy_intp* multi_index)
Adjusts the iterator to point to the ``ndim`` indices
pointed to by ``multi_index``. Returns an error if a multi-index
@@ -834,19 +834,19 @@ Construction and Destruction
Returns ``NPY_SUCCEED`` or ``NPY_FAIL``.
-.. cfunction:: int NpyIter_GotoIndex(NpyIter* iter, npy_intp index)
+.. c:function:: int NpyIter_GotoIndex(NpyIter* iter, npy_intp index)
Adjusts the iterator to point to the ``index`` specified.
If the iterator was constructed with the flag
- :cdata:`NPY_ITER_C_INDEX`, ``index`` is the C-order index,
+ :c:data:`NPY_ITER_C_INDEX`, ``index`` is the C-order index,
and if the iterator was constructed with the flag
- :cdata:`NPY_ITER_F_INDEX`, ``index`` is the Fortran-order
+ :c:data:`NPY_ITER_F_INDEX`, ``index`` is the Fortran-order
index. Returns an error if there is no index being tracked,
the index is out of bounds, or inner loop iteration is disabled.
Returns ``NPY_SUCCEED`` or ``NPY_FAIL``.
-.. cfunction:: npy_intp NpyIter_GetIterSize(NpyIter* iter)
+.. c:function:: npy_intp NpyIter_GetIterSize(NpyIter* iter)
Returns the number of elements being iterated. This is the product
of all the dimensions in the shape. When a multi index is being tracked
@@ -855,18 +855,18 @@ Construction and Destruction
may become valid after `NpyIter_RemoveAxis` is called. It is not
necessary to check for this case.
-.. cfunction:: npy_intp NpyIter_GetIterIndex(NpyIter* iter)
+.. c:function:: npy_intp NpyIter_GetIterIndex(NpyIter* iter)
Gets the ``iterindex`` of the iterator, which is an index matching
the iteration order of the iterator.
-.. cfunction:: void NpyIter_GetIterIndexRange(NpyIter* iter, npy_intp* istart, npy_intp* iend)
+.. c:function:: void NpyIter_GetIterIndexRange(NpyIter* iter, npy_intp* istart, npy_intp* iend)
Gets the ``iterindex`` sub-range that is being iterated. If
- :cdata:`NPY_ITER_RANGED` was not specified, this always returns the
+ :c:data:`NPY_ITER_RANGED` was not specified, this always returns the
range ``[0, NpyIter_IterSize(iter))``.
-.. cfunction:: int NpyIter_GotoIterIndex(NpyIter* iter, npy_intp iterindex)
+.. c:function:: int NpyIter_GotoIterIndex(NpyIter* iter, npy_intp iterindex)
Adjusts the iterator to point to the ``iterindex`` specified.
The IterIndex is an index matching the iteration order of the iterator.
@@ -875,97 +875,97 @@ Construction and Destruction
Returns ``NPY_SUCCEED`` or ``NPY_FAIL``.
-.. cfunction:: npy_bool NpyIter_HasDelayedBufAlloc(NpyIter* iter)
+.. c:function:: npy_bool NpyIter_HasDelayedBufAlloc(NpyIter* iter)
- Returns 1 if the flag :cdata:`NPY_ITER_DELAY_BUFALLOC` was passed
+ Returns 1 if the flag :c:data:`NPY_ITER_DELAY_BUFALLOC` was passed
to the iterator constructor, and no call to one of the Reset
functions has been done yet, 0 otherwise.
-.. cfunction:: npy_bool NpyIter_HasExternalLoop(NpyIter* iter)
+.. c:function:: npy_bool NpyIter_HasExternalLoop(NpyIter* iter)
Returns 1 if the caller needs to handle the inner-most 1-dimensional
loop, or 0 if the iterator handles all looping. This is controlled
- by the constructor flag :cdata:`NPY_ITER_EXTERNAL_LOOP` or
- :cfunc:`NpyIter_EnableExternalLoop`.
+ by the constructor flag :c:data:`NPY_ITER_EXTERNAL_LOOP` or
+ :c:func:`NpyIter_EnableExternalLoop`.
-.. cfunction:: npy_bool NpyIter_HasMultiIndex(NpyIter* iter)
+.. c:function:: npy_bool NpyIter_HasMultiIndex(NpyIter* iter)
Returns 1 if the iterator was created with the
- :cdata:`NPY_ITER_MULTI_INDEX` flag, 0 otherwise.
+ :c:data:`NPY_ITER_MULTI_INDEX` flag, 0 otherwise.
-.. cfunction:: npy_bool NpyIter_HasIndex(NpyIter* iter)
+.. c:function:: npy_bool NpyIter_HasIndex(NpyIter* iter)
Returns 1 if the iterator was created with the
- :cdata:`NPY_ITER_C_INDEX` or :cdata:`NPY_ITER_F_INDEX`
+ :c:data:`NPY_ITER_C_INDEX` or :c:data:`NPY_ITER_F_INDEX`
flag, 0 otherwise.
-.. cfunction:: npy_bool NpyIter_RequiresBuffering(NpyIter* iter)
+.. c:function:: npy_bool NpyIter_RequiresBuffering(NpyIter* iter)
Returns 1 if the iterator requires buffering, which occurs
when an operand needs conversion or alignment and so cannot
be used directly.
-.. cfunction:: npy_bool NpyIter_IsBuffered(NpyIter* iter)
+.. c:function:: npy_bool NpyIter_IsBuffered(NpyIter* iter)
Returns 1 if the iterator was created with the
- :cdata:`NPY_ITER_BUFFERED` flag, 0 otherwise.
+ :c:data:`NPY_ITER_BUFFERED` flag, 0 otherwise.
-.. cfunction:: npy_bool NpyIter_IsGrowInner(NpyIter* iter)
+.. c:function:: npy_bool NpyIter_IsGrowInner(NpyIter* iter)
Returns 1 if the iterator was created with the
- :cdata:`NPY_ITER_GROWINNER` flag, 0 otherwise.
+ :c:data:`NPY_ITER_GROWINNER` flag, 0 otherwise.
-.. cfunction:: npy_intp NpyIter_GetBufferSize(NpyIter* iter)
+.. c:function:: npy_intp NpyIter_GetBufferSize(NpyIter* iter)
If the iterator is buffered, returns the size of the buffer
being used, otherwise returns 0.
-.. cfunction:: int NpyIter_GetNDim(NpyIter* iter)
+.. c:function:: int NpyIter_GetNDim(NpyIter* iter)
Returns the number of dimensions being iterated. If a multi-index
was not requested in the iterator constructor, this value
may be smaller than the number of dimensions in the original
objects.
-.. cfunction:: int NpyIter_GetNOp(NpyIter* iter)
+.. c:function:: int NpyIter_GetNOp(NpyIter* iter)
Returns the number of operands in the iterator.
- When :cdata:`NPY_ITER_USE_MASKNA` is used on an operand, a new
+ When :c:data:`NPY_ITER_USE_MASKNA` is used on an operand, a new
operand is added to the end of the operand list in the iterator
to track that operand's NA mask. Thus, this equals the number
of construction operands plus the number of operands for
- which the flag :cdata:`NPY_ITER_USE_MASKNA` was specified.
+ which the flag :c:data:`NPY_ITER_USE_MASKNA` was specified.
-.. cfunction:: int NpyIter_GetFirstMaskNAOp(NpyIter* iter)
+.. c:function:: int NpyIter_GetFirstMaskNAOp(NpyIter* iter)
.. versionadded:: 1.7
Returns the index of the first NA mask operand in the array. This
value is equal to the number of operands passed into the constructor.
-.. cfunction:: npy_intp* NpyIter_GetAxisStrideArray(NpyIter* iter, int axis)
+.. c:function:: npy_intp* NpyIter_GetAxisStrideArray(NpyIter* iter, int axis)
Gets the array of strides for the specified axis. Requires that
the iterator be tracking a multi-index, and that buffering not
be enabled.
This may be used when you want to match up operand axes in
- some fashion, then remove them with :cfunc:`NpyIter_RemoveAxis` to
+ some fashion, then remove them with :c:func:`NpyIter_RemoveAxis` to
handle their processing manually. By calling this function
before removing the axes, you can get the strides for the
manual processing.
Returns ``NULL`` on error.
-.. cfunction:: int NpyIter_GetShape(NpyIter* iter, npy_intp* outshape)
+.. c:function:: int NpyIter_GetShape(NpyIter* iter, npy_intp* outshape)
Returns the broadcast shape of the iterator in ``outshape``.
This can only be called on an iterator which is tracking a multi-index.
Returns ``NPY_SUCCEED`` or ``NPY_FAIL``.
-.. cfunction:: PyArray_Descr** NpyIter_GetDescrArray(NpyIter* iter)
+.. c:function:: PyArray_Descr** NpyIter_GetDescrArray(NpyIter* iter)
This gives back a pointer to the ``nop`` data type Descrs for
the objects being iterated. The result points into ``iter``,
@@ -974,26 +974,26 @@ Construction and Destruction
This pointer may be cached before the iteration loop, calling
``iternext`` will not change it.
-.. cfunction:: PyObject** NpyIter_GetOperandArray(NpyIter* iter)
+.. c:function:: PyObject** NpyIter_GetOperandArray(NpyIter* iter)
This gives back a pointer to the ``nop`` operand PyObjects
that are being iterated. The result points into ``iter``,
so the caller does not gain any references to the PyObjects.
-.. cfunction:: npy_int8* NpyIter_GetMaskNAIndexArray(NpyIter* iter)
+.. c:function:: npy_int8* NpyIter_GetMaskNAIndexArray(NpyIter* iter)
.. versionadded:: 1.7
This gives back a pointer to the ``nop`` indices which map
- construction operands with :cdata:`NPY_ITER_USE_MASKNA` flagged
+ construction operands with :c:data:`NPY_ITER_USE_MASKNA` flagged
to their corresponding NA mask operands and vice versa. For
- operands which were not flagged with :cdata:`NPY_ITER_USE_MASKNA`,
+ operands which were not flagged with :c:data:`NPY_ITER_USE_MASKNA`,
this array contains negative values.
-.. cfunction:: PyObject* NpyIter_GetIterView(NpyIter* iter, npy_intp i)
+.. c:function:: PyObject* NpyIter_GetIterView(NpyIter* iter, npy_intp i)
This gives back a reference to a new ndarray view, which is a view
- into the i-th object in the array :cfunc:`NpyIter_GetOperandArray`(),
+ into the i-th object in the array :c:func:`NpyIter_GetOperandArray()`,
whose dimensions and strides match the internal optimized
iteration pattern. A C-order iteration of this view is equivalent
to the iterator's iteration order.
@@ -1003,24 +1003,24 @@ Construction and Destruction
collapse it into a single strided iteration, this would return
a view that is a one-dimensional array.
-.. cfunction:: void NpyIter_GetReadFlags(NpyIter* iter, char* outreadflags)
+.. c:function:: void NpyIter_GetReadFlags(NpyIter* iter, char* outreadflags)
Fills ``nop`` flags. Sets ``outreadflags[i]`` to 1 if
``op[i]`` can be read from, and to 0 if not.
-.. cfunction:: void NpyIter_GetWriteFlags(NpyIter* iter, char* outwriteflags)
+.. c:function:: void NpyIter_GetWriteFlags(NpyIter* iter, char* outwriteflags)
Fills ``nop`` flags. Sets ``outwriteflags[i]`` to 1 if
``op[i]`` can be written to, and to 0 if not.
-.. cfunction:: int NpyIter_CreateCompatibleStrides(NpyIter* iter, npy_intp itemsize, npy_intp* outstrides)
+.. c:function:: int NpyIter_CreateCompatibleStrides(NpyIter* iter, npy_intp itemsize, npy_intp* outstrides)
Builds a set of strides which are the same as the strides of an
- output array created using the :cdata:`NPY_ITER_ALLOCATE` flag, where NULL
+ output array created using the :c:data:`NPY_ITER_ALLOCATE` flag, where NULL
was passed for op_axes. This is for data packed contiguously,
but not necessarily in C or Fortran order. This should be used
- together with :cfunc:`NpyIter_GetShape` and :cfunc:`NpyIter_GetNDim`
- with the flag :cdata:`NPY_ITER_MULTI_INDEX` passed into the constructor.
+ together with :c:func:`NpyIter_GetShape` and :c:func:`NpyIter_GetNDim`
+ with the flag :c:data:`NPY_ITER_MULTI_INDEX` passed into the constructor.
A use case for this function is to match the shape and layout of
the iterator and tack on one or more dimensions. For example,
@@ -1031,7 +1031,7 @@ Construction and Destruction
the symmetry and pack it into 1 dimension with a particular encoding.
This function may only be called if the iterator is tracking a multi-index
- and if :cdata:`NPY_ITER_DONT_NEGATE_STRIDES` was used to prevent an axis
+ and if :c:data:`NPY_ITER_DONT_NEGATE_STRIDES` was used to prevent an axis
from being iterated in reverse order.
If an array is created with this method, simply adding 'itemsize'
@@ -1040,7 +1040,7 @@ Construction and Destruction
Returns ``NPY_SUCCEED`` or ``NPY_FAIL``.
-.. cfunction:: npy_bool NpyIter_IsFirstVisit(NpyIter* iter, int iop)
+.. c:function:: npy_bool NpyIter_IsFirstVisit(NpyIter* iter, int iop)
.. versionadded:: 1.7
@@ -1067,7 +1067,7 @@ Construction and Destruction
Functions For Iteration
-----------------------
-.. cfunction:: NpyIter_IterNextFunc* NpyIter_GetIterNext(NpyIter* iter, char** errmsg)
+.. c:function:: NpyIter_IterNextFunc* NpyIter_GetIterNext(NpyIter* iter, char** errmsg)
Returns a function pointer for iteration. A specialized version
of the function pointer may be calculated by this function
@@ -1092,7 +1092,7 @@ Functions For Iteration
/* use the addresses dataptr[0], ... dataptr[nop-1] */
} while(iternext(iter));
- When :cdata:`NPY_ITER_EXTERNAL_LOOP` is specified, the typical
+ When :c:data:`NPY_ITER_EXTERNAL_LOOP` is specified, the typical
inner loop construct is as follows.
.. code-block:: c
@@ -1119,11 +1119,11 @@ Functions For Iteration
with fresh values, not incrementally updated.
If a compile-time fixed buffer is being used (both flags
- :cdata:`NPY_ITER_BUFFERED` and :cdata:`NPY_ITER_EXTERNAL_LOOP`), the
+ :c:data:`NPY_ITER_BUFFERED` and :c:data:`NPY_ITER_EXTERNAL_LOOP`), the
inner size may be used as a signal as well. The size is guaranteed
to become zero when ``iternext()`` returns false, enabling the
following loop construct. Note that if you use this construct,
- you should not pass :cdata:`NPY_ITER_GROWINNER` as a flag, because it
+ you should not pass :c:data:`NPY_ITER_GROWINNER` as a flag, because it
will cause larger sizes under some circumstances.
.. code-block:: c
@@ -1165,7 +1165,7 @@ Functions For Iteration
}
} while (iternext());
-.. cfunction:: NpyIter_GetMultiIndexFunc *NpyIter_GetGetMultiIndex(NpyIter* iter, char** errmsg)
+.. c:function:: NpyIter_GetMultiIndexFunc *NpyIter_GetGetMultiIndex(NpyIter* iter, char** errmsg)
Returns a function pointer for getting the current multi-index
of the iterator. Returns NULL if the iterator is not tracking
@@ -1179,10 +1179,10 @@ Functions For Iteration
non-NULL, the function may be safely called without holding
the Python GIL.
-.. cfunction:: char** NpyIter_GetDataPtrArray(NpyIter* iter)
+.. c:function:: char** NpyIter_GetDataPtrArray(NpyIter* iter)
This gives back a pointer to the ``nop`` data pointers. If
- :cdata:`NPY_ITER_EXTERNAL_LOOP` was not specified, each data
+ :c:data:`NPY_ITER_EXTERNAL_LOOP` was not specified, each data
pointer points to the current data item of the iterator. If
no inner iteration was specified, it points to the first data
item of the inner loop.
@@ -1191,7 +1191,7 @@ Functions For Iteration
``iternext`` will not change it. This function may be safely
called without holding the Python GIL.
-.. cfunction:: char** NpyIter_GetInitialDataPtrArray(NpyIter* iter)
+.. c:function:: char** NpyIter_GetInitialDataPtrArray(NpyIter* iter)
Gets the array of data pointers directly into the arrays (never
into the buffers), corresponding to iteration index 0.
@@ -1202,18 +1202,18 @@ Functions For Iteration
This function may be safely called without holding the Python GIL.
-.. cfunction:: npy_intp* NpyIter_GetIndexPtr(NpyIter* iter)
+.. c:function:: npy_intp* NpyIter_GetIndexPtr(NpyIter* iter)
This gives back a pointer to the index being tracked, or NULL
if no index is being tracked. It is only useable if one of
- the flags :cdata:`NPY_ITER_C_INDEX` or :cdata:`NPY_ITER_F_INDEX`
+ the flags :c:data:`NPY_ITER_C_INDEX` or :c:data:`NPY_ITER_F_INDEX`
were specified during construction.
-When the flag :cdata:`NPY_ITER_EXTERNAL_LOOP` is used, the code
+When the flag :c:data:`NPY_ITER_EXTERNAL_LOOP` is used, the code
needs to know the parameters for doing the inner loop. These
functions provide that information.
-.. cfunction:: npy_intp* NpyIter_GetInnerStrideArray(NpyIter* iter)
+.. c:function:: npy_intp* NpyIter_GetInnerStrideArray(NpyIter* iter)
Returns a pointer to an array of the ``nop`` strides,
one for each iterated object, to be used by the inner loop.
@@ -1222,7 +1222,7 @@ functions provide that information.
``iternext`` will not change it. This function may be safely
called without holding the Python GIL.
-.. cfunction:: npy_intp* NpyIter_GetInnerLoopSizePtr(NpyIter* iter)
+.. c:function:: npy_intp* NpyIter_GetInnerLoopSizePtr(NpyIter* iter)
Returns a pointer to the number of iterations the
inner loop should execute.
@@ -1232,14 +1232,14 @@ functions provide that information.
iteration, in particular if buffering is enabled. This function
may be safely called without holding the Python GIL.
-.. cfunction:: void NpyIter_GetInnerFixedStrideArray(NpyIter* iter, npy_intp* out_strides)
+.. c:function:: void NpyIter_GetInnerFixedStrideArray(NpyIter* iter, npy_intp* out_strides)
Gets an array of strides which are fixed, or will not change during
the entire iteration. For strides that may change, the value
NPY_MAX_INTP is placed in the stride.
Once the iterator is prepared for iteration (after a reset if
- :cdata:`NPY_DELAY_BUFALLOC` was used), call this to get the strides
+ :c:data:`NPY_DELAY_BUFALLOC` was used), call this to get the strides
which may be used to select a fast inner loop function. For example,
if the stride is 0, that means the inner loop can always load its
value into a variable once, then use the variable throughout the loop,
@@ -1265,33 +1265,33 @@ iterator, which does not have corresponding features in this iterator.
Here is a conversion table for which functions to use with the new iterator:
-===================================== =============================================
+===================================== ===================================================
*Iterator Functions*
-:cfunc:`PyArray_IterNew` :cfunc:`NpyIter_New`
-:cfunc:`PyArray_IterAllButAxis` :cfunc:`NpyIter_New` + ``axes`` parameter **or**
- Iterator flag :cdata:`NPY_ITER_EXTERNAL_LOOP`
-:cfunc:`PyArray_BroadcastToShape` **NOT SUPPORTED** (Use the support for
+:c:func:`PyArray_IterNew` :c:func:`NpyIter_New`
+:c:func:`PyArray_IterAllButAxis` :c:func:`NpyIter_New` + ``axes`` parameter **or**
+ Iterator flag :c:data:`NPY_ITER_EXTERNAL_LOOP`
+:c:func:`PyArray_BroadcastToShape` **NOT SUPPORTED** (Use the support for
multiple operands instead.)
-:cfunc:`PyArrayIter_Check` Will need to add this in Python exposure
-:cfunc:`PyArray_ITER_RESET` :cfunc:`NpyIter_Reset`
-:cfunc:`PyArray_ITER_NEXT` Function pointer from :cfunc:`NpyIter_GetIterNext`
-:cfunc:`PyArray_ITER_DATA` :cfunc:`NpyIter_GetDataPtrArray`
-:cfunc:`PyArray_ITER_GOTO` :cfunc:`NpyIter_GotoMultiIndex`
-:cfunc:`PyArray_ITER_GOTO1D` :cfunc:`NpyIter_GotoIndex` or
- :cfunc:`NpyIter_GotoIterIndex`
-:cfunc:`PyArray_ITER_NOTDONE` Return value of ``iternext`` function pointer
+:c:func:`PyArrayIter_Check` Will need to add this in Python exposure
+:c:func:`PyArray_ITER_RESET` :c:func:`NpyIter_Reset`
+:c:func:`PyArray_ITER_NEXT` Function pointer from :c:func:`NpyIter_GetIterNext`
+:c:func:`PyArray_ITER_DATA` c:func:`NpyIter_GetDataPtrArray`
+:c:func:`PyArray_ITER_GOTO` :c:func:`NpyIter_GotoMultiIndex`
+:c:func:`PyArray_ITER_GOTO1D` :c:func:`NpyIter_GotoIndex` or
+ :c:func:`NpyIter_GotoIterIndex`
+:c:func:`PyArray_ITER_NOTDONE` Return value of ``iternext`` function pointer
*Multi-iterator Functions*
-:cfunc:`PyArray_MultiIterNew` :cfunc:`NpyIter_MultiNew`
-:cfunc:`PyArray_MultiIter_RESET` :cfunc:`NpyIter_Reset`
-:cfunc:`PyArray_MultiIter_NEXT` Function pointer from :cfunc:`NpyIter_GetIterNext`
-:cfunc:`PyArray_MultiIter_DATA` :cfunc:`NpyIter_GetDataPtrArray`
-:cfunc:`PyArray_MultiIter_NEXTi` **NOT SUPPORTED** (always lock-step iteration)
-:cfunc:`PyArray_MultiIter_GOTO` :cfunc:`NpyIter_GotoMultiIndex`
-:cfunc:`PyArray_MultiIter_GOTO1D` :cfunc:`NpyIter_GotoIndex` or
- :cfunc:`NpyIter_GotoIterIndex`
-:cfunc:`PyArray_MultiIter_NOTDONE` Return value of ``iternext`` function pointer
-:cfunc:`PyArray_Broadcast` Handled by :cfunc:`NpyIter_MultiNew`
-:cfunc:`PyArray_RemoveSmallest` Iterator flag :cdata:`NPY_ITER_EXTERNAL_LOOP`
+:c:func:`PyArray_MultiIterNew` :c:func:`NpyIter_MultiNew`
+:c:func:`PyArray_MultiIter_RESET` :c:func:`NpyIter_Reset`
+:c:func:`PyArray_MultiIter_NEXT` Function pointer from :c:func:`NpyIter_GetIterNext`
+:c:func:`PyArray_MultiIter_DATA` :c:func:`NpyIter_GetDataPtrArray`
+:c:func:`PyArray_MultiIter_NEXTi` **NOT SUPPORTED** (always lock-step iteration)
+:c:func:`PyArray_MultiIter_GOTO` :c:func:`NpyIter_GotoMultiIndex`
+:c:func:`PyArray_MultiIter_GOTO1D` :c:func:`NpyIter_GotoIndex` or
+ :c:func:`NpyIter_GotoIterIndex`
+:c:func:`PyArray_MultiIter_NOTDONE` Return value of ``iternext`` function pointer
+:c:func:`PyArray_Broadcast` Handled by :c:func:`NpyIter_MultiNew`
+:c:func:`PyArray_RemoveSmallest` Iterator flag :c:data:`NPY_ITER_EXTERNAL_LOOP`
*Other Functions*
-:cfunc:`PyArray_ConvertToCommonType` Iterator flag :cdata:`NPY_ITER_COMMON_DTYPE`
-===================================== =============================================
+:c:func:`PyArray_ConvertToCommonType` Iterator flag :c:data:`NPY_ITER_COMMON_DTYPE`
+===================================== ===================================================