Enum NDIterFlags
Iterator-level flags. Conceptually matches NumPy's NPY_ITFLAG_* constants.
NOTE: Bit positions differ from NumPy's implementation:
- NumPy uses bits 0-7 for IDENTPERM, NEGPERM, HASINDEX, etc.
- NumSharp reserves bits 0-7 for legacy compatibility flags (SourceBroadcast, SourceContiguous, DestinationContiguous)
- NumPy-equivalent flags are shifted to bits 8-15
This layout maintains backward compatibility with existing NumSharp code while adding NumPy parity flags. The semantic meaning of each flag matches NumPy, only the bit positions differ.
[Flags]
public enum NDIterFlags : uint
- Extension Methods
Fields
None = 0SourceBroadcast = 1Source operand has broadcast dimensions (stride=0).
SourceContiguous = 2Source operand is contiguous after coalescing.
DestinationContiguous = 4Destination operand is contiguous after coalescing.
IDENTPERM = 256The axis permutation is identity.
NEGPERM = 512The permutation has negative entries (flipped axes).
HASINDEX = 1024Iterator is tracking a flat index.
HASMULTIINDEX = 2048Iterator is tracking a multi-index.
FORCEDORDER = 4096Iteration order was forced on construction.
EXLOOP = 8192Inner loop is handled outside the iterator.
RANGE = 16384Iterator is ranged (subset iteration).
BUFFER = 32768Iterator uses buffering.
GROWINNER = 65536Grow the buffered inner loop when possible.
ONEITERATION = 131072Single iteration, can specialize iternext.
DELAYBUF = 262144Delay buffer allocation until first Reset.
REDUCE = 524288Iteration includes reduction operands.
REUSE_REDUCE_LOOPS = 1048576Reduce loops don't need recalculation.
CONTIGUOUS = 8All operands are contiguous (SIMD eligible).
GATHER_ELIGIBLE = 16Can use AVX2 gather for strided access.
PARALLEL_SAFE = 64The iteration range can be split across parallel workers without write hazards. Set at construction when there is no REDUCE operand (cross-iteration accumulation on a shared slot) and either no WRITE operands at all, or exactly one WRITE operand whose potential overlap with the inputs was resolved by COPY_IF_OVERLAP processing (forced copy + write-back on Dispose). Consumed by the parallel ForEach work (roadmap Wave 6.2).