Universal operations
Overview
Universal operations are extension functions on MultiArray<T, D> that follow Kotlin collection conventions. They provide familiar APIs for transforming, filtering, aggregating, and converting arrays.
Predicates
Traversal
Transformation
Function | Description |
|---|---|
Transform each element, preserving shape. | |
Transform each element into an iterable, flatten to 1D. | |
Running accumulation, returning all intermediate values. | |
Append elements or another array. | |
Tile elements n times into a flat 1D array. | |
Clamp every element to a |
Filtering
Aggregation
Function | Description |
|---|---|
Accumulate from an initial value. | |
Accumulate without an initial value. | |
Sum of all elements. | |
Average of all elements. | |
Count elements, optionally matching a predicate. | |
Largest element, or | |
Smallest element, or | |
Element-wise maximum of two arrays. | |
Element-wise minimum of two arrays. |
Search
Ordering
Partitioning
Grouping
Function | Description |
|---|---|
Group elements by key into a map of 1D arrays. | |
Build a map from key-value pairs. | |
Set intersection with another collection. |
Conversion
Function | Description |
|---|---|
Flat | |
Append all elements to a mutable collection. | |
Convert to a Kotlin primitive array. | |
Convert to nested Kotlin arrays. | |
Lazy | |
Convert element type (e.g. | |
Build a string representation. |