8000 DOC: nditer: Document NpyIter_IsFirstVisit function · numpy/numpy@a702e7e · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit a702e7e

Browse files
committed
DOC: nditer: Document NpyIter_IsFirstVisit function
1 parent ddc7e6e commit a702e7e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

doc/source/reference/c-api.iterator.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,28 @@ Construction and Destruction
10741074

10751075
Returns ``NPY_SUCCEED`` or ``NPY_FAIL``.
10761076

1077+
.. cfunction:: npy_bool NpyIter_IsFirstVisit(NpyIter* iter, int iop)
1078+
1079+
Checks to see whether this is the first time the elements of the
1080+
specified reduction operand which the iterator points at are being
1081+
seen for the first time. The function returns a reasonable answer
1082+
for reduction operands and when buffering is disabled. The answer
1083+
may be incorrect for buffered non-reduction operands.
1084+
1085+
This function is intended to be used in EXTERNAL_LOOP mode only,
1086+
and will produce some wrong answers when that mode is not enabled.
1087+
1088+
If this function returns true, the caller should also check the inner
1089+
loop stride of the operand, because if that stride is 0, then only
1090+
the first element of the innermost external loop is being visited
1091+
for the first time.
1092+
1093+
*WARNING*: For performance reasons, 'iop' is not bounds-checked,
1094+
it is not confirmed that 'iop' is actually a reduction operand,
1095+
and it is not confirmed that EXTERNAL_LOOP mode is enabled. These
1096+
checks are the responsibility of the caller, and should be done
1097+
outside of any inner loops.
1098+
10771099
Functions For Iteration
10781100
-----------------------
10791101

0 commit comments

Comments
 (0)
0