Iterating
NDArrayIterator
Traverses elements of a non-consistent array in logical (row-major) order, respecting offset, strides, and shape.
Member | Description |
|---|---|
| Current multi-dimensional index. |
|
|
| Returns the current element and advances the index. |
For consistent arrays (contiguous, default strides), NDArray.iterator() delegates directly to MemoryView.iterator() for better performance.
MultiIndexProgression
Iterates over all valid multi-dimensional index tuples within a shape.
Member | Description |
|---|---|
| Start indices (inclusive). |
| End indices (inclusive). |
| Traversal step. Positive for forward, negative for backward. |
| Lazy reversed progression. |
| Returns an |
Creating progressions
forEach on progressions
Collection-style operations
All operations below are extension functions on MultiArray<T, D>.
Predicates
Function | Signature | Description |
|---|---|---|
|
|
|
|
|
|
|
|
|
Traversal
Function | Signature | Description |
|---|---|---|
|
| Applies action to each element. |
|
| With flat index. |
|
| With multi-dimensional index. |
Transformation
Function | Signature | Description |
|---|---|---|
|
| Element-wise transform, preserves shape. |
|
| With flat index, returns 1D. |
|
| With multi-index, preserves shape. |
Filtering
Function | Signature | Description |
|---|---|---|
|
| Returns 1D array of matching elements. |
|
| With flat index. |
|
| With multi-dimensional index. |
Aggregation
Function | Signature | Description |
|---|---|---|
|
| Accumulate from initial value. |
|
| With flat index. |
|
| Accumulate without initial value. Throws on empty. |
|
| Sum of all elements. |
|
| Maximum, or |
|
| Minimum, or |
Search
Function | Signature | Description |
|---|---|---|
|
| First element. Throws |
|
| Last element. Throws |
|
| Flat index of the first occurrence, or |
Ordering
Function | Returns | Description |
|---|---|---|
|
| New array with elements sorted. |
|
| New array with elements in reverse order. |
|
| Unique elements as a 1D array. |
Partitioning
Function | Signature | Description |
|---|---|---|
|
| Split into (matching, non-matching). |
|
| Split into fixed-size chunks. |
|
| Sliding window. |
Conversion
Function | Returns | Description |
|---|---|---|
|
| Flat list of all elements. |
|
| Mutable flat list. |
|
| Set of unique elements. |
|
| Mutable set. |
|
| Lazy sequence over elements. |
Logic
Function | Signature | Description |
|---|---|---|
|
| Element-wise logical AND (1/0). |
|
| Element-wise logical OR (1/0). |
|
| Element-wise max. |
|
| Element-wise min. |