Table of Contents

Class NDFlatIterator

Namespace
NumSharp.Backends.Iteration
Assembly
NumSharp.dll

Flat (1-D, C-order) element iterator — the NumSharp analog of NumPy's flatiter, used by iters.

It wraps an operand already broadcast (via broadcast_to(NDArray, Shape)) to the broadcast result shape, and yields each logical element — in C-order, expanding stride-0 (broadcast) dimensions — exactly like NumPy's broadcast.iters[i]:

// numpy: np.broadcast([1,2,3], [[10],[20]]).iters[0] -> 1,2,3,1,2,3
//                                            .iters[1] -> 10,10,10,20,20,20

The broadcast expansion is the same Shape/stride machinery NDIter uses; element access resolves the (possibly stride-0) coordinates per step, so no buffer is materialized.

public sealed class NDFlatIterator : IEnumerable<object>, IEnumerable
Inheritance
NDFlatIterator
Implements
Inherited Members
Extension Methods

Properties

size

Total number of elements yielded (the broadcast result size).

public long size { get; }

Property Value

long

Methods

GetEnumerator()

Returns an enumerator that iterates through the collection.

public IEnumerator<object> GetEnumerator()

Returns

IEnumerator<object>

An enumerator that can be used to iterate through the collection.