Class NDIterUtils
Helper utilities for NDIter op_axes encoding/decoding.
public static class NDIterUtils
- Inheritance
-
NDIterUtils
- Inherited Members
Methods
GetOpAxis(int, out bool)
Decodes an op_axes entry. Matches NumPy's npyiter_get_op_axis (nditer_constr.c:1439).
public static int GetOpAxis(int axis, out bool isReduction)
Parameters
axisintThe raw value from op_axes[iop][idim].
isReductionboolTrue if the entry was flagged as a reduction axis.
Returns
- int
The axis index (with reduction flag stripped if present).
ReductionAxis(int)
Encodes an op_axes entry as an explicit reduction axis. Matches NumPy's NPY_ITER_REDUCTION_AXIS macro (common.h:347).
Use in the opAxes parameter of AdvancedNew(int, NDArray[], NDIterGlobalFlags, NPY_ORDER, NPY_CASTING, NDIterPerOpFlags[], NPTypeCode[]?, int, int[][]?, long[]?, long)
to mark an axis as a reduction target (must have length 1 on the operand,
and the operand must be READWRITE with REDUCE_OK set).
public static int ReductionAxis(int axis)
Parameters
axisintThe axis index (may be -1 to mean broadcast+reduce).
Returns
- int
The encoded value for op_axes[iop][idim].